From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/5081 Path: news.gmane.org!not-for-mail From: Stephen Thomas Newsgroups: gmane.linux.lib.musl.general Subject: RE: Linking musl with ld.gold Date: Thu, 8 May 2014 01:03:19 +0100 Message-ID: References: ,<20140506101410.GP12324@port70.net>,,<20140506231807.GQ12324@port70.net>,,<20140507130443.72c74f47@vostro> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="_4f9b040d-f34b-4ce4-a809-065be517e017_" X-Trace: ger.gmane.org 1399507457 9719 80.91.229.3 (8 May 2014 00:04:17 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 8 May 2014 00:04:17 +0000 (UTC) To: "musl@lists.openwall.com" Original-X-From: musl-return-5087-gllmg-musl=m.gmane.org@lists.openwall.com Thu May 08 02:04:09 2014 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1WiBom-0001A1-FC for gllmg-musl@plane.gmane.org; Thu, 08 May 2014 02:04:08 +0200 Original-Received: (qmail 7380 invoked by uid 550); 8 May 2014 00:04:06 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 6113 invoked from network); 8 May 2014 00:03:31 -0000 X-TMN: [inVHgFu6ZzycXW26zcKYu62HPCe/zGgk] X-Originating-Email: [scjthm@live.com] Importance: Normal In-Reply-To: <20140507130443.72c74f47@vostro> X-OriginalArrivalTime: 08 May 2014 00:03:19.0075 (UTC) FILETIME=[EB116F30:01CF6A50] Xref: news.gmane.org gmane.linux.lib.musl.general:5081 Archived-At: --_4f9b040d-f34b-4ce4-a809-065be517e017_ Content-Type: multipart/alternative; boundary="_8800cd4f-43da-480e-970b-fa5e721509a5_" --_8800cd4f-43da-480e-970b-fa5e721509a5_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable > > > only the object files with referenced symbols are linked from an > > > archive > > >=20 > > > so only a.o with the given main.o because of the symbol f > > >=20 > > > now if you make some reference in main.c such that b.o should > > > be included but main still returns 0 that would be a bug > > >=20 > > > eg. add a void g(void){} to b.c and call it from main.c =20 > >=20 > > Ok=2C thanks for that info. It appears that there is a problem in gcc > > 4.9 and not 4.8.3. >=20 > Is perhaps -ffunction-sections and/or -fdata-sections added > automatically? Those would break musl like experienced. Thanks for that tip=2C but I didn't change the sections in the linker scrip= t. I didn't add any flags either. I attach the single test case cleaned up = a bit. I ran this on the buildroot toolchain (standard config with uclibc a= nd with 2.24.0 binutils) with 4.8.2 and the result is 42. I rebuilt the too= lchain only changing the compiler version to 4.9.2 and the result is 0. This corroborates what I was seeing (or not as in the case of the prompt no= t appearing in busybox) with my builds also. Thomo = --_8800cd4f-43da-480e-970b-fa5e721509a5_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable


>=3B >=3B >= =3B only the object files with referenced symbols are linked from an
>= =3B >=3B >=3B archive
>=3B >=3B >=3B
>=3B >=3B >=3B = so only a.o with the given main.o because of the symbol f
>=3B >=3B = >=3B
>=3B >=3B >=3B now if you make some reference in main.c su= ch that b.o should
>=3B >=3B >=3B be included but main still retur= ns 0 that would be a bug
>=3B >=3B >=3B
>=3B >=3B >=3B e= g. add a void g(void){} to b.c and call it from main.c
>=3B >=3B <= br>>=3B >=3B Ok=2C thanks for that info. It appears that there is a pro= blem in gcc
>=3B >=3B 4.9 and not 4.8.3.
>=3B
>=3B Is per= haps -ffunction-sections and/or -fdata-sections added
>=3B automatical= ly? Those would break musl like experienced.

Thanks for t= hat tip=2C but I didn't change the sections in the linker script. I didn't = add any flags either. I attach the single test case cleaned up a bit. I ran= this on the buildroot toolchain (standard config with uclibc and with 2.24= .0 binutils) with 4.8.2 and the result is 42. I rebuilt the toolchain only = changing the compiler version to 4.9.2 and the result is 0.

<= /div>
This corroborates what I was seeing (or not as in the case of the= prompt not appearing in busybox) with my builds also.

=
Thomo
= --_8800cd4f-43da-480e-970b-fa5e721509a5_-- --_4f9b040d-f34b-4ce4-a809-065be517e017_ Content-Type: application/x-sh Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="badgcc.sh" IyEvYmluL3NoIC1lCkxPQURFUj0iIgpDQz0iZ2NjIgpBUj0iYXIiCk5NPSJubSIKRkxJU1Q9ImEu YyBiLmMgbWFpbi5jIGEubyBiLm8gbWFpbi5vIGEuYSBhIgpjZCAvdG1wCmlmIFsgIiQobHMgLWwg JHtGTElTVH0gMj4gL2Rldi9udWxsIHwgd2MgLWwpIiAhPSAiMCIgXSA7IHRoZW4KICAgIGVjaG8g IlNvcnJ5IG9uZSBvZiB0aGVzZSBmaWxlcyBleGlzdHMgJHtGTElTVH0gYW5kIEkgd291bGQgbGlr ZSB0byBvdmVyd3JpdGUgdGhlbSIKICAgIGV4aXQgMQpmaQpjYXQgPiBhLmMgPDwgX0VPRgovLyBh LmMKc3RydWN0IGZvbyB7aW50IGk7fTsKc3RhdGljIHN0cnVjdCBmb28gKmNvbnN0IGR1bW15ID0g MDsKZXh0ZXJuIHN0cnVjdCBmb28gKmNvbnN0IGhhc2ZvbyBfX2F0dHJpYnV0ZV9fKCh3ZWFrLCBh bGlhcygiZHVtbXkiKSkpOwppbnQgZih2b2lkKQp7CiAgICByZXR1cm4gaGFzZm9vID8gaGFzZm9v LT5pIDogMDsKfQpfRU9GCmNhdCA+IGIuYyA8PCBfRU9GCi8vIGIuYwpzdHJ1Y3QgZm9vIHtpbnQg aTt9OwpzdGF0aWMgc3RydWN0IGZvbyBmb28gPSB7LmkgPSA0Mn07CnN0cnVjdCBmb28gKmNvbnN0 IGhhc2ZvbyA9ICZmb287CnZvaWQgZygpCnsKfQpfRU9GCmNhdCA+IG1haW4uYyA8PCBfRU9GCi8v IG1haW4uYwppbnQgZih2b2l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