[llvm] 6227f04 - [llvm-readobj] - Add proper testing for the SHT_MIPS_ABIFLAGS section.

Georgii Rymar via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 17 05:25:10 PDT 2020


Author: Georgii Rymar
Date: 2020-07-17T15:24:39+03:00
New Revision: 6227f04a09f664a45e7fa75304c636f59a115fa9

URL: https://github.com/llvm/llvm-project/commit/6227f04a09f664a45e7fa75304c636f59a115fa9
DIFF: https://github.com/llvm/llvm-project/commit/6227f04a09f664a45e7fa75304c636f59a115fa9.diff

LOG: [llvm-readobj] - Add proper testing for the SHT_MIPS_ABIFLAGS section.

This rewrites the mips-abiflags.test to stop using recompiled objects,
adds testing for all missed bits and also adds two missing enum values
to lib/ObjectYAML, which are used in the new test.

Differential revision: https://reviews.llvm.org/D83954

Added: 
    

Modified: 
    llvm/lib/ObjectYAML/ELFYAML.cpp
    llvm/test/tools/llvm-readobj/ELF/mips-abiflags.test

Removed: 
    llvm/test/tools/llvm-readobj/ELF/Inputs/abiflags.obj.elf-mips
    llvm/test/tools/llvm-readobj/ELF/Inputs/abiflags.obj.elf-mipsel


################################################################################
diff  --git a/llvm/lib/ObjectYAML/ELFYAML.cpp b/llvm/lib/ObjectYAML/ELFYAML.cpp
index 2353b34f188b..f85d6a5d30ef 100644
--- a/llvm/lib/ObjectYAML/ELFYAML.cpp
+++ b/llvm/lib/ObjectYAML/ELFYAML.cpp
@@ -823,6 +823,8 @@ void ScalarBitSetTraits<ELFYAML::MIPS_AFL_ASE>::bitset(
   BCase(MIPS16);
   BCase(MICROMIPS);
   BCase(XPA);
+  BCase(CRC);
+  BCase(GINV);
 #undef BCase
 }
 

diff  --git a/llvm/test/tools/llvm-readobj/ELF/Inputs/abiflags.obj.elf-mips b/llvm/test/tools/llvm-readobj/ELF/Inputs/abiflags.obj.elf-mips
deleted file mode 100644
index edcd50becec4..000000000000
Binary files a/llvm/test/tools/llvm-readobj/ELF/Inputs/abiflags.obj.elf-mips and /dev/null 
diff er

diff  --git a/llvm/test/tools/llvm-readobj/ELF/Inputs/abiflags.obj.elf-mipsel b/llvm/test/tools/llvm-readobj/ELF/Inputs/abiflags.obj.elf-mipsel
deleted file mode 100644
index bb5f43d28623..000000000000
Binary files a/llvm/test/tools/llvm-readobj/ELF/Inputs/abiflags.obj.elf-mipsel and /dev/null 
diff er

