[llvm] r368138 - [llvm-readelf] --notes: move 'Data size' column left by 1
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 7 02:13:12 PDT 2019
Author: maskray
Date: Wed Aug 7 02:13:11 2019
New Revision: 368138
URL: http://llvm.org/viewvc/llvm-project?rev=368138&view=rev
Log:
[llvm-readelf] --notes: move 'Data size' column left by 1
readelf -n:
```
// "Data size" is not left justified
Owner Data size Description
GNU 0x00000010 NT_GNU_ABI_TAG (ABI version tag)
```
llvm-readelf -n (before):
```
// "Data size" column shifted by 1
Owner Data size Description
GNU 0x00000010 NT_GNU_ABI_TAG (ABI version tag)
```
llvm-readelf -n (after):
```
Owner Data size Description
GNU 0x00000010 NT_GNU_ABI_TAG (ABI version tag)
```
This change is made to reduce the diff with readelf -n, so that it is
slightly easier to check what features readelf implements but we don't.
Reviewed By: grimar, jhenderson
Differential Revision: https://reviews.llvm.org/D65847
Modified:
llvm/trunk/test/tools/llvm-readobj/gnu-notes.test
llvm/trunk/tools/llvm-readobj/ELFDumper.cpp
Modified: llvm/trunk/test/tools/llvm-readobj/gnu-notes.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-readobj/gnu-notes.test?rev=368138&r1=368137&r2=368138&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-readobj/gnu-notes.test (original)
+++ llvm/trunk/test/tools/llvm-readobj/gnu-notes.test Wed Aug 7 02:13:11 2019
@@ -1,23 +1,23 @@
## Test tools are able to dump different types of notes.
# RUN: yaml2obj --docnum=1 %s > %t1.so
-# RUN: llvm-readelf --notes %t1.so | FileCheck %s --check-prefix=GNU
+# RUN: llvm-readelf --notes %t1.so | FileCheck %s --check-prefix=GNU --strict-whitespace --match-full-lines
# RUN: llvm-readobj --notes %t1.so | FileCheck %s --check-prefix=LLVM
-# GNU: Displaying notes found at file offset 0x00000200 with length 0x00000020:
-# GNU-NEXT: Owner Data size Description
-# GNU-NEXT: GNU 0x00000010 NT_GNU_ABI_TAG (ABI version tag)
-# GNU-NEXT: OS: Linux, ABI: 2.6.32
+# GNU:Displaying notes found at file offset 0x00000200 with length 0x00000020:
+# GNU-NEXT: Owner Data size Description
+# GNU-NEXT: GNU 0x00000010 NT_GNU_ABI_TAG (ABI version tag)
+# GNU-NEXT: OS: Linux, ABI: 2.6.32
-# GNU: Displaying notes found at file offset 0x00000220 with length 0x00000020:
-# GNU-NEXT: Owner Data size Description
-# GNU-NEXT: GNU 0x00000010 NT_GNU_BUILD_ID (unique build ID bitstring)
-# GNU-NEXT: Build ID: 4fcb712aa6387724a9f465a32cd8c14b
+# GNU:Displaying notes found at file offset 0x00000220 with length 0x00000020:
+# GNU-NEXT: Owner Data size Description
+# GNU-NEXT: GNU 0x00000010 NT_GNU_BUILD_ID (unique build ID bitstring)
+# GNU-NEXT: Build ID: 4fcb712aa6387724a9f465a32cd8c14b
-# GNU: Displaying notes found at file offset 0x00000240 with length 0x0000001c:
-# GNU-NEXT: Owner Data size Description
-# GNU-NEXT: GNU 0x00000009 NT_GNU_GOLD_VERSION (gold version)
-# GNU-NEXT: Version: gold 1.11
+# GNU:Displaying notes found at file offset 0x00000240 with length 0x0000001c:
+# GNU-NEXT: Owner Data size Description
+# GNU-NEXT: GNU 0x00000009 NT_GNU_GOLD_VERSION (gold version)
+# GNU-NEXT: Version: gold 1.11
# LLVM: Notes [
# LLVM-NEXT: NoteSection {
Modified: llvm/trunk/tools/llvm-readobj/ELFDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/ELFDumper.cpp?rev=368138&r1=368137&r2=368138&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-readobj/ELFDumper.cpp (original)
+++ llvm/trunk/tools/llvm-readobj/ELFDumper.cpp Wed Aug 7 02:13:11 2019
@@ -4315,7 +4315,7 @@ void GNUStyle<ELFT>::printNotes(const EL
const typename ELFT::Addr Size) {
OS << "Displaying notes found at file offset " << format_hex(Offset, 10)
<< " with length " << format_hex(Size, 10) << ":\n"
- << " Owner Data size\tDescription\n";
+ << " Owner Data size \tDescription\n";
};
auto ProcessNote = [&](const Elf_Note &Note) {
@@ -4323,7 +4323,7 @@ void GNUStyle<ELFT>::printNotes(const EL
ArrayRef<uint8_t> Descriptor = Note.getDesc();
Elf_Word Type = Note.getType();
- OS << " " << Name << std::string(22 - Name.size(), ' ')
+ OS << " " << left_justify(Name, 20) << ' '
<< format_hex(Descriptor.size(), 10) << '\t';
if (Name == "GNU") {
More information about the llvm-commits
mailing list