[llvm] Do not replace dead constant references in metadata with undef
[llvm-project.git] / lld / test / ELF / linkerscript / discard-gnu-version.s
blob7a40236feaaa5549d1e5c49779f1f9c060ca72d5
1 # REQUIRES: x86
2 # RUN: echo '.globl f; f:' | llvm-mc -filetype=obj -triple=x86_64 - -o %t1.o
3 # RUN: echo 'v1 { f; };' > %t1.ver
4 # RUN: ld.lld -shared --version-script %t1.ver %t1.o -o %t1.so
6 # RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t.o
7 # RUN: echo 'v1 { foo; };' > %t.ver
8 # RUN: ld.lld -shared --version-script %t.ver %t.o %t1.so -o %t.so
9 # RUN: llvm-readelf -S -d %t.so | FileCheck --check-prefixes=SYM,DEF,NEED %s
11 # SYM: .gnu.version
12 # DEF: .gnu.version_d
13 # NEED: .gnu.version_r
15 # SYM: (VERSYM)
16 # DEF: (VERDEF)
17 # DEF: (VERDEFNUM)
18 # NEED: (VERNEED)
19 # NEED: (VERNEEDNUM)
21 ## Discard all of .gnu.version*
22 # RUN: echo 'SECTIONS { /DISCARD/ : { *(.gnu.version*) } }' > %t.script
23 # RUN: ld.lld -shared --version-script %t.ver -T %t.script %t.o %t1.so -o %t.so
24 # RUN: llvm-readelf -S -d %t.so | FileCheck /dev/null \
25 # RUN: --implicit-check-not='(VER' --implicit-check-not=.gnu.version
27 ## Discard .gnu.version
28 # RUN: echo 'SECTIONS { /DISCARD/ : { *(.gnu.version) } }' > %t.noversym.script
29 # RUN: ld.lld -shared --version-script %t.ver -T %t.noversym.script %t.o %t1.so -o %t.noversym.so
30 # RUN: llvm-readelf -S -d %t.noversym.so | FileCheck --check-prefixes=DEF,NEED %s \
31 # RUN: --implicit-check-not='(VER' --implicit-check-not=.gnu.version
33 ## Discard .gnu.version_d
34 # RUN: echo 'SECTIONS { /DISCARD/ : { *(.gnu.version_d) } }' > %t.noverdef.script
35 # RUN: ld.lld -shared --version-script %t.ver -T %t.noverdef.script %t.o %t1.so -o %t.noverdef.so
36 # RUN: llvm-readelf -S -d %t.noverdef.so | FileCheck --check-prefixes=SYM,NEED %s \
37 # RUN: --implicit-check-not='(VER' --implicit-check-not=.gnu.version
39 ## Discard .gnu.version_r
40 # RUN: echo 'SECTIONS { /DISCARD/ : { *(.gnu.version_r) } }' > %t.noverneed.script
41 # RUN: ld.lld -shared --version-script %t.ver -T %t.noverneed.script %t.o %t1.so -o %t.noverneed.so
42 # RUN: llvm-readelf -S -d %t.noverneed.so | FileCheck --check-prefixes=SYM,DEF %s \
43 # RUN: --implicit-check-not='(VER' --implicit-check-not=.gnu.version
45 .globl foo
46 foo:
47 call f@plt