Skip to content

Commit

Permalink
[ELF][test] Improve relocatable link & /DISCARD/ test
Browse files Browse the repository at this point in the history
Check that llvm#69295 will fix symbols referenced by relocations that are
defined in discarded sections.
  • Loading branch information
MaskRay committed Oct 17, 2023
1 parent 389958a commit 0996cee
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion lld/test/ELF/linkerscript/discard-section.s
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,27 @@
# RUN: llvm-mc -filetype=obj -triple=x86_64 b.s -o b.o
# RUN: ld.lld -T a.lds a.o b.o -z undefs -o /dev/null 2>&1 | count 0
# RUN: ld.lld -T a.lds a.o b.o -o /dev/null 2>&1 | count 0
# RUN: ld.lld -r -T a.lds a.o b.o -o /dev/null 2>&1 | count 0
# RUN: ld.lld -r -T a.lds a.o b.o -o a.ro 2>&1 | count 0
# RUN: llvm-readelf -r -s a.ro | FileCheck %s --check-prefix=RELOC

# RELOC: Relocation section '.rela.bbb' at offset {{.*}} contains 1 entries:
# RELOC-NEXT: Offset Info Type Symbol's Value Symbol's Name + Addend
# RELOC-NEXT: 0000000000000000 0000000000000000 R_X86_64_NONE 0
# RELOC-EMPTY:
# RELOC-NEXT: Relocation section '.rela.data' at offset {{.*}} contains 4 entries:
# RELOC-NEXT: Offset Info Type Symbol's Value Symbol's Name + Addend
# RELOC-NEXT: 0000000000000000 0000000000000001 R_X86_64_64 0
# RELOC-NEXT: 0000000000000008 0000000000000001 R_X86_64_64 0
# RELOC-NEXT: 0000000000000010 0000000000000001 R_X86_64_64 0
# RELOC-NEXT: 0000000000000018 0000000000000001 R_X86_64_64 0

# RELOC: Num: Value Size Type Bind Vis Ndx Name
# RELOC-NEXT: 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
# RELOC-NEXT: 1: 0000000000000000 0 SECTION LOCAL DEFAULT 1 .text
# RELOC-NEXT: 2: 0000000000000000 0 SECTION LOCAL DEFAULT 2 .bbb
# RELOC-NEXT: 3: 0000000000000000 0 SECTION LOCAL DEFAULT 4 .data
# RELOC-NEXT: 4: 0000000000000000 0 NOTYPE GLOBAL DEFAULT 1 _start
# RELOC-EMPTY:

#--- a.s
.globl _start
Expand Down

0 comments on commit 0996cee

Please sign in to comment.