[llvm] [SPARC][Utilities] Add names for SPARC ELF flags in llvm-readobj (PR #102843)
Sergei Barannikov via llvm-commits
llvm-commits at lists.llvm.org
Sun Aug 11 20:55:18 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: ]
----------------
s-barannikov wrote:
Ah, sorry, it does use llvm-mc.
However, this is not necessary. You can construct a dummy elf in YAML,
see `llvm/test/tools/llvm-readobj/ELF/avr-elf-headers.test` for example.
https://github.com/llvm/llvm-project/pull/102843
More information about the llvm-commits
mailing list