Skip to content

Commit d30fe62

Browse files
committed
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.
1 parent 41f3438 commit d30fe62

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

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

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# REQUIRES: x86
2+
## Test that marker relocations are ignored and undefined symbols lead to errors.
3+
4+
# RUN: rm -rf %t && split-file %s %t && cd %t
5+
# RUN: llvm-mc -filetype=obj -triple=x86_64 a.s -o a.o
6+
# RUN: llvm-mc -filetype=obj -triple=x86_64 abi.s -o abi.o
7+
# RUN: ld.lld a.o abi.o -o a
8+
# RUN: llvm-readelf -s a | FileCheck %s
9+
10+
# CHECK: 00000000002{{.*}} 0 FUNC GLOBAL DEFAULT [[#]] __gxx_personality_v0
11+
12+
# RUN: not ld.lld a.o 2>&1 | FileCheck %s --check-prefix=ERR
13+
14+
# ERR: error: undefined symbol: __gxx_personality_v0
15+
# ERR-NEXT: >>> referenced by a.o:(.eh_frame+0x12)
16+
17+
#--- a.s
18+
.cfi_startproc
19+
.cfi_personality 0, __gxx_personality_v0
20+
ret
21+
.cfi_endproc
22+
23+
.section .eh_frame,"a",@unwind
24+
.reloc ., BFD_RELOC_NONE, ignore
25+
26+
#--- abi.s
27+
.globl __gxx_personality_v0
28+
.type __gxx_personality_v0, @function
29+
__gxx_personality_v0:

0 commit comments

Comments
 (0)