[PATCH] _dl_iterate_phdr rework

Joakim Tjernlund joakim.tjernlund at transmode.se
Wed Jan 23 09:06:14 UTC 2008


On Tue, 2008-01-22 at 15:44 +0100, Carmelo AMOROSO wrote:
> Hi All,
> the attached patch will solve an problem when statically linking
> a C++ application with gcc configured to use unwind-dw2-fde-glibc 
> implementation.
> This needs _dl_iterate_phdr to be included into libc.a instead of libdl.a,
> and the implementation has been fixed to handle the static case too 
> (based on glibc code).
> For the dynamic case, it's still present in ld.so.
> Moreover, _dl_loaded_modules has been moved too (being used by 
> _dl_iterate_phdr).
> 
> This has accomplished in the following way:
> 
> ldso/ldso/dl-elf.c:           removed _dl_iterate_phdr code and include 
> "dl-iterate-phdr.c" source
> ldso/ldso/dl-iterate-phdr.c : new file containing the fixed 
> _dl_iterate_phdr function
> ldso/ldso/dl-hash.c:          removed _dl_loaded_modules definition
> ldso/ldso/dl-symbols.c:       included _dl_loaded_modules defintion
> ldso/ldso/ldso.c:             include "dl-symbols.c"
> 
> libc/misc/elf/dl-core.c:      new file including dl-symbols.c and 
> dl-iterate-phdr.c from ldso directory
> 
> The idea is to use dl-symbols.c to keep all symbols common among ldso 
> and libc.a
> (note that into the nptl branch another file dl-support.c will be added 
> to keep some
> TLS specific functionalities that are shared between ldso and libc.a)
> 
> Thanks to Peter Mazinger for his suggestions on this topic.
> 
> Any comments are welcome.
> 
> Carmelo

Hi Carmelo

Thanks for working on this.
Got a comment or two:

1) I belive the iterate_phdr function has a new impl. in glibc where
   struct dl_phdr_info has 2 more fields: dlpi_adds and dlpi_subs
   I guess they are there for a reason and that uClibc should perhaps
   impl. them too?

2) Have you looked at impl. this only in libc, like glibc?
   Would that make the code less complex? 

 Jocke



More information about the uClibc mailing list