3 # RUN: not ld.lld --unknown1 --unkn=own2 -m foo /no/such/file -lnosuchlib \
4 # RUN: 2>&1 | FileCheck -check-prefix=UNKNOWN %s
6 # UNKNOWN: unknown argument '--unknown1'
7 # UNKNOWN: unknown argument '--unkn=own2'
8 # UNKNOWN: unknown emulation: foo
9 # UNKNOWN: cannot open /no/such/file
10 # UNKNOWN: unable to find library -lnosuchlib
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
16 # RUN: ld.lld --help 2>&1 | FileCheck -check-prefix=HELP %s
18 # HELP: : supported targets:{{.*}} elf
20 # RUN: not ld.lld --versin 2>&1 | FileCheck -check-prefix=SPELLVERSION %s
21 # SPELLVERSION: unknown argument '--versin', did you mean '--version'
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 /dev/null 2>&1 | FileCheck -check-prefix=ERR %s
26 # ERR: attempted static link of dynamic object
28 ## Attempt to use -r and -shared together
29 # RUN: not ld.lld -r -shared %t -o /dev/null 2>&1 | FileCheck -check-prefix=ERR2 %s
30 # ERR2: -r and -shared may not be used together
32 ## Attempt to use -r and --gdb-index together
33 # RUN: not ld.lld -r --gdb-index %t -o /dev/null 2>&1 | FileCheck -check-prefix=ERR4 %s
34 # ERR4: -r and --gdb-index may not be used together
36 ## Attempt to use -r and --icf together
37 # RUN: not ld.lld -r --icf=all %t -o /dev/null 2>&1 | FileCheck -check-prefix=ERR5 %s
38 # ERR5: -r and --icf may not be used together
40 ## Attempt to use -r and -pie together
41 # RUN: not ld.lld -r -pie %t -o /dev/null 2>&1 | FileCheck -check-prefix=ERR6 %s
42 # ERR6: -r and -pie may not be used together
44 ## Attempt to use -shared and -pie together
45 # RUN: not ld.lld -shared -pie %t -o /dev/null 2>&1 | FileCheck -check-prefix=ERR7 %s
46 # ERR7: -shared and -pie may not be used together
48 ## "--output=foo" is equivalent to "-o foo".
49 # RUN: not ld.lld %t --output=/no/such/file 2>&1 | FileCheck -check-prefix=ERR8 %s
50 # ERR8: cannot open output file /no/such/file
52 ## "-output=foo" is equivalent to "-o utput=foo".
53 # RUN: not ld.lld %t -output=/no/such/file 2>&1 | FileCheck -check-prefix=ERR9 %s
54 # ERR9: cannot open output file utput=/no/such/file
56 # RUN: ld.lld %t -z foo -o /dev/null 2>&1 | FileCheck -check-prefix=ERR10 %s
57 # RUN: ld.lld %t -z foo -o /dev/null --version 2>&1 | FileCheck -check-prefix=ERR10 %s
58 # ERR10: warning: unknown -z value: foo
60 ## Check we report "unknown -z value" error even with -v.
61 # RUN: ld.lld %t -z foo -o /dev/null -v 2>&1 | FileCheck -check-prefix=ERR10 %s
63 ## Note: in GNU ld, --fatal-warning still leads to a warning.
64 # RUN: not ld.lld %t -z foo --fatal-warnings 2>&1 | FileCheck --check-prefix=ERR10-FATAL %s
65 # ERR10-FATAL: error: unknown -z value: foo
67 # RUN: not ld.lld %t -z max-page-size 2>&1 | FileCheck -check-prefix=ERR11 %s
68 # ERR11: unknown -z value: max-page-size
70 ## Attempt to use -r and --export-dynamic together
71 # RUN: not ld.lld -r -export-dynamic %t -o /dev/null 2>&1 | FileCheck -check-prefix=ERR12 %s
72 # ERR12: -r and --export-dynamic may not be used together