Date: Sun, 3 Mar 2019 16:10:27 +0100 From: =?UTF-8?B?VMSzbA==?= Coosemans <tijl@FreeBSD.org> To: Willem Jan Withagen <wjw@digiware.nl> Cc: FreeBSD Toolchain <freebsd-toolchain@freebsd.org>, Ed Maste <emaste@freebsd.org> Subject: Re: Linking problem with lld Message-ID: <20190303161027.10ad0bc0@kalimero.tijl.coosemans.org> In-Reply-To: <2e447b16-6180-7450-cd53-bc48d826365a@digiware.nl> References: <71079fbc-c3c0-9b93-0ae4-8ceda5d1f751@digiware.nl> <20190222223456.5d7840b7@kalimero.tijl.coosemans.org> <29a75c78-f2df-e80b-d013-631584e0fc71@digiware.nl> <cf912b3e-2699-0997-a0f6-4bb75fee4aab@digiware.nl> <20190302162142.2bf23551@kalimero.tijl.coosemans.org> <9f659c4b-d542-b610-8e29-1341a00b43b7@digiware.nl> <20190302183501.478d29e8@kalimero.tijl.coosemans.org> <492f6e8c-166d-a3ba-c4ed-f042a9c73072@digiware.nl> <20190303133435.2de4636d@kalimero.tijl.coosemans.org> <cb7836b6-4e90-0a1e-0407-010c4f3a51bb@digiware.nl> <2e447b16-6180-7450-cd53-bc48d826365a@digiware.nl>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 3 Mar 2019 15:21:56 +0100 Willem Jan Withagen <wjw@digiware.nl> wrote: > First success. > I used this map, but also needed to fix a .symver: > =3D=3D=3D=3D > =C2=A0#define LIBRADOS_C_API_BASE_DEFAULT(fn)=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 \ > -=C2=A0 asm(".symver _" #fn ", " #fn "@@") > +=C2=A0 asm(".symver _" #fn ", " #fn "@") > =3D=3D=3D=3D > That last was more or less guessed from the binutils/docs/ld page. It's really a bug in lld. You can add LLD_UNSAFE=3Dyes to the port Makefile for now. Here's a simple test case: % cat test.c void _test1() { } asm(".symver _test1, test1@@"); void test2() { } % cat test.map { local: *; }; % clang70 -shared -o libtest.so test.c -fPIC -Wl,--version-script=3Dtest.map % readelf -s libtest.so | grep test 8: 0000000000000000 0 FILE LOCAL DEFAULT ABS test.c 9: 0000000000001090 5 FUNC LOCAL DEFAULT 9 _test1 10: 0000000000001090 5 FUNC LOCAL DEFAULT 9 test1 11: 00000000000010a0 5 FUNC LOCAL DEFAULT 9 test2 % clang70 -shared -o libtest.so test.c -fPIC -Wl,--version-script=3Dtest.ma= p -fuse-ld=3Dbfd % readelf -s libtest.so | grep test 3: 0000000000000280 5 FUNC GLOBAL DEFAULT 11 test1 34: 0000000000000000 0 FILE LOCAL DEFAULT ABS test.c 38: 0000000000000280 5 FUNC LOCAL DEFAULT 11 _test1 42: 0000000000000290 5 FUNC LOCAL DEFAULT 11 test2 46: 0000000000000280 5 FUNC GLOBAL DEFAULT 11 test1@@ With lld test1 is local. With GNU ld it's global. The .symver directive should override the version script.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20190303161027.10ad0bc0>