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