--- configure.ac-orig 2017-06-05 10:58:51.000000000 +0100 +++ configure.ac 2017-06-08 17:42:08.000000000 +0100 @@ -1650,7 +1650,12 @@ # if supported. But if the user explicitly specified the libraries to use, # trust that they are doing what they want. if test "$stage1_libs" = "" -a "$have_static_libs" = yes; then - stage1_ldflags="-static-libstdc++ -static-libgcc" + # .. but on Darwin, for exception handling, we include -lSystem + # (which is included before -lgcc, and uses the correct unwinder) + case $host in + x86_64-apple-darwin*) stage1_ldflags="-lSystem -static-libstdc++ -static-libgcc";; + *) stage1_ldflags="-static-libstdc++ -static-libgcc";; + esac fi]) AC_SUBST(stage1_ldflags) @@ -1679,7 +1684,12 @@ # statically. But if the user explicitly specified the libraries to # use, trust that they are doing what they want. if test "$poststage1_libs" = ""; then - poststage1_ldflags="-static-libstdc++ -static-libgcc" + # .. but on Darwin, for exception handling, we include -lSystem + # (which is included before -lgcc, and uses the correct unwinder) + case $host in + x86_64-apple-darwin*) poststage1_ldflags="-lSystem -static-libstdc++ -static-libgcc";; + *) poststage1_ldflags="-static-libstdc++ -static-libgcc";; + esac fi]) AC_SUBST(poststage1_ldflags) --- configure-orig 2017-06-05 10:59:09.000000000 +0100 +++ configure 2017-06-08 17:42:25.000000000 +0100 @@ -5819,7 +5819,12 @@ # if supported. But if the user explicitly specified the libraries to use, # trust that they are doing what they want. if test "$stage1_libs" = "" -a "$have_static_libs" = yes; then - stage1_ldflags="-static-libstdc++ -static-libgcc" + # .. but on Darwin, for exception handling, we include -lSystem + # (which is included before -lgcc, and uses the correct unwinder) + case $host in + x86_64-apple-darwin*) stage1_ldflags="-lSystem -static-libstdc++ -static-libgcc";; + *) stage1_ldflags="-static-libstdc++ -static-libgcc";; + esac fi fi @@ -5855,7 +5860,12 @@ # statically. But if the user explicitly specified the libraries to # use, trust that they are doing what they want. if test "$poststage1_libs" = ""; then - poststage1_ldflags="-static-libstdc++ -static-libgcc" + # .. but on Darwin, for exception handling, we include -lSystem + # (which is included before -lgcc, and uses the correct unwinder) + case $host in + x86_64-apple-darwin*) poststage1_ldflags="-lSystem -static-libstdc++ -static-libgcc";; + *) poststage1_ldflags="-static-libstdc++ -static-libgcc";; + esac fi fi