diff options
| author | George Rimar <grimar@accesssoftek.com> | 2019-01-28 14:11:35 +0000 |
|---|---|---|
| committer | George Rimar <grimar@accesssoftek.com> | 2019-01-28 14:11:35 +0000 |
| commit | 87fa2e66e715b0d1d457f519a6f668cc6f56e23a (patch) | |
| tree | fe137ff5ed70ea7825d1b746a5345a812bcab7e7 /llvm/test/tools | |
| parent | f02e9f3783434a7440d563c046d0c677b758bb56 (diff) | |
| download | bcm5719-llvm-87fa2e66e715b0d1d457f519a6f668cc6f56e23a.tar.gz bcm5719-llvm-87fa2e66e715b0d1d457f519a6f668cc6f56e23a.zip | |
[llvm-objdump] - Print LMAs when dumping section headers.
When --section-headers is used, GNU objdump prints both LMA and VMA for sections.
llvm-objdump does not do that what makes it's output be slightly inconsistent.
Patch teaches llvm-objdump to print LMA/VMA for ELF file formats.
The behavior for other formats remains unchanged.
Differential revision: https://reviews.llvm.org/D57146
llvm-svn: 352366
Diffstat (limited to 'llvm/test/tools')
| -rw-r--r-- | llvm/test/tools/llvm-objdump/X86/macho-section-headers.test | 2 | ||||
| -rw-r--r-- | llvm/test/tools/llvm-objdump/X86/phdrs-lma.test | 48 | ||||
| -rw-r--r-- | llvm/test/tools/llvm-objdump/X86/phdrs-lma2.test | 60 | ||||
| -rw-r--r-- | llvm/test/tools/llvm-objdump/wasm.txt | 2 |
4 files changed, 110 insertions, 2 deletions
diff --git a/llvm/test/tools/llvm-objdump/X86/macho-section-headers.test b/llvm/test/tools/llvm-objdump/X86/macho-section-headers.test index 5159d180822..770b25b22ba 100644 --- a/llvm/test/tools/llvm-objdump/X86/macho-section-headers.test +++ b/llvm/test/tools/llvm-objdump/X86/macho-section-headers.test @@ -1,7 +1,7 @@ RUN: llvm-objdump -macho -h %p/Inputs/hello.obj.macho-x86_64 | FileCheck %s CHECK: Sections: -CHECK: Idx Name Size Address Type +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 diff --git a/llvm/test/tools/llvm-objdump/X86/phdrs-lma.test b/llvm/test/tools/llvm-objdump/X86/phdrs-lma.test new file mode 100644 index 00000000000..de1b982c0de --- /dev/null +++ b/llvm/test/tools/llvm-objdump/X86/phdrs-lma.test @@ -0,0 +1,48 @@ +# RUN: yaml2obj %s > %t + +## Check we print both VMA and LMA correctly when dumping section headers. +# RUN: llvm-objdump --section-headers %t | FileCheck %s + +# CHECK: Sections: +# CHECK-NEXT: Idx Name Size VMA LMA Type +# CHECK-NEXT: 0 00000000 0000000000000000 0000000000000000 +# CHECK-NEXT: 1 .text 00000004 0000000000001000 0000000000002000 TEXT +# CHECK-NEXT: 2 .init 00000004 0000000000001010 0000000000001010 TEXT +# CHECK-NEXT: 3 .data 00000004 0000000000002000 0000000000003000 DATA + +!ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_EXEC + Machine: EM_X86_64 +Sections: + - Name: .text + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC, SHF_EXECINSTR ] + Content: "00000000" + Address: 0x00001000 + - Name: .init + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC, SHF_EXECINSTR ] + Content: "00000000" + Address: 0x00001010 + - Name: .data + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC ] + Content: "00000000" + Address: 0x00002000 +ProgramHeaders: + - Type: PT_LOAD + Flags: [ PF_X, PF_R ] + VAddr: 0x00001000 + PAddr: 0x00002000 + Sections: + - Section: .text + - Section: .init + - Type: PT_LOAD + Flags: [ PF_R ] + VAddr: 0x00002000 + PAddr: 0x00003000 + Sections: + - Section: .data diff --git a/llvm/test/tools/llvm-objdump/X86/phdrs-lma2.test b/llvm/test/tools/llvm-objdump/X86/phdrs-lma2.test new file mode 100644 index 00000000000..2dd155f246c --- /dev/null +++ b/llvm/test/tools/llvm-objdump/X86/phdrs-lma2.test @@ -0,0 +1,60 @@ +# RUN: yaml2obj %s > %t + +## If there are no sections with different LMA to VMA, +## we do not display LMA column. +# RUN: llvm-objdump --section-headers %t | FileCheck %s + +# CHECK: Sections: +# CHECK-NEXT: Idx Name Size VMA Type +# CHECK-NEXT: 0 00000000 0000000000000000 +# CHECK-NEXT: 1 .text 00000004 0000000000001000 TEXT +# CHECK-NEXT: 2 .init 00000004 0000000000001010 TEXT +# CHECK-NEXT: 3 .data 00000004 0000000000002000 DATA + +## Check we can trigger displaying the LMA column with --show-lma. +# RUN: llvm-objdump --section-headers --show-lma %t |\ +# RUN: FileCheck %s --check-prefix=LMA + +# LMA: Sections: +# LMA-NEXT: Idx Name Size VMA LMA Type +# LMA-NEXT: 0 00000000 0000000000000000 0000000000000000 +# LMA-NEXT: 1 .text 00000004 0000000000001000 0000000000001000 TEXT +# LMA-NEXT: 2 .init 00000004 0000000000001010 0000000000001010 TEXT +# LMA-NEXT: 3 .data 00000004 0000000000002000 0000000000002000 DATA + +!ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_EXEC + Machine: EM_X86_64 +Sections: + - Name: .text + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC, SHF_EXECINSTR ] + Content: "00000000" + Address: 0x00001000 + - Name: .init + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC, SHF_EXECINSTR ] + Content: "00000000" + Address: 0x00001010 + - Name: .data + Type: SHT_PROGBITS + Flags: [ SHF_ALLOC ] + Content: "00000000" + Address: 0x00002000 +ProgramHeaders: + - Type: PT_LOAD + Flags: [ PF_X, PF_R ] + VAddr: 0x00001000 + PAddr: 0x00001000 + Sections: + - Section: .text + - Section: .init + - Type: PT_LOAD + Flags: [ PF_R ] + VAddr: 0x00002000 + PAddr: 0x00002000 + Sections: + - Section: .data diff --git a/llvm/test/tools/llvm-objdump/wasm.txt b/llvm/test/tools/llvm-objdump/wasm.txt index 93517fed6d4..4a0cfd06582 100644 --- a/llvm/test/tools/llvm-objdump/wasm.txt +++ b/llvm/test/tools/llvm-objdump/wasm.txt @@ -1,7 +1,7 @@ # RUN: llvm-objdump -h %p/Inputs/trivial.obj.wasm | FileCheck %s # CHECK: Sections: -# CHECK-NEXT: Idx Name Size Address Type +# CHECK-NEXT: Idx Name Size VMA Type # CHECK-NEXT: 0 TYPE 00000011 0000000000000000 # CHECK-NEXT: 1 IMPORT 0000005d 0000000000000000 # CHECK-NEXT: 2 FUNCTION 00000003 0000000000000000 |

