blob: 6a93856d13b619af2d6124d6b8927aee19d9f75d [file] [log] [blame]
## Test that --section works correctly for -h.
## We test the LMA here too, because the code at the time of writing uses the
## value of --section when looking up section LMAs.
# RUN: yaml2obj %s --docnum=1 -o %t.h.elf
# RUN: llvm-objdump -h %t.h.elf -j=.text --section=.bss \
# RUN: | FileCheck %s --check-prefix=SHDRS --implicit-check-not=.data --implicit-check-not=.text2
# SHDRS: Name Size VMA LMA
# SHDRS: .text 00000001 0000000000000400 0000000000001000
# SHDRS: .bss 00000001 0000000000000420 0000000000003000
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_EXEC
Machine: EM_X86_64
Sections:
- Name: .text
Type: SHT_PROGBITS
Flags: [SHF_ALLOC, SHF_EXECINSTR]
Address: 0x400
AddressAlign: 0x10
Content: 'c3'
- Name: .text2
Type: SHT_PROGBITS
Flags: [SHF_ALLOC, SHF_EXECINSTR]
Address: 0x401
Content: '90'
- Name: .data
Type: SHT_PROGBITS
Flags: [SHF_ALLOC, SHF_WRITE]
Address: 0x410
AddressAlign: 0x10
Content: '42'
- Name: .bss
Type: SHT_NOBITS
Flags: [SHF_ALLOC, SHF_WRITE]
Address: 0x420
AddressAlign: 0x10
Size: 1
ProgramHeaders:
- Type: PT_LOAD
VAddr: 0x400
PAddr: 0x1000
Sections:
- Section: .text
- Section: .text2
- Type: PT_LOAD
VAddr: 0x410
PAddr: 0x2000
Sections:
- Section: .data
- Type: PT_LOAD
VAddr: 0x420
PAddr: 0x3000
Sections:
- Section: .bss
## Test that --section works with --fault-map-section.
# RUN: yaml2obj %s --docnum=2 -o %t.o
# RUN: llvm-objdump %t.o --fault-map-section -j __clangast \
# RUN: | FileCheck %s --check-prefixes=FAULTMAP,NO-FAULTMAP
# RUN: llvm-objdump %t.o --fault-map-section -j .llvm_faultmaps \
# RUN: | FileCheck %s --check-prefixes=FAULTMAP,WITH-FAULTMAP
# FAULTMAP: FaultMap table:
# NO-FAULTMAP-NEXT: <not found>
# WITH-FAULTMAP-NEXT: Version: 0x1
# WITH-FAULTMAP-NEXT: NumFunctions: 0
## Test that --section works with --raw-clang-ast.
# RUN: llvm-objdump %t.o --raw-clang-ast -j .llvm_faultmaps \
# RUN: | FileCheck %s --check-prefix=NO-AST --allow-empty
# RUN: llvm-objdump %t.o --raw-clang-ast -j __clangast \
# RUN: | FileCheck %s --check-prefix=CLANG-AST
# NO-AST-NOT: {{.}}
# CLANG-AST: foobar
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_X86_64
Sections:
- Name: .llvm_faultmaps
Type: SHT_PROGBITS
Content: '0100000000000000'
- Name: __clangast
Type: SHT_PROGBITS
Content: '666f6f626172' # "foobar"
## Test that the -j alias can be used flexibly. Create a baseline and ensure
## all other combinations are identical.
# RUN: llvm-objdump %t.h.elf -h -s --section .symtab > %t.full
# RUN: llvm-objdump %t.h.elf -h -s -j .symtab > %t.1
# RUN: llvm-objdump %t.h.elf -h -s -j=.symtab > %t.2
# RUN: llvm-objdump %t.h.elf -h -s -j.symtab > %t.3
# RUN: llvm-objdump %t.h.elf -hsj .symtab > %t.4
# RUN: llvm-objdump %t.h.elf -hsj=.symtab > %t.5
# RUN: llvm-objdump %t.h.elf -hsj.symtab > %t.6
# RUN: cmp %t.full %t.1
# RUN: cmp %t.full %t.2
# RUN: cmp %t.full %t.3
# RUN: cmp %t.full %t.4
# RUN: cmp %t.full %t.5
# RUN: cmp %t.full %t.6
## Test that an unknown section name causes all section output to be suppressed.
# RUN: llvm-objdump %t.h.elf -h --section foobar \
# RUN: | FileCheck %s --check-prefix=NO-SECTION
# NO-SECTION: Sections:
# NO-SECTION-NEXT: Idx Name Size VMA Type
# NO-SECTION-NOT: {{.}}