[llvm] [SPARC][Utilities] Add names for SPARC ELF flags in llvm-readobj (PR #102843)

via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 12 04:43:54 PDT 2024


================
@@ -0,0 +1,20 @@
+## Emit correct flags depending on triple, cpu, and memory model options.
+## - `-triple sparc` sets the flag field to 0x0
+## - `-triple sparc -mattr=+v8plus` adds an EF_SPARC_32PLUS (0x100)
+## - Currently, for sparc64 we always compile for TSO memory model, so
+##   `-triple sparcv9` sets the memory model flag to EF_SPARCV9_TSO (0x0)
+##   (i.e the last two bits have to be a zero).
+
+# RUN: llvm-mc -filetype=obj -triple sparc                  %s -o - | llvm-readobj -h - | FileCheck --check-prefixes=SPARC       %s
+# RUN: llvm-mc -filetype=obj -triple sparc   -mattr=+v8plus %s -o - | llvm-readobj -h - | FileCheck --check-prefixes=SPARC32PLUS %s
+# RUN: llvm-mc -filetype=obj -triple sparcv9                %s -o - | llvm-readobj -h - | FileCheck --check-prefixes=SPARCV9     %s
+
+# SPARC:      Flags [ (0x0)
+# SPARC-NEXT: ]
+
+# SPARC32PLUS:      Flags [ (0x100)
+# SPARC32PLUS-NEXT:   EF_SPARC_32PLUS (0x100)
+# SPARC32PLUS-NEXT: ]
+
+# SPARCV9:      Flags [ (0x0)
+# SPARCV9-NEXT: ]
----------------
koachan wrote:

Hmm, seems like we don't have suport yet for yaml2obj... I'll make another PR for it then (?)
Also, should I keep the test in MC? Asking because some backends like RISC-V seem to have tests in there too in addition in the llvm-readobj tests.

https://github.com/llvm/llvm-project/pull/102843


More information about the llvm-commits mailing list