Skip to content

Commit 0996cee

Browse files
committed
[ELF][test] Improve relocatable link & /DISCARD/ test
Check that #69295 will fix symbols referenced by relocations that are defined in discarded sections.
1 parent 389958a commit 0996cee

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

lld/test/ELF/linkerscript/discard-section.s

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,27 @@
66
# RUN: llvm-mc -filetype=obj -triple=x86_64 b.s -o b.o
77
# RUN: ld.lld -T a.lds a.o b.o -z undefs -o /dev/null 2>&1 | count 0
88
# 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
9+
# RUN: ld.lld -r -T a.lds a.o b.o -o a.ro 2>&1 | count 0
10+
# RUN: llvm-readelf -r -s a.ro | FileCheck %s --check-prefix=RELOC
11+
12+
# RELOC: Relocation section '.rela.bbb' at offset {{.*}} contains 1 entries:
13+
# RELOC-NEXT: Offset Info Type Symbol's Value Symbol's Name + Addend
14+
# RELOC-NEXT: 0000000000000000 0000000000000000 R_X86_64_NONE 0
15+
# RELOC-EMPTY:
16+
# RELOC-NEXT: Relocation section '.rela.data' at offset {{.*}} contains 4 entries:
17+
# RELOC-NEXT: Offset Info Type Symbol's Value Symbol's Name + Addend
18+
# RELOC-NEXT: 0000000000000000 0000000000000001 R_X86_64_64 0
19+
# RELOC-NEXT: 0000000000000008 0000000000000001 R_X86_64_64 0
20+
# RELOC-NEXT: 0000000000000010 0000000000000001 R_X86_64_64 0
21+
# RELOC-NEXT: 0000000000000018 0000000000000001 R_X86_64_64 0
22+
23+
# RELOC: Num: Value Size Type Bind Vis Ndx Name
24+
# RELOC-NEXT: 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
25+
# RELOC-NEXT: 1: 0000000000000000 0 SECTION LOCAL DEFAULT 1 .text
26+
# RELOC-NEXT: 2: 0000000000000000 0 SECTION LOCAL DEFAULT 2 .bbb
27+
# RELOC-NEXT: 3: 0000000000000000 0 SECTION LOCAL DEFAULT 4 .data
28+
# RELOC-NEXT: 4: 0000000000000000 0 NOTYPE GLOBAL DEFAULT 1 _start
29+
# RELOC-EMPTY:
1030

1131
#--- a.s
1232
.globl _start

0 commit comments

Comments
 (0)