1# REQUIRES: x86
2## Copy relocate a versioned symbol which has a versioned alias.
3
4# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t1.o
5# RUN: llvm-mc -filetype=obj -triple=x86_64 %p/Inputs/copy-rel-version.s -o %t.o
6# RUN: echo 'v1 {}; v2 {}; v3 {};' > %t.ver
7# RUN: ld.lld %t.o -shared -soname t.so --version-script=%t.ver -o %t.so
8
9## Copy relocate the default version symbol.
10# RUN: ld.lld %t1.o %t.so -o %t1
11# RUN: llvm-readelf --dyn-syms %t1 | FileCheck %s --check-prefix=CHECK1
12
13# CHECK1:       1: {{.+}}            12 OBJECT  GLOBAL DEFAULT [[#]] foo@v3
14# CHECK1-EMPTY:
15
16## Copy relocate the non-default version symbol.
17# RUN: llvm-objcopy --redefine-sym foo=foo@v1 %t1.o %t2.o
18# RUN: ld.lld %t2.o %t.so -o %t2
19# RUN: llvm-readelf --dyn-syms %t2 | FileCheck %s --check-prefix=CHECK2
20
21# CHECK2:       1: [[ADDR:[0-9a-f]+]] 4 OBJECT  GLOBAL DEFAULT [[#]] foo@v1
22# CHECK2-NEXT:  2: [[ADDR]]          12 OBJECT  GLOBAL DEFAULT [[#]] foo@v3
23# CHECK2-EMPTY:
24
25.global _start
26_start:
27  leaq foo, %rax
28