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: cannot open output file /no/such/file
15
16# RUN: ld.lld --help 2>&1 | FileCheck -check-prefix=HELP %s
17# HELP: USAGE:
18# HELP: : supported targets:{{.*}} elf
19
20# RUN: ld.lld --version 2>&1 | FileCheck -check-prefix=VERSION %s
21# RUN: ld.lld -v 2>&1 | FileCheck -check-prefix=VERSION %s
22# RUN: not ld.lld -v xyz 2>&1 | FileCheck -check-prefix=VERSION %s
23# VERSION: LLD {{.*}} (compatible with GNU linkers)
24
25## Attempt to link DSO with -r
26# RUN: ld.lld -shared %t -o %t.so
27# RUN: not ld.lld -r %t.so %t -o %tfail 2>&1 | FileCheck -check-prefix=ERR %s
28# ERR: attempted static link of dynamic object
29
30## Attempt to use -r and -shared together
31# RUN: not ld.lld -r -shared %t -o %tfail 2>&1 | FileCheck -check-prefix=ERR2 %s
32# ERR2: -r and -shared may not be used together
33
34## Attempt to use -r and --gc-sections together
35# RUN: not ld.lld -r --gc-sections %t -o %tfail 2>&1 | FileCheck -check-prefix=ERR3 %s
36# ERR3: -r and --gc-sections may not be used together
37
38## Attempt to use -r and --gdb-index together
39# RUN: not ld.lld -r --gdb-index %t -o %tfail 2>&1 | FileCheck -check-prefix=ERR4 %s
40# ERR4: -r and --gdb-index may not be used together
41
42## Attempt to use -r and --icf together
43# RUN: not ld.lld -r --icf=all %t -o %tfail 2>&1 | FileCheck -check-prefix=ERR5 %s
44# ERR5: -r and --icf may not be used together
45
46## Attempt to use -r and -pie together
47# RUN: not ld.lld -r -pie %t -o %tfail 2>&1 | FileCheck -check-prefix=ERR6 %s
48# ERR6: -r and -pie may not be used together
49
50## Attempt to use -shared and -pie together
51# RUN: not ld.lld -shared -pie %t -o %tfail 2>&1 | FileCheck -check-prefix=ERR7 %s
52# ERR7: -shared and -pie may not be used together
53
54## "--output=foo" is equivalent to "-o foo".
55# RUN: not ld.lld %t --output=/no/such/file 2>&1 | FileCheck -check-prefix=ERR8 %s
56# ERR8: cannot open output file /no/such/file
57
58## "-output=foo" is equivalent to "-o utput=foo".
59# RUN: not ld.lld %t -output=/no/such/file 2>&1 | FileCheck -check-prefix=ERR9 %s
60# ERR9: cannot open output file utput=/no/such/file
61
62# RUN: not ld.lld %t -z foo 2>&1 | FileCheck -check-prefix=ERR10 %s
63# ERR10: unknown -z value: foo
64
65## Check we report "unknown -z value" error even with -v.
66# RUN: not ld.lld %t -z foo -v 2>&1 | FileCheck -check-prefix=ERR10 %s
67
68# RUN: not ld.lld %t -z max-page-size 2>&1 | FileCheck -check-prefix=ERR11 %s
69# ERR11: unknown -z value: max-page-size
70
71.globl _start
72_start:
73  nop
74