strip vs. nm vs. readelf
Erik Leunissen
e.leunissen@hccnet.nl
Thu Dec 15 18:33:00 GMT 2005
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.
>
More information about the Binutils
mailing list