Skip to content

Commit 05738a3

Browse files
committed
[ELF] Improve symbol resolution tests related to both DSO and archive
1 parent 5bd0f0d commit 05738a3

File tree

1 file changed

+21
-5
lines changed

1 file changed

+21
-5
lines changed

lld/test/ELF/shared-lazy.s

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
# RUN: llvm-ar rc a.a a.o
66
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux ref.s -o ref.o
77
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux ref2.s -o ref2.o
8+
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux weakref2.s -o weakref2.o
89
# RUN: ld.lld a.a b.so ref.o -shared -o 1.so
910
# RUN: llvm-readelf --dyn-syms 1.so | FileCheck %s
1011
# RUN: ld.lld a.so a.a ref.o -shared -o 1.so
@@ -25,12 +26,25 @@
2526
# CHECK2: {{.*}} 0 NOTYPE GLOBAL DEFAULT [[#]] x1
2627
# CHECK2-NEXT: {{.*}} 0 NOTYPE WEAK DEFAULT [[#]] x2
2728

28-
## The extracted x2 is defined as STB_WEAK. x1 is not referenced by any relocatable object file. Undef x1 is unneeded.
29-
# RUN: ld.lld a.a ref2.o b.so -o 3.so -shared
30-
# RUN: llvm-readelf --dyn-symbols 3.so | FileCheck %s --check-prefix=CHECK2
29+
## The extracted x2 is defined as STB_WEAK. x1 is not referenced by any relocatable object file.
30+
# RUN: ld.lld a.a ref2.o b.so -o 2.so -shared
31+
# RUN: llvm-readelf --dyn-syms 2.so | FileCheck %s --check-prefix=CHECK2
32+
# RUN: ld.lld a.a a.so ref2.o -o 3.so -shared
33+
# RUN: llvm-readelf --dyn-syms 3.so | FileCheck %s --check-prefix=CHECK3
34+
# RUN: ld.lld a.so a.a ref2.o -o 3.so -shared
35+
# RUN: llvm-readelf --dyn-syms 3.so | FileCheck %s --check-prefix=CHECK3
3136

32-
# RUN: ld.lld a.a --as-needed a.so -o 4.so -shared
33-
# RUN: llvm-readelf -d 4.so | FileCheck %s --check-prefix=NONEEDED
37+
# CHECK3: 1: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND x2
38+
# CHECK3-EMPTY:
39+
40+
# RUN: ld.lld a.a weakref2.o a.so -o 4.so -shared
41+
# RUN: llvm-readelf --dyn-syms 4.so | FileCheck %s --check-prefix=CHECK4
42+
43+
# CHECK4: 1: 0000000000000000 0 NOTYPE WEAK DEFAULT UND x2
44+
# CHECK4-EMPTY:
45+
46+
# RUN: ld.lld a.a --as-needed a.so -o noneeded.so -shared
47+
# RUN: llvm-readelf -d noneeded.so | FileCheck %s --check-prefix=NONEEDED
3448

3549
# NONEEDED-NOT: NEEDED
3650

@@ -51,3 +65,5 @@ x2:
5165
.globl x2
5266
#--- ref2.s
5367
.globl x2
68+
#--- weakref2.s
69+
.weak x2

0 commit comments

Comments
 (0)