Skip to content

Commit ed1c8d7

Browse files
committed
ELF,test: Test unversioned undefined symbols of index 0 and 1
My 2020 change that added versioned symbol recognition (reviews.llvm.org/D80059) checks both VER_NDX_LOCAL and VER_NDX_GLOBAL, though test coverage was missing. lld/test/ELF/dso-undef-extract-lazy.s checks that the undefined symbol is indeed considered unversioned.
1 parent 5bba4fd commit ed1c8d7

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

lld/test/ELF/dso-undef-extract-lazy.s

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@
2525

2626
# CHECK-FETCH: GLOBAL DEFAULT {{[0-9]+}} foo
2727

28+
## Unversioned undefined symbols also extract the archive definitions.
29+
# RUN: yaml2obj %t/ver.yaml -o %t4.so
30+
# RUN: ld.lld %t1.o %t4.so %t2.a -o %t.exe
31+
# RUN: llvm-readelf --dyn-symbols %t.exe | FileCheck %s --check-prefix=CHECK-FETCH
32+
2833
#--- main.s
2934
.text
3035
.globl _start
@@ -38,3 +43,39 @@ foo:
3843

3944
#--- shlib.s
4045
.global foo
46+
47+
#--- ver.yaml
48+
--- !ELF
49+
FileHeader:
50+
Class: ELFCLASS64
51+
Data: ELFDATA2LSB
52+
Type: ET_DYN
53+
Machine: EM_X86_64
54+
Sections:
55+
- Name: .gnu.version
56+
Type: SHT_GNU_versym
57+
Flags: [ SHF_ALLOC ]
58+
Address: 0x0000000000200210
59+
AddressAlign: 0x0000000000000002
60+
EntSize: 0x0000000000000002
61+
## Test both index 0 and 1 for unversioned undefined symbols.
62+
## https://sourceware.org/PR33577
63+
Entries: [ 0, 0, 1 ]
64+
- Name: .gnu.version_r
65+
Type: SHT_GNU_verneed
66+
Flags: [ SHF_ALLOC ]
67+
Address: 0x0000000000200250
68+
AddressAlign: 0x0000000000000004
69+
Dependencies:
70+
- Version: 1
71+
File: dso.so.0
72+
Entries:
73+
- Name: v1
74+
Hash: 1937
75+
Flags: 0
76+
Other: 3
77+
DynamicSymbols:
78+
- Name: _start
79+
Binding: STB_GLOBAL
80+
- Name: foo
81+
Binding: STB_GLOBAL

0 commit comments

Comments
 (0)