This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: strip vs. nm vs. readelf
Read up Linkers and Loaders first about loading, dynamic linking and
relocations Thats a nice book to read. You can read it online at
http://www.iecc.com/linker .
Read up the ELF ABI spec for your favourite architecture after that.
and then the sources ....
cheers
Ramana
On Thu, 2005-12-15 at 19:32 +0100, Erik Leunissen wrote:
> Indeed, the output of "nm -D" produced a lot of symbols, and inspection
> of readelf output listed a lot of symbols in the .dynsym section.
>
> Thanks. This resolves my initial confusion regarding apparent
> contradictory output of these programs.
>
> It also made me want to learn more about;
> - the meaning of the various sections;
> - which parts of source code can be found in which sections (related to
> loading, relocation and dynamic linking).
>
> Could anybody recommend books or other sources of information from where
> I could start an exploration of these areas? My first interest is an
> introductory text, but more advanced material is also most welcome.
>
>
> Thanks in advance,
>
> Erik Leunissen
> ==============
>
>
>
>
>
> > On Wed, Dec 14, 2005 at 10:24:11PM +0100, Erik Leunissen wrote:
> >
> >>L.S.
> >>
> >>I stumble across some apparent contradictory behaviour of the
> >>applications strip, nm and readelf.
> >>
> >>This occurs when processing a shared lib "myLib.so" which has been
> >>subjected to the strip application as follows:
> >>
> >> strip --strip-unneeded myLib.so
> >
> >
> > --strip-unneeded
> > Remove all symbols that are not needed for relocation processing.
> >
> > ... but leaves the dynamic symbol table; that is always necessary.
> >
> >
> >>Next, when I invoke:
> >>
> >> nm -a myLib.so
> >>
> >>the output is (as expected):
> >>
> >> nm: myLib.so: no symbols
> >
> >
> > Try nm -D myLib.so.
> >
> >
> >>Finally, when doing:
> >>
> >> readelf -a myLib.so
> >>
> >>a lot of information is emitted, including the names of symbols that I
> >>believed to be removed by strip.
> >
> >
> > See which section it says they're in. They'll be in .dynsym, which is
> > part of the executable image.
> >