Skip to content

Commit 557299c

Browse files
committed
[ELF][test] Test relocations referencing weak symbol, which is defined relative to a section discarded by /DISCARD/
1 parent 4fb49f4 commit 557299c

File tree

1 file changed

+21
-8
lines changed

1 file changed

+21
-8
lines changed
Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,36 @@
11
# REQUIRES: x86
22
## Test relocations referencing symbols defined relative to sections discarded by /DISCARD/.
33

4-
# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
5-
# RUN: echo "SECTIONS { /DISCARD/ : { *(.aaa*) } }" > %t.lds
6-
# RUN: ld.lld -T %t.lds %t.o -z undefs -o /dev/null 2>&1 | count 0
7-
# RUN: ld.lld -T %t.lds %t.o -o /dev/null 2>&1 | count 0
8-
# RUN: ld.lld -r -T %t.lds %t.o -o /dev/null 2>&1 | count 0
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 b.s -o b.o
7+
# RUN: ld.lld -T a.lds a.o b.o -z undefs -o /dev/null 2>&1 | count 0
8+
# RUN: ld.lld -T a.lds a.o b.o -o /dev/null 2>&1 | count 0
9+
# RUN: ld.lld -r -T a.lds a.o b.o -o /dev/null 2>&1 | count 0
910

11+
#--- a.s
1012
.globl _start
1113
_start:
1214

1315
.section .aaa,"a"
14-
.globl global
15-
.weak weak
16+
.globl global, weakref1
17+
.weak weak, weakref2
1618
global:
1719
weak:
20+
weakref1:
21+
weakref2:
1822
.quad 0
1923

20-
.section .zzz,"a"
24+
.section .bbb,"aw"
2125
.quad .aaa
26+
27+
#--- b.s
28+
.weak weakref1, weakref2
29+
.section .data,"aw"
2230
.quad global
2331
.quad weak
32+
.quad weakref1
33+
.quad weakref2
34+
35+
#--- a.lds
36+
SECTIONS { /DISCARD/ : { *(.aaa) } }

0 commit comments

Comments
 (0)