[llvm] Allow "[[FLAGS=<none>]]" value in the ELF Fileheader Flags field (PR #143845)
James Henderson via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 8 23:53:43 PDT 2025
================
@@ -0,0 +1,48 @@
+## Test for FileHeader Flags; when FLAGS variable isn't defined, the e_flags value is 0, otherwise it's the specified value
+
+# RUN: yaml2obj %s -o %t
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=CHECK,NO-FLAG
+
+# RUN: yaml2obj %s -o %t -DFLAGS=[EF_AMDGPU_MACH_AMDGCN_GFX900]
+# RUN: llvm-readobj -h %t | FileCheck %s --check-prefixes=CHECK,FLAG
+
+!ELF
+FileHeader:
+ Class: ELFCLASS64
+ Data: ELFDATA2LSB
+ OSABI: ELFOSABI_AMDGPU_HSA
+ Type: ET_EXEC
+ Machine: EM_AMDGPU
----------------
jh7370 wrote:
I'd suggest we don't use `AMDGPU` here, because of the interactions with other fields and the extra complexities this introduces to the test that aren't necessary to demonstrate the important behaviour. Instead, I'd get rid of the `OSABI` field and pick a "simpler" machine like `EM_ARM`. You can then just pick one of the available ARM flags for the test, e.g. `EF_ARM_ABI_FLOAT_HARD`.
https://github.com/llvm/llvm-project/pull/143845
More information about the llvm-commits
mailing list