[lld] [LLD][ELF] Add `-z execute-only-report` that checks PURECODE section flags (PR #128883)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 26 08:54:21 PST 2025


================
@@ -0,0 +1,40 @@
+// REQUIRES: aarch64
+
+// RUN: llvm-mc --triple=aarch64 --filetype=obj -o %t.o %s
+// RUN: ld.lld --defsym absolute=0xf0000000 -z execute-only-report=none --fatal-warnings %t.o -o /dev/null
+// RUN: ld.lld --defsym absolute=0xf0000000 -z execute-only-report=warning %t.o -o /dev/null 2>&1 \
----------------
MaskRay wrote:

For continuation lines, place `|` at the end of the last line.
```
rg 'RUN: ld.lld.*\\\\$'
```

---

Actually, I would use

```
rm -rf %t && mkdir %t && cd %t
llvm-mc ... a.s -o a.o
ld.lld --defsym absolute=0xf0000000 -z execute-only-report=none --fatal-warnings a.o
...
// WARNING-NOT: warning: -z execute-only-report: a.o:(.text) does not have SHF_AARCH64_PURECODE flag set
```

Can then drop `-o /dev/null` and avoid `{{.*}}.o`

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


More information about the llvm-commits mailing list