[PATCH] D71243: [llvm-readelf] - Do no print an empty symbol version as "<corrupt>"
George Rimar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 10 01:47:14 PST 2019
grimar created this revision.
grimar added reviewers: jhenderson, MaskRay, rupprecht.
Herald added subscribers: seiya, arichardson, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.
It is discussed here https://reviews.llvm.org/D71118#inline-643172
Currently when a version is empty, llvm-readelf prints:
"000: 0 (*local*) 2 (<corrupt>)"
But GNU readelf does not treat empty section as corrupt.
There is no sense in having empty versions anyways it seems, but
this change is for consistency with GNU.
https://reviews.llvm.org/D71243
Files:
llvm/test/tools/llvm-readobj/ELF/verneed-invalid.test
llvm/tools/llvm-readobj/ELFDumper.cpp
Index: llvm/tools/llvm-readobj/ELFDumper.cpp
===================================================================
--- llvm/tools/llvm-readobj/ELFDumper.cpp
+++ llvm/tools/llvm-readobj/ELFDumper.cpp
@@ -4133,7 +4133,7 @@
bool IsDefault;
Expected<StringRef> NameOrErr =
this->dumper()->getSymbolVersionByIndex(Ndx, IsDefault);
- if (!NameOrErr || NameOrErr->empty()) {
+ if (!NameOrErr) {
if (!NameOrErr) {
unsigned SecNdx = Sec - &cantFail(Obj->sections()).front();
this->reportUniqueWarning(createError(
Index: llvm/test/tools/llvm-readobj/ELF/verneed-invalid.test
===================================================================
--- llvm/test/tools/llvm-readobj/ELF/verneed-invalid.test
+++ llvm/test/tools/llvm-readobj/ELF/verneed-invalid.test
@@ -10,7 +10,7 @@
# GNU-VERNEED-NAME: Version symbols section '.gnu.version' contains 2 entries:
# GNU-VERNEED-NAME-NEXT: Addr: 0000000000200210 Offset: 0x000040 Link: 5 (.dynsym)
-# GNU-VERNEED-NAME-NEXT: 000: 0 (*local*) 2 (<corrupt>)
+# GNU-VERNEED-NAME-NEXT: 000: 0 (*local*) 2 ()
# GNU-VERNEED-NAME: Version needs section '.gnu.version_r' contains 1 entries:
# GNU-VERNEED-NAME-NEXT: Addr: 0000000000000000 Offset: 0x000044 Link: 6 (.dynstr)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71243.233018.patch
Type: text/x-patch
Size: 1289 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191210/3d25f282/attachment.bin>
More information about the llvm-commits
mailing list