[clang-tidy][modernize-use-starts-ends-with] Fix operator rewriting false negative...
[llvm-project.git] / lld / test / ELF / version-script-weak.s
blobcfa2455ee2bd226ad5b257e2566741b11a787570
1 # REQUIRES: x86
3 ## An weak undefined symbol does not fetch the lazy definition.
4 ## Version scripts do not affect undefined symbols.
6 # RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
7 # RUN: echo '.globl foo; foo:' | llvm-mc -filetype=obj -triple=x86_64 - -o %t1.o
8 # RUN: echo "{ local: *; };" > %t.script
9 # RUN: ld.lld -shared --version-script %t.script %t.o --start-lib %t1.o --end-lib -o %t.so
10 # RUN: llvm-readobj --dyn-syms -r %t.so | FileCheck %s
12 # CHECK: Relocations [
13 # CHECK-NEXT: Section ({{.*}}) .rela.plt {
14 # CHECK-NEXT: R_X86_64_JUMP_SLOT foo
15 # CHECK-NEXT: }
16 # CHECK-NEXT: ]
17 # CHECK: Symbol {
18 # CHECK: Name: foo
19 # CHECK-NEXT: Value: 0x0
20 # CHECK-NEXT: Size: 0
21 # CHECK-NEXT: Binding: Weak
22 # CHECK-NEXT: Type: None
23 # CHECK-NEXT: Other: 0
24 # CHECK-NEXT: Section: Undefined
25 # CHECK-NEXT: }
27 ## The version of an unfetched lazy symbol is VER_NDX_GLOBAL. It is not affected by version scripts.
28 # RUN: echo "v1 { *; };" > %t2.script
29 # RUN: ld.lld -shared --version-script %t2.script %t.o --start-lib %t1.o --end-lib -o %t2.so
30 # RUN: llvm-readelf --dyn-syms %t2.so | FileCheck %s --check-prefix=CHECK2
32 # CHECK2: NOTYPE WEAK DEFAULT UND foo{{$}}
34 # RUN: ld.lld -shared --soname=tshared --version-script %t2.script %t1.o -o %tshared.so
35 # RUN: ld.lld -shared --version-script %t2.script %t.o --start-lib %t1.o --end-lib %tshared.so -o %t3.so
36 # RUN: llvm-readelf --dyn-syms %t3.so | FileCheck %s --check-prefix=CHECK3
38 # CHECK3: NOTYPE WEAK DEFAULT UND foo@v1
40 .text
41 callq foo@PLT
42 .weak foo