[memprof] Remove an unused using directive (#117004)
[llvm-project.git] / lld / test / ELF / shared-lazy.s
blob0fa8f06884a3f5c92eeb8e16d2159700efb1f933
1 # REQUIRES: x86
2 # RUN: rm -rf %t && split-file %s %t && cd %t
3 # RUN: llvm-mc -filetype=obj -triple=x86_64 a.s -o a.o && ld.lld a.o -shared -o a.so
4 # RUN: llvm-mc -filetype=obj -triple=x86_64 b.s -o b.o && ld.lld b.o -shared -o b.so
5 # RUN: llvm-ar rc a.a a.o
6 # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux ref.s -o ref.o
7 # 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
9 # RUN: ld.lld a.a b.so ref.o -shared -o 1.so
10 # RUN: llvm-readelf --dyn-syms 1.so | FileCheck %s
11 # RUN: ld.lld a.so a.a ref.o -shared -o 1.so
12 # RUN: llvm-readelf --dyn-syms 1.so | FileCheck %s
14 ## The definitions from a.so are used and we don't extract a member from the
15 ## archive.
17 # CHECK: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND x1
18 # CHECK-NEXT: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND x2
20 ## The extracted x1 is defined as STB_GLOBAL.
21 # RUN: ld.lld ref.o a.a b.so -o 2.so -shared
22 # RUN: llvm-readelf --dyn-symbols 2.so | FileCheck %s --check-prefix=CHECK2
23 # RUN: ld.lld a.a ref.o b.so -o 2.so -shared
24 # RUN: llvm-readelf --dyn-symbols 2.so | FileCheck %s --check-prefix=CHECK2
26 # CHECK2: {{.*}} 0 NOTYPE GLOBAL DEFAULT [[#]] x1
27 # CHECK2-NEXT: {{.*}} 0 NOTYPE WEAK DEFAULT [[#]] x2
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
37 # CHECK3: 1: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND x2
38 # CHECK3-EMPTY:
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
43 # CHECK4: 1: 0000000000000000 0 NOTYPE WEAK DEFAULT UND x2
44 # CHECK4-EMPTY:
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
49 # NONEEDED-NOT: NEEDED
51 #--- a.s
52 .global x1
53 x1:
54 .weak x2
55 x2:
56 #--- b.s
57 .globl x1, x2
58 x1:
59 x2:
60 .byte 0
61 .size x1, .-x1
62 .size x2, .-x2
63 #--- ref.s
64 .globl x1
65 .globl x2
66 #--- ref2.s
67 .globl x2
68 #--- weakref2.s
69 .weak x2