[PATCH] D69304: [llvm-objcopy] - Do not crash on object that has relocations but no symbol table.

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 28 19:35:46 PDT 2019


MaskRay added inline comments.


================
Comment at: llvm/test/tools/llvm-objcopy/ELF/relocations-no-symtab.test:35
+# RUN: yaml2obj --docnum=2 %s > %t3
+# RUN: not llvm-objcopy %t3 %t4 2>&1 | FileCheck %s --check-prefix=ERR
+
----------------
`%t4` -> `/dev/null`


================
Comment at: llvm/tools/llvm-objcopy/ELF/Object.cpp:1426-1427
+      if (!SymbolTable)
+        error("'" + Relocs->Name + "': relocation references a symbol (" +
+              Twine(Sym) + "), but there is no symbol table");
+      ToAdd.RelocSymbol = SymbolTable->getSymbolByIndex(Sym);
----------------
jhenderson wrote:
> I'm not sure this error message is clear enough. I think it is not obvious what the number in it represents. Perhaps it could be rephrased "relocation references symbol with index N, but there is no symbol table". What do you think?
> "relocation references symbol with index N, but there is no symbol table"

+1


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69304/new/

https://reviews.llvm.org/D69304





More information about the llvm-commits mailing list