[llvm] Do not replace dead constant references in metadata with undef
[llvm-project.git] / lld / test / ELF / linkerscript / linkerscript.s
blob14d30bbc1eddaa3311954f46a74128db383d3963
1 # REQUIRES: x86
2 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
3 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux \
4 # RUN: %p/Inputs/libsearch-st.s -o %t2.o
6 # RUN: echo "EXTERN( undef undef2 \"undef3\" \"undef4@@other\")" > %t.script
7 # RUN: ld.lld %t -o %t2 %t.script
8 # RUN: llvm-readobj %t2 > /dev/null
10 # RUN: echo "OUTPUT_FORMAT(elf64-x86-64) /*/*/ GROUP(\"%t\" )" > %t.script
11 # RUN: ld.lld -o %t2 %t.script
12 # RUN: llvm-readobj %t2 > /dev/null
14 # RUN: rm -f %t.out
15 # RUN: echo "OUTPUT(\"%t.out\")" > %t.script
16 # RUN: ld.lld %t.script %t
17 # RUN: llvm-readobj %t.out > /dev/null
19 # RUN: echo "SEARCH_DIR(/lib/foo/blah)" > %t.script
20 # RUN: ld.lld %t.script %t -o %t.out
21 # RUN: llvm-readobj %t.out > /dev/null
23 # RUN: echo ";SEARCH_DIR(x);SEARCH_DIR(y);" > %t.script
24 # RUN: ld.lld %t.script %t -o %t.out
25 # RUN: llvm-readobj %t.out > /dev/null
27 # RUN: echo ";" > %t.script
28 # RUN: ld.lld %t.script %t -o %t.out
29 # RUN: llvm-readobj %t.out > /dev/null
31 # RUN: echo "INCLUDE \"%t.script2\" OUTPUT(\"%t.out\")" > %t.script1
32 # RUN: echo "GROUP(\"%t\")" > %t.script2
33 # RUN: ld.lld %t.script1 -o %t.out
34 # RUN: llvm-readobj %t2 > /dev/null
36 # RUN: rm -rf %t.dir && mkdir -p %t.dir
37 # RUN: echo "INCLUDE \"foo.script\"" > %t.script
38 # RUN: echo "OUTPUT(\"%t.out\")" > %t.dir/foo.script
39 # RUN: not ld.lld %t.script -o /dev/null > %t.log 2>&1
40 # RUN: FileCheck -check-prefix=INCLUDE_ERR %s < %t.log
41 # INCLUDE_ERR: error: {{.+}}.script:1: cannot find linker script foo.script
42 # INCLUDE_ERR-NEXT: INCLUDE "foo.script"
43 # RUN: ld.lld -L %t.dir %t.script %t
45 # RUN: echo "FOO(BAR)" > %t.script
46 # RUN: not ld.lld -o /dev/null %t.script > %t.log 2>&1
47 # RUN: FileCheck -check-prefix=ERR1 %s < %t.log
49 # ERR1: unknown directive: FOO
51 .globl _start, _label
52 _start:
53 ret
54 _label:
55 ret