1# REQUIRES: x86
2
3# RUN: not ld.lld --unknown1 --unknown2 -m foo /no/such/file -lnosuchlib \
4# RUN:   2>&1 | FileCheck -check-prefix=UNKNOWN %s
5
6# UNKNOWN: unknown argument: --unknown1
7# UNKNOWN: unknown argument: --unknown2
8# UNKNOWN: unknown emulation: foo
9# UNKNOWN: cannot open /no/such/file
10# UNKNOWN: unable to find library -lnosuchlib
11
12# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
13# RUN: not ld.lld %t -o /no/such/file 2>&1 | FileCheck -check-prefix=MISSING %s
14# MISSING: failed to open /no/such/file
15
16# RUN: ld.lld --help 2>&1 | FileCheck -check-prefix=HELP %s
17# HELP: USAGE:
18
19# RUN: ld.lld --version 2>&1 | FileCheck -check-prefix=VERSION %s
20# VERSION: LLD
21
22# RUN: not ld.lld -v 2>&1 | FileCheck -check-prefix=VERSION %s
23
24## Attempt to link DSO with -r
25# RUN: ld.lld -shared %t -o %t.so
26# RUN: not ld.lld -r %t.so %t -o %tfail 2>&1 | FileCheck -check-prefix=ERR %s
27# ERR: attempted static link of dynamic object
28
29## Attempt to use -r and -shared together
30# RUN: not ld.lld -r -shared %t -o %tfail 2>&1 | FileCheck -check-prefix=ERR2 %s
31# ERR2: -r and -shared may not be used together
32
33## Attempt to use -r and --gc-sections together
34# RUN: not ld.lld -r --gc-sections %t -o %tfail 2>&1 | FileCheck -check-prefix=ERR3 %s
35# ERR3: -r and --gc-sections may not be used together
36
37## Attempt to use -r and --icf together
38# RUN: not ld.lld -r --icf=all %t -o %tfail 2>&1 | FileCheck -check-prefix=ERR4 %s
39# ERR4: -r and --icf may not be used together
40
41## Attempt to use -r and -pie together
42# RUN: not ld.lld -r -pie %t -o %tfail 2>&1 | FileCheck -check-prefix=ERR5 %s
43# ERR5: -r and -pie may not be used together
44
45## Attempt to use -shared and -pie together
46# RUN: not ld.lld -shared -pie %t -o %tfail 2>&1 | FileCheck -check-prefix=ERR6 %s
47# ERR6: -shared and -pie may not be used together
48
49## "--output=foo" is equivalent to "-o foo".
50# RUN: not ld.lld %t --output=/no/such/file 2>&1 | FileCheck -check-prefix=ERR7 %s
51# ERR7: failed to open /no/such/file
52
53## "-output=foo" is equivalent to "-o utput=foo".
54# RUN: not ld.lld %t -output=/no/such/file 2>&1 | FileCheck -check-prefix=ERR8 %s
55# ERR8: failed to open utput=/no/such/file
56
57.globl _start
58_start:
59  nop
60