diff  --git a/llvm/test/tools/llvm-readobj/ELF/mips-abiflags.test b/llvm/test/tools/llvm-readobj/ELF/mips-abiflags.test
index 54797bfa76f6..1a8affa07984 100644
--- a/llvm/test/tools/llvm-readobj/ELF/mips-abiflags.test
+++ b/llvm/test/tools/llvm-readobj/ELF/mips-abiflags.test
@@ -1,71 +1,314 @@
-RUN: llvm-readobj -A %p/Inputs/abiflags.obj.elf-mipsel | \
-RUN:   FileCheck -check-prefix=EL64 %s
-RUN: llvm-readobj -A %p/Inputs/abiflags.obj.elf-mips | \
-RUN:   FileCheck -check-prefix=BE32 %s
-
-RUN: llvm-readelf -A %p/Inputs/abiflags.obj.elf-mipsel | \
-RUN:   FileCheck -check-prefix=GNU-EL64 %s
-RUN: llvm-readelf -A %p/Inputs/abiflags.obj.elf-mips | \
-RUN:   FileCheck -check-prefix=GNU-BE32 %s
-
-EL64:      MIPS ABI Flags {
-EL64-NEXT:   Version: 0
-EL64-NEXT:   ISA: MIPS64r5
-EL64-NEXT:   ISA Extension: Cavium Networks Octeon3 (0x13)
-EL64-NEXT:   ASEs [ (0x103)
-EL64-NEXT:     DSP (0x1)
-EL64-NEXT:     DSPR2 (0x2)
-EL64-NEXT:     VZ (0x100)
-EL64-NEXT:   ]
-EL64-NEXT:   FP ABI: Hard float (double precision) (0x1)
-EL64-NEXT:   GPR size: 64
-EL64-NEXT:   CPR1 size: 64
-EL64-NEXT:   CPR2 size: 0
-EL64-NEXT:   Flags 1 [ (0x1)
-EL64-NEXT:     ODDSPREG (0x1)
-EL64-NEXT:   ]
-EL64-NEXT:   Flags 2: 0x0
-EL64-NEXT: }
-
-BE32:      MIPS ABI Flags {
-BE32-NEXT:   Version: 0
-BE32-NEXT:   ISA: MIPS32r2
-BE32-NEXT:   ISA Extension: None (0x0)
-BE32-NEXT:   ASEs [ (0x803)
-BE32-NEXT:     DSP (0x1)
-BE32-NEXT:     DSPR2 (0x2)
-BE32-NEXT:     microMIPS (0x800)
-BE32-NEXT:   ]
-BE32-NEXT:   FP ABI: Soft float (0x3)
-BE32-NEXT:   GPR size: 32
-BE32-NEXT:   CPR1 size: 0
-BE32-NEXT:   CPR2 size: 0
-BE32-NEXT:   Flags 1 [ (0x1)
-BE32-NEXT:     ODDSPREG (0x1)
-BE32-NEXT:   ]
-BE32-NEXT:   Flags 2: 0x0
-BE32-NEXT: }
-
-GNU-EL64:       MIPS ABI Flags Version: 0
-GNU-EL64-EMPTY:
-GNU-EL64-NEXT:  ISA: MIPS64r5
-GNU-EL64-NEXT:  GPR size: 64
-GNU-EL64-NEXT:  CPR1 size: 64
-GNU-EL64-NEXT:  CPR2 size: 0
-GNU-EL64-NEXT:  FP ABI: Hard float (double precision)
-GNU-EL64-NEXT:  ISA Extension: Cavium Networks Octeon3
-GNU-EL64-NEXT:  ASEs: DSP, DSPR2, VZ
-GNU-EL64-NEXT:  FLAGS 1: 00000001
-GNU-EL64-NEXT:  FLAGS 2: 00000000
-
-GNU-BE32:       MIPS ABI Flags Version: 0
-GNU-BE32-EMPTY:
-GNU-BE32-NEXT:  ISA: MIPS32r2
-GNU-BE32-NEXT:  GPR size: 32
-GNU-BE32-NEXT:  CPR1 size: 0
-GNU-BE32-NEXT:  CPR2 size: 0
-GNU-BE32-NEXT:  FP ABI: Soft float
-GNU-BE32-NEXT:  ISA Extension: None
-GNU-BE32-NEXT:  ASEs: DSP, DSPR2, microMIPS
-GNU-BE32-NEXT:  FLAGS 1: 00000001
-GNU-BE32-NEXT:  FLAGS 2: 00000000
+## Check that we are able to dump the SHT_MIPS_ABIFLAGS section using -A properly.
+
+## Show how the full output looks like, check the formatting and the output order.
+# RUN: yaml2obj %s -DBITS=32 -DENCODE=LSB -o %t.le32
+# RUN: llvm-readelf -A %t.le32 | \
+# RUN:   FileCheck %s --check-prefix=GNU --strict-whitespace --match-full-lines
+# RUN: yaml2obj %s -DBITS=32 -DENCODE=MSB -o %t.be32
+# RUN: llvm-readelf -A %t.be32 | \
+# RUN:   FileCheck %s --check-prefix=GNU --strict-whitespace --match-full-lines
+# RUN: yaml2obj %s -DBITS=64 -DENCODE=LSB -o %t.le64
+# RUN: llvm-readelf -A %t.le64 | \
+# RUN:   FileCheck %s --check-prefix=GNU --strict-whitespace --match-full-lines
+# RUN: yaml2obj %s -DBITS=64 -DENCODE=MSB -o %t.be64
+# RUN: llvm-readelf -A %t.be64 | \
+# RUN:   FileCheck %s --check-prefix=GNU --strict-whitespace --match-full-lines
+
+#       GNU:MIPS ABI Flags Version: 101
+# GNU-EMPTY:
+#  GNU-NEXT:ISA: MIPS32r102
+#  GNU-NEXT:GPR size: 32
+#  GNU-NEXT:CPR1 size: 64
+#  GNU-NEXT:CPR2 size: 128
+#  GNU-NEXT:FP ABI: Soft float
+#  GNU-NEXT:ISA Extension: Broadcom SB-1
+#  GNU-NEXT:ASEs: DSP, DSPR2
+#  GNU-NEXT:FLAGS 1: 00000001
+#  GNU-NEXT:FLAGS 2: ffffffff
+
+# RUN: llvm-readobj -A %t.le32 | FileCheck %s --check-prefix=LLVM
+# RUN: llvm-readobj -A %t.be32 | FileCheck %s --check-prefix=LLVM
+# RUN: llvm-readobj -A %t.le64 | FileCheck %s --check-prefix=LLVM
+# RUN: llvm-readobj -A %t.be64 | FileCheck %s --check-prefix=LLVM
+
+# LLVM:      MIPS ABI Flags {
+# LLVM-NEXT:   Version: 101
+# LLVM-NEXT:   ISA: MIPS32r102
+# LLVM-NEXT:   ISA Extension: Broadcom SB-1 (0xC)
+# LLVM-NEXT:   ASEs [ (0x3)
+# LLVM-NEXT:     DSP (0x1)
+# LLVM-NEXT:     DSPR2 (0x2)
+# LLVM-NEXT:   ]
+# LLVM-NEXT:   FP ABI: Soft float (0x3)
+# LLVM-NEXT:   GPR size: 32
+# LLVM-NEXT:   CPR1 size: 64
+# LLVM-NEXT:   CPR2 size: 128
+# LLVM-NEXT:   Flags 1 [ (0x1)
+# LLVM-NEXT:     ODDSPREG (0x1)
+# LLVM-NEXT:   ]
+# LLVM-NEXT:   Flags 2: 0xFFFFFFFF
+# LLVM-NEXT: }
+
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS[[BITS=64]]
+  Data:    ELFDATA2[[ENCODE=LSB]]
+  Type:    ET_REL
+  Machine: EM_MIPS
+Sections:
+## Set arbitrary default values.
+  - Name:         .MIPS.abiflags
+    Type:         SHT_MIPS_ABIFLAGS
+    Version:      [[VERSION=101]]
+    ISA:          [[ISA=MIPS32]]
+    ISARevision:  [[ISAREV=102]]
+    ISAExtension: EXT_SB1
+    ASEs:         [ [[ASES=DSP,DSPR2]] ]
+    FpABI:        [[FPABI=FP_SOFT]]
+    GPRSize:      [[GPR=REG_32]]
+    CPR1Size:     [[CPR1=REG_64]]
+    CPR2Size:     [[CPR2=REG_128]]
+    Flags1:       [ [[FLAG1=ODDSPREG]] ]
+    Flags2:       [[FLAG2=0xffffffff]]
+
+## Check that we are able to dump the version properly.
+## Document we do not report warnings for any version.
+# RUN: yaml2obj %s -DVERSION=0 -o %t.version.a
+# RUN: llvm-readelf -A %t.version.a | \
+# RUN:   FileCheck %s --check-prefix=GNU-VERSION-A --implicit-check-not=warning:
+# RUN: llvm-readobj -A %t.version.a | \
+# RUN:   FileCheck %s --check-prefix=LLVM-VERSION-A --implicit-check-not=warning:
+
+# GNU-VERSION-A: MIPS ABI Flags Version: 0
+
+# LLVM-VERSION-A:      MIPS ABI Flags {
+# LLVM-VERSION-A-NEXT:   Version: 0
+
+# RUN: yaml2obj %s -DVERSION=0xffff -o %t.version.b
+# RUN: llvm-readelf -A %t.version.b | \
+# RUN:   FileCheck %s --check-prefix=GNU-VERSION-B --implicit-check-not=warning:
+# RUN: llvm-readobj -A %t.version.b | \
+# RUN:   FileCheck %s --check-prefix=LLVM-VERSION-B --implicit-check-not=warning:
+
+# GNU-VERSION-B: MIPS ABI Flags Version: 65535
+
+# LLVM-VERSION-B:      MIPS ABI Flags {
+# LLVM-VERSION-B-NEXT:   Version: 65535
+
+## Check how we dump isa_level and isa_rev fields.
+
+# RUN: yaml2obj %s -DISAREV=1 -DISA=MIPS1 -o %t.isa1
+# RUN: llvm-readelf -A %t.isa1 | FileCheck %s --check-prefix=CHECK-ISA -DVAL=MIPS1
+# RUN: llvm-readobj -A %t.isa1 | FileCheck %s --check-prefix=CHECK-ISA -DVAL=MIPS1
+
+# CHECK-ISA: ISA: [[VAL]]{{$}}
+
+# RUN: yaml2obj %s -DISAREV=1 -DISA=MIPS2 -o %t.isa2
+# RUN: llvm-readelf -A %t.isa2 | FileCheck %s --check-prefix=CHECK-ISA -DVAL=MIPS2
+# RUN: llvm-readobj -A %t.isa2 | FileCheck %s --check-prefix=CHECK-ISA -DVAL=MIPS2
+
+# RUN: yaml2obj %s -DISAREV=1 -DISA=MIPS3 -o %t.isa3
+# RUN: llvm-readelf -A %t.isa3 | FileCheck %s --check-prefix=CHECK-ISA -DVAL=MIPS3
+# RUN: llvm-readobj -A %t.isa3 | FileCheck %s --check-prefix=CHECK-ISA -DVAL=MIPS3
+
+# RUN: yaml2obj %s -DISAREV=1 -DISA=MIPS4 -o %t.isa4
+# RUN: llvm-readelf -A %t.isa4 | FileCheck %s --check-prefix=CHECK-ISA -DVAL=MIPS4
+# RUN: llvm-readobj -A %t.isa4 | FileCheck %s --check-prefix=CHECK-ISA -DVAL=MIPS4
+
+# RUN: yaml2obj %s -DISAREV=1 -DISA=MIPS5 -o %t.isa5
+# RUN: llvm-readelf -A %t.isa5 | FileCheck %s --check-prefix=CHECK-ISA -DVAL=MIPS5
+# RUN: llvm-readobj -A %t.isa5 | FileCheck %s --check-prefix=CHECK-ISA -DVAL=MIPS5
+
+# RUN: yaml2obj %s -DISAREV=1 -DISA=MIPS32 -o %t.isa32
+# RUN: llvm-readelf -A %t.isa32 | FileCheck %s --check-prefix=CHECK-ISA -DVAL=MIPS32
+# RUN: llvm-readobj -A %t.isa32 | FileCheck %s --check-prefix=CHECK-ISA -DVAL=MIPS32
+
+# RUN: yaml2obj %s -DISAREV=1 -DISA=MIPS64 -o %t.isa64
+# RUN: llvm-readelf -A %t.isa64 | FileCheck %s --check-prefix=CHECK-ISA -DVAL=MIPS64
+# RUN: llvm-readobj -A %t.isa64 | FileCheck %s --check-prefix=CHECK-ISA -DVAL=MIPS64
+
+## Check that isa_rev is only dumped when its value > 1.
+# RUN: yaml2obj %s -DISAREV=2 -DISA=MIPS1 -o %t.isa1.r
+# RUN: llvm-readelf -A %t.isa1.r | FileCheck %s --check-prefix=CHECK-ISA -DVAL=MIPS1r2
+# RUN: llvm-readobj -A %t.isa1.r | FileCheck %s --check-prefix=CHECK-ISA -DVAL=MIPS1r2
+
+## Check how we dump the gpr_size field.
+
+# RUN: yaml2obj %s -DGPR=REG_NONE -o %t.gpr.none
+# RUN: llvm-readelf -A %t.gpr.none | FileCheck %s --check-prefix=GPRSIZE -DVAL=0
+# RUN: llvm-readobj -A %t.gpr.none | FileCheck %s --check-prefix=GPRSIZE -DVAL=0
+
+# GPRSIZE: GPR size: [[VAL]]{{$}}
+
+# RUN: yaml2obj %s -DGPR=REG_32 -o %t.gpr.32
+# RUN: llvm-readelf -A %t.gpr.32 | FileCheck %s --check-prefix=GPRSIZE -DVAL=32
+# RUN: llvm-readobj -A %t.gpr.32 | FileCheck %s --check-prefix=GPRSIZE -DVAL=32
+
+# RUN: yaml2obj %s -DGPR=REG_64 -o %t.gpr.64
+# RUN: llvm-readelf -A %t.gpr.64 | FileCheck %s --check-prefix=GPRSIZE -DVAL=64
+# RUN: llvm-readobj -A %t.gpr.64 | FileCheck %s --check-prefix=GPRSIZE -DVAL=64
+
+# RUN: yaml2obj %s -DGPR=REG_128 -o %t.gpr.128
+# RUN: llvm-readelf -A %t.gpr.128 | FileCheck %s --check-prefix=GPRSIZE -DVAL=128
+# RUN: llvm-readobj -A %t.gpr.128 | FileCheck %s --check-prefix=GPRSIZE -DVAL=128
+
+## Check how we dump the cpr1_size field.
+
+# RUN: yaml2obj %s -DCPR1=REG_NONE -o %t.cpr1.none
+# RUN: llvm-readelf -A %t.cpr1.none | FileCheck %s --check-prefix=CPR1SIZE -DVAL=0
+# RUN: llvm-readobj -A %t.cpr1.none | FileCheck %s --check-prefix=CPR1SIZE -DVAL=0
+
+# CPR1SIZE: CPR1 size: [[VAL]]{{$}}
+
+# RUN: yaml2obj %s -DCPR1=REG_32 -o %t.cpr1.32
+# RUN: llvm-readelf -A %t.cpr1.32 | FileCheck %s --check-prefix=CPR1SIZE -DVAL=32
+# RUN: llvm-readobj -A %t.cpr1.32 | FileCheck %s --check-prefix=CPR1SIZE -DVAL=32
+
+# RUN: yaml2obj %s -DCPR1=REG_64 -o %t.cpr1.64
+# RUN: llvm-readelf -A %t.cpr1.64 | FileCheck %s --check-prefix=CPR1SIZE -DVAL=64
+# RUN: llvm-readobj -A %t.cpr1.64 | FileCheck %s --check-prefix=CPR1SIZE -DVAL=64
+
+# RUN: yaml2obj %s -DCPR1=REG_128 -o %t.cpr1.128
+# RUN: llvm-readelf -A %t.cpr1.128 | FileCheck %s --check-prefix=CPR1SIZE -DVAL=128
+# RUN: llvm-readobj -A %t.cpr1.128 | FileCheck %s --check-prefix=CPR1SIZE -DVAL=128
+
+## Check how we dump the cpr2_size field.
+
+# RUN: yaml2obj %s -DCPR2=REG_NONE -o %t.cpr2.none
+# RUN: llvm-readelf -A %t.cpr2.none | FileCheck %s --check-prefix=CPR2SIZE -DVAL=0
+# RUN: llvm-readobj -A %t.cpr2.none | FileCheck %s --check-prefix=CPR2SIZE -DVAL=0
+
+# CPR2SIZE: CPR2 size: [[VAL]]{{$}}
+
+# RUN: yaml2obj %s -DCPR2=REG_32 -o %t.cpr2.32
+# RUN: llvm-readelf -A %t.cpr2.32 | FileCheck %s --check-prefix=CPR2SIZE -DVAL=32
+# RUN: llvm-readobj -A %t.cpr2.32 | FileCheck %s --check-prefix=CPR2SIZE -DVAL=32
+
+# RUN: yaml2obj %s -DCPR2=REG_64 -o %t.cpr2.64
+# RUN: llvm-readelf -A %t.cpr2.64 | FileCheck %s --check-prefix=CPR2SIZE -DVAL=64
+# RUN: llvm-readobj -A %t.cpr2.64 | FileCheck %s --check-prefix=CPR2SIZE -DVAL=64
+
+# RUN: yaml2obj %s -DCPR2=REG_128 -o %t.cpr2.128
+# RUN: llvm-readelf -A %t.cpr2.128 | FileCheck %s --check-prefix=CPR2SIZE -DVAL=128
+# RUN: llvm-readobj -A %t.cpr2.128 | FileCheck %s --check-prefix=CPR2SIZE -DVAL=128
+
+## Check how we dump the fp_abi field.
+
+# RUN: yaml2obj %s -DFPABI=FP_ANY -o %t.fpabi.any
+# RUN: llvm-readelf -A %t.fpabi.any | FileCheck %s --check-prefix=FPABI-ANY
+# RUN: llvm-readobj -A %t.fpabi.any | FileCheck %s --check-prefix=FPABI-ANY
+
+# FPABI-ANY: FP ABI: Hard or soft float
+
+# RUN: yaml2obj %s -DFPABI=FP_DOUBLE -o %t.fpabi.double
+# RUN: llvm-readelf -A %t.fpabi.double | FileCheck %s --check-prefix=FPABI-DOUBLE
+# RUN: llvm-readobj -A %t.fpabi.double | FileCheck %s --check-prefix=FPABI-DOUBLE
+
+# FPABI-DOUBLE: FP ABI: Hard float (double precision)
+
+# RUN: yaml2obj %s -DFPABI=FP_SINGLE -o %t.fpabi.single
+# RUN: llvm-readelf -A %t.fpabi.single | FileCheck %s --check-prefix=FPABI-SINGLE
+# RUN: llvm-readobj -A %t.fpabi.single | FileCheck %s --check-prefix=FPABI-SINGLE
+
+# FPABI-SINGLE: FP ABI: Hard float (single precision)
+
+# RUN: yaml2obj %s -DFPABI=FP_SOFT -o %t.fpabi.soft
+# RUN: llvm-readelf -A %t.fpabi.soft | FileCheck %s --check-prefix=FPABI-SOFT
+# RUN: llvm-readobj -A %t.fpabi.soft | FileCheck %s --check-prefix=FPABI-SOFT
+
+# FPABI-SOFT: FP ABI: Soft float
+
+# RUN: yaml2obj %s -DFPABI=FP_OLD_64 -o %t.fpabi.old64
+# RUN: llvm-readelf -A %t.fpabi.old64 | FileCheck %s --check-prefix=FPABI-OLD64
+# RUN: llvm-readobj -A %t.fpabi.old64 | FileCheck %s --check-prefix=FPABI-OLD64
+
+# FPABI-OLD64: FP ABI: Hard float (MIPS32r2 64-bit FPU 12 callee-saved)
+
+# RUN: yaml2obj %s -DFPABI=FP_XX -o %t.fpabi.xx
+# RUN: llvm-readelf -A %t.fpabi.xx | FileCheck %s --check-prefix=FPABI-XX
+# RUN: llvm-readobj -A %t.fpabi.xx | FileCheck %s --check-prefix=FPABI-XX
+
+# FPABI-XX: FP ABI: Hard float (32-bit CPU, Any FPU)
+
+# RUN: yaml2obj %s -DFPABI=FP_64 -o %t.fpabi.fp64
+# RUN: llvm-readelf -A %t.fpabi.fp64 | FileCheck %s --check-prefix=FPABI-FP64
+# RUN: llvm-readobj -A %t.fpabi.fp64 | FileCheck %s --check-prefix=FPABI-FP64
+
+# FPABI-FP64: FP ABI: Hard float (32-bit CPU, 64-bit FPU)
+
+# RUN: yaml2obj %s -DFPABI=FP_64A -o %t.fpabi.fp64a
+# RUN: llvm-readelf -A %t.fpabi.fp64a | FileCheck %s --check-prefix=FPABI-FP64A
+# RUN: llvm-readobj -A %t.fpabi.fp64a | FileCheck %s --check-prefix=FPABI-FP64A
+
+# FPABI-FP64A: FP ABI: Hard float compat (32-bit CPU, 64-bit FPU)
+
+## Check how we dump ASEs.
+# RUN: yaml2obj %s -DASES="" -o %t.ases.no
+# RUN: llvm-readelf -A %t.ases.no | FileCheck %s --check-prefix=FPABI-ASES-NONE-GNU
+# RUN: llvm-readobj -A %t.ases.no | FileCheck %s --check-prefix=FPABI-ASES-NONE-LLVM
+
+# FPABI-ASES-NONE-GNU: ASEs: None
+
+# FPABI-ASES-NONE-LLVM:      ASEs [ (0x0)
+# FPABI-ASES-NONE-LLVM-NEXT: ]
+
+# RUN: yaml2obj %s -DASES="DSP,DSPR2,EVA,MCU,MDMX,MIPS3D,MT,SMARTMIPS,VIRT,MSA,MIPS16,MICROMIPS,XPA,CRC,GINV" -o %t.ases.all
+# RUN: llvm-readelf -A %t.ases.all | FileCheck %s --check-prefix=FPABI-ASES-ALL-GNU
+# RUN: llvm-readobj -A %t.ases.all | FileCheck %s --check-prefix=FPABI-ASES-ALL-LLVM
+
+# FPABI-ASES-ALL-GNU: ASEs: DSP, DSPR2, Enhanced VA Scheme, MCU, MDMX, MIPS-3D, MT, SmartMIPS, VZ, MSA, MIPS16, microMIPS, XPA, CRC, GINV
+
+# FPABI-ASES-ALL-LLVM:      ASEs [ (0x29FFF)
+# FPABI-ASES-ALL-LLVM-NEXT:   CRC (0x8000)
+# FPABI-ASES-ALL-LLVM-NEXT:   DSP (0x1)
+# FPABI-ASES-ALL-LLVM-NEXT:   DSPR2 (0x2)
+# FPABI-ASES-ALL-LLVM-NEXT:   Enhanced VA Scheme (0x4)
+# FPABI-ASES-ALL-LLVM-NEXT:   GINV (0x20000)
+# FPABI-ASES-ALL-LLVM-NEXT:   MCU (0x8)
+# FPABI-ASES-ALL-LLVM-NEXT:   MDMX (0x10)
+# FPABI-ASES-ALL-LLVM-NEXT:   MIPS-3D (0x20)
+# FPABI-ASES-ALL-LLVM-NEXT:   MIPS16 (0x400)
+# FPABI-ASES-ALL-LLVM-NEXT:   MSA (0x200)
+# FPABI-ASES-ALL-LLVM-NEXT:   MT (0x40)
+# FPABI-ASES-ALL-LLVM-NEXT:   SmartMIPS (0x80)
+# FPABI-ASES-ALL-LLVM-NEXT:   VZ (0x100)
+# FPABI-ASES-ALL-LLVM-NEXT:   XPA (0x1000)
+# FPABI-ASES-ALL-LLVM-NEXT:   microMIPS (0x800)
+# FPABI-ASES-ALL-LLVM-NEXT: ]
+
+## Check how we dump the flags1 field.
+
+# RUN: yaml2obj %s -DFLAG1="" -o %t.flag1.empty
+# RUN: llvm-readelf -A %t.flag1.empty | FileCheck %s --check-prefix=FLAG1-EMPTY-GNU
+# RUN: llvm-readobj -A %t.flag1.empty | FileCheck %s --check-prefix=FLAG1-EMPTY-LLVM
+
+# FLAG1-EMPTY-GNU: FLAGS 1: 00000000
+
+# FLAG1-EMPTY-LLVM:      Flags 1 [ (0x0)
+# FLAG1-EMPTY-LLVM-NEXT: ]
+
+# RUN: yaml2obj %s -DFLAG1="ODDSPREG" -o %t.flag1.all
+# RUN: llvm-readelf -A %t.flag1.all | FileCheck %s --check-prefix=FLAG1-ALL-GNU
+# RUN: llvm-readobj -A %t.flag1.all | FileCheck %s --check-prefix=FLAG1-ALL-LLVM
+
+# FLAG1-ALL-GNU: FLAGS 1: 00000001
+
+# FLAG1-ALL-LLVM:      Flags 1 [ (0x1)
+# FLAG1-ALL-LLVM-NEXT:  ODDSPREG (0x1)
+# FLAG1-ALL-LLVM-NEXT: ]
+
+## Check how we dump the flags2 field.
+
+# RUN: yaml2obj %s -DFLAG2=0x0 -o %t.flag2.empty
+# RUN: llvm-readelf -A %t.flag2.empty | FileCheck %s --check-prefix=FLAG2-EMPTY-GNU
+# RUN: llvm-readobj -A %t.flag2.empty | FileCheck %s --check-prefix=FLAG2-EMPTY-LLVM
+
+# FLAG2-EMPTY-GNU:  FLAGS 2: 00000000
+# FLAG2-EMPTY-LLVM: Flags 2: 0x0
+
+# RUN: yaml2obj %s -DFLAG2=0xffffffff -o %t.flag2.all
+# RUN: llvm-readelf -A %t.flag2.all | FileCheck %s --check-prefix=FLAG2-ALL-GNU
+# RUN: llvm-readobj -A %t.flag2.all | FileCheck %s --check-prefix=FLAG2-ALL-LLVM
+
+# FLAG2-ALL-GNU:  FLAGS 2: ffffffff
+# FLAG2-ALL-LLVM: Flags 2: 0xFFFFFFF


        


More information about the llvm-commits mailing list