[lld] lld: add support for NOCROSSREFS(_TO) (PR #95714)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 12 15:52:44 PDT 2024


================
@@ -0,0 +1,179 @@
+# REQUIRES: x86
+# RUN: rm -rf %t && split-file %s %t && cd %t
+
+# RUN: llvm-mc --triple=x86_64-unknown-linux -filetype=obj -o main.o main.s
+# RUN: not ld.lld main.o -o main --script script1.ld 2>&1 | FileCheck -check-prefix=ERR %s
+# ERR: {{.*}} error: main.o:(.text+0x6): prohibited cross reference from .text to in .text1
+
+#--- script1.ld
+NOCROSSREFS(.text .text1);
+SECTIONS {
+	.text  : { *(.text) }
----------------
MaskRay wrote:

I'll clean up the tests. We actually don't need `SECTIONS` since the default orphan section placement does the right thing. We need to make these sections SHF_ALLOC, though (`"a"`).

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


More information about the llvm-commits mailing list