[lld] d30fe62 - ELF: Test .eh_frame relocation

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 28 10:15:14 PDT 2025


Author: Fangrui Song
Date: 2025-09-28T10:15:08-07:00
New Revision: d30fe62cf15960b0b0b2c15d315fe51bb718822a

URL: https://github.com/llvm/llvm-project/commit/d30fe62cf15960b0b0b2c15d315fe51bb718822a
DIFF: https://github.com/llvm/llvm-project/commit/d30fe62cf15960b0b0b2c15d315fe51bb718822a.diff

LOG: ELF: Test .eh_frame relocation

EhInputSection currently uses scanSection path, getting ignored marker
relocations and undefined symbol diagnostics for free. This might change
in the future. Add test coverage.

Added: 
    lld/test/ELF/eh-frame-relocation.s

Modified: 
    

Removed: 
    


################################################################################
diff  --git a/lld/test/ELF/eh-frame-relocation.s b/lld/test/ELF/eh-frame-relocation.s
new file mode 100644
index 0000000000000..9c1fe40dba7d3
--- /dev/null
+++ b/lld/test/ELF/eh-frame-relocation.s
@@ -0,0 +1,29 @@
+# REQUIRES: x86
+## Test that marker relocations are ignored and undefined symbols lead to errors.
+
+# RUN: rm -rf %t && split-file %s %t && cd %t
+# RUN: llvm-mc -filetype=obj -triple=x86_64 a.s -o a.o
+# RUN: llvm-mc -filetype=obj -triple=x86_64 abi.s -o abi.o
+# RUN: ld.lld a.o abi.o -o a
+# RUN: llvm-readelf -s a | FileCheck %s
+
+# CHECK: 00000000002{{.*}} 0 FUNC    GLOBAL DEFAULT [[#]] __gxx_personality_v0
+
+# RUN: not ld.lld a.o 2>&1 | FileCheck %s --check-prefix=ERR
+
+# ERR:      error: undefined symbol: __gxx_personality_v0
+# ERR-NEXT: >>> referenced by a.o:(.eh_frame+0x12)
+
+#--- a.s
+.cfi_startproc
+.cfi_personality 0, __gxx_personality_v0
+  ret
+.cfi_endproc
+
+.section .eh_frame,"a", at unwind
+.reloc ., BFD_RELOC_NONE, ignore
+
+#--- abi.s
+.globl __gxx_personality_v0
+.type __gxx_personality_v0, @function
+__gxx_personality_v0:


        


More information about the llvm-commits mailing list