aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-readobj/llvm-readobj.cpp
diff options
context:
space:
mode:
authorJames Henderson <jh7370@my.bristol.ac.uk>2019-01-23 16:15:39 +0000
committerJames Henderson <jh7370@my.bristol.ac.uk>2019-01-23 16:15:39 +0000
commit21ed868390fee0faca2fb86d52ec41ec65101bd6 (patch)
tree288973118bf4842ad0927ceddc89ce2393014fde /llvm/tools/llvm-readobj/llvm-readobj.cpp
parentac5b775522c602324f6dd4ec877d54ef198ebfe0 (diff)
downloadllvm-21ed868390fee0faca2fb86d52ec41ec65101bd6.zip
llvm-21ed868390fee0faca2fb86d52ec41ec65101bd6.tar.gz
llvm-21ed868390fee0faca2fb86d52ec41ec65101bd6.tar.bz2
[llvm-readelf] Don't suppress static symbol table with --dyn-symbols + --symbols
In r287786, a bug was introduced into llvm-readelf where it didn't print the static symbol table if both --symbols and --dyn-symbols were specified, even if there was no dynamic symbol table. This is obviously incorrect. This patch fixes this issue, by delegating the decision of which 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) for ELF output. 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 avoid having different orders of .dynsym and .symtab dumping for GNU "--symbols" and "--symbols --dyn-symbols". Reviewed by: grimar, rupprecht Differential Revision: https://reviews.llvm.org/D57016 llvm-svn: 351960
Diffstat (limited to 'llvm/tools/llvm-readobj/llvm-readobj.cpp')
-rw-r--r--llvm/tools/llvm-readobj/llvm-readobj.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/llvm/tools/llvm-readobj/llvm-readobj.cpp b/llvm/tools/llvm-readobj/llvm-readobj.cpp
index 91526fe..206b67b 100644
--- a/llvm/tools/llvm-readobj/llvm-readobj.cpp
+++ b/llvm/tools/llvm-readobj/llvm-readobj.cpp
@@ -124,8 +124,10 @@ namespace opts {
// -symbols
// Also -s in llvm-readelf mode, or -t in llvm-readobj mode.
- cl::opt<bool> Symbols("symbols",
- cl::desc("Display the symbol table"));
+ cl::opt<bool>
+ Symbols("symbols",
+ cl::desc("Display the symbol table. Also display the dynamic "
+ "symbol table when using GNU output style for ELF"));
cl::alias SymbolsGNU("syms", cl::desc("Alias for --symbols"),
cl::aliasopt(Symbols));
@@ -462,10 +464,8 @@ static void dumpObject(const ObjectFile *Obj, ScopedPrinter &Writer) {
Dumper->printRelocations();
if (opts::DynRelocs)
Dumper->printDynamicRelocations();
- if (opts::Symbols)
- Dumper->printSymbols();
- if (opts::DynamicSymbols)
- Dumper->printDynamicSymbols();
+ if (opts::Symbols || opts::DynamicSymbols)
+ Dumper->printSymbols(opts::Symbols, opts::DynamicSymbols);
if (opts::HashSymbols)
Dumper->printHashSymbols();
if (opts::UnwindInfo)