Skip to content

Commit 3510c48

Browse files
committed
[ELF] Improve .o preempting DSO tests
The new RUN line `ld.lld --version-script=a.ver b.so a.o -o a1` `c3` would be able to caught `replaceWithDefined` bug in commit 667ea2c (#72208).
1 parent 181e806 commit 3510c48

File tree

1 file changed

+25
-16
lines changed

1 file changed

+25
-16
lines changed

lld/test/ELF/obj-preempt-dso.s

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,37 +3,44 @@
33
# RUN: llvm-mc -filetype=obj -triple=x86_64 a.s -o a.o
44
# RUN: llvm-mc -filetype=obj -triple=x86_64 b.s -o b.o
55
# RUN: ld.lld -shared --version-script=b.ver b.o -o b.so
6-
# RUN: ld.lld --version-script=a.ver a.o b.so -o a
7-
# RUN: llvm-readelf --dyn-syms a | FileCheck %s
6+
# RUN: ld.lld --version-script=a.ver a.o b.so -o a0
7+
# RUN: llvm-nm -D a0 | FileCheck %s
8+
# RUN: ld.lld --version-script=a.ver b.so a.o -o a1
9+
# RUN: llvm-nm -D a1 | FileCheck %s
810

9-
# CHECK: 1: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND b2
10-
# CHECK-NEXT: 2: {{.*}} 0 NOTYPE GLOBAL DEFAULT [[#]] a1
11-
# CHECK-NEXT: 3: {{.*}} 0 NOTYPE GLOBAL DEFAULT [[#]] a2
12-
# CHECK-NEXT: 4: {{.*}} 0 NOTYPE GLOBAL DEFAULT [[#]] b1
13-
# CHECK-NEXT: 5: {{.*}} 0 NOTYPE GLOBAL DEFAULT [[#]] c2@@v2
14-
# CHECK-NEXT: 6: {{.*}} 0 NOTYPE GLOBAL DEFAULT [[#]] c1@v1
11+
# CHECK: T a1{{$}}
12+
# CHECK-NEXT: T a2{{$}}
13+
# CHECK-NEXT: T b1{{$}}
14+
# CHECK-NEXT: U b2{{$}}
15+
# CHECK-NEXT: T c1@v1
16+
# CHECK-NEXT: T c2@@v2
17+
# CHECK-NEXT: T c3{{$}}
18+
# CHECK-NEXT: T c4@@v3
1519
# CHECK-NOT: {{.}}
1620

1721
#--- a.s
18-
.globl _start, a1, a2, a3, b1, c1, c2
22+
.globl _start, a1, a2, a3, b1, c1, c2, c3, c4
1923
_start:
20-
a1: a2:
24+
a1: a2: ## defined in b.so and a
2125
.hidden a3
22-
a3:
23-
b1:
26+
a3: ## defined in b.so; hidden in a
27+
b1: ## protected in b.so; defined in a
2428
.symver c1, c1@v1, remove
25-
c1:
26-
c2:
29+
c1: ## non-default version in b.so and a
30+
c2: ## default version in b.so and a
31+
c3: ## default version in b.so; unversioned in a
32+
c4: ## default version in b.so; another version in a
2733

2834
.data
2935
.quad b2
3036

3137
#--- a.ver
3238
v1 {};
3339
v2 { c2; };
40+
v3 { c4; };
3441

3542
#--- b.s
36-
.globl a1, a2, a3, b1, b2, c1, c2
43+
.globl a1, a2, a3, b1, b2, c1, c2, c3, c4
3744
.type a1,@function
3845
a1: a2: a3:
3946
.protected b1, b2
@@ -42,7 +49,9 @@ b2:
4249
.symver c1, c1@v1
4350
c1:
4451
c2:
52+
c3:
53+
c4:
4554

4655
#--- b.ver
4756
v1 {};
48-
v2 { c2; };
57+
v2 { c2; c3; c4; };

0 commit comments

Comments
 (0)