[llvm] Do not replace dead constant references in metadata with undef
[llvm-project.git] / lld / test / ELF / copy-rel-version.s
blobfeaa59f8eb8cbd4098f1c876a186a70d6f240c0d
1 # REQUIRES: x86
2 ## Copy relocate a versioned symbol which has a versioned alias.
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
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
13 # CHECK1: 1: {{.+}} 12 OBJECT GLOBAL DEFAULT [[#]] foo@v3
14 # CHECK1-EMPTY:
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
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:
25 .global _start
26 _start:
27 leaq foo, %rax