1# REQUIRES: x86 2# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o 3# RUN: echo 'v1 {bar;};' > %t.ver 4# RUN: ld.lld -shared --version-script %t.ver %t.o -o %t.so 5 6## For an unversioned undefined symbol, check we can suggest the symbol with the 7## default version. 8# RUN: echo 'call bat' | llvm-mc -filetype=obj -triple=x86_64 - -o %tdef1.o 9# RUN: not ld.lld %t.so %tdef1.o -o /dev/null 2>&1 | FileCheck --check-prefix=DEFAULT1 %s 10 11# DEFAULT1: error: undefined symbol: bat 12# DEFAULT1-NEXT: >>> referenced by {{.*}}.o:(.text+0x1) 13# DEFAULT1-NEXT: >>> did you mean: bar{{$}} 14# DEFAULT1-NEXT: >>> defined in: {{.*}}.so 15 16## For a versioned undefined symbol, check we can suggest the symbol with the 17## default version. 18# RUN: echo '.symver bar.v2,bar@v2; call bar.v2' | llvm-mc -filetype=obj -triple=x86_64 - -o %tdef2.o 19# RUN: not ld.lld %t.so %tdef2.o -o /dev/null 2>&1 | FileCheck --check-prefix=DEFAULT2 %s 20 21# DEFAULT2: error: undefined symbol: bar@v2 22# DEFAULT2-NEXT: >>> referenced by {{.*}}.o:(.text+0x1) 23# DEFAULT2-NEXT: >>> did you mean: bar{{$}} 24# DEFAULT2-NEXT: >>> defined in: {{.*}}.so 25 26## For an unversioned undefined symbol, check we can suggest a symbol with 27## a non-default version. 28# RUN: echo 'call foo; call _Z3fooi' | llvm-mc -filetype=obj -triple=x86_64 - -o %thidden1.o 29# RUN: not ld.lld %t.so %thidden1.o -o /dev/null 2>&1 | FileCheck --check-prefix=HIDDEN1 %s 30 31# HIDDEN1: error: undefined symbol: foo 32# HIDDEN1-NEXT: >>> referenced by {{.*}}.o:(.text+0x1) 33# HIDDEN1-NEXT: >>> did you mean: foo@v1 34# HIDDEN1-NEXT: >>> defined in: {{.*}}.so 35# HIDDEN1-EMPTY: 36# HIDDEN1-NEXT: error: undefined symbol: foo(int) 37# HIDDEN1-NEXT: >>> referenced by {{.*}}.o:(.text+0x6) 38# HIDDEN1-NEXT: >>> did you mean: foo(int)@v1 39# HIDDEN1-NEXT: >>> defined in: {{.*}}.so 40 41## For a versioned undefined symbol, check we can suggest a symbol with 42## a different version. 43# RUN: echo '.symver foo.v2,foo@v2; call foo.v2' | llvm-mc -filetype=obj -triple=x86_64 - -o %thidden2.o 44# RUN: not ld.lld %t.so %thidden2.o -o /dev/null 2>&1 | FileCheck --check-prefix=HIDDEN2 %s 45 46# HIDDEN2: error: undefined symbol: foo@v2 47# HIDDEN2-NEXT: >>> referenced by {{.*}}.o:(.text+0x1) 48# HIDDEN2-NEXT: >>> did you mean: foo@v1 49# HIDDEN2-NEXT: >>> defined in: {{.*}}.so 50 51## %t.so exports bar@@v1 and two VERSYM_HIDDEN symbols: foo@v1 and _Z3fooi@v1. 52.globl foo.v1, _Z3fooi.v1, bar 53.symver foo.v1,foo@v1 54.symver _Z3fooi.v1,_Z3fooi@v1 55foo.v1: 56_Z3fooi.v1: 57bar: 58