https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80556
--- Comment #43 from simon at pushface dot org --- Created attachment 41651 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41651&action=edit Patch to gcc/config/darwin.h Following up on a comment from Jeff Law on gcc-patches@, I replied as follows (it didn't appear on the archive, so I've re-sent) > I'm a bit confused here. Isn't -lSystem included in darwin's > LIB_SPEC in which case the right things ought to already be > happening, shouldn't it? The specs that involve -lSystem are *link_gcc_c_sequence: %:version-compare(>= 10.6 mmacosx-version-min= -no_compact_unwind) %{!static:%{!static-libgcc: %:version-compare(>= 10.6 mmacosx-version-min= -lSystem) } } %{fno-pic|fno-PIC|fno-pie|fno-PIE|fapple-kext|mkernel|static|mdynamic-no-pic: %:version-compare(>= 10.7 mmacosx-version-min= -no_pie) } %G %L *lib: %{!static:-lSystem} but I also see *libgcc: %{static-libgcc|static: -lgcc_eh -lgcc; .... which might be the root of the problem? In comment 39, I report that $ gnatmake raiser -largs -static-libgcc -static-libstdc++ resulted in the link command /usr/bin/ld -dynamic -arch x86_64 -macosx_version_min 10.12.0 -weak_reference_mismatches non-weak -o raiser -L./ -L/opt/gcc-7.1.0/lib/gcc/x86_64-apple-darwin15/7.1.0/adalib/ -L/opt/gcc-7.1.0/lib/gcc/x86_64-apple-darwin15/7.1.0 -L/opt/gcc-7.1.0/lib/gcc/x86_64-apple-darwin15/7.1.0/../../.. b~raiser.o ./raiser.o -v /opt/gcc-7.1.0/lib/gcc/x86_64-apple-darwin15/7.1.0/adalib/libgnat.a -no_compact_unwind -lgcc_eh -lgcc -lSystem i.e. -lSystem is *after* -lgcc, so that its exception handling won't be invoked. I don't know what -lgcc_eh does, but my patch would be pretty much equivalent to changing the libgcc spec above to *libgcc: %{static-libgcc|static: -lSystem -lgcc_eh -lgcc; .... and if that would be OK it would obviously be much better. I've rebuilt gcc-8-20170528 with this, successfully; the last line of the raiser.adb link command above becomes -no_compact_unwind -lSystem -lgcc_eh -lgcc -lSystem and the exception is properly handled. Patch attached.