[PATCH] D70826: [llvm-readobj/llvm-readelf] - Reimplement dumping of the SHT_GNU_verneed section.
James Henderson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 29 01:10:09 PST 2019
jhenderson added inline comments.
================
Comment at: llvm/test/tools/llvm-readobj/elf-verneed-invalid.test:92
# GNU-NOLINK-NEXT: Addr: 0000000000000000 Offset: 0x000044 Link: 0 ()
-# GNU-NOLINK-NEXT: 0x0000: Version: 1 File: <invalid> Cnt: 1
-# GNU-NOLINK-NEXT: 0x0010: Name: <invalid> Flags: none Version: 2
+# GNU-NOLINK-EMPTY:
+# GNU-NOLINK-NEXT: warning: '[[FILE]]': invalid string table linked to SHT_GNU_verneed section with index 2: invalid sh_type for string table section [index 0]: expected SHT_STRTAB, but got SHT_NULL
----------------
No need for this EMPTY line.
================
Comment at: llvm/test/tools/llvm-readobj/elf-verneed-invalid.test:109
# LLVM-NOLINK: VersionRequirements [
+# LLVM-NOLINK-EMPTY:
+# LLVM-NOLINK-NEXT: warning: '[[FILE]]': invalid string table linked to SHT_GNU_verneed section with index 2: invalid sh_type for string table section [index 0]: expected SHT_STRTAB, but got SHT_NULL
----------------
Ditto
================
Comment at: llvm/test/tools/llvm-readobj/elf-verneed-invalid.test:340
+ Link: 0xFF
+ Dependencies:
+ - Version: 1
----------------
Can you delete this Dependencies section to simplify the YAML?
================
Comment at: llvm/test/tools/llvm-readobj/elf-verneed-invalid.test:372
+ ShOffset: 0xFFFFFFFF
+ Dependencies:
+ - Version: 1
----------------
Ditto
================
Comment at: llvm/tools/llvm-readobj/ELFDumper.cpp:468-483
+ unsigned SecNdx = Sec - &cantFail(Obj->sections()).front();
+
+ Expected<const Elf_Shdr *> StrTabSecOrErr = Obj->getSection(Sec->sh_link);
+ if (!StrTabSecOrErr)
+ return createError(
+ "invalid section linked to SHT_GNU_verneed section with index " +
+ Twine(SecNdx) + ": " + toString(StrTabSecOrErr.takeError()));
----------------
I wonder if this block, which is common at least with the verdef section, could be pulled out into a function `getLinkAsStrtab` or something similar?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D70826/new/
https://reviews.llvm.org/D70826
More information about the llvm-commits
mailing list