## Test how yaml2obj creates SHT_MIPS_ABIFLAGS sections.

# RUN: yaml2obj %s -o %t
# RUN: llvm-readobj -A %t | FileCheck %s

# CHECK:      MIPS ABI Flags {
# CHECK-NEXT:   Version: 0
# CHECK-NEXT:   ISA: MIPS64r5
# CHECK-NEXT:   ISA Extension: Cavium Networks Octeon3 (0x13)
# CHECK-NEXT:   ASEs [ (0x103)
# CHECK-NEXT:     DSP (0x1)
# CHECK-NEXT:     DSPR2 (0x2)
# CHECK-NEXT:     VZ (0x100)
# CHECK-NEXT:   ]
# CHECK-NEXT:   FP ABI: Hard float (double precision) (0x1)
# CHECK-NEXT:   GPR size: 64
# CHECK-NEXT:   CPR1 size: 64
# CHECK-NEXT:   CPR2 size: 0
# CHECK-NEXT:   Flags 1 [ (0x1)
# CHECK-NEXT:     ODDSPREG (0x1)
# CHECK-NEXT:   ]
# CHECK-NEXT:   Flags 2: 0x0
# CHECK-NEXT: }

--- !ELF
FileHeader:
  Class:   ELFCLASS64
  Data:    ELFDATA2MSB
  Type:    ET_REL
  Machine: [[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
    Content:     [[CONTENT=<none>]]
    Size:        [[SIZE=<none>]]

## Check we don't recognize the SHT_MIPS_ABIFLAGS section for non-MIPS targets.

# RUN: not yaml2obj %s -DMACHINE=EM_NONE 2>&1 | FileCheck %s --check-prefix=ERR

# ERR:      error: invalid hex32 number
# ERR-NEXT: Type: SHT_MIPS_ABIFLAGS

## Document we don't support the "Content" key yet.

# RUN: not yaml2obj %s -DCONTENT="'00'" 2>&1 | FileCheck %s --check-prefix=ERR-CONTENT

# ERR-CONTENT: error: "Content" key is not implemented for SHT_MIPS_ABIFLAGS section

## Document we don't support the "Size" key yet.

# RUN: not yaml2obj %s -DSIZE=0 2>&1 | FileCheck %s --check-prefix=ERR-SIZE

# ERR-SIZE: error: "Size" key is not implemented for SHT_MIPS_ABIFLAGS section
