1# REQUIRES: x86 2 3## An weak undefined symbol does not fetch the lazy definition. 4## Version scripts do not affect undefined symbols. 5 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 11 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: } 26 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 31 32# CHECK2: NOTYPE WEAK DEFAULT UND foo{{$}} 33 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 37 38# CHECK3: NOTYPE WEAK DEFAULT UND foo@v1 39 40.text 41 callq foo@PLT 42.weak foo 43