[llvm] [SPARC][Utilities] Add names for SPARC ELF flags in LLVM binary utilities (PR #102843)
Sergei Barannikov via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 13 19:21:42 PDT 2024
================
@@ -0,0 +1,57 @@
+# RUN: yaml2obj %s -o %t -DCLASS_NAME="ELFCLASS32" -DMACHINE_NAME="EM_SPARC" -DFLAG_NAME=""
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=V8 -DFLAG_VALUE=0x0
+# RUN: llvm-readelf -a %t | FileCheck %s --check-prefix=READELF -DFLAG_VALUE=0x0
+
+# RUN: yaml2obj %s -o %t -DCLASS_NAME="ELFCLASS32" -DMACHINE_NAME="EM_SPARC32PLUS" -DFLAG_NAME="EF_SPARC_32PLUS"
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=V8PLUS-PLAIN -DFLAG_NAME=EF_SPARC_32PLUS -DFLAG_VALUE=0x100
+# RUN: llvm-readelf -a %t | FileCheck %s --check-prefix=READELF -DFLAG_VALUE=0x100
+
+# RUN: yaml2obj %s -o %t -DCLASS_NAME="ELFCLASS32" -DMACHINE_NAME="EM_SPARC32PLUS" -DFLAG_NAME="EF_SPARC_32PLUS, EF_SPARC_SUN_US1"
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=V8PLUS-US1 -DFLAG0_NAME=EF_SPARC_32PLUS -DFLAG1_NAME=EF_SPARC_SUN_US1 -DFLAG_VALUE=0x300
+# RUN: llvm-readelf -a %t | FileCheck %s --check-prefix=READELF -DFLAG_VALUE=0x300
+
+# RUN: yaml2obj %s -o %t -DCLASS_NAME="ELFCLASS64" -DMACHINE_NAME="EM_SPARCV9" -DFLAG_NAME=""
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=V9-PLAIN -DFLAG_VALUE=0x0
+# RUN: llvm-readelf -a %t | FileCheck %s --check-prefix=READELF -DFLAG_VALUE=0x0
+
+# RUN: yaml2obj %s -o %t -DCLASS_NAME="ELFCLASS64" -DMACHINE_NAME="EM_SPARCV9" -DFLAG_NAME="EF_SPARC_SUN_US1"
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=V9-US1 -DFLAG_NAME=EF_SPARC_SUN_US1 -DFLAG_VALUE=0x200
+# RUN: llvm-readelf -a %t | FileCheck %s --check-prefix=READELF -DFLAG_VALUE=0x200
+
+# RUN: yaml2obj %s -o %t -DCLASS_NAME="ELFCLASS64" -DMACHINE_NAME="EM_SPARCV9" -DFLAG_NAME="EF_SPARC_SUN_US1, EF_SPARCV9_RMO"
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=V9-US1-RMO -DFLAG0_NAME=EF_SPARCV9_RMO -DFLAG1_NAME=EF_SPARC_SUN_US1 -DFLAG_VALUE=0x202
+# RUN: llvm-readelf -a %t | FileCheck %s --check-prefix=READELF -DFLAG_VALUE=0x202
+
+--- !ELF
+FileHeader:
+ Class: [[CLASS_NAME]]
+ Data: ELFDATA2MSB
+ Type: ET_REL
+ Machine: [[MACHINE_NAME]]
+ Flags: [ [[FLAG_NAME]] ]
+
+# V8: Flags [ ([[FLAG_VALUE]])
+# V8-NEXT: ]
+
+# V8PLUS-PLAIN: Flags [ ([[FLAG_VALUE]])
+# V8PLUS-PLAIN-NEXT: [[FLAG_NAME]] ([[FLAG_VALUE]])
+# V8PLUS-PLAIN-NEXT: ]
+
+# V8PLUS-US1: Flags [ ([[FLAG_VALUE]])
+# V8PLUS-US1-NEXT: [[FLAG0_NAME]]
+# V8PLUS-US1-NEXT: [[FLAG1_NAME]]
+# V8PLUS-US1-NEXT: ]
+
+# V9-PLAIN: Flags [ ([[FLAG_VALUE]])
+# V9-PLAIN-NEXT: ]
+
+# V9-US1: Flags [ ([[FLAG_VALUE]])
+# V9-US1-NEXT: [[FLAG_NAME]]
+# V9-US1-NEXT: ]
+
+# V9-US1-RMO: Flags [ ([[FLAG_VALUE]])
+# V9-US1-RMO-NEXT: [[FLAG0_NAME]]
+# V9-US1-RMO-NEXT: [[FLAG1_NAME]]
+# V9-US1-RMO-NEXT: ]
+
+# READELF: Flags: [[FLAG_VALUE]]
----------------
s-barannikov wrote:
llvm-readelf should print flag names, too.
https://github.com/llvm/llvm-project/pull/102843
More information about the llvm-commits
mailing list