1## In this test we test how machine-specific dynamic tags are dumped.
2
3## Case 1: Test that hexagon machine-specific tags can be dumped.
4# RUN: yaml2obj --docnum=1 -o %t.hex %s
5# RUN: llvm-objdump -p %t.hex | FileCheck %s --check-prefix=HEXAGON
6
7# HEXAGON:      Dynamic Section:
8# HEXAGON-NEXT:  HEXAGON_SYMSZ 0x0000000000000010
9# HEXAGON-NEXT:  HEXAGON_VER   0x0000000000001000
10# HEXAGON-NEXT:  HEXAGON_PLT   0x0000000000001000
11
12--- !ELF
13FileHeader:
14  Class:   ELFCLASS64
15  Data:    ELFDATA2LSB
16  Type:    ET_EXEC
17  Machine: EM_HEXAGON
18Sections:
19  - Name: .dynamic
20    Type: SHT_DYNAMIC
21    Entries:
22      - Tag:   DT_HEXAGON_SYMSZ
23        Value: 0x10
24      - Tag:   DT_HEXAGON_VER
25        Value: 0x1000
26      - Tag:   DT_HEXAGON_PLT
27        Value: 0x1000
28      - Tag:   DT_NULL
29        Value: 0
30ProgramHeaders:
31  - Type:     PT_LOAD
32    FirstSec: .dynamic
33    LastSec:  .dynamic
34  - Type:     PT_DYNAMIC
35    FirstSec: .dynamic
36    LastSec:  .dynamic
37
38## Case 2: Test that MIPS machine-specific tags can be dumped.
39##         MIPS has a few long tag names. Show that we indent columns properly.
40# RUN: yaml2obj --docnum=2 -o %t.mips %s
41# RUN: llvm-objdump -p %t.mips | FileCheck %s  --strict-whitespace --match-full-lines --check-prefix=MIPS
42
43#      MIPS:Dynamic Section:
44# MIPS-NEXT:  MIPS_RLD_VERSION           0x0000000012345678
45# MIPS-NEXT:  MIPS_TIME_STAMP            0x0000000011223344
46# MIPS-NEXT:  MIPS_ICHECKSUM             0x0000000011112222
47# MIPS-NEXT:  MIPS_IVERSION              0x0000000000000001
48# MIPS-NEXT:  MIPS_FLAGS                 0x0000000011111111
49# MIPS-NEXT:  MIPS_BASE_ADDRESS          0x0000000087654321
50# MIPS-NEXT:  MIPS_MSYM                  0x0000000000001000
51# MIPS-NEXT:  MIPS_CONFLICT              0x0000000000001000
52# MIPS-NEXT:  MIPS_LIBLIST               0x0000000000001000
53# MIPS-NEXT:  MIPS_LOCAL_GOTNO           0x0000000000000001
54# MIPS-NEXT:  MIPS_CONFLICTNO            0x0000000000000001
55# MIPS-NEXT:  MIPS_LIBLISTNO             0x0000000000000001
56# MIPS-NEXT:  MIPS_SYMTABNO              0x0000000000000001
57# MIPS-NEXT:  MIPS_UNREFEXTNO            0x0000000000000000
58# MIPS-NEXT:  MIPS_GOTSYM                0x0000000000000000
59# MIPS-NEXT:  MIPS_HIPAGENO              0x0000000088776655
60# MIPS-NEXT:  MIPS_RLD_MAP               0x0000000000001000
61# MIPS-NEXT:  MIPS_DELTA_CLASS           0x0000000000001000
62# MIPS-NEXT:  MIPS_DELTA_CLASS_NO        0x0000000000000001
63# MIPS-NEXT:  MIPS_DELTA_INSTANCE        0x0000000000001000
64# MIPS-NEXT:  MIPS_DELTA_INSTANCE_NO     0x0000000000000001
65# MIPS-NEXT:  MIPS_DELTA_RELOC           0x0000000000001000
66# MIPS-NEXT:  MIPS_DELTA_RELOC_NO        0x0000000000000001
67# MIPS-NEXT:  MIPS_DELTA_SYM             0x0000000000001000
68# MIPS-NEXT:  MIPS_DELTA_SYM_NO          0x0000000000000001
69# MIPS-NEXT:  MIPS_DELTA_CLASSSYM        0x0000000000001000
70# MIPS-NEXT:  MIPS_DELTA_CLASSSYM_NO     0x0000000000000001
71# MIPS-NEXT:  MIPS_CXX_FLAGS             0x0000000088887777
72# MIPS-NEXT:  MIPS_PIXIE_INIT            0x0000000000001000
73# MIPS-NEXT:  MIPS_LOCALPAGE_GOTIDX      0x0000000000000001
74# MIPS-NEXT:  MIPS_LOCAL_GOTIDX          0x0000000000000001
75# MIPS-NEXT:  MIPS_HIDDEN_GOTIDX         0x0000000000000001
76# MIPS-NEXT:  MIPS_PROTECTED_GOTIDX      0x0000000000000001
77# MIPS-NEXT:  MIPS_OPTIONS               0x0000000000001000
78# MIPS-NEXT:  MIPS_INTERFACE             0x0000000000001000
79# MIPS-NEXT:  MIPS_DYNSTR_ALIGN          0x0000000088888888
80# MIPS-NEXT:  MIPS_INTERFACE_SIZE        0x0000000000000010
81# MIPS-NEXT:  MIPS_RLD_TEXT_RESOLVE_ADDR 0x0000000000000008
82# MIPS-NEXT:  MIPS_PERF_SUFFIX           0x0000000000000000
83# MIPS-NEXT:  MIPS_COMPACT_SIZE          0x0000000000000010
84# MIPS-NEXT:  MIPS_GP_VALUE              0x0000000000000001
85# MIPS-NEXT:  MIPS_AUX_DYNAMIC           0x0000000000001000
86# MIPS-NEXT:  MIPS_PLTGOT                0x0000000000001000
87# MIPS-NEXT:  MIPS_RWPLT                 0x0000000000001000
88# MIPS-NEXT:  MIPS_RLD_MAP_REL           0x0000000000001000
89
90--- !ELF
91FileHeader:
92  Class:   ELFCLASS64
93  Data:    ELFDATA2LSB
94  Type:    ET_EXEC
95  Machine: EM_MIPS
96Sections:
97  - Name: .dynamic
98    Type: SHT_DYNAMIC
99    Entries:
100      - Tag:   DT_MIPS_RLD_VERSION
101        Value: 0x12345678
102      - Tag:   DT_MIPS_TIME_STAMP
103        Value: 0x11223344
104      - Tag:   DT_MIPS_ICHECKSUM
105        Value: 0x11112222
106      - Tag:   DT_MIPS_IVERSION
107        Value: 0x1
108      - Tag:   DT_MIPS_FLAGS
109        Value: 0x11111111
110      - Tag:   DT_MIPS_BASE_ADDRESS
111        Value: 0x87654321
112      - Tag:   DT_MIPS_MSYM
113        Value: 0x1000
114      - Tag:   DT_MIPS_CONFLICT
115        Value: 0x1000
116      - Tag:   DT_MIPS_LIBLIST
117        Value: 0x1000
118      - Tag:   DT_MIPS_LOCAL_GOTNO
119        Value: 0x1
120      - Tag:   DT_MIPS_CONFLICTNO
121        Value: 0x1
122      - Tag:   DT_MIPS_LIBLISTNO
123        Value: 0x1
124      - Tag:   DT_MIPS_SYMTABNO
125        Value: 0x1
126      - Tag:   DT_MIPS_UNREFEXTNO
127        Value: 0x0
128      - Tag:   DT_MIPS_GOTSYM
129        Value: 0x0
130      - Tag:   DT_MIPS_HIPAGENO
131        Value: 0x88776655
132      - Tag:   DT_MIPS_RLD_MAP
133        Value: 0x1000
134      - Tag:   DT_MIPS_DELTA_CLASS
135        Value: 0x1000
136      - Tag:   DT_MIPS_DELTA_CLASS_NO
137        Value: 0x1
138      - Tag:   DT_MIPS_DELTA_INSTANCE
139        Value: 0x1000
140      - Tag:   DT_MIPS_DELTA_INSTANCE_NO
141        Value: 0x1
142      - Tag:   DT_MIPS_DELTA_RELOC
143        Value: 0x1000
144      - Tag:   DT_MIPS_DELTA_RELOC_NO
145        Value: 0x1
146      - Tag:   DT_MIPS_DELTA_SYM
147        Value: 0x1000
148      - Tag:   DT_MIPS_DELTA_SYM_NO
149        Value: 0x1
150      - Tag:   DT_MIPS_DELTA_CLASSSYM
151        Value: 0x1000
152      - Tag:   DT_MIPS_DELTA_CLASSSYM_NO
153        Value: 0x1
154      - Tag:   DT_MIPS_CXX_FLAGS
155        Value: 0x88887777
156      - Tag:   DT_MIPS_PIXIE_INIT
157        Value: 0x1000
158      - Tag:   DT_MIPS_LOCALPAGE_GOTIDX
159        Value: 0x1
160      - Tag:   DT_MIPS_LOCAL_GOTIDX
161        Value: 0x1
162      - Tag:   DT_MIPS_HIDDEN_GOTIDX
163        Value: 0x1
164      - Tag:   DT_MIPS_PROTECTED_GOTIDX
165        Value: 0x1
166      - Tag:   DT_MIPS_OPTIONS
167        Value: 0x1000
168      - Tag:   DT_MIPS_INTERFACE
169        Value: 0x1000
170      - Tag:   DT_MIPS_DYNSTR_ALIGN
171        Value: 0x88888888
172      - Tag:   DT_MIPS_INTERFACE_SIZE
173        Value: 0x10
174      - Tag:   DT_MIPS_RLD_TEXT_RESOLVE_ADDR
175        Value: 0x8
176      - Tag:   DT_MIPS_PERF_SUFFIX
177        Value: 0x0
178      - Tag:   DT_MIPS_COMPACT_SIZE
179        Value: 0x10
180      - Tag:   DT_MIPS_GP_VALUE
181        Value: 0x1
182      - Tag:   DT_MIPS_AUX_DYNAMIC
183        Value: 0x1000
184      - Tag:   DT_MIPS_PLTGOT
185        Value: 0x1000
186      - Tag:   DT_MIPS_RWPLT
187        Value: 0x1000
188      - Tag:   DT_MIPS_RLD_MAP_REL
189        Value: 0x1000
190      - Tag:   DT_NULL
191        Value: 0
192ProgramHeaders:
193  - Type:     PT_LOAD
194    FirstSec: .dynamic
195    LastSec:  .dynamic
196  - Type:     PT_DYNAMIC
197    FirstSec: .dynamic
198    LastSec:  .dynamic
199
200## Case 3: Test that PPC machine-specific tags can be dumped.
201# RUN: yaml2obj --docnum=3 -o %t.ppc %s
202# RUN: llvm-objdump -p %t.ppc | FileCheck %s --check-prefix=PPC
203
204# PPC:      Dynamic Section:
205# PPC-NEXT:  PPC_GOT 0x000200c0
206# PPC-NEXT:  PPC_OPT 0x00000001
207
208--- !ELF
209FileHeader:
210  Class:   ELFCLASS32
211  Data:    ELFDATA2MSB
212  Type:    ET_EXEC
213  Machine: EM_PPC
214Sections:
215  - Name: .dynamic
216    Type: SHT_DYNAMIC
217    Entries:
218      - Tag:   DT_PPC_GOT
219        Value: 0x200c0
220      - Tag:   DT_PPC_OPT
221        Value: 1
222      - Tag:   DT_NULL
223        Value: 0
224ProgramHeaders:
225  - Type:     PT_LOAD
226    FirstSec: .dynamic
227    LastSec:  .dynamic
228  - Type:     PT_DYNAMIC
229    FirstSec: .dynamic
230    LastSec:  .dynamic
231
232## Case 4: Test that PPC64 machine-specific tags can be dumped.
233# RUN: yaml2obj --docnum=4 -o %t.ppc64 %s
234# RUN: llvm-objdump -p %t.ppc64 | FileCheck %s --check-prefix=PPC64
235
236# PPC64:      Dynamic Section:
237# PPC64-NEXT:  PPC64_GLINK 0x0000000000001000
238
239--- !ELF
240FileHeader:
241  Class:   ELFCLASS64
242  Data:    ELFDATA2LSB
243  Type:    ET_EXEC
244  Machine: EM_PPC64
245Sections:
246  - Name: .dynamic
247    Type: SHT_DYNAMIC
248    Entries:
249      - Tag:   DT_PPC64_GLINK
250        Value: 0x1000
251      - Tag:   DT_NULL
252        Value: 0
253ProgramHeaders:
254  - Type:     PT_LOAD
255    FirstSec: .dynamic
256    LastSec:  .dynamic
257  - Type:      PT_DYNAMIC
258    FirstSec: .dynamic
259    LastSec:  .dynamic
260
261## Case 5: Test that AARCH64 machine-specific tags can be dumped.
262# RUN: yaml2obj --docnum=5 -o %t.aarch64 %s
263# RUN: llvm-objdump -p %t.aarch64 | FileCheck %s --check-prefix=AARCH64
264
265# AARCH64:      Dynamic Section:
266# AARCH64-NEXT:  AARCH64_BTI_PLT      0x0000000000000001
267# AARCH64-NEXT:  AARCH64_PAC_PLT      0x0000000000000002
268
269--- !ELF
270FileHeader:
271  Class:   ELFCLASS64
272  Data:    ELFDATA2LSB
273  Type:    ET_EXEC
274  Machine: EM_AARCH64
275Sections:
276  - Name: .dynamic
277    Type: SHT_DYNAMIC
278    Entries:
279      - Tag:   DT_AARCH64_BTI_PLT
280        Value: 1
281      - Tag:   DT_AARCH64_PAC_PLT
282        Value: 2
283      - Tag:   DT_NULL
284        Value: 0
285ProgramHeaders:
286  - Type:     PT_LOAD
287    FirstSec: .dynamic
288    LastSec:  .dynamic
289  - Type:     PT_DYNAMIC
290    FirstSec: .dynamic
291    LastSec:  .dynamic
292