From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 128051 invoked by alias); 1 Sep 2017 13:03:01 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 128032 invoked by uid 89); 1 Sep 2017 13:03:00 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy=Isnt, Isn't, H*c:HHHH, H*c:HHHHHHHH X-HELO: smtp.hosts.co.uk Received: from smtp.hosts.co.uk (HELO smtp.hosts.co.uk) (85.233.160.19) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 01 Sep 2017 13:02:53 +0000 Received: from [62.64.210.40] (helo=[192.168.1.2]) by smtp.hosts.co.uk with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.89) (envelope-from ) id 1dnlay-000301-8k for gcc-patches@gcc.gnu.org; Fri, 01 Sep 2017 14:02:51 +0100 From: Simon Wright Content-Type: multipart/mixed; boundary="Apple-Mail=_239E409B-803C-4A9D-A84F-6C191441B8E9" Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: [PATCH] PR target/80556 Date: Fri, 01 Sep 2017 13:03:00 -0000 References: <9BD5550D-1CBC-4A8C-80DE-61BE01001EE6@pushface.org> <9f55384a-72e2-c1b3-6f7a-c3a2ee7be978@redhat.com> <8DF8CB89-6147-4E03-9507-851BFAF0F105@pushface.org> To: gcc-patches@gcc.gnu.org In-Reply-To: <8DF8CB89-6147-4E03-9507-851BFAF0F105@pushface.org> Message-Id: <05E1B5C3-FE6B-4AF3-B987-FF77B17A2290@pushface.org> X-SW-Source: 2017-09/txt/msg00045.txt.bz2 --Apple-Mail=_239E409B-803C-4A9D-A84F-6C191441B8E9 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Content-length: 2549 On 29 Jun 2017, at 21:41, Simon Wright wrote: >=20 > On 28 Jun 2017, at 18:40, Jeff Law wrote: >>=20 >> On 06/09/2017 07:57 AM, Simon Wright wrote: >>> 2017-06-09 Simon Wright >>>=20 >>> 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? >=20 > The specs that involve -lSystem are >=20 > *link_gcc_c_sequence: > %:version-compare(>=3D 10.6 mmacosx-version-min=3D -no_compact_unwind) = %{!static:%{!static-libgcc: %:version-compare(>=3D 10.6 mmacosx-vers= ion-min=3D -lSystem) } } %{fno-pic|fno-PIC|fno-pie|fno-PIE|fapple-kext|m= kernel|static|mdynamic-no-pic: %:version-compare(>=3D 10.7 mmacosx-ve= rsion-min=3D -no_pie) } %G %L >=20 > *lib: > %{!static:-lSystem} >=20 > but I also see >=20 > *libgcc: > %{static-libgcc|static: -lgcc_eh -lgcc; .... >=20 > which might be the root of the problem? >=20 > Looking at https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D80556#c39, I re= port that >=20 > $ gnatmake raiser -largs -static-libgcc -static-libstdc++ >=20 > resulted in the link command >=20 > /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 >=20 > i.e. -lSystem is *after* -lgcc, so that its exception handling won't be i= nvoked. >=20 > I don't know what -lgcc_eh does, but my patch would be pretty much equiva= lent to changing the libgcc spec above to >=20 > *libgcc: > %{static-libgcc|static: -lSystem -lgcc_eh -lgcc; .... >=20 > and if that would be OK it would obviously be much better. >=20 > I've rebuilt gcc-8-20170528 with this change alone (i.e. not the patch cu= rrently posted here), successfully. I've rebuilt and tested gcc-8-20170820 with this change, successfully. gcc/Changelog: 2017-09-01 Simon Wright PR target/80556 * config/darwin.h (REAL_LIBGCC_SPEC): for static-libgcc|static, incl= ude -lSystem first. --Apple-Mail=_239E409B-803C-4A9D-A84F-6C191441B8E9 Content-Disposition: attachment; filename=80556-darwin.h.diff Content-Type: application/octet-stream; x-unix-mode=0644; name="80556-darwin.h.diff" Content-Transfer-Encoding: 7bit Content-length: 796 --- gcc/config/darwin.h.orig 2017-01-16 21:33:07.000000000 +0000 +++ gcc/config/darwin.h 2017-07-03 14:19:55.000000000 +0100 @@ -339,10 +339,12 @@ libraries, you need to explicitly say -static-libgcc. If it is linked against, it has to be before -lgcc, because it may - need symbols from -lgcc. */ + need symbols from -lgcc. + + For PR80556 and PR61027, link libSystem before a static libgcc. */ #undef REAL_LIBGCC_SPEC #define REAL_LIBGCC_SPEC \ - "%{static-libgcc|static: -lgcc_eh -lgcc; \ + "%{static-libgcc|static: -lSystem -lgcc_eh -lgcc; \ shared-libgcc|fexceptions|fgnu-runtime: \ %:version-compare(!> 10.5 mmacosx-version-min= -lgcc_s.10.4) \ %:version-compare(>< 10.5 10.6 mmacosx-version-min= -lgcc_s.10.5) \ --Apple-Mail=_239E409B-803C-4A9D-A84F-6C191441B8E9 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii Content-length: 2 --Apple-Mail=_239E409B-803C-4A9D-A84F-6C191441B8E9--