Recommit "rL366894: [yaml2obj] - Allow custom fields for the SHT_UNDEF sections."
[llvm-complete.git] / test / tools / llvm-readobj / elf-section-types.test
blobf65655afbcc0d1acd39fcf594a6f0af331ea6045
1 # Show that all regular section types are properly printed for both LLVM and
2 # GNU styles.
4 # RUN: yaml2obj %s -o %t-basic.o
5 # RUN: llvm-readobj --section-headers %t-basic.o | FileCheck %s --check-prefix=LLVM
6 # RUN: llvm-readelf --section-headers %t-basic.o | FileCheck %s --check-prefix=GNU
8 # LLVM: Name: (0)
9 # LLVM: Type: SHT_NULL
10 # LLVM: Name: progbits
11 # LLVM: Type: SHT_PROGBITS
12 # LLVM: Name: rela
13 # LLVM: Type: SHT_RELA
14 # LLVM: Name: hash
15 # LLVM: Type: SHT_HASH
16 # LLVM: Name: dynamic
17 # LLVM: Type: SHT_DYNAMIC
18 # LLVM: Name: note
19 # LLVM: Type: SHT_NOTE
20 # LLVM: Name: nobits
21 # LLVM: Type: SHT_NOBITS
22 # LLVM: Name: rel
23 # LLVM: Type: SHT_REL
24 # LLVM: Name: shlib
25 # LLVM: Type: SHT_SHLIB
26 # LLVM: Name: dynsym
27 # LLVM: Type: SHT_DYNSYM
28 # LLVM: Name: init_array
29 # LLVM: Type: SHT_INIT_ARRAY
30 # LLVM: Name: fini_array
31 # LLVM: Type: SHT_FINI_ARRAY
32 # LLVM: Name: preinit_array
33 # LLVM: Type: SHT_PREINIT_ARRAY
34 # LLVM: Name: group
35 # LLVM: Type: SHT_GROUP
36 # LLVM: Name: symtab_shndx
37 # LLVM: Type: SHT_SYMTAB_SHNDX
38 # LLVM: Name: relr
39 # LLVM: Type: SHT_RELR
40 # LLVM: Name: android_rel
41 # LLVM: Type: SHT_ANDROID_REL
42 # LLVM: Name: android_rela
43 # LLVM: Type: SHT_ANDROID_RELA
44 # LLVM: Name: android_relr
45 # LLVM: Type: SHT_ANDROID_RELR
46 # LLVM: Name: llvm_odrtab
47 # LLVM: Type: SHT_LLVM_ODRTAB
48 # LLVM: Name: linker_options
49 # LLVM: Type: SHT_LLVM_LINKER_OPTIONS
50 # LLVM: Name: llvm_call_graph_profile
51 # LLVM: Type: SHT_LLVM_CALL_GRAPH_PROFILE
52 # LLVM: Name: llvm_addrsig
53 # LLVM: Type: SHT_LLVM_ADDRSIG
54 # LLVM: Name: gnu_attributes
55 # LLVM: Type: SHT_GNU_ATTRIBUTES
56 # LLVM: Name: gnu_hash
57 # LLVM: Type: SHT_GNU_HASH
58 # LLVM: Name: gnu_verdef
59 # LLVM: Type: SHT_GNU_verdef
60 # LLVM: Name: gnu_verneed
61 # LLVM: Type: SHT_GNU_verneed
62 # LLVM: Name: unknown
63 # LLVM: Type: Unknown (0x1000)
64 # LLVM: Name: loos
65 # LLVM: Type: Unknown (0x60000000)
66 # LLVM: Name: fooos
67 # LLVM: Type: Unknown (0x60000F00)
68 # LLVM: Name: hios
69 # LLVM: Type: SHT_GNU_versym
70 # LLVM: Name: loproc
71 # LLVM: Type: Unknown (0x70000000)
72 # LLVM: Name: fooproc
73 # LLVM: Type: Unknown (0x70000F00)
74 # LLVM: Name: hiproc
75 # LLVM: Type: Unknown (0x7FFFFFFF)
76 # LLVM: Name: louser
77 # LLVM: Type: Unknown (0x80000000)
78 # LLVM: Name: foouser
79 # LLVM: Type: Unknown (0x80000F00)
80 # LLVM: Name: hiuser
81 # LLVM: Type: Unknown (0xFFFFFFFF)
82 # LLVM: Name: .symtab
83 # LLVM: Type: SHT_SYMTAB
84 # LLVM: Name: .strtab
85 # LLVM: Type: SHT_STRTAB
87 # GNU: [ 0]                         NULL
88 # GNU-NEXT: progbits                PROGBITS
89 # GNU-NEXT: rela                    RELA
90 # GNU-NEXT: hash                    HASH
91 # GNU-NEXT: dynamic                 DYNAMIC
92 # GNU-NEXT: note                    NOTE
93 # GNU-NEXT: nobits                  NOBITS
94 # GNU-NEXT: rel                     REL
95 # GNU-NEXT: shlib                   SHLIB
96 # GNU-NEXT: dynsym                  DYNSYM
97 # GNU-NEXT: init_array              INIT_ARRAY
98 # GNU-NEXT: fini_array              FINI_ARRAY
99 # GNU-NEXT: preinit_array           PREINIT_ARRAY
100 # GNU-NEXT: group                   GROUP
101 # GNU-NEXT: symtab_shndx            SYMTAB SECTION INDICES
102 # GNU-NEXT: relr                    RELR
103 # GNU-NEXT: android_rel             ANDROID_REL
104 # GNU-NEXT: android_rela            ANDROID_RELA
105 # GNU-NEXT: android_relr            RELR
106 # GNU-NEXT: llvm_odrtab             LLVM_ODRTAB
107 # GNU-NEXT: linker_options          LLVM_LINKER_OPTIONS
108 # GNU-NEXT: llvm_call_graph_profile LLVM_CALL_GRAPH_PROFILE
109 # GNU-NEXT: llvm_addrsig            LLVM_ADDRSIG
110 # GNU-NEXT: gnu_attributes          ATTRIBUTES
111 # GNU-NEXT: gnu_hash                GNU_HASH
112 # GNU-NEXT: gnu_verdef              VERDEF
113 # GNU-NEXT: gnu_verneed             VERNEED
114 # GNU-NEXT: unknown                 0x1000: <unknown>
115 # GNU-NEXT: loos                    LOOS+0x0
116 # GNU-NEXT: fooos                   LOOS+0xF00
117 # GNU-NEXT: hios                    VERSYM
118 # GNU-NEXT: loproc                  LOPROC+0x0
119 # GNU-NEXT: fooproc                 LOPROC+0xF00
120 # GNU-NEXT: hiproc                  LOPROC+0xFFFFFFF
121 # GNU-NEXT: louser                  LOUSER+0x0
122 # GNU-NEXT: foouser                 LOUSER+0xF00
123 # GNU-NEXT: hiuser                  LOUSER+0x7FFFFFFF
124 # GNU-NEXT: .symtab                 SYMTAB
125 # GNU-NEXT: .strtab                 STRTAB
127 --- !ELF
128 FileHeader:
129   Class:   ELFCLASS64
130   Data:    ELFDATA2LSB
131   Type:    ET_REL
132   Machine: EM_X86_64
133 Sections:
134   - Name: progbits
135     Type: SHT_PROGBITS
136   - Name: rela
137     Type: SHT_RELA
138     Info: progbits
139   - Name: hash
140     Type: SHT_HASH
141   - Name: dynamic
142     Type: SHT_DYNAMIC
143   - Name: note
144     Type: SHT_NOTE
145   - Name: nobits
146     Type: SHT_NOBITS
147   - Name: rel
148     Type: SHT_REL
149     Info: progbits
150   - Name: shlib
151     Type: SHT_SHLIB
152   - Name: dynsym
153     Type: SHT_DYNSYM
154     Link: .strtab
155   - Name: init_array
156     Type: SHT_INIT_ARRAY
157   - Name: fini_array
158     Type: SHT_FINI_ARRAY
159   - Name: preinit_array
160     Type: SHT_PREINIT_ARRAY
161   - Name: group
162     Type: SHT_GROUP
163     Info: foo
164     Members:
165         - SectionOrType: 0
166   - Name: symtab_shndx
167     Type: SHT_SYMTAB_SHNDX
168     Link: .symtab
169     EntSize: 0x4
170     Content: "0000000000000000"
171   - Name: relr
172     Type: SHT_RELR
173   - Name: android_rel
174     Type: SHT_ANDROID_REL
175   - Name: android_rela
176     Type: SHT_ANDROID_RELA
177   - Name: android_relr
178     Type: SHT_ANDROID_RELR
179   - Name: llvm_odrtab
180     Type: SHT_LLVM_ODRTAB
181   - Name: linker_options
182     Type: SHT_LLVM_LINKER_OPTIONS
183   - Name: llvm_call_graph_profile
184     Type: SHT_LLVM_CALL_GRAPH_PROFILE
185   - Name: llvm_addrsig
186     Type: SHT_LLVM_ADDRSIG
187   - Name: gnu_attributes
188     Type: SHT_GNU_ATTRIBUTES
189   - Name: gnu_hash
190     Type: SHT_GNU_HASH
191   - Name: gnu_verdef
192     Type: SHT_GNU_verdef
193     Info: 0
194     Entries:
195   - Name: gnu_verneed
196     Type: SHT_GNU_verneed
197     Info: 0
198     Dependencies:
199   - Name: unknown
200     Type: 0x1000
201   - Name: loos
202     Type: 0x60000000
203   - Name: fooos
204     Type: 0x60000F00
205   - Name: hios
206     Type: 0x6fffffff
207     Entries: []
208   - Name: loproc
209     Type: 0x70000000
210   - Name: fooproc
211     Type: 0x70000F00
212   - Name: hiproc
213     Type: 0x7fffffff
214   - Name: louser
215     Type: 0x80000000
216   - Name: foouser
217     Type: 0x80000F00
218   - Name: hiuser
219     Type: 0xffffffff
220 Symbols:
221   - Name:    foo
222     Binding: STB_GLOBAL