[lld] [lld][ELF] Fix crash when relaxation pass encounters synthetic sections (PR #184758)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 6 00:21:54 PST 2026


================
@@ -0,0 +1,37 @@
+# REQUIRES: loongarch
+# RUN: rm -rf %t && split-file %s %t
+# RUN: llvm-mc --filetype=obj -triple=loongarch64 -mattr=+relax %t/a.s -o %t/a.o
+
+## Do not crash when we encounter a synthetic section (like .got) that has
+## been placed inside an executable output section via a linker script.
+## Synthetic sections do not have relaxAux data structures initialized.
+
+# RUN: ld.lld -T %t/a.ld %t/a.o -o %t/nopie
----------------
MaskRay wrote:

No need to have both -no-pie and -pie. Just use -pie, which gives us dynamic sections. select on and add it to the .text output section to show that we correctly handle synthetic sections without relocations. but omit its hex dump in the check prefix.

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


More information about the llvm-commits mailing list