[PATCH] D57016: [llvm-readelf] Stop suppressing static symbol output when --dyn-symbols is specified with --symbols

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 21 06:53:16 PST 2019


jhenderson created this revision.
jhenderson added reviewers: grimar, rupprecht, davide, khemant, jakehehrlich, sidneym.
Herald added subscribers: aheejin, sbc100.

In rL287786 <https://reviews.llvm.org/rL287786>, a bug was introduced into llvm-readelf where it didn't print the static symbol table if both --symbols and --dyn-symbols was specified, even if there was no dynamic  symbol table. This is obviously incorrect.

This patch fixes this issue, by delegating the decision of what static and dynamic symbol tables should be printed to the final dumper, rather than trying to decide in the command-line option handling layer. The decision was made to follow the approach taken in this patch because the LLVM style dumper uses a different order to the original GNU style behaviour (and GNU readelf). Other approaches resulted in behaviour changes for other dumpers which felt wrong. In particular, I wanted to avoid changing the order of the output for `--symbols --dyn-symbols` for LLVM style, keep what is emitted by `--symbols` unchanged for all dumpers, and to avoid having different orders of .dynsym and .symtab dumping for GNU `--symbols` and `--symbols --dyn-symbols`.

This change requires some further updates once D56910 <https://reviews.llvm.org/D56910> lands (currently awaiting restoration of my commit access). The gnu-symbols.test in particular needs rebasing, and the `printDynamicSymbols` function for the GNU style dumper can be completely deleted once that change has landed.


Repository:
  rL LLVM

https://reviews.llvm.org/D57016

Files:
  test/tools/llvm-readobj/demangle.test
  test/tools/llvm-readobj/gnu-symbols.test
  tools/llvm-readobj/COFFDumper.cpp
  tools/llvm-readobj/ELFDumper.cpp
  tools/llvm-readobj/MachODumper.cpp
  tools/llvm-readobj/ObjDumper.h
  tools/llvm-readobj/WasmDumper.cpp
  tools/llvm-readobj/llvm-readobj.cpp
  tools/llvm-readobj/llvm-readobj.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57016.182788.patch
Type: text/x-patch
Size: 16628 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190121/250139f4/attachment.bin>


More information about the llvm-commits mailing list