llvm/llvm/test/tools/obj2yaml/ELF/mips-abi-flags.yaml

## Check how obj2yaml dumps SHT_MIPS_ABIFLAGS sections.

# RUN: yaml2obj %s -o %t
# RUN: obj2yaml %t | FileCheck %s

# CHECK:      Sections:
# CHECK-NEXT:   - Name:         .MIPS.abiflags
# CHECK-NEXT:     Type:         SHT_MIPS_ABIFLAGS
# CHECK-NEXT:     AddressAlign: 0x8
# CHECK-NEXT:     ISA:          MIPS64
# CHECK-NEXT:     ISARevision:  0x5
# CHECK-NEXT:     ISAExtension: EXT_OCTEON3
# CHECK-NEXT:     ASEs:         [ DSP, DSPR2, VIRT ]
# CHECK-NEXT:     FpABI:        FP_DOUBLE
# CHECK-NEXT:     GPRSize:      REG_64
# CHECK-NEXT:     CPR1Size:     REG_64
# CHECK-NEXT:     Flags1:       [ ODDSPREG ]
# CHECK-NEXT: ...

--- !ELF
FileHeader:
  Class:   ELFCLASS64
  Data:    ELFDATA2MSB
  Type:    ET_REL
  Machine: EM_MIPS
Sections:
  - Name:         .MIPS.abiflags
    Type:         SHT_MIPS_ABIFLAGS
    AddressAlign: 8
    Version:      0
    ISA:          MIPS64
    ISARevision:  5
    ISAExtension: EXT_OCTEON3
    ASEs:         [ DSP, DSPR2, VIRT ]
    FpABI:        FP_DOUBLE
    GPRSize:      REG_64
    CPR1Size:     REG_64
    CPR2Size:     REG_NONE
    Flags1:       [ ODDSPREG ]
    Flags2:       0x0

## Check how we dump the SHT_MIPS_ABIFLAGS (0x7000002a) section when
## the machine type is not EM_MIPS. It is dumped as a regular
## section of an unknown type.

# RUN: yaml2obj %s --docnum=2 -DMACHINE=EM_NONE -o %t2.notmips
# RUN: obj2yaml %t2.notmips | FileCheck %s --check-prefix=NOT-MIPS

# RUN: yaml2obj %s --docnum=2 -DMACHINE=EM_MIPS -o %t2.mips
# RUN: obj2yaml %t2.mips | FileCheck %s --check-prefix=MIPS

# MIPS:      - Name: .MIPS.abiflags
# MIPS-NEXT:   Type: SHT_MIPS_ABIFLAGS
## We don't print the "EntSize" key, because 0x18 is the default value
## for the sh_entsize field of SHT_MIPS_ABIFLAGS.
# MIPS-NEXT:   ISA:  0x0
# MIPS-NEXT: ...

# NOT-MIPS:      - Name:    .MIPS.abiflags
# NOT-MIPS-NEXT:   Type:    0x7000002A
## We print the "EntSize" key, because 0x7000002A only means
## "SHT_MIPS_ABIFLAGS" when machine is EM_MIPS, so 0x18 is not a known default value.
# NOT-MIPS-NEXT:   EntSize: 0x18
# NOT-MIPS-NEXT:   Content: '000000000000000000000000000000000000000000000000'
# NOT-MIPS-NEXT: ...

--- !ELF
FileHeader:
  Class:   ELFCLASS64
  Data:    ELFDATA2MSB
  Type:    ET_REL
  Machine: [[MACHINE]]
Sections:
  - Name:    .MIPS.abiflags
    Type:    SHT_PROGBITS
    ShType:  0x7000002a ## SHT_MIPS_ABIFLAGS.
    Size:    0x18
    EntSize: [[ENTSIZE=0x18]]

## Check we dump the "EntSize" key when the value of the "sh_entsize" field is not equal to 0x18.

# RUN: yaml2obj %s --docnum=2 -DMACHINE=EM_MIPS -DENTSIZE=0x19 -o %t2.mips.entsize
# RUN: obj2yaml %t2.mips.entsize | FileCheck %s --check-prefix=MIPS-ENTSIZE

# MIPS-ENTSIZE:      - Name:    .MIPS.abiflags
# MIPS-ENTSIZE-NEXT:   Type:    SHT_MIPS_ABIFLAGS
# MIPS-ENTSIZE-NEXT:   EntSize: 0x19