[llvm] [AArch64] Add support for SHF_AARCH64_PURECODE ELF section flag (1/3) (PR #125687)

Csanád Hajdú via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 13 01:28:20 PST 2025


================
@@ -138,3 +138,25 @@ Sections:
   - Name:  foo
     Type:  SHT_PROGBITS
     Flags: [ SHF_ARM_PURECODE ]
+
+# RUN: yaml2obj --docnum 6 %s -o %t-aarch64.o
+# RUN: llvm-readobj -S %t-aarch64.o | FileCheck --check-prefix=AARCH64-LLVM %s
+# RUN: llvm-readelf -S %t-aarch64.o | FileCheck --check-prefix=AARCH64-GNU %s
+
+# AARCH64-LLVM:      Flags [ (0x20000000)
+# AARCH64-LLVM-NEXT:   SHF_AARCH64_PURECODE (0x20000000)
+# AARCH64-LLVM-NEXT: ]
+
+# AARCH64-GNU: [Nr] Name Type     Address          Off    Size   ES Flg Lk Inf Al
+# AARCH64-GNU: [ 1] foo  PROGBITS 0000000000000000 000040 000000 00   y 0   0  0
+
+--- !ELF
----------------
Il-Capitano wrote:

This test has each architecture with all its arch-specific section flags as separate test cases. If in the future the ARM and AArch64 section flags don't match exactly (which was the case before `SHF_AARCH64_PURECODE`), this test case would have to be split into two parts anyways. I feel that it's more clear what the test file does if the ARM and AArch64 tests are separated out, and it's easier to update them in the future if new section flags are introduced. What do you think about this?

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


More information about the llvm-commits mailing list