Currently we crash when trying to print --sections and the SHN_XINDEX escape value
is used for the e_shstrndx field, but there is no section header at index 0 to
read the value from.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Thanks!
llvm/include/llvm/Object/ELF.h | ||
---|---|---|
521 | Considering using the ELF spec wording: ... the actual index of the section name string table section is contained in the sh_link field of the section header at index 0. |
LGTM, aside from the nit, I think my other comments are probably best left for another patch.
llvm/include/llvm/Object/ELF.h | ||
---|---|---|
526 | Nit: either e_shstrndx == SHN_XINDEX or e_shstrndx is SHN_XINDEX | |
llvm/test/tools/llvm-readobj/ELF/many-sections.s | ||
46 | 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. | |
53–54 | In a similar manner, the lack of a warning here is surprising. |
Considering using the ELF spec wording:
... the actual index of the section name string table section is contained in the sh_link field of the section header at index 0.