From owner-freebsd-toolchain@freebsd.org Sun Mar 3 15:10:33 2019 Return-Path: Delivered-To: freebsd-toolchain@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8E72F150DB7A for ; Sun, 3 Mar 2019 15:10:33 +0000 (UTC) (envelope-from tijl@freebsd.org) Received: from mailrelay111.isp.belgacom.be (mailrelay111.isp.belgacom.be [195.238.20.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "relay.skynet.be", Issuer "GlobalSign Organization Validation CA - SHA256 - G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AF27288344; Sun, 3 Mar 2019 15:10:32 +0000 (UTC) (envelope-from tijl@freebsd.org) X-Belgacom-Dynamic: yes X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A2BGAADb7Xtc/0RF8lFlHAECBAEIBAG?= =?us-ascii?q?BUgcBDAGCD1cRcRInhAiIGl+KaAEBggw1AYlxjXqBeyiEUQKEICM0CQ0BAQM?= =?us-ascii?q?BAQMBAwJtHAyFSwEFIzMjEAkCGAICBSECAg8qHgYTgyOBeYx2m2aBL4kUgQ6?= =?us-ascii?q?BCyQBiz6Bf4QjhQGDCoJXAqQECYdDiyUlgkyQVp51OIFWTTAIgycJgg0Xijy?= =?us-ascii?q?DYz4DMJFDAQE?= X-IPAS-Result: =?us-ascii?q?A2BGAADb7Xtc/0RF8lFlHAECBAEIBAGBUgcBDAGCD1cRc?= =?us-ascii?q?RInhAiIGl+KaAEBggw1AYlxjXqBeyiEUQKEICM0CQ0BAQMBAQMBAwJtHAyFS?= =?us-ascii?q?wEFIzMjEAkCGAICBSECAg8qHgYTgyOBeYx2m2aBL4kUgQ6BCyQBiz6Bf4Qjh?= =?us-ascii?q?QGDCoJXAqQECYdDiyUlgkyQVp51OIFWTTAIgycJgg0XijyDYz4DMJFDAQE?= Received: from 68.69-242-81.adsl-dyn.isp.belgacom.be (HELO kalimero.tijl.coosemans.org) ([81.242.69.68]) by relay.skynet.be with ESMTP; 03 Mar 2019 16:10:29 +0100 Received: from kalimero.tijl.coosemans.org (kalimero.tijl.coosemans.org [127.0.0.1]) by kalimero.tijl.coosemans.org (8.15.2/8.15.2) with ESMTP id x23FASkU004714; Sun, 3 Mar 2019 16:10:28 +0100 (CET) (envelope-from tijl@FreeBSD.org) Date: Sun, 3 Mar 2019 16:10:27 +0100 From: =?UTF-8?B?VMSzbA==?= Coosemans To: Willem Jan Withagen Cc: FreeBSD Toolchain , Ed Maste 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> <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> <2e447b16-6180-7450-cd53-bc48d826365a@digiware.nl> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: AF27288344 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.88 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.88)[-0.879,0]; NEURAL_HAM_LONG(-1.00)[-0.998,0]; ASN(0.00)[asn:5432, ipnet:195.238.0.0/19, country:BE] X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Mar 2019 15:10:33 -0000 On Sun, 3 Mar 2019 15:21:56 +0100 Willem Jan Withagen 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.