Rui Ueyama | cbe3926 | 2016-02-02 22:48:04 +0000 | [diff] [blame] | 1 | # REQUIRES: x86 |
| 2 | |
Rui Ueyama | a1ee70b | 2016-03-03 00:09:02 +0000 | [diff] [blame] | 3 | # RUN: not ld.lld --unknown1 --unknown2 -m foo /no/such/file -lnosuchlib \ |
Rui Ueyama | 1abcf37 | 2016-02-28 03:18:07 +0000 | [diff] [blame] | 4 | # RUN: 2>&1 | FileCheck -check-prefix=UNKNOWN %s |
Rui Ueyama | 21eecb4 | 2016-02-02 21:13:09 +0000 | [diff] [blame] | 5 | |
Rui Ueyama | 0f282a5 | 2016-07-07 01:58:04 +0000 | [diff] [blame] | 6 | # UNKNOWN: unknown argument: --unknown1 |
| 7 | # UNKNOWN: unknown argument: --unknown2 |
George Rimar | 777f963 | 2016-03-12 08:31:34 +0000 | [diff] [blame] | 8 | # UNKNOWN: unknown emulation: foo |
George Rimar | 5761042 | 2016-03-11 14:43:02 +0000 | [diff] [blame] | 9 | # UNKNOWN: cannot open /no/such/file |
George Rimar | 777f963 | 2016-03-12 08:31:34 +0000 | [diff] [blame] | 10 | # UNKNOWN: unable to find library -lnosuchlib |
Rui Ueyama | cbe3926 | 2016-02-02 22:48:04 +0000 | [diff] [blame] | 11 | |
| 12 | # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t |
Rui Ueyama | 1abcf37 | 2016-02-28 03:18:07 +0000 | [diff] [blame] | 13 | # RUN: not ld.lld %t -o /no/such/file 2>&1 | FileCheck -check-prefix=MISSING %s |
Rui Ueyama | eaeca5e | 2017-03-13 17:24:52 +0000 | [diff] [blame] | 14 | # MISSING: cannot open output file /no/such/file |
Rui Ueyama | cbe3926 | 2016-02-02 22:48:04 +0000 | [diff] [blame] | 15 | |
Rui Ueyama | 1eb9f44 | 2016-02-28 03:18:09 +0000 | [diff] [blame] | 16 | # RUN: ld.lld --help 2>&1 | FileCheck -check-prefix=HELP %s |
| 17 | # HELP: USAGE: |
Rui Ueyama | 4372c38 | 2017-03-23 01:16:57 +0000 | [diff] [blame] | 18 | # HELP: : supported targets:{{.*}} elf |
Rui Ueyama | 1eb9f44 | 2016-02-28 03:18:09 +0000 | [diff] [blame] | 19 | |
George Rimar | 0a94bff | 2016-11-19 18:14:24 +0000 | [diff] [blame] | 20 | # RUN: ld.lld --version 2>&1 | FileCheck -check-prefix=VERSION %s |
Rui Ueyama | be61cc9 | 2017-12-05 00:03:41 +0000 | [diff] [blame] | 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 |
Rui Ueyama | bdc8bc0 | 2017-03-22 18:04:57 +0000 | [diff] [blame] | 23 | # VERSION: LLD {{.*}} (compatible with GNU linkers) |
Rui Ueyama | cbe3926 | 2016-02-02 22:48:04 +0000 | [diff] [blame] | 24 | |
George Rimar | 262b927 | 2016-03-01 19:38:51 +0000 | [diff] [blame] | 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 |
George Rimar | 777f963 | 2016-03-12 08:31:34 +0000 | [diff] [blame] | 28 | # ERR: attempted static link of dynamic object |
George Rimar | 262b927 | 2016-03-01 19:38:51 +0000 | [diff] [blame] | 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 | |
Fangrui Song | 4a29482 | 2018-07-18 22:02:48 +0000 | [diff] [blame] | 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 | |
George Rimar | 262b927 | 2016-03-01 19:38:51 +0000 | [diff] [blame] | 42 | ## Attempt to use -r and --icf together |
Fangrui Song | 4a29482 | 2018-07-18 22:02:48 +0000 | [diff] [blame] | 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 |
George Rimar | 262b927 | 2016-03-01 19:38:51 +0000 | [diff] [blame] | 45 | |
George Rimar | 786e866 | 2016-03-17 05:57:33 +0000 | [diff] [blame] | 46 | ## Attempt to use -r and -pie together |
Fangrui Song | 4a29482 | 2018-07-18 22:02:48 +0000 | [diff] [blame] | 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 |
George Rimar | 786e866 | 2016-03-17 05:57:33 +0000 | [diff] [blame] | 49 | |
| 50 | ## Attempt to use -shared and -pie together |
Fangrui Song | 4a29482 | 2018-07-18 22:02:48 +0000 | [diff] [blame] | 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 |
George Rimar | 786e866 | 2016-03-17 05:57:33 +0000 | [diff] [blame] | 53 | |
Rui Ueyama | a60058c | 2016-09-09 00:25:56 +0000 | [diff] [blame] | 54 | ## "--output=foo" is equivalent to "-o foo". |
Fangrui Song | 4a29482 | 2018-07-18 22:02:48 +0000 | [diff] [blame] | 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 |
Rui Ueyama | a60058c | 2016-09-09 00:25:56 +0000 | [diff] [blame] | 57 | |
| 58 | ## "-output=foo" is equivalent to "-o utput=foo". |
Fangrui Song | 4a29482 | 2018-07-18 22:02:48 +0000 | [diff] [blame] | 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 |
Rui Ueyama | a60058c | 2016-09-09 00:25:56 +0000 | [diff] [blame] | 61 | |
Fangrui Song | 4a29482 | 2018-07-18 22:02:48 +0000 | [diff] [blame] | 62 | # RUN: not ld.lld %t -z foo 2>&1 | FileCheck -check-prefix=ERR10 %s |
| 63 | # ERR10: unknown -z value: foo |
Rui Ueyama | 2fa0604 | 2018-06-27 07:22:27 +0000 | [diff] [blame] | 64 | |
George Rimar | ee981860 | 2018-10-15 14:21:43 +0000 | [diff] [blame] | 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 | |
Fangrui Song | 4a29482 | 2018-07-18 22:02:48 +0000 | [diff] [blame] | 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 |
Rui Ueyama | 53f6bfb | 2018-06-27 07:56:23 +0000 | [diff] [blame] | 70 | |
Rui Ueyama | cbe3926 | 2016-02-02 22:48:04 +0000 | [diff] [blame] | 71 | .globl _start |
| 72 | _start: |
| 73 | nop |