xref: /llvm-project/llvm/test/tools/obj2yaml/ELF/mips-abi-flags.yaml (revision 6d3098e7ff968ad7d3033d7751af05a1fcd2ed9b)
1## Check how obj2yaml dumps SHT_MIPS_ABIFLAGS sections.
2
3# RUN: yaml2obj %s -o %t
4# RUN: obj2yaml %t | FileCheck %s
5
6# CHECK:      Sections:
7# CHECK-NEXT:   - Name:         .MIPS.abiflags
8# CHECK-NEXT:     Type:         SHT_MIPS_ABIFLAGS
9# CHECK-NEXT:     AddressAlign: 0x8
10# CHECK-NEXT:     ISA:          MIPS64
11# CHECK-NEXT:     ISARevision:  0x5
12# CHECK-NEXT:     ISAExtension: EXT_OCTEON3
13# CHECK-NEXT:     ASEs:         [ DSP, DSPR2, VIRT ]
14# CHECK-NEXT:     FpABI:        FP_DOUBLE
15# CHECK-NEXT:     GPRSize:      REG_64
16# CHECK-NEXT:     CPR1Size:     REG_64
17# CHECK-NEXT:     Flags1:       [ ODDSPREG ]
18# CHECK-NEXT: ...
19
20--- !ELF
21FileHeader:
22  Class:   ELFCLASS64
23  Data:    ELFDATA2MSB
24  Type:    ET_REL
25  Machine: EM_MIPS
26Sections:
27  - Name:         .MIPS.abiflags
28    Type:         SHT_MIPS_ABIFLAGS
29    AddressAlign: 8
30    Version:      0
31    ISA:          MIPS64
32    ISARevision:  5
33    ISAExtension: EXT_OCTEON3
34    ASEs:         [ DSP, DSPR2, VIRT ]
35    FpABI:        FP_DOUBLE
36    GPRSize:      REG_64
37    CPR1Size:     REG_64
38    CPR2Size:     REG_NONE
39    Flags1:       [ ODDSPREG ]
40    Flags2:       0x0
41
42## Check how we dump the SHT_MIPS_ABIFLAGS (0x7000002a) section when
43## the machine type is not EM_MIPS. It is dumped as a regular
44## section of an unknown type.
45
46# RUN: yaml2obj %s --docnum=2 -DMACHINE=EM_NONE -o %t2.notmips
47# RUN: obj2yaml %t2.notmips | FileCheck %s --check-prefix=NOT-MIPS
48
49# RUN: yaml2obj %s --docnum=2 -DMACHINE=EM_MIPS -o %t2.mips
50# RUN: obj2yaml %t2.mips | FileCheck %s --check-prefix=MIPS
51
52# MIPS:      - Name: .MIPS.abiflags
53# MIPS-NEXT:   Type: SHT_MIPS_ABIFLAGS
54## We don't print the "EntSize" key, because 0x18 is the default value
55## for the sh_entsize field of SHT_MIPS_ABIFLAGS.
56# MIPS-NEXT:   ISA:  0x0
57# MIPS-NEXT: ...
58
59# NOT-MIPS:      - Name:    .MIPS.abiflags
60# NOT-MIPS-NEXT:   Type:    0x7000002A
61## We print the "EntSize" key, because 0x7000002A only means
62## "SHT_MIPS_ABIFLAGS" when machine is EM_MIPS, so 0x18 is not a known default value.
63# NOT-MIPS-NEXT:   EntSize: 0x18
64# NOT-MIPS-NEXT:   Content: '000000000000000000000000000000000000000000000000'
65# NOT-MIPS-NEXT: ...
66
67--- !ELF
68FileHeader:
69  Class:   ELFCLASS64
70  Data:    ELFDATA2MSB
71  Type:    ET_REL
72  Machine: [[MACHINE]]
73Sections:
74  - Name:    .MIPS.abiflags
75    Type:    SHT_PROGBITS
76    ShType:  0x7000002a ## SHT_MIPS_ABIFLAGS.
77    Size:    0x18
78    EntSize: [[ENTSIZE=0x18]]
79
80## Check we dump the "EntSize" key when the value of the "sh_entsize" field is not equal to 0x18.
81
82# RUN: yaml2obj %s --docnum=2 -DMACHINE=EM_MIPS -DENTSIZE=0x19 -o %t2.mips.entsize
83# RUN: obj2yaml %t2.mips.entsize | FileCheck %s --check-prefix=MIPS-ENTSIZE
84
85# MIPS-ENTSIZE:      - Name:    .MIPS.abiflags
86# MIPS-ENTSIZE-NEXT:   Type:    SHT_MIPS_ABIFLAGS
87# MIPS-ENTSIZE-NEXT:   EntSize: 0x19
88