[PATCH] D82374: [llvm-readelf] - Don't crash when e_shstrndx=SHN_XINDEX, but there is no section header.
James Henderson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 24 01:34:45 PDT 2020
jhenderson accepted this revision.
jhenderson added a comment.
LGTM, aside from the nit, I think my other comments are probably best left for another patch.
================
Comment at: llvm/include/llvm/Object/ELF.h:526
+ return createError(
+ "e_shstrndx = SHN_XINDEX, but the section header table is empty");
+
----------------
Nit: either `e_shstrndx == SHN_XINDEX` or `e_shstrndx is SHN_XINDEX`
================
Comment at: llvm/test/tools/llvm-readobj/ELF/many-sections.s:46
+# GNU2-NEXT: [Nr] Name Type Address Off Size ES Flg Lk Inf Al
+# GNU2-NEXT: error: '[[FILE]]': e_shstrndx = SHN_XINDEX, but the section header table is empty
+
----------------
This being an error rather than a warning is a bit surprising, given that it would be trivial to treat the behaviour as no string table instead. I take it that's a different patch of code that would need changing though.
================
Comment at: llvm/test/tools/llvm-readobj/ELF/many-sections.s:53-54
+# LLVM2-NEXT: }
+# LLVM2-NEXT: Sections [
+# LLVM2-NEXT: ]
----------------
In a similar manner, the lack of a warning here is surprising.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D82374/new/
https://reviews.llvm.org/D82374
More information about the llvm-commits
mailing list