[llvm] [SPARC][Utilities] Add names for SPARC ELF flags in llvm-readobj (PR #102843)
James Henderson via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 12 05:59:00 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: ]
----------------
jh7370 wrote:
As this code is target agnostic (i.e. it'll work regardless of which targets are enabled), I'd put the test in llvm-readobj ELF tests, once it's been converted to using YAML. I don't know why the RISC-V people have done what they have done, but as a regular reviewer of llvm-readobj, I'd be happy with just the test in the tool directory.
https://github.com/llvm/llvm-project/pull/102843
More information about the llvm-commits
mailing list