[PATCH] readelf: Add --dyn-sym option.

Mark Wielaard mark@klomp.org
Tue Sep 3 08:12:00 GMT 2019


On Tue, 2019-09-03 at 09:44 +0200, Florian Weimer wrote:
> * Mark Wielaard:
> 
> > It is already possible to select the symbol table to print by name,
> > using --symbols=SECTION. This allows printing the dynamic symbol table
> > with --symbols=.dynsym. binutils readelf allows printing just the
> > dynamic symbol table by type using --dyn-sym. Add the same option
> > and document it. Also add a testcase to show --symbols=.dynsym and
> > --dyn-sym produce the same output.
> 
> Note that this behavior is not the same as the binutils behavior.
> There, --dyn-sym does not use the section header table to locate the
> dynamic symbol table, but the dynamic segment.

When I experimented with this, binutils seems to be display the symbols
through the dynamic segment when using --symbols --use-dynamic.
Using --dyn-sym explicitly seems to only display the symbols from the
SHT_DYNSYM section, not by getting it through the dynamic segment, even
when combined with --use-dynamic (*).

eu-readelf doesn't implement --use-dynamic, -D, it probably should.

Cheers,

Mark

(*) Try eu-strip --strip-sections on a binary to replicate.



More information about the Elfutils-devel mailing list