|
5 | 5 | # RUN: llvm-ar rc a.a a.o
|
6 | 6 | # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux ref.s -o ref.o
|
7 | 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 |
8 | 9 | # RUN: ld.lld a.a b.so ref.o -shared -o 1.so
|
9 | 10 | # RUN: llvm-readelf --dyn-syms 1.so | FileCheck %s
|
10 | 11 | # RUN: ld.lld a.so a.a ref.o -shared -o 1.so
|
|
25 | 26 | # CHECK2: {{.*}} 0 NOTYPE GLOBAL DEFAULT [[#]] x1
|
26 | 27 | # CHECK2-NEXT: {{.*}} 0 NOTYPE WEAK DEFAULT [[#]] x2
|
27 | 28 |
|
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 |
31 | 36 |
|
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 |
34 | 48 |
|
35 | 49 | # NONEEDED-NOT: NEEDED
|
36 | 50 |
|
|
51 | 65 | .globl x2
|
52 | 66 | #--- ref2.s
|
53 | 67 | .globl x2
|
| 68 | +#--- weakref2.s |
| 69 | +.weak x2 |
0 commit comments