• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# REQUIRES: x86
2# RUN: echo 'v1 { f; }; v2 { g; };' > %t.ver
3# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
4# RUN: ld.lld -shared --version-script %t.ver %t.o -o %t.so
5
6# RUN: ld.lld --version-script %t.ver %t.o %t.so -o /dev/null -y f@v1 | \
7# RUN:   FileCheck --check-prefix=TRACE %s --implicit-check-not=f@v1
8
9## TRACE:      {{.*}}.o: definition of f@v1
10## TRACE-NEXT: {{.*}}.so: shared definition of f@v1
11
12# RUN: echo '.symver f,f@v1; .symver g,g@v2; call f; call g' | \
13# RUN:   llvm-mc -filetype=obj -triple=x86_64 - -o %t1.o
14# RUN: ld.lld -shared %t1.o %t.so -o %t1.so
15
16## Test that we can parse SHT_GNU_verneed to know that the undefined symbols in
17## %t1.so are called 'f@v1' and 'g@v2', which can be satisfied by the executable.
18## We will thus export the symbols.
19# RUN: ld.lld -pie %t.o %t1.so -o %t
20# RUN: llvm-nm -D %t | FileCheck --check-prefix=NM %s
21
22# NM: T f
23# NM: T g
24
25## The default is --no-allow-shlib-undefined.
26## Don't error because undefined symbols in %t1.so are satisfied by %t.so
27# RUN: llvm-mc -filetype=obj -triple=x86_64 /dev/null -o %t2.o
28# RUN: ld.lld %t2.o %t1.so %t.so -y f@v1 -o /dev/null | FileCheck %s
29
30# CHECK:      {{.*}}1.so: reference to f@v1
31# CHECK-NEXT: {{.*}}.so: shared definition of f@v1
32
33.globl f_v1, g_v2
34.symver f_v1,f@v1
35.symver g_v2,g@v2
36f_v1:
37g_v2:
38