[CFR] Adding a function to rtld-elf.so, how to handle Symbol.map?

Konstantin Belousov kostikbel at gmail.com
Fri Jul 18 08:15:02 UTC 2014


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]
> 
> > > 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.
> > > 
> > > 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 unless
> > > __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 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 need any
> > additional service from rtld, except already existing _rtld_addr_phdr().
> > 
> 
> 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.
> 
> 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.  

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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20140718/3f8f53ff/attachment.sig>


More information about the freebsd-hackers mailing list