Date: Fri, 18 Jul 2014 18:57:12 +0300 From: Konstantin Belousov <kostikbel@gmail.com> To: Ian Lepore <ian@FreeBSD.org> Cc: hackers@freebsd.org Subject: Re: [CFR] Adding a function to rtld-elf.so, how to handle Symbol.map? Message-ID: <20140718155712.GM93733@kib.kiev.ua> In-Reply-To: <1405691354.1312.152.camel@revolution.hippie.lan> 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> <20140718081455.GI93733@kib.kiev.ua> <1405689839.1312.148.camel@revolution.hippie.lan> <20140718133625.GL93733@kib.kiev.ua> <1405691354.1312.152.camel@revolution.hippie.lan>
next in thread | previous in thread | raw e-mail | index | archive | help
--vIs3Povh1jkh1Gsq Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jul 18, 2014 at 07:49:14AM -0600, Ian Lepore wrote: > On Fri, 2014-07-18 at 16:36 +0300, Konstantin Belousov wrote: > > On Fri, Jul 18, 2014 at 07:23:59AM -0600, Ian Lepore wrote: > > > On Fri, 2014-07-18 at 11:14 +0300, Konstantin Belousov wrote: > > > > 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 lik= e 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_exid= x() which > > > > > > > is implemented in their loader. > > > > > > >=20 > > > > > > > I've just discovered that the arm unwind support code that wi= ll arrive > > > > > > > as part of clang 3.5 appears to assume the Android way of thi= ngs unless > > > > > > > __LINUX__ is defined, so maybe it would be good to follow tha= t model > > > > > > > ourselves and add a dl_unwind_find_exidx() stub to libc/gen/d= lfcn.c and > > > > > > > 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 ne= ed any > > > > > > additional service from rtld, except already existing _rtld_add= r_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 th= rough > > > > > to the dl_unwind_find_exidx() implementation in the dynamic linke= r. > > > > >=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 a= gnostic > > > > > about whether we're exporting a new function from libc versus rtl= d. It > > > > > seems a bit strange to me to have just one dl_something() functio= n with > > > > > its shared/dynamic implementation in libc, while all the other fu= nctions > > > > > with dl-prefix names are implemented in rtld. But not so weird t= hat > > > > > it's a big deal. > > > > The new patch is fine with me. =20 > > > >=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. > > >=20 > > > I think you might have misunderstood what I said earlier. According = to > > > comments in some clang 3.5 sources I saw, the clang project considers > > > dl_unwind_find_exidx() to be "the BSD interface" for finding the exidx > > > data. They fall back to the gnu name only when clang is compiled with > > > __LINUX__ defined. By providing the functionality with this name, cl= ang > > > 3.5 will just work right on freebsd without needing to be modified to > > > also use the gnu name when __FreeBSD__ is defined. > > >=20 > > > Android and Netbsd provide dl_unwind_find_exidx(); I haven't checked > > > other BSDs. It certainly is a better name for an interface shared by > > > different toolchains than __gnu_Unwind_Find_exidx(), although we do n= eed > > > to also provide that symbol for anyone using gcc. > >=20 > > Yes, I indeed misunderstood your description, thank you for the clarifi= cation. > > I.e. clang on Linux and gcc use __gnu_Unwind_Find_exidx(), while (futur= e) > > clang on non-Linuxes uses dl_unwind_find_exidx() ? And there is no > > ABI statement on the symbol, right ? >=20 > Right, except I don't understand what you are asking in your last > sentence. I ask, does ABI document requires the presence of the function ? Does the spec defines interface for the function ? --vIs3Povh1jkh1Gsq Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBAgAGBQJTyUPYAAoJEJDCuSvBvK1BKeMP/iDTVkpSIwPOusYP1VFs8rn/ M3LW3xcGwPt5PtaZ4Jt6EZM38sYvVFdvhyXAh+i52hjE9qRTcu4p65mgHN8f1HPY VXXe6cb/XWN7idExnjUcIOZ+PlyLn70pZHPFvMuSUeRxX+Czr0rL5LJrQhOE/cpi MlAh1C156YdePLHn2ZE589oTF9XU1xhgeaImX2iNlpl5KnZpq0+o8CA573SYdi/E 7SpZ24ZXEZcPrWTSizSXpMa32Qk2p9RoQZw/sOK9VFF0xql9sXg28NcW7UEujUAx b1JasBDbvYWP9PZsRMo6Qjo/l1fBEGE0VymGS3SE5+rZQkOV4g0ltbuoCbJb4iZd lPha83Z6WfEkm2tW1YB+9e+sU2RMouKtq+UtU8GK/PRUDEJp2IQ1H9vI1sK8cpGo fVFet40qVNA1oGOkUJDPK2muAjwHoTEg1WN2P+l5qQkseYtqGySJSs1VWB+YS3LS Q8E0fSd2J/zos4xkEPgdvK38SiBHUv55PqRK1/CdOpodwPRs2Pp/FXYmarIvEtaL u16LXaj687fygsddVTPLX7O90cLKZXwZA8BmTux8YpTYKK40qS17XQBCRz6pvh5D vhv6YcxzQrd8mnwTRh/U49fR2QRjc176lPONYiRpvYm13yBjrKuSRahVdxnTafYR x1x2SDkwuPnDkxBrQaUv =2zso -----END PGP SIGNATURE----- --vIs3Povh1jkh1Gsq--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20140718155712.GM93733>