[PATCH] PR target/80556

Simon Wright simon@pushface.org
Fri Sep 1 13:03:00 GMT 2017


On 29 Jun 2017, at 21:41, Simon Wright <simon@pushface.org> wrote:
> 
> On 28 Jun 2017, at 18:40, Jeff Law <law@redhat.com> wrote:
>> 
>> On 06/09/2017 07:57 AM, Simon Wright wrote:
>>>       2017-06-09 Simon Wright <simon@pushface.org>
>>> 
>>>       PR target/80556
>>>       * configure.ac (stage1_ldflags): For Darwin, include -lSystem.
>>>         (poststage1_ldflags): likewise.
>>>       * configure: regenerated.
>> 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?
> 
> Looking at https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80556#c39, 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 change alone (i.e. not the patch currently posted here), successfully.

I've rebuilt and tested gcc-8-20170820 with this change, successfully.

gcc/Changelog:

       2017-09-01 Simon Wright <simon@pushface.org>

       PR target/80556
       * config/darwin.h (REAL_LIBGCC_SPEC): for static-libgcc|static, include -lSystem first.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 80556-darwin.h.diff
Type: application/octet-stream
Size: 796 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20170901/2bbeb4db/attachment.obj>
-------------- next part --------------




More information about the Gcc-patches mailing list