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
5
6# RUN: echo "EXTERN( undef undef2 )" > %t.script
7# RUN: ld.lld %t -o %t2 %t.script
8# RUN: llvm-readobj %t2 > /dev/null
9
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
13
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
18
19# RUN: echo "SEARCH_DIR(/lib/foo/blah)" > %t.script
20# RUN: ld.lld %t.script %t
21# RUN: llvm-readobj %t.out > /dev/null
22
23# RUN: echo ";SEARCH_DIR(x);SEARCH_DIR(y);" > %t.script
24# RUN: ld.lld %t.script %t
25# RUN: llvm-readobj %t.out > /dev/null
26
27# RUN: echo ";" > %t.script
28# RUN: ld.lld %t.script %t
29# RUN: llvm-readobj %t.out > /dev/null
30
31# RUN: echo "INCLUDE \"%t.script2\" OUTPUT(\"%t.out\")" > %t.script1
32# RUN: echo "GROUP(\"%t\")" > %t.script2
33# RUN: ld.lld %t.script1
34# RUN: llvm-readobj %t2 > /dev/null
35
36# RUN: echo "INCLUDE \"foo.script\"" > %t.script
37# RUN: echo "OUTPUT(\"%t.out\")" > %T/foo.script
38# RUN: not ld.lld %t.script > %t.log 2>&1
39# RUN: FileCheck -check-prefix=INCLUDE_ERR %s < %t.log
40# INCLUDE_ERR: error: {{.+}}.script:1: cannot open foo.script
41# INCLUDE_ERR-NEXT: error: {{.+}}.script:1: INCLUDE "foo.script"
42# RUN: ld.lld -L %T %t.script %t
43
44# RUN: echo "FOO(BAR)" > %t.script
45# RUN: not ld.lld -o foo %t.script > %t.log 2>&1
46# RUN: FileCheck -check-prefix=ERR1 %s < %t.log
47
48# ERR1: unknown directive: FOO
49
50.globl _start, _label
51_start:
52  ret
53_label:
54  ret
55