1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
| ## 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: {{.}}
|