[PATCH] D69093: [llvm-objcopy] --add-symbol: fix crash if SHT_SYMTAB does not exist
Jordan Rupprecht via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 17 10:33:26 PDT 2019
rupprecht added inline comments.
================
Comment at: llvm/tools/llvm-objcopy/ELF/Object.cpp:1547
+ for (auto &Sec : Obj.sections()) {
+ if (Sec.Type == ELF::SHT_STRTAB && !(Sec.Flags & SHF_ALLOC)) {
+ StrTab = static_cast<StringTableSection *>(&Sec);
----------------
Why do we need to check `SHF_ALLOC`?
================
Comment at: llvm/tools/llvm-objcopy/ELF/Object.cpp:1550-1552
+ // Prefer .strtab to .shstrtab.
+ if (Obj.SectionNames != &Sec)
+ break;
----------------
Should `.dynstr` also be avoided? Is it better to just check that the name is literally `.strtab`?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D69093/new/
https://reviews.llvm.org/D69093
More information about the llvm-commits
mailing list