1## Check that we are able to dump the SHT_MIPS_ABIFLAGS section using -A properly.
2
3## Show how the full output looks like, check the formatting and the output order.
4# RUN: yaml2obj %s -DBITS=32 -DENCODE=LSB -o %t.le32
5# RUN: llvm-readelf -A %t.le32 | \
6# RUN:   FileCheck %s --check-prefix=GNU --strict-whitespace --match-full-lines
7# RUN: yaml2obj %s -DBITS=32 -DENCODE=MSB -o %t.be32
8# RUN: llvm-readelf -A %t.be32 | \
9# RUN:   FileCheck %s --check-prefix=GNU --strict-whitespace --match-full-lines
10# RUN: yaml2obj %s -DBITS=64 -DENCODE=LSB -o %t.le64
11# RUN: llvm-readelf -A %t.le64 | \
12# RUN:   FileCheck %s --check-prefix=GNU --strict-whitespace --match-full-lines
13# RUN: yaml2obj %s -DBITS=64 -DENCODE=MSB -o %t.be64
14# RUN: llvm-readelf -A %t.be64 | \
15# RUN:   FileCheck %s --check-prefix=GNU --strict-whitespace --match-full-lines
16
17#       GNU:MIPS ABI Flags Version: 101
18# GNU-EMPTY:
19#  GNU-NEXT:ISA: MIPS32r102
20#  GNU-NEXT:GPR size: 32
21#  GNU-NEXT:CPR1 size: 64
22#  GNU-NEXT:CPR2 size: 128
23#  GNU-NEXT:FP ABI: Soft float
24#  GNU-NEXT:ISA Extension: Broadcom SB-1
25#  GNU-NEXT:ASEs: DSP, DSPR2
26#  GNU-NEXT:FLAGS 1: 00000001
27#  GNU-NEXT:FLAGS 2: ffffffff
28
29# RUN: llvm-readobj -A %t.le32 | FileCheck %s --check-prefix=LLVM
30# RUN: llvm-readobj -A %t.be32 | FileCheck %s --check-prefix=LLVM
31# RUN: llvm-readobj -A %t.le64 | FileCheck %s --check-prefix=LLVM
32# RUN: llvm-readobj -A %t.be64 | FileCheck %s --check-prefix=LLVM
33
34# LLVM:      MIPS ABI Flags {
35# LLVM-NEXT:   Version: 101
36# LLVM-NEXT:   ISA: MIPS32r102
37# LLVM-NEXT:   ISA Extension: Broadcom SB-1 (0xC)
38# LLVM-NEXT:   ASEs [ (0x3)
39# LLVM-NEXT:     DSP (0x1)
40# LLVM-NEXT:     DSPR2 (0x2)
41# LLVM-NEXT:   ]
42# LLVM-NEXT:   FP ABI: Soft float (0x3)
43# LLVM-NEXT:   GPR size: 32
44# LLVM-NEXT:   CPR1 size: 64
45# LLVM-NEXT:   CPR2 size: 128
46# LLVM-NEXT:   Flags 1 [ (0x1)
47# LLVM-NEXT:     ODDSPREG (0x1)
48# LLVM-NEXT:   ]
49# LLVM-NEXT:   Flags 2: 0xFFFFFFFF
50# LLVM-NEXT: }
51
52--- !ELF
53FileHeader:
54  Class:   ELFCLASS[[BITS=64]]
55  Data:    ELFDATA2[[ENCODE=LSB]]
56  Type:    ET_REL
57  Machine: EM_MIPS
58Sections:
59## Set arbitrary default values.
60  - Name:         .MIPS.abiflags
61    Type:         SHT_MIPS_ABIFLAGS
62    Version:      [[VERSION=101]]
63    ISA:          [[ISA=MIPS32]]
64    ISARevision:  [[ISAREV=102]]
65    ISAExtension: EXT_SB1
66    ASEs:         [ [[ASES=DSP,DSPR2]] ]
67    FpABI:        [[FPABI=FP_SOFT]]
68    GPRSize:      [[GPR=REG_32]]
69    CPR1Size:     [[CPR1=REG_64]]
70    CPR2Size:     [[CPR2=REG_128]]
71    Flags1:       [ [[FLAG1=ODDSPREG]] ]
72    Flags2:       [[FLAG2=0xffffffff]]
73
74## Check that we are able to dump the version properly.
75## Document we do not report warnings for any version.
76# RUN: yaml2obj %s -DVERSION=0 -o %t.version.a
77# RUN: llvm-readelf -A %t.version.a | \
78# RUN:   FileCheck %s --check-prefix=GNU-VERSION-A --implicit-check-not=warning:
79# RUN: llvm-readobj -A %t.version.a | \
80# RUN:   FileCheck %s --check-prefix=LLVM-VERSION-A --implicit-check-not=warning:
81
82# GNU-VERSION-A: MIPS ABI Flags Version: 0
83
84# LLVM-VERSION-A:      MIPS ABI Flags {
85# LLVM-VERSION-A-NEXT:   Version: 0
86
87# RUN: yaml2obj %s -DVERSION=0xffff -o %t.version.b
88# RUN: llvm-readelf -A %t.version.b | \
89# RUN:   FileCheck %s --check-prefix=GNU-VERSION-B --implicit-check-not=warning:
90# RUN: llvm-readobj -A %t.version.b | \
91# RUN:   FileCheck %s --check-prefix=LLVM-VERSION-B --implicit-check-not=warning:
92
93# GNU-VERSION-B: MIPS ABI Flags Version: 65535
94
95# LLVM-VERSION-B:      MIPS ABI Flags {
96# LLVM-VERSION-B-NEXT:   Version: 65535
97
98## Check how we dump isa_level and isa_rev fields.
99
100# RUN: yaml2obj %s -DISAREV=1 -DISA=MIPS1 -o %t.isa1
101# RUN: llvm-readelf -A %t.isa1 | FileCheck %s --check-prefix=CHECK-ISA -DVAL=MIPS1
102# RUN: llvm-readobj -A %t.isa1 | FileCheck %s --check-prefix=CHECK-ISA -DVAL=MIPS1
103
104# CHECK-ISA: ISA: [[VAL]]{{$}}
105
106# RUN: yaml2obj %s -DISAREV=1 -DISA=MIPS2 -o %t.isa2
107# RUN: llvm-readelf -A %t.isa2 | FileCheck %s --check-prefix=CHECK-ISA -DVAL=MIPS2
108# RUN: llvm-readobj -A %t.isa2 | FileCheck %s --check-prefix=CHECK-ISA -DVAL=MIPS2
109
110# RUN: yaml2obj %s -DISAREV=1 -DISA=MIPS3 -o %t.isa3
111# RUN: llvm-readelf -A %t.isa3 | FileCheck %s --check-prefix=CHECK-ISA -DVAL=MIPS3
112# RUN: llvm-readobj -A %t.isa3 | FileCheck %s --check-prefix=CHECK-ISA -DVAL=MIPS3
113
114# RUN: yaml2obj %s -DISAREV=1 -DISA=MIPS4 -o %t.isa4
115# RUN: llvm-readelf -A %t.isa4 | FileCheck %s --check-prefix=CHECK-ISA -DVAL=MIPS4
116# RUN: llvm-readobj -A %t.isa4 | FileCheck %s --check-prefix=CHECK-ISA -DVAL=MIPS4
117
118# RUN: yaml2obj %s -DISAREV=1 -DISA=MIPS5 -o %t.isa5
119# RUN: llvm-readelf -A %t.isa5 | FileCheck %s --check-prefix=CHECK-ISA -DVAL=MIPS5
120# RUN: llvm-readobj -A %t.isa5 | FileCheck %s --check-prefix=CHECK-ISA -DVAL=MIPS5
121
122# RUN: yaml2obj %s -DISAREV=1 -DISA=MIPS32 -o %t.isa32
123# RUN: llvm-readelf -A %t.isa32 | FileCheck %s --check-prefix=CHECK-ISA -DVAL=MIPS32
124# RUN: llvm-readobj -A %t.isa32 | FileCheck %s --check-prefix=CHECK-ISA -DVAL=MIPS32
125
126# RUN: yaml2obj %s -DISAREV=1 -DISA=MIPS64 -o %t.isa64
127# RUN: llvm-readelf -A %t.isa64 | FileCheck %s --check-prefix=CHECK-ISA -DVAL=MIPS64
128# RUN: llvm-readobj -A %t.isa64 | FileCheck %s --check-prefix=CHECK-ISA -DVAL=MIPS64
129
130## Check that isa_rev is only dumped when its value > 1.
131# RUN: yaml2obj %s -DISAREV=2 -DISA=MIPS1 -o %t.isa1.r
132# RUN: llvm-readelf -A %t.isa1.r | FileCheck %s --check-prefix=CHECK-ISA -DVAL=MIPS1r2
133# RUN: llvm-readobj -A %t.isa1.r | FileCheck %s --check-prefix=CHECK-ISA -DVAL=MIPS1r2
134
135## Check how we dump the gpr_size field.
136
137# RUN: yaml2obj %s -DGPR=REG_NONE -o %t.gpr.none
138# RUN: llvm-readelf -A %t.gpr.none | FileCheck %s --check-prefix=GPRSIZE -DVAL=0
139# RUN: llvm-readobj -A %t.gpr.none | FileCheck %s --check-prefix=GPRSIZE -DVAL=0
140
141# GPRSIZE: GPR size: [[VAL]]{{$}}
142
143# RUN: yaml2obj %s -DGPR=REG_32 -o %t.gpr.32
144# RUN: llvm-readelf -A %t.gpr.32 | FileCheck %s --check-prefix=GPRSIZE -DVAL=32
145# RUN: llvm-readobj -A %t.gpr.32 | FileCheck %s --check-prefix=GPRSIZE -DVAL=32
146
147# RUN: yaml2obj %s -DGPR=REG_64 -o %t.gpr.64
148# RUN: llvm-readelf -A %t.gpr.64 | FileCheck %s --check-prefix=GPRSIZE -DVAL=64
149# RUN: llvm-readobj -A %t.gpr.64 | FileCheck %s --check-prefix=GPRSIZE -DVAL=64
150
151# RUN: yaml2obj %s -DGPR=REG_128 -o %t.gpr.128
152# RUN: llvm-readelf -A %t.gpr.128 | FileCheck %s --check-prefix=GPRSIZE -DVAL=128
153# RUN: llvm-readobj -A %t.gpr.128 | FileCheck %s --check-prefix=GPRSIZE -DVAL=128
154
155## Check how we dump the cpr1_size field.
156
157# RUN: yaml2obj %s -DCPR1=REG_NONE -o %t.cpr1.none
158# RUN: llvm-readelf -A %t.cpr1.none | FileCheck %s --check-prefix=CPR1SIZE -DVAL=0
159# RUN: llvm-readobj -A %t.cpr1.none | FileCheck %s --check-prefix=CPR1SIZE -DVAL=0
160
161# CPR1SIZE: CPR1 size: [[VAL]]{{$}}
162
163# RUN: yaml2obj %s -DCPR1=REG_32 -o %t.cpr1.32
164# RUN: llvm-readelf -A %t.cpr1.32 | FileCheck %s --check-prefix=CPR1SIZE -DVAL=32
165# RUN: llvm-readobj -A %t.cpr1.32 | FileCheck %s --check-prefix=CPR1SIZE -DVAL=32
166
167# RUN: yaml2obj %s -DCPR1=REG_64 -o %t.cpr1.64
168# RUN: llvm-readelf -A %t.cpr1.64 | FileCheck %s --check-prefix=CPR1SIZE -DVAL=64
169# RUN: llvm-readobj -A %t.cpr1.64 | FileCheck %s --check-prefix=CPR1SIZE -DVAL=64
170
171# RUN: yaml2obj %s -DCPR1=REG_128 -o %t.cpr1.128
172# RUN: llvm-readelf -A %t.cpr1.128 | FileCheck %s --check-prefix=CPR1SIZE -DVAL=128
173# RUN: llvm-readobj -A %t.cpr1.128 | FileCheck %s --check-prefix=CPR1SIZE -DVAL=128
174
175## Check how we dump the cpr2_size field.
176
177# RUN: yaml2obj %s -DCPR2=REG_NONE -o %t.cpr2.none
178# RUN: llvm-readelf -A %t.cpr2.none | FileCheck %s --check-prefix=CPR2SIZE -DVAL=0
179# RUN: llvm-readobj -A %t.cpr2.none | FileCheck %s --check-prefix=CPR2SIZE -DVAL=0
180
181# CPR2SIZE: CPR2 size: [[VAL]]{{$}}
182
183# RUN: yaml2obj %s -DCPR2=REG_32 -o %t.cpr2.32
184# RUN: llvm-readelf -A %t.cpr2.32 | FileCheck %s --check-prefix=CPR2SIZE -DVAL=32
185# RUN: llvm-readobj -A %t.cpr2.32 | FileCheck %s --check-prefix=CPR2SIZE -DVAL=32
186
187# RUN: yaml2obj %s -DCPR2=REG_64 -o %t.cpr2.64
188# RUN: llvm-readelf -A %t.cpr2.64 | FileCheck %s --check-prefix=CPR2SIZE -DVAL=64
189# RUN: llvm-readobj -A %t.cpr2.64 | FileCheck %s --check-prefix=CPR2SIZE -DVAL=64
190
191# RUN: yaml2obj %s -DCPR2=REG_128 -o %t.cpr2.128
192# RUN: llvm-readelf -A %t.cpr2.128 | FileCheck %s --check-prefix=CPR2SIZE -DVAL=128
193# RUN: llvm-readobj -A %t.cpr2.128 | FileCheck %s --check-prefix=CPR2SIZE -DVAL=128
194
195## Check how we dump the fp_abi field.
196
197# RUN: yaml2obj %s -DFPABI=FP_ANY -o %t.fpabi.any
198# RUN: llvm-readelf -A %t.fpabi.any | FileCheck %s --check-prefix=FPABI-ANY
199# RUN: llvm-readobj -A %t.fpabi.any | FileCheck %s --check-prefix=FPABI-ANY
200
201# FPABI-ANY: FP ABI: Hard or soft float
202
203# RUN: yaml2obj %s -DFPABI=FP_DOUBLE -o %t.fpabi.double
204# RUN: llvm-readelf -A %t.fpabi.double | FileCheck %s --check-prefix=FPABI-DOUBLE
205# RUN: llvm-readobj -A %t.fpabi.double | FileCheck %s --check-prefix=FPABI-DOUBLE
206
207# FPABI-DOUBLE: FP ABI: Hard float (double precision)
208
209# RUN: yaml2obj %s -DFPABI=FP_SINGLE -o %t.fpabi.single
210# RUN: llvm-readelf -A %t.fpabi.single | FileCheck %s --check-prefix=FPABI-SINGLE
211# RUN: llvm-readobj -A %t.fpabi.single | FileCheck %s --check-prefix=FPABI-SINGLE
212
213# FPABI-SINGLE: FP ABI: Hard float (single precision)
214
215# RUN: yaml2obj %s -DFPABI=FP_SOFT -o %t.fpabi.soft
216# RUN: llvm-readelf -A %t.fpabi.soft | FileCheck %s --check-prefix=FPABI-SOFT
217# RUN: llvm-readobj -A %t.fpabi.soft | FileCheck %s --check-prefix=FPABI-SOFT
218
219# FPABI-SOFT: FP ABI: Soft float
220
221# RUN: yaml2obj %s -DFPABI=FP_OLD_64 -o %t.fpabi.old64
222# RUN: llvm-readelf -A %t.fpabi.old64 | FileCheck %s --check-prefix=FPABI-OLD64
223# RUN: llvm-readobj -A %t.fpabi.old64 | FileCheck %s --check-prefix=FPABI-OLD64
224
225# FPABI-OLD64: FP ABI: Hard float (MIPS32r2 64-bit FPU 12 callee-saved)
226
227# RUN: yaml2obj %s -DFPABI=FP_XX -o %t.fpabi.xx
228# RUN: llvm-readelf -A %t.fpabi.xx | FileCheck %s --check-prefix=FPABI-XX
229# RUN: llvm-readobj -A %t.fpabi.xx | FileCheck %s --check-prefix=FPABI-XX
230
231# FPABI-XX: FP ABI: Hard float (32-bit CPU, Any FPU)
232
233# RUN: yaml2obj %s -DFPABI=FP_64 -o %t.fpabi.fp64
234# RUN: llvm-readelf -A %t.fpabi.fp64 | FileCheck %s --check-prefix=FPABI-FP64
235# RUN: llvm-readobj -A %t.fpabi.fp64 | FileCheck %s --check-prefix=FPABI-FP64
236
237# FPABI-FP64: FP ABI: Hard float (32-bit CPU, 64-bit FPU)
238
239# RUN: yaml2obj %s -DFPABI=FP_64A -o %t.fpabi.fp64a
240# RUN: llvm-readelf -A %t.fpabi.fp64a | FileCheck %s --check-prefix=FPABI-FP64A
241# RUN: llvm-readobj -A %t.fpabi.fp64a | FileCheck %s --check-prefix=FPABI-FP64A
242
243# FPABI-FP64A: FP ABI: Hard float compat (32-bit CPU, 64-bit FPU)
244
245## Check how we dump ASEs.
246# RUN: yaml2obj %s -DASES="" -o %t.ases.no
247# RUN: llvm-readelf -A %t.ases.no | FileCheck %s --check-prefix=FPABI-ASES-NONE-GNU
248# RUN: llvm-readobj -A %t.ases.no | FileCheck %s --check-prefix=FPABI-ASES-NONE-LLVM
249
250# FPABI-ASES-NONE-GNU: ASEs: None
251
252# FPABI-ASES-NONE-LLVM:      ASEs [ (0x0)
253# FPABI-ASES-NONE-LLVM-NEXT: ]
254
255# RUN: yaml2obj %s -DASES="DSP,DSPR2,EVA,MCU,MDMX,MIPS3D,MT,SMARTMIPS,VIRT,MSA,MIPS16,MICROMIPS,XPA,CRC,GINV" -o %t.ases.all
256# RUN: llvm-readelf -A %t.ases.all | FileCheck %s --check-prefix=FPABI-ASES-ALL-GNU
257# RUN: llvm-readobj -A %t.ases.all | FileCheck %s --check-prefix=FPABI-ASES-ALL-LLVM
258
259# FPABI-ASES-ALL-GNU: ASEs: DSP, DSPR2, Enhanced VA Scheme, MCU, MDMX, MIPS-3D, MT, SmartMIPS, VZ, MSA, MIPS16, microMIPS, XPA, CRC, GINV
260
261# FPABI-ASES-ALL-LLVM:      ASEs [ (0x29FFF)
262# FPABI-ASES-ALL-LLVM-NEXT:   CRC (0x8000)
263# FPABI-ASES-ALL-LLVM-NEXT:   DSP (0x1)
264# FPABI-ASES-ALL-LLVM-NEXT:   DSPR2 (0x2)
265# FPABI-ASES-ALL-LLVM-NEXT:   Enhanced VA Scheme (0x4)
266# FPABI-ASES-ALL-LLVM-NEXT:   GINV (0x20000)
267# FPABI-ASES-ALL-LLVM-NEXT:   MCU (0x8)
268# FPABI-ASES-ALL-LLVM-NEXT:   MDMX (0x10)
269# FPABI-ASES-ALL-LLVM-NEXT:   MIPS-3D (0x20)
270# FPABI-ASES-ALL-LLVM-NEXT:   MIPS16 (0x400)
271# FPABI-ASES-ALL-LLVM-NEXT:   MSA (0x200)
272# FPABI-ASES-ALL-LLVM-NEXT:   MT (0x40)
273# FPABI-ASES-ALL-LLVM-NEXT:   SmartMIPS (0x80)
274# FPABI-ASES-ALL-LLVM-NEXT:   VZ (0x100)
275# FPABI-ASES-ALL-LLVM-NEXT:   XPA (0x1000)
276# FPABI-ASES-ALL-LLVM-NEXT:   microMIPS (0x800)
277# FPABI-ASES-ALL-LLVM-NEXT: ]
278
279## Check how we dump the flags1 field.
280
281# RUN: yaml2obj %s -DFLAG1="" -o %t.flag1.empty
282# RUN: llvm-readelf -A %t.flag1.empty | FileCheck %s --check-prefix=FLAG1-EMPTY-GNU
283# RUN: llvm-readobj -A %t.flag1.empty | FileCheck %s --check-prefix=FLAG1-EMPTY-LLVM
284
285# FLAG1-EMPTY-GNU: FLAGS 1: 00000000
286
287# FLAG1-EMPTY-LLVM:      Flags 1 [ (0x0)
288# FLAG1-EMPTY-LLVM-NEXT: ]
289
290# RUN: yaml2obj %s -DFLAG1="ODDSPREG" -o %t.flag1.all
291# RUN: llvm-readelf -A %t.flag1.all | FileCheck %s --check-prefix=FLAG1-ALL-GNU
292# RUN: llvm-readobj -A %t.flag1.all | FileCheck %s --check-prefix=FLAG1-ALL-LLVM
293
294# FLAG1-ALL-GNU: FLAGS 1: 00000001
295
296# FLAG1-ALL-LLVM:      Flags 1 [ (0x1)
297# FLAG1-ALL-LLVM-NEXT:  ODDSPREG (0x1)
298# FLAG1-ALL-LLVM-NEXT: ]
299
300## Check how we dump the flags2 field.
301
302# RUN: yaml2obj %s -DFLAG2=0x0 -o %t.flag2.empty
303# RUN: llvm-readelf -A %t.flag2.empty | FileCheck %s --check-prefix=FLAG2-EMPTY-GNU
304# RUN: llvm-readobj -A %t.flag2.empty | FileCheck %s --check-prefix=FLAG2-EMPTY-LLVM
305
306# FLAG2-EMPTY-GNU:  FLAGS 2: 00000000
307# FLAG2-EMPTY-LLVM: Flags 2: 0x0
308
309# RUN: yaml2obj %s -DFLAG2=0xffffffff -o %t.flag2.all
310# RUN: llvm-readelf -A %t.flag2.all | FileCheck %s --check-prefix=FLAG2-ALL-GNU
311# RUN: llvm-readobj -A %t.flag2.all | FileCheck %s --check-prefix=FLAG2-ALL-LLVM
312
313# FLAG2-ALL-GNU:  FLAGS 2: ffffffff
314# FLAG2-ALL-LLVM: Flags 2: 0xFFFFFFF
315
316## Check what we print when there is no .MIPS.abiflags section in the file.
317# RUN: yaml2obj --docnum=2 %s -o %t.nosection
318## Note: GNU readelf 2.31.1 prints nothing.
319# RUN: llvm-readelf -A %t.nosection 2>&1 | \
320# RUN:   FileCheck %s --check-prefix=NOSEC --implicit-check-not={{.}}
321# RUN: llvm-readobj -A %t.nosection 2>&1 | \
322# RUN:   FileCheck %s --check-prefixes=NOSEC,NOSEC-LLVM --implicit-check-not=warning:
323
324# NOSEC-LLVM: There is no .MIPS.abiflags section in the file.
325# NOSEC:      There is no .MIPS.options section in the file.
326# NOSEC-NEXT: There is no .reginfo section in the file.
327
328--- !ELF
329FileHeader:
330  Class:   ELFCLASS64
331  Data:    ELFDATA2LSB
332  Type:    ET_REL
333  Machine: EM_MIPS
334Sections: []
335
336## Check we report a warning when we are unable to read the content of the .MIPS.abiflags section.
337# RUN: yaml2obj --docnum=3 -DSHOFFSET=0xffffffff %s -o %t.err1
338# RUN: llvm-readelf -A %t.err1 2>&1 | FileCheck %s -DFILE=%t.err1 --check-prefix=CONTENT-ERR
339# RUN: llvm-readobj -A %t.err1 2>&1 | FileCheck %s -DFILE=%t.err1 --check-prefix=CONTENT-ERR
340
341# CONTENT-ERR:      warning: '[[FILE]]': unable to read the .MIPS.abiflags section: section [index 2] has a sh_offset (0xffffffff) + sh_size (0x18) that is greater than the file size (0x2c0)
342# CONTENT-ERR-NEXT: There is no .MIPS.options section in the file.
343# CONTENT-ERR-NEXT: There is no .reginfo section in the file.
344
345--- !ELF
346FileHeader:
347  Class:   ELFCLASS64
348  Data:    ELFDATA2LSB
349  Type:    ET_REL
350  Machine: EM_MIPS
351Sections:
352  - Type:   SHT_PROGBITS
353    ShName: [[NAME=<none>]]
354  - Name:     .MIPS.abiflags
355    Type:     SHT_MIPS_ABIFLAGS
356    ISA:      MIPS32
357    Offset:   0x100
358    ShOffset: [[SHOFFSET=0x100]]
359    ShSize:   [[SHSIZE=24]]
360    ShName: [[ABIFLAGSNAME=<none>]]
361  - Type:   SHT_PROGBITS
362    ShName: [[NAME=<none>]]
363
364## Check we report a warning when the .MIPS.abiflags section has an unexpected size.
365# RUN: yaml2obj --docnum=3 -DSHSIZE=23 %s -o %t.err2
366# RUN: llvm-readelf -A %t.err2 2>&1 | FileCheck %s -DFILE=%t.err2 --check-prefix=SIZE-ERR
367# RUN: llvm-readobj -A %t.err2 2>&1 | FileCheck %s -DFILE=%t.err2 --check-prefix=SIZE-ERR
368
369# SIZE-ERR:      warning: '[[FILE]]': unable to read the .MIPS.abiflags section: it has a wrong size (23)
370# SIZE-ERR-NEXT: There is no .MIPS.options section in the file.
371# SIZE-ERR-NEXT: There is no .reginfo section in the file.
372
373## Check that we try to dump the .MIPS.abiflags section when we are able to locate it by name.
374# RUN: yaml2obj --docnum=3 -DNAME=0xffff %s -o %t.err3
375# RUN: llvm-readelf -A %t.err3 2>&1 | \
376# RUN:   FileCheck %s -DFILE=%t.err3 --check-prefixes=NAME-ERR-FOUND,NAME-ERR-FOUND-GNU --implicit-check-not=warning:
377# RUN: llvm-readobj -A %t.err3 2>&1 | \
378# RUN:   FileCheck %s -DFILE=%t.err3 --check-prefixes=NAME-ERR-FOUND,NAME-ERR-FOUND-LLVM --implicit-check-not=warning:
379
380# NAME-ERR-FOUND:           warning: '[[FILE]]': unable to read the name of SHT_PROGBITS section with index 1: a section [index 1] has an invalid sh_name (0xffff) offset which goes past the end of the section name string table
381# NAME-ERR-FOUND-GNU-NEXT:  MIPS ABI Flags Version: 0
382# NAME-ERR-FOUND-LLVM-NEXT: MIPS ABI Flags {
383# NAME-ERR-FOUND:           warning: '[[FILE]]': unable to read the name of SHT_PROGBITS section with index 3: a section [index 3] has an invalid sh_name (0xffff) offset which goes past the end of the section name string table
384
385## Check we report a warning when we are unable to find the .MIPS.abiflags section due to an error.
386# RUN: yaml2obj --docnum=3 -DABIFLAGSNAME=0xffff %s -o %t.err4
387# RUN: llvm-readelf -A %t.err4 2>&1 | \
388# RUN:   FileCheck %s -DFILE=%t.err4 --check-prefix=NAME-ERR-NOTFOUND --implicit-check-not=warning: --implicit-check-not="MIPS ABI Flags"
389# RUN: llvm-readobj -A %t.err4 2>&1 | \
390# RUN:   FileCheck %s -DFILE=%t.err4 --check-prefix=NAME-ERR-NOTFOUND --implicit-check-not=warning: --implicit-check-not="MIPS ABI Flags"
391
392# NAME-ERR-NOTFOUND: warning: '[[FILE]]': unable to read the name of SHT_MIPS_ABIFLAGS section with index 2: a section [index 2] has an invalid sh_name (0xffff) offset which goes past the end of the section name string table
393