blob: 585800a3b0b5401ffe900b73564c2bb4811f8fa0 [file] [log] [blame]
Rui Ueyamacbe39262016-02-02 22:48:04 +00001# REQUIRES: x86
2
Rui Ueyamaa1ee70b2016-03-03 00:09:02 +00003# RUN: not ld.lld --unknown1 --unknown2 -m foo /no/such/file -lnosuchlib \
Rui Ueyama1abcf372016-02-28 03:18:07 +00004# RUN: 2>&1 | FileCheck -check-prefix=UNKNOWN %s
Rui Ueyama21eecb42016-02-02 21:13:09 +00005
Rui Ueyama0f282a52016-07-07 01:58:04 +00006# UNKNOWN: unknown argument: --unknown1
7# UNKNOWN: unknown argument: --unknown2
George Rimar777f9632016-03-12 08:31:34 +00008# UNKNOWN: unknown emulation: foo
George Rimar57610422016-03-11 14:43:02 +00009# UNKNOWN: cannot open /no/such/file
George Rimar777f9632016-03-12 08:31:34 +000010# UNKNOWN: unable to find library -lnosuchlib
Rui Ueyamacbe39262016-02-02 22:48:04 +000011
12# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
Rui Ueyama1abcf372016-02-28 03:18:07 +000013# RUN: not ld.lld %t -o /no/such/file 2>&1 | FileCheck -check-prefix=MISSING %s
Rui Ueyamaeaeca5e2017-03-13 17:24:52 +000014# MISSING: cannot open output file /no/such/file
Rui Ueyamacbe39262016-02-02 22:48:04 +000015
Rui Ueyama1eb9f442016-02-28 03:18:09 +000016# RUN: ld.lld --help 2>&1 | FileCheck -check-prefix=HELP %s
17# HELP: USAGE:
Rui Ueyama4372c382017-03-23 01:16:57 +000018# HELP: : supported targets:{{.*}} elf
Rui Ueyama1eb9f442016-02-28 03:18:09 +000019
George Rimar0a94bff2016-11-19 18:14:24 +000020# RUN: ld.lld --version 2>&1 | FileCheck -check-prefix=VERSION %s
Rui Ueyamabe61cc92017-12-05 00:03:41 +000021# 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
Rui Ueyamabdc8bc02017-03-22 18:04:57 +000023# VERSION: LLD {{.*}} (compatible with GNU linkers)
Rui Ueyamacbe39262016-02-02 22:48:04 +000024
George Rimar262b9272016-03-01 19:38:51 +000025## 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
George Rimar777f9632016-03-12 08:31:34 +000028# ERR: attempted static link of dynamic object
George Rimar262b9272016-03-01 19:38:51 +000029
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
Fangrui Song4a294822018-07-18 22:02:48 +000038## 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
George Rimar262b9272016-03-01 19:38:51 +000042## Attempt to use -r and --icf together
Fangrui Song4a294822018-07-18 22:02:48 +000043# 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
George Rimar262b9272016-03-01 19:38:51 +000045
George Rimar786e8662016-03-17 05:57:33 +000046## Attempt to use -r and -pie together
Fangrui Song4a294822018-07-18 22:02:48 +000047# 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
George Rimar786e8662016-03-17 05:57:33 +000049
50## Attempt to use -shared and -pie together
Fangrui Song4a294822018-07-18 22:02:48 +000051# 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
George Rimar786e8662016-03-17 05:57:33 +000053
Rui Ueyamaa60058c2016-09-09 00:25:56 +000054## "--output=foo" is equivalent to "-o foo".
Fangrui Song4a294822018-07-18 22:02:48 +000055# 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
Rui Ueyamaa60058c2016-09-09 00:25:56 +000057
58## "-output=foo" is equivalent to "-o utput=foo".
Fangrui Song4a294822018-07-18 22:02:48 +000059# 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
Rui Ueyamaa60058c2016-09-09 00:25:56 +000061
Fangrui Song4a294822018-07-18 22:02:48 +000062# RUN: not ld.lld %t -z foo 2>&1 | FileCheck -check-prefix=ERR10 %s
63# ERR10: unknown -z value: foo
Rui Ueyama2fa06042018-06-27 07:22:27 +000064
George Rimaree9818602018-10-15 14:21:43 +000065## 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
Fangrui Song4a294822018-07-18 22:02:48 +000068# RUN: not ld.lld %t -z max-page-size 2>&1 | FileCheck -check-prefix=ERR11 %s
69# ERR11: unknown -z value: max-page-size
Rui Ueyama53f6bfb2018-06-27 07:56:23 +000070
Rui Ueyamacbe39262016-02-02 22:48:04 +000071.globl _start
72_start:
73 nop