[lld] [lld][ELF] Improve the vulnerability in Orphan Sections initialization (PR #156354)
Peter Smith via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 2 05:32:44 PDT 2025
================
@@ -0,0 +1,30 @@
+# REQUIRES: x86
+# RUN: rm -rf %t && mkdir -p %t
+# RUN: split-file %s %t && cd %t
+
+# RUN: llvm-mc -filetype=obj -triple=x86_64 foo.s -o foo.o
+
+# RUN: ld.lld -r foo.o -T script.ld -o foo_mc.o
+
+# RUN: llvm-objcopy --rename-section .text=.com.text foo_mc.o foo_mc.o
+# RUN: llvm-objcopy --rename-section .rela.text=.rela.com.text foo_mc.o foo_mc.o
+
+# RUN: ld.lld -r foo_mc.o -T script.ld -o foo_mc_after.o
+
+#--- foo.s
+ .text
+ .globl foo
+ .p2align 4
+ .type foo, at function
+foo:
+ mov $bar, %rax
+
+
----------------
smithp35 wrote:
I recommend a CHECK of the llvm-readelf --sections output to make sure lld has created the link from the relocations correctly.
I've seen some scripts been run to find tests with no FileCheck output before so it is worth putting at least one in.
https://github.com/llvm/llvm-project/pull/156354
More information about the llvm-commits
mailing list