[llvm] [RISCV] Emit .note.gnu.property section when Zicfiss-based shadow stack is enabled (PR #127036)

Ming-Yi Lai via llvm-commits llvm-commits at lists.llvm.org
Tue May 13 04:04:41 PDT 2025


================
@@ -0,0 +1,13 @@
+; RUN: llc --mtriple=riscv32-unknown-linux-gnu --filetype=obj -o - %s | llvm-readelf -n - | FileCheck %s
+; RUN: llc --mtriple=riscv64-unknown-linux-gnu --filetype=obj -o - %s | llvm-readelf -n - | FileCheck %s
+
+; CHECK: Properties: RISC-V feature: ZICFISS
+
+define i32 @f() "hw-shadow-stack" {
+entry:
+  ret i32 0
+}
+
+!llvm.module.flags = !{!0}
+
+!0 = !{i32 8, !"cf-protection-return", i32 1}
----------------
mylai-mtk wrote:

Hmmm, I've added some version of the section. Check if you like the version though... The `.note.gnu.property` section has an ambiguous spec about alignment, so I just picked the version which is emitted by my PR now...

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


More information about the llvm-commits mailing list