This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: incomplete symtabs via dl_iterate_phdr?


On Tue, Jan 02, 2007 at 04:54:59PM +0100, Thomas Kühne wrote:
> I am trying to find all global symbols of a programm at runtime
> from within that very programm. If I use dl_iterate_phdr
> and search the DT_SYMTAB sections the result is incomplete.
> 
> source:
> http://svn.dsource.org/projects/flectioned/trunk/elf2.c
> 
> That way only 55 symbols are found in libc while
> "nm --extern-only --defined-only libc.a" returns 2455 symbols.
> 
> Is there any way to get a list of all defined symbols, their names
> and addresses at runtime?

nm is looking at the static symbol table, not the global symbol table. 
Compare to nm -D.  If you're only getting 55, though, you've got
something else wrong... assuming you're using a dynamic libc.so.

Why are you using sym->st_value as a loop termination condition?
That is definitely wrong.  I don't believe the size of the symtab
is available, but you're going to stop at the first undefined symbol.

-- 
Daniel Jacobowitz
CodeSourcery


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]