[lld] 0c2e2f8 - [llvm-objdump] Improve newline consistency between different pieces of information
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Tue May 4 09:56:12 PDT 2021
Author: Fangrui Song
Date: 2021-05-04T09:56:07-07:00
New Revision: 0c2e2f88fbd3f3ffa2e441e08cdd17141e7bea97
URL: https://github.com/llvm/llvm-project/commit/0c2e2f88fbd3f3ffa2e441e08cdd17141e7bea97
DIFF: https://github.com/llvm/llvm-project/commit/0c2e2f88fbd3f3ffa2e441e08cdd17141e7bea97.diff
LOG: [llvm-objdump] Improve newline consistency between different pieces of information
When dumping multiple pieces of information (e.g. --all-headers),
there is sometimes no separator between two pieces.
This patch uses the "\nheader:\n" style, which generally improves
compatibility with GNU objdump.
Note: objdump -t/-T does not add a newline before "SYMBOL TABLE:" and "DYNAMIC SYMBOL TABLE:".
We add a newline to be consistent with other information.
`objdump -d` prints two empty lines before the first 'Disassembly of section'.
We print just one with this patch.
Differential Revision: https://reviews.llvm.org/D101796
Added:
Modified:
lld/test/MachO/arm64-32-reloc-got-load.s
lld/test/MachO/arm64-reloc-got-load.s
lld/test/MachO/arm64-reloc-tlv-load.s
llvm/test/tools/llvm-objdump/ELF/AMDGPU/kd-failure.s
llvm/test/tools/llvm-objdump/ELF/AMDGPU/kd-sgpr.s
llvm/test/tools/llvm-objdump/ELF/AMDGPU/kd-vgpr.s
llvm/test/tools/llvm-objdump/ELF/AMDGPU/kd-zeroed-gfx9.s
llvm/test/tools/llvm-objdump/ELF/AMDGPU/kd-zeroed-raw.s
llvm/test/tools/llvm-objdump/ELF/symbol-table.test
llvm/test/tools/llvm-objdump/ELF/verdef.test
llvm/test/tools/llvm-objdump/ELF/verneed.test
llvm/test/tools/llvm-objdump/MachO/section-headers.test
llvm/test/tools/llvm-objdump/X86/disassemble-section-name.s
llvm/test/tools/llvm-objdump/X86/elf-dynamic-symbols.test
llvm/test/tools/llvm-objdump/all-headers.test
llvm/tools/llvm-objdump/ELFDump.cpp
llvm/tools/llvm-objdump/llvm-objdump.cpp
Removed:
################################################################################
diff --git a/lld/test/MachO/arm64-32-reloc-got-load.s b/lld/test/MachO/arm64-32-reloc-got-load.s
index b26aea3d4eda4..336f9ecdcea4b 100644
--- a/lld/test/MachO/arm64-32-reloc-got-load.s
+++ b/lld/test/MachO/arm64-32-reloc-got-load.s
@@ -28,6 +28,7 @@
# DYLIB-NEXT: adrp x8, [[#]] ; 0x[[#GOT]]
# DYLIB-NEXT: ldr w8, [x8]
# DYLIB-NEXT: ret
+# DYLIB-EMPTY:
# DYLIB-NEXT: Sections:
# DYLIB-NEXT: Idx Name Size VMA Type
# DYLIB: [[#]] __got 00000008 [[#%.8x,GOT]] DATA
diff --git a/lld/test/MachO/arm64-reloc-got-load.s b/lld/test/MachO/arm64-reloc-got-load.s
index ee1ce1ea1aefc..ad7633262c680 100644
--- a/lld/test/MachO/arm64-reloc-got-load.s
+++ b/lld/test/MachO/arm64-reloc-got-load.s
@@ -28,6 +28,7 @@
# DYLIB-NEXT: adrp x8, [[#]] ; 0x[[#GOT]]
# DYLIB-NEXT: ldr x8, [x8] ; literal pool symbol address: _bar
# DYLIB-NEXT: ret
+# DYLIB-EMPTY:
# DYLIB-NEXT: Sections:
# DYLIB-NEXT: Idx Name Size VMA Type
# DYLIB: [[#]] __got 00000010 {{0*}}[[#GOT]] DATA
diff --git a/lld/test/MachO/arm64-reloc-tlv-load.s b/lld/test/MachO/arm64-reloc-tlv-load.s
index 3cfd311fa606d..17de5bdf01ad2 100644
--- a/lld/test/MachO/arm64-reloc-tlv-load.s
+++ b/lld/test/MachO/arm64-reloc-tlv-load.s
@@ -28,6 +28,7 @@
# DYLIB-NEXT: adrp x8, [[#]] ; 0x[[#TLV]]
# DYLIB-NEXT: ldr x8, [x8] ; literal pool symbol address: _bar
# DYLIB-NEXT: ret
+# DYLIB-EMPTY:
# DYLIB-NEXT: Sections:
# DYLIB-NEXT: Idx Name Size VMA Type
# DYLIB: [[#]] __thread_ptrs 00000010 {{0*}}[[#TLV]] DATA
diff --git a/llvm/test/tools/llvm-objdump/ELF/AMDGPU/kd-failure.s b/llvm/test/tools/llvm-objdump/ELF/AMDGPU/kd-failure.s
index 98b8b9a4f0b60..608cfd863c260 100644
--- a/llvm/test/tools/llvm-objdump/ELF/AMDGPU/kd-failure.s
+++ b/llvm/test/tools/llvm-objdump/ELF/AMDGPU/kd-failure.s
@@ -6,7 +6,7 @@
; RUN: printf ".type my_kernel.kd, @object \nmy_kernel.kd:\n.size my_kernel.kd, 64\n" > %t1.sym_info
; RUN: llvm-objdump --disassemble-symbols=my_kernel.kd %t.o \
-; RUN: | tail -n +9 > %t1.sym_content
+; RUN: | tail -n +8 > %t1.sym_content
; RUN: cat %t1.sym_info %t1.sym_content > %t1.s
; RUN: llvm-mc %t1.s --triple=amdgcn-amd-amdhsa -mcpu=gfx908 -filetype=obj -o %t-re-assemble.o
diff --git a/llvm/test/tools/llvm-objdump/ELF/AMDGPU/kd-sgpr.s b/llvm/test/tools/llvm-objdump/ELF/AMDGPU/kd-sgpr.s
index e397932585bb3..825a6cf0292b5 100644
--- a/llvm/test/tools/llvm-objdump/ELF/AMDGPU/kd-sgpr.s
+++ b/llvm/test/tools/llvm-objdump/ELF/AMDGPU/kd-sgpr.s
@@ -3,17 +3,17 @@
; RUN: split-file %s %t.dir
; RUN: llvm-mc %t.dir/1.s --triple=amdgcn-amd-amdhsa -mcpu=gfx908 -mattr=-xnack -filetype=obj -o %t1
-; RUN: llvm-objdump --disassemble-symbols=my_kernel_1.kd %t1 | tail -n +8 \
+; RUN: llvm-objdump --disassemble-symbols=my_kernel_1.kd %t1 | tail -n +7 \
; RUN: | llvm-mc --triple=amdgcn-amd-amdhsa -mcpu=gfx908 -mattr=-xnack -filetype=obj -o %t1-re-assemble
; RUN:
diff %t1 %t1-re-assemble
; RUN: llvm-mc %t.dir/2.s --triple=amdgcn-amd-amdhsa -mcpu=gfx908 -mattr=-xnack -filetype=obj -o %t2
-; RUN: llvm-objdump --disassemble-symbols=my_kernel_2.kd %t2 | tail -n +8 \
+; RUN: llvm-objdump --disassemble-symbols=my_kernel_2.kd %t2 | tail -n +7 \
; RUN: | llvm-mc --triple=amdgcn-amd-amdhsa -mcpu=gfx908 -mattr=-xnack -filetype=obj -o %t2-re-assemble
; RUN:
diff %t2 %t2-re-assemble
; RUN: llvm-mc %t.dir/3.s --triple=amdgcn-amd-amdhsa -mcpu=gfx908 -mattr=-xnack -filetype=obj -o %t3
-; RUN: llvm-objdump --disassemble-symbols=my_kernel_3.kd %t3 | tail -n +8 \
+; RUN: llvm-objdump --disassemble-symbols=my_kernel_3.kd %t3 | tail -n +7 \
; RUN: | llvm-mc --triple=amdgcn-amd-amdhsa -mcpu=gfx908 -mattr=-xnack -filetype=obj -o %t3-re-assemble
; RUN:
diff %t3 %t3-re-assemble
diff --git a/llvm/test/tools/llvm-objdump/ELF/AMDGPU/kd-vgpr.s b/llvm/test/tools/llvm-objdump/ELF/AMDGPU/kd-vgpr.s
index ba6e1d60b207e..52981b6f24d3a 100644
--- a/llvm/test/tools/llvm-objdump/ELF/AMDGPU/kd-vgpr.s
+++ b/llvm/test/tools/llvm-objdump/ELF/AMDGPU/kd-vgpr.s
@@ -3,17 +3,17 @@
; RUN: split-file %s %t.dir
; RUN: llvm-mc %t.dir/1.s --triple=amdgcn-amd-amdhsa -mcpu=gfx908 -mattr=-xnack -filetype=obj -o %t1
-; RUN: llvm-objdump --disassemble-symbols=my_kernel_1.kd %t1 | tail -n +8 \
+; RUN: llvm-objdump --disassemble-symbols=my_kernel_1.kd %t1 | tail -n +7 \
; RUN: | llvm-mc --triple=amdgcn-amd-amdhsa -mcpu=gfx908 -mattr=-xnack -filetype=obj -o %t1-re-assemble
; RUN:
diff %t1 %t1-re-assemble
; RUN: llvm-mc %t.dir/2.s --triple=amdgcn-amd-amdhsa -mcpu=gfx908 -mattr=-xnack -filetype=obj -o %t2
-; RUN: llvm-objdump --disassemble-symbols=my_kernel_2.kd %t2 | tail -n +8 \
+; RUN: llvm-objdump --disassemble-symbols=my_kernel_2.kd %t2 | tail -n +7 \
; RUN: | llvm-mc --triple=amdgcn-amd-amdhsa -mcpu=gfx908 -mattr=-xnack -filetype=obj -o %t2-re-assemble
; RUN:
diff %t2 %t2-re-assemble
; RUN: llvm-mc %t.dir/3.s --triple=amdgcn-amd-amdhsa -mcpu=gfx908 -mattr=-xnack -filetype=obj -o %t3
-; RUN: llvm-objdump --disassemble-symbols=my_kernel_3.kd %t3 | tail -n +8 \
+; RUN: llvm-objdump --disassemble-symbols=my_kernel_3.kd %t3 | tail -n +7 \
; RUN: | llvm-mc --triple=amdgcn-amd-amdhsa -mcpu=gfx908 -mattr=-xnack -filetype=obj -o %t3-re-assemble
; RUN:
diff %t3 %t3-re-assemble
diff --git a/llvm/test/tools/llvm-objdump/ELF/AMDGPU/kd-zeroed-gfx9.s b/llvm/test/tools/llvm-objdump/ELF/AMDGPU/kd-zeroed-gfx9.s
index 68a502492c503..78b405097cf60 100644
--- a/llvm/test/tools/llvm-objdump/ELF/AMDGPU/kd-zeroed-gfx9.s
+++ b/llvm/test/tools/llvm-objdump/ELF/AMDGPU/kd-zeroed-gfx9.s
@@ -2,7 +2,7 @@
; RUN: llvm-mc %s --triple=amdgcn-amd-amdhsa -mcpu=gfx908 -mattr=-xnack -filetype=obj -o %t1
; RUN: llvm-objdump --disassemble-symbols=my_kernel.kd %t1 \
-; RUN: | tail -n +8 | llvm-mc --triple=amdgcn-amd-amdhsa -mcpu=gfx908 -mattr=-xnack -filetype=obj -o %t2
+; RUN: | tail -n +7 | llvm-mc --triple=amdgcn-amd-amdhsa -mcpu=gfx908 -mattr=-xnack -filetype=obj -o %t2
; RUN:
diff %t1 %t2
; RUN: llvm-objdump -s -j .text %t1 | FileCheck --check-prefix=OBJDUMP %s
diff --git a/llvm/test/tools/llvm-objdump/ELF/AMDGPU/kd-zeroed-raw.s b/llvm/test/tools/llvm-objdump/ELF/AMDGPU/kd-zeroed-raw.s
index 7e98bd9f67c03..40f54fdab6080 100644
--- a/llvm/test/tools/llvm-objdump/ELF/AMDGPU/kd-zeroed-raw.s
+++ b/llvm/test/tools/llvm-objdump/ELF/AMDGPU/kd-zeroed-raw.s
@@ -1,6 +1,6 @@
; RUN: llvm-mc %s --triple=amdgcn-amd-amdhsa -mcpu=gfx908 -mattr=-xnack -filetype=obj -o %t1
; RUN: llvm-objdump --disassemble-symbols=my_kernel.kd %t1 \
-; RUN: | tail -n +8 | llvm-mc --triple=amdgcn-amd-amdhsa -mcpu=gfx908 -mattr=-xnack -filetype=obj -o %t2
+; RUN: | tail -n +7 | llvm-mc --triple=amdgcn-amd-amdhsa -mcpu=gfx908 -mattr=-xnack -filetype=obj -o %t2
; RUN: llvm-objdump -s -j .text %t2 | FileCheck --check-prefix=OBJDUMP %s
;; Not running lit-test over gfx10 (see kd-zeroed-gfx10.s for details).
diff --git a/llvm/test/tools/llvm-objdump/ELF/symbol-table.test b/llvm/test/tools/llvm-objdump/ELF/symbol-table.test
index 507641ee0f6d3..cba5f75892935 100644
--- a/llvm/test/tools/llvm-objdump/ELF/symbol-table.test
+++ b/llvm/test/tools/llvm-objdump/ELF/symbol-table.test
@@ -4,7 +4,9 @@
# RUN: llvm-objdump -t %t | cmp - %t.txt
# RUN: FileCheck %s --input-file=%t.txt --match-full-lines --strict-whitespace
-# CHECK:SYMBOL TABLE:
+# CHECK:{{.*}}file format elf64-x86-64
+#CHECK-EMPTY:
+# CHECK-NEXT:SYMBOL TABLE:
# CHECK-NEXT:0000000000000000 l df *ABS* 0000000000000000 a.c
# CHECK-NEXT:0000000000000000 l d .text 0000000000000000 .text
# CHECK-NEXT:0000000000002000 l O .data 0000000000000000 local_object
diff --git a/llvm/test/tools/llvm-objdump/ELF/verdef.test b/llvm/test/tools/llvm-objdump/ELF/verdef.test
index 034afe8d166e6..e4ae33853deb4 100644
--- a/llvm/test/tools/llvm-objdump/ELF/verdef.test
+++ b/llvm/test/tools/llvm-objdump/ELF/verdef.test
@@ -1,7 +1,9 @@
# RUN: yaml2obj %s -o %t
# RUN: llvm-objdump -p %t | FileCheck --strict-whitespace %s
-# CHECK: Version definitions:
+# CHECK: Dynamic Section:
+# CHECK-EMPTY:
+# CHECK-NEXT: Version definitions:
# CHECK-NEXT: 1 0x01 0x075bcd15 foo
# CHECK-NEXT: 2 0x02 0x3ade68b1 VERSION_1
# CHECK-NEXT: VERSION_2
diff --git a/llvm/test/tools/llvm-objdump/ELF/verneed.test b/llvm/test/tools/llvm-objdump/ELF/verneed.test
index 66ac837bfbf6f..57e856e542adb 100644
--- a/llvm/test/tools/llvm-objdump/ELF/verneed.test
+++ b/llvm/test/tools/llvm-objdump/ELF/verneed.test
@@ -1,12 +1,14 @@
# RUN: yaml2obj %s -o %t
-# RUN: llvm-objdump -p %t | FileCheck %s
+# RUN: llvm-objdump -p %t | FileCheck %s --strict-whitespace --match-full-lines
-# CHECK: Version References:
-# CHECK-NEXT: required from dso.so.0:
-# CHECK-NEXT: 0x000004d2 0x0a 03 v1
-# CHECK-NEXT: 0x0000162e 0x0b 04 v2
-# CHECK-NEXT: required from dso.so.1:
-# CHECK-NEXT: 0x000011d7 0x0c 02 v3
+# CHECK:Dynamic Section:
+# CHECK-EMPTY:
+# CHECK-NEXT:Version References:
+# CHECK-NEXT: required from dso.so.0:
+# CHECK-NEXT: 0x000004d2 0x0a 03 v1
+# CHECK-NEXT: 0x0000162e 0x0b 04 v2
+# CHECK-NEXT: required from dso.so.1:
+# CHECK-NEXT: 0x000011d7 0x0c 02 v3
--- !ELF
FileHeader:
diff --git a/llvm/test/tools/llvm-objdump/MachO/section-headers.test b/llvm/test/tools/llvm-objdump/MachO/section-headers.test
index 3012620fcb39d..9d19cdaa8ce83 100644
--- a/llvm/test/tools/llvm-objdump/MachO/section-headers.test
+++ b/llvm/test/tools/llvm-objdump/MachO/section-headers.test
@@ -1,8 +1,9 @@
-RUN: llvm-objdump --macho -h %p/Inputs/hello.obj.macho-x86_64 | FileCheck %s
+RUN: llvm-objdump --macho -h %p/Inputs/hello.obj.macho-x86_64 | FileCheck %s --strict-whitespace --match-full-lines
-CHECK: Sections:
-CHECK: Idx Name Size VMA Type
-CHECK: 0 __text 0000003b 0000000000000000 TEXT
-CHECK: 1 __cstring 0000000d 000000000000003b DATA
-CHECK: 2 __compact_unwind 00000020 0000000000000048 DATA
-CHECK: 3 __eh_frame 00000040 0000000000000068 DATA
+ CHECK:{{^$}}
+ CHECK-NEXT:Sections:
+ CHECK-NEXT:Idx Name Size VMA Type
+ CHECK-NEXT: 0 __text 0000003b 0000000000000000 TEXT
+ CHECK-NEXT: 1 __cstring 0000000d 000000000000003b DATA
+ CHECK-NEXT: 2 __compact_unwind 00000020 0000000000000048 DATA
+ CHECK-NEXT: 3 __eh_frame 00000040 0000000000000068 DATA
diff --git a/llvm/test/tools/llvm-objdump/X86/disassemble-section-name.s b/llvm/test/tools/llvm-objdump/X86/disassemble-section-name.s
index da07cb82f74a4..762c9269b4950 100644
--- a/llvm/test/tools/llvm-objdump/X86/disassemble-section-name.s
+++ b/llvm/test/tools/llvm-objdump/X86/disassemble-section-name.s
@@ -3,7 +3,6 @@
# CHECK: : file format elf64-x86-64
# CHECK-EMPTY:
-# CHECK-EMPTY:
# CHECK-NEXT: Disassembly of section .text:
# CHECK-EMPTY:
# CHECK-NEXT: 0000000000000000 <foo>:
diff --git a/llvm/test/tools/llvm-objdump/X86/elf-dynamic-symbols.test b/llvm/test/tools/llvm-objdump/X86/elf-dynamic-symbols.test
index 580ac8507f0e6..d4e9a6500771a 100644
--- a/llvm/test/tools/llvm-objdump/X86/elf-dynamic-symbols.test
+++ b/llvm/test/tools/llvm-objdump/X86/elf-dynamic-symbols.test
@@ -5,7 +5,9 @@
# RUN: llvm-objdump -T %t1 | \
# RUN: FileCheck %s --match-full-lines --strict-whitespace --check-prefix=DYNSYM
-# DYNSYM:DYNAMIC SYMBOL TABLE:
+# DYNSYM:{{.*}}file format elf64-x86-64
+# DYNSYM-EMPTY:
+# DYNSYM-NEXT:DYNAMIC SYMBOL TABLE:
# DYNSYM-NEXT:0000000000000000 l DO .data 0000000000000000 localsym
# DYNSYM-NEXT:0000000000000000 g DO .data 0000000000000000 globalsym
# DYNSYM-NEXT:0000000000000000 u DO .data 0000000000000000 uniqueglobalsym
diff --git a/llvm/test/tools/llvm-objdump/all-headers.test b/llvm/test/tools/llvm-objdump/all-headers.test
index c1c1815ef0838..4a2fc3ce853fd 100644
--- a/llvm/test/tools/llvm-objdump/all-headers.test
+++ b/llvm/test/tools/llvm-objdump/all-headers.test
@@ -7,15 +7,21 @@
## in the following order which provides GNU objdump compatability.
# CHECK: file format elf64-x86-64
-# CHECK-EMPTY:
# CHECK-NEXT: architecture: x86_64
# CHECK-NEXT: start address: 0x0000000000000000
# CHECK-EMPTY:
-# CHECK-NEXT: Program Header:
-# CHECK: Dynamic Section:
-# CHECK: Sections:
-# CHECK: SYMBOL TABLE:
-# CHECK: RELOCATION RECORDS FOR [.text]:
+# CHECK-NEXT: Program Header:
+# CHECK-EMPTY:
+# CHECK-NEXT: Dynamic Section:
+# CHECK: INIT
+# CHECK-EMPTY:
+# CHECK-NEXT: Sections:
+# CHECK: 6 .shstrtab 0000002e 0000000000000000
+# CHECK-EMPTY:
+# CHECK-NEXT: SYMBOL TABLE:
+# CHECK-NEXT: 0000000000000000 l .text 0000000000000000 foo
+# CHECK-EMPTY:
+# CHECK-NEXT: RELOCATION RECORDS FOR [.text]:
## Check how we dump the archives.
## Check we dump the appropriate headers for each file in the archive.
diff --git a/llvm/tools/llvm-objdump/ELFDump.cpp b/llvm/tools/llvm-objdump/ELFDump.cpp
index 31af0cda5e327..da7415834c639 100644
--- a/llvm/tools/llvm-objdump/ELFDump.cpp
+++ b/llvm/tools/llvm-objdump/ELFDump.cpp
@@ -180,7 +180,7 @@ static void printDynamicSection(const ELFFile<ELFT> &Elf, StringRef Filename) {
MaxLen = std::max(MaxLen, Elf.getDynamicTagAsString(Dyn.d_tag).size());
std::string TagFmt = " %-" + std::to_string(MaxLen) + "s ";
- outs() << "Dynamic Section:\n";
+ outs() << "\nDynamic Section:\n";
for (const typename ELFT::Dyn &Dyn : DynamicEntries) {
if (Dyn.d_tag == ELF::DT_NULL)
continue;
@@ -208,7 +208,7 @@ static void printDynamicSection(const ELFFile<ELFT> &Elf, StringRef Filename) {
template <class ELFT>
static void printProgramHeaders(const ELFFile<ELFT> &Obj, StringRef FileName) {
- outs() << "Program Header:\n";
+ outs() << "\nProgram Header:\n";
auto ProgramHeaderOrError = Obj.program_headers();
if (!ProgramHeaderOrError) {
reportWarning("unable to read program headers: " +
@@ -275,13 +275,12 @@ static void printProgramHeaders(const ELFFile<ELFT> &Obj, StringRef FileName) {
<< ((Phdr.p_flags & ELF::PF_W) ? "w" : "-")
<< ((Phdr.p_flags & ELF::PF_X) ? "x" : "-") << "\n";
}
- outs() << "\n";
}
template <class ELFT>
static void printSymbolVersionDependency(ArrayRef<uint8_t> Contents,
StringRef StrTab) {
- outs() << "Version References:\n";
+ outs() << "\nVersion References:\n";
const uint8_t *Buf = Contents.data();
while (Buf) {
@@ -307,7 +306,7 @@ template <class ELFT>
static void printSymbolVersionDefinition(const typename ELFT::Shdr &Shdr,
ArrayRef<uint8_t> Contents,
StringRef StrTab) {
- outs() << "Version definitions:\n";
+ outs() << "\nVersion definitions:\n";
const uint8_t *Buf = Contents.data();
uint32_t VerdefIndex = 1;
diff --git a/llvm/tools/llvm-objdump/llvm-objdump.cpp b/llvm/tools/llvm-objdump/llvm-objdump.cpp
index 2d5a7287204aa..0e6ffe83414a2 100644
--- a/llvm/tools/llvm-objdump/llvm-objdump.cpp
+++ b/llvm/tools/llvm-objdump/llvm-objdump.cpp
@@ -1656,7 +1656,7 @@ void objdump::printRelocations(const ObjectFile *Obj) {
for (std::pair<SectionRef, std::vector<SectionRef>> &P : SecToRelSec) {
StringRef SecName = unwrapOrError(P.first.getName(), Obj->getFileName());
- outs() << "RELOCATION RECORDS FOR [" << SecName << "]:\n";
+ outs() << "\nRELOCATION RECORDS FOR [" << SecName << "]:\n";
uint32_t OffsetPadding = (Obj->getBytesInAddress() > 4 ? 16 : 8);
uint32_t TypePadding = 24;
outs() << left_justify("OFFSET", OffsetPadding) << " "
@@ -1679,7 +1679,6 @@ void objdump::printRelocations(const ObjectFile *Obj) {
<< "\n";
}
}
- outs() << "\n";
}
}
@@ -1739,16 +1738,13 @@ void objdump::printSectionHeaders(const ObjectFile *Obj) {
size_t NameWidth = getMaxSectionNameWidth(Obj);
size_t AddressWidth = 2 * Obj->getBytesInAddress();
bool HasLMAColumn = shouldDisplayLMA(Obj);
+ outs() << "\nSections:\n";
if (HasLMAColumn)
- outs() << "Sections:\n"
- "Idx "
- << left_justify("Name", NameWidth) << " Size "
+ outs() << "Idx " << left_justify("Name", NameWidth) << " Size "
<< left_justify("VMA", AddressWidth) << " "
<< left_justify("LMA", AddressWidth) << " Type\n";
else
- outs() << "Sections:\n"
- "Idx "
- << left_justify("Name", NameWidth) << " Size "
+ outs() << "Idx " << left_justify("Name", NameWidth) << " Size "
<< left_justify("VMA", AddressWidth) << " Type\n";
uint64_t Idx;
@@ -1777,7 +1773,6 @@ void objdump::printSectionHeaders(const ObjectFile *Obj) {
Name.str().c_str(), Size)
<< format_hex_no_prefix(VMA, AddressWidth) << " " << Type << "\n";
}
- outs() << "\n";
}
void objdump::printSectionContents(const ObjectFile *Obj) {
@@ -1833,7 +1828,7 @@ void objdump::printSectionContents(const ObjectFile *Obj) {
void objdump::printSymbolTable(const ObjectFile *O, StringRef ArchiveName,
StringRef ArchitectureName, bool DumpDynamic) {
if (O->isCOFF() && !DumpDynamic) {
- outs() << "SYMBOL TABLE:\n";
+ outs() << "\nSYMBOL TABLE:\n";
printCOFFSymbolTable(cast<const COFFObjectFile>(O));
return;
}
@@ -1841,13 +1836,13 @@ void objdump::printSymbolTable(const ObjectFile *O, StringRef ArchiveName,
const StringRef FileName = O->getFileName();
if (!DumpDynamic) {
- outs() << "SYMBOL TABLE:\n";
+ outs() << "\nSYMBOL TABLE:\n";
for (auto I = O->symbol_begin(); I != O->symbol_end(); ++I)
printSymbol(O, *I, FileName, ArchiveName, ArchitectureName, DumpDynamic);
return;
}
- outs() << "DYNAMIC SYMBOL TABLE:\n";
+ outs() << "\nDYNAMIC SYMBOL TABLE:\n";
if (!O->isELF()) {
reportWarning(
"this operation is not currently supported for this file format",
@@ -2119,7 +2114,7 @@ static void printFileHeaders(const ObjectFile *O) {
StringRef Fmt = O->getBytesInAddress() > 4 ? "%016" PRIx64 : "%08" PRIx64;
outs() << "start address: "
- << "0x" << format(Fmt.data(), Address) << "\n\n";
+ << "0x" << format(Fmt.data(), Address) << "\n";
}
static void printArchiveChild(StringRef Filename, const Archive::Child &C) {
@@ -2216,7 +2211,7 @@ static void dumpObject(ObjectFile *O, const Archive *A = nullptr,
outs() << A->getFileName() << "(" << O->getFileName() << ")";
else
outs() << O->getFileName();
- outs() << ":\tfile format " << O->getFileFormatName().lower() << "\n\n";
+ outs() << ":\tfile format " << O->getFileFormatName().lower() << "\n";
}
if (HasStartAddressFlag || HasStopAddressFlag)
More information about the llvm-commits
mailing list