aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-cfi-verify
diff options
context:
space:
mode:
authorFangrui Song <i@maskray.me>2020-08-13 08:13:26 -0700
committerFangrui Song <i@maskray.me>2020-08-13 08:13:42 -0700
commit7f8c49b016003a1a642235b14788648736809a58 (patch)
treee6f0732c28d4e8f85b7c82c9e24c0361bf084947 /llvm/tools/llvm-cfi-verify
parent1ffc299628948ee0bee3ffb7451c9085b5a80e83 (diff)
downloadllvm-7f8c49b016003a1a642235b14788648736809a58.zip
llvm-7f8c49b016003a1a642235b14788648736809a58.tar.gz
llvm-7f8c49b016003a1a642235b14788648736809a58.tar.bz2
[llvm-objdump] Change symbol name/PLT decoding errors to warnings
If the referenced symbol of a J[U]MP_SLOT is invalid (e.g. symbol index 0), llvm-objdump -d will bail out: ``` error: 'a': st_name (0x326600) is past the end of the string table of size 0x7 ``` where 0x326600 is the st_name field of the first entry past the end of .symtab Change it to a warning to continue dumping. `X86/plt.test` uses a prebuilt executable, so I pick `ELF/AArch64/plt.test` which has a YAML input and can be easily modified. Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D85623
Diffstat (limited to 'llvm/tools/llvm-cfi-verify')
-rw-r--r--llvm/tools/llvm-cfi-verify/lib/FileAnalysis.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/tools/llvm-cfi-verify/lib/FileAnalysis.cpp b/llvm/tools/llvm-cfi-verify/lib/FileAnalysis.cpp
index d2b4db3b5..1070446 100644
--- a/llvm/tools/llvm-cfi-verify/lib/FileAnalysis.cpp
+++ b/llvm/tools/llvm-cfi-verify/lib/FileAnalysis.cpp
@@ -568,7 +568,9 @@ Error FileAnalysis::parseSymbolTable() {
}
if (auto *ElfObject = dyn_cast<object::ELFObjectFileBase>(Object)) {
for (const auto &Addr : ElfObject->getPltAddresses()) {
- object::SymbolRef Sym(Addr.first, Object);
+ if (!Addr.first)
+ continue;
+ object::SymbolRef Sym(*Addr.first, Object);
auto SymNameOrErr = Sym.getName();
if (!SymNameOrErr)
consumeError(SymNameOrErr.takeError());