From owner-freebsd-hackers@FreeBSD.ORG Fri Jul 18 08:15:01 2014 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CBC0C3D6; Fri, 18 Jul 2014 08:15:01 +0000 (UTC) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5358D27E1; Fri, 18 Jul 2014 08:15:01 +0000 (UTC) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.14.9/8.14.9) with ESMTP id s6I8Etks083439 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 18 Jul 2014 11:14:55 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.9.2 kib.kiev.ua s6I8Etks083439 Received: (from kostik@localhost) by tom.home (8.14.9/8.14.9/Submit) id s6I8Etn2083438; Fri, 18 Jul 2014 11:14:55 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 18 Jul 2014 11:14:55 +0300 From: Konstantin Belousov To: Ian Lepore Subject: Re: [CFR] Adding a function to rtld-elf.so, how to handle Symbol.map? Message-ID: <20140718081455.GI93733@kib.kiev.ua> References: <1405545833.1312.84.camel@revolution.hippie.lan> <20140717004537.GE93733@kib.kiev.ua> <1405616990.1312.111.camel@revolution.hippie.lan> <20140717172910.GH93733@kib.kiev.ua> <1405642661.1312.135.camel@revolution.hippie.lan> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="/sv6gJA63ZcCAX3m" Content-Disposition: inline In-Reply-To: <1405642661.1312.135.camel@revolution.hippie.lan> User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on tom.home Cc: hackers@freebsd.org X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Jul 2014 08:15:02 -0000 --/sv6gJA63ZcCAX3m Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jul 17, 2014 at 06:17:41PM -0600, Ian Lepore wrote: > On Thu, 2014-07-17 at 20:29 +0300, Konstantin Belousov wrote: > > On Thu, Jul 17, 2014 at 11:09:50AM -0600, Ian Lepore wrote: > > > On Thu, 2014-07-17 at 03:45 +0300, Konstantin Belousov wrote: > > > > On Wed, Jul 16, 2014 at 03:23:53PM -0600, Ian Lepore wrote: > > > [snip] >=20 > > > I did some looking around and Netbsd, Android, and Risc Os all > > > implemented this in their dynamic loaders, so that seemed like the way > > > to go. Android actually puts a function with this __gnu name in its > > > libc, but all that function does is calls dl_unwind_find_exidx() which > > > is implemented in their loader. > > >=20 > > > I've just discovered that the arm unwind support code that will arrive > > > as part of clang 3.5 appears to assume the Android way of things unle= ss > > > __LINUX__ is defined, so maybe it would be good to follow that model > > > ourselves and add a dl_unwind_find_exidx() stub to libc/gen/dlfcn.c a= nd > > > name the new implementation in ld-elf to match. > > I think that Android/__LINUX__ combination does the right thing, by > > providing the symbol in libc. A libc implementation does not need any > > additional service from rtld, except already existing _rtld_addr_phdr(). > >=20 >=20 > Android provides a stub of dl_unwind_find_exidx() in libdl and the > shared-object implementation in the dynamic linker. What it puts in > libc is the __gnu_Unwind_Find_exidx() symbol, which just calls through > to the dl_unwind_find_exidx() implementation in the dynamic linker. >=20 > That aside, I've reworked my code so it all lives in libc instead of > rtld, as you suggested. It seems to work fine, and I guess I'm agnostic > about whether we're exporting a new function from libc versus rtld. It > seems a bit strange to me to have just one dl_something() function with > its shared/dynamic implementation in libc, while all the other functions > with dl-prefix names are implemented in rtld. But not so weird that > it's a big deal. The new patch is fine with me. =20 Could you, please, comment why did you decided to export the dl_unwind_find_exidx alias ? It was absent in the original patch, and from your description, it seems to be an implementation detail on Linux. --/sv6gJA63ZcCAX3m Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBAgAGBQJTyNd/AAoJEJDCuSvBvK1BY3YP/i+0rHyXtv2s6+WUIZIAq7Sx qt5EhabJT+e934pErTLH4BZPizbRXBjGM7FI8/cr43KsiiM3Dq6p2Y2zupOMk5l8 DrX76pqEdzCB7Nr7NydQuglBw+OAXatJBiN51VMdWC+uO04Gi1+Ne8581fceAG82 rQ79PcXtTmmCrtQQaJvQFuBUKTV3qdc5pdn0Hoso11+OPDWSs0ajmqlgFSgS2X5x 15s8x4uV7qUjWVbD8ksdxs49dPBr8x7wUfRnakBWNv71Gna5isRCSyJQsWjDPCCJ zKTVxq95fubyEe2LOX72m7xlCqpXB8/Cidy2T+fP/ziFkQvB+pH4xzQGyuC87Qnx h9ZLaEbHl/n+JToXgyEk10NCVcd8vDL3FktS6p9yNrRlleA7RB33evdgjyUgmjXG vNApBeridTmwb3E1UhC+SkOKcOwP+6j7Y9+DkHhFelDSeHGCTcMHyIdAtwY3METf ItBpKH+agIk+8+KI2UiSUjgySFyF4SpnPYTo+F8ZTKwrLxKtt9t+HzIaNwr73FN4 Z4EXqyz23TMv1ije7TU397DAyW4n6eYWm8dIR9DhqJ4zdx2X586Q23YhE57qCO1q D+nCrcrrX8dDw51YK1P6KH3ILdDhn9LkpO3cZsNtY71mgLxahF7qPOTIBBrnXwBs QKro600NBsAy/s4/IS1d =7OX1 -----END PGP SIGNATURE----- --/sv6gJA63ZcCAX3m--