| 1 |
// Note: %s must be preceded by -- or bound to another option, otherwise it may |
| 2 |
// be interpreted as a command-line option, e.g. on Mac where %s is commonly |
| 3 |
// under /Users. |
| 4 |
|
| 5 |
// RUN: %clang_cl /Tc%s -fuse-ld=link -### /link foo bar baz 2>&1 | FileCheck --check-prefix=LINK %s |
| 6 |
// RUN: %clang_cl /Tc%s -fuse-ld=link -### /linkfoo bar baz 2>&1 | FileCheck --check-prefix=LINK %s |
| 7 |
// LINK: link.exe |
| 8 |
// LINK: "foo" |
| 9 |
// LINK: "bar" |
| 10 |
// LINK: "baz" |
| 11 |
|
| 12 |
// RUN: %clang_cl -m32 -arch:IA32 --target=i386-pc-win32 /Tc%s -fuse-ld=link -### -fsanitize=address 2>&1 | FileCheck --check-prefix=ASAN %s |
| 13 |
// ASAN: link.exe |
| 14 |
// ASAN: "-debug" |
| 15 |
// ASAN: "-incremental:no" |
| 16 |
// ASAN: "{{[^"]*}}clang_rt.asan_dynamic{{(-i386)?}}.lib" |
| 17 |
// ASAN: "-wholearchive:{{.*}}clang_rt.asan_static_runtime_thunk{{(-i386)?}}.lib" |
| 18 |
// ASAN: "{{.*}}cl-link{{.*}}.obj" |
| 19 |
|
| 20 |
// RUN: %clang_cl -m32 -arch:IA32 --target=i386-pc-win32 /MD /Tc%s -fuse-ld=link -### -fsanitize=address 2>&1 | FileCheck --check-prefix=ASAN-MD %s |
| 21 |
// ASAN-MD: link.exe |
| 22 |
// ASAN-MD: "-debug" |
| 23 |
// ASAN-MD: "-incremental:no" |
| 24 |
// ASAN-MD: "{{.*}}clang_rt.asan_dynamic{{(-i386)?}}.lib" |
| 25 |
// ASAN-MD: "-include:___asan_seh_interceptor" |
| 26 |
// ASAN-MD: "-wholearchive:{{.*}}clang_rt.asan_dynamic_runtime_thunk{{(-i386)?}}.lib" |
| 27 |
// ASAN-MD: "{{.*}}cl-link{{.*}}.obj" |
| 28 |
|
| 29 |
// RUN: %clang_cl /LD -fuse-ld=link -### /Tc%s 2>&1 | FileCheck --check-prefix=DLL %s |
| 30 |
// RUN: %clang_cl /LDd -fuse-ld=link -### /Tc%s 2>&1 | FileCheck --check-prefix=DLL %s |
| 31 |
// DLL: link.exe |
| 32 |
// "-dll" |
| 33 |
|
| 34 |
// RUN: %clang_cl -m32 -arch:IA32 --target=i386-pc-win32 /LD /Tc%s -fuse-ld=link -### -fsanitize=address 2>&1 | FileCheck --check-prefix=ASAN-DLL %s |
| 35 |
// RUN: not %clang_cl -m32 -arch:IA32 --target=i386-pc-win32 /LDd /Tc%s -fuse-ld=link -### -fsanitize=address 2>&1 | FileCheck --check-prefix=ASAN-DLL %s |
| 36 |
// ASAN-DLL: link.exe |
| 37 |
// ASAN-DLL: "-dll" |
| 38 |
// ASAN-DLL: "-debug" |
| 39 |
// ASAN-DLL: "-incremental:no" |
| 40 |
// ASAN-DLL: "{{.*}}clang_rt.asan_dynamic{{(-i386)?}}.lib" |
| 41 |
// ASAN-DLL: "-wholearchive:{{.*}}clang_rt.asan_static_runtime_thunk{{(-i386)?}}.lib" |
| 42 |
// ASAN-DLL: "{{.*}}cl-link{{.*}}.obj" |
| 43 |
|
| 44 |
// RUN: %clang_cl /Zi /Tc%s -fuse-ld=link -### 2>&1 | FileCheck --check-prefix=DEBUG %s |
| 45 |
// DEBUG: link.exe |
| 46 |
// DEBUG: "-debug" |
| 47 |
|
| 48 |
// Don't pass through /libpath: if it's not after a /link flag: |
| 49 |
// RUN: not %clang_cl /Tc%s /libpath:foo -fuse-ld=link -### /link /libpath:bar 2>&1 | FileCheck --check-prefix=LIBPATH %s |
| 50 |
// LIBPATH: error: no such file or directory: '/libpath:foo' |
| 51 |
// LIBPATH: libpath:bar |
| 52 |
|
| 53 |
// PR27234 |
| 54 |
// RUN: %clang_cl /Tc%s nonexistent.obj -fuse-ld=link -### /link /libpath:somepath 2>&1 | FileCheck --check-prefix=NONEXISTENT %s |
| 55 |
// RUN: %clang_cl /Tc%s nonexistent.lib -fuse-ld=link -### /link /libpath:somepath 2>&1 | FileCheck --check-prefix=NONEXISTENT %s |
| 56 |
// RUN: %clang_cl /Tc%s nonexistent.obj -fuse-ld=link -### /winsysroot somepath 2>&1 | FileCheck --check-prefix=NONEXISTENT %s |
| 57 |
// RUN: %clang_cl /Tc%s nonexistent.lib -fuse-ld=link -### /winsysroot somepath 2>&1 | FileCheck --check-prefix=NONEXISTENT %s |
| 58 |
// RUN: %clang_cl /Tc%s nonexistent.obj -fuse-ld=link -### 2>&1 | FileCheck --check-prefix=NONEXISTENT %s |
| 59 |
// RUN: %clang_cl /Tc%s nonexistent.lib -fuse-ld=link -### 2>&1 | FileCheck --check-prefix=NONEXISTENT %s |
| 60 |
// NONEXISTENT-NOT: no such file |
| 61 |
// NONEXISTENT: link.exe |
| 62 |
// NONEXISTENT: nonexistent |
| 63 |
|
| 64 |
// RUN: %clang_cl /Tc%s -fuse-ld=lld -### 2>&1 | FileCheck --check-prefix=USE_LLD %s |
| 65 |
// USE_LLD: lld-link |
| 66 |
|
| 67 |
// RUN: %clang_cl -m32 -arch:IA32 --target=i386-pc-win32 /Tc%s -fuse-ld=link -### -fsanitize=address 2>&1 | FileCheck --check-prefix=INFER-LINK %s |
| 68 |
// INFER-LINK: link.exe |
| 69 |
// INFER-LINK: /INFERASANLIBS:NO |
| 70 |
|
| 71 |
// RUN: %clang_cl -m32 -arch:IA32 --target=i386-pc-win32 /Tc%s -fuse-ld=lld -### -fsanitize=address 2>&1 | FileCheck --check-prefix=INFER-LLD %s |
| 72 |
// INFER-LLD: lld-link |
| 73 |
// INFER-LLD-NOT: INFERASANLIBS |
| 74 |
|
| 75 |
// RUN: %clang_cl --target=x86_64-unknown-windows-msvc /Tc%s -flto -fuse-ld=lld -### -fprofile-sample-use=%S/Inputs/file.prof 2>&1 | FileCheck -check-prefix=CHECK-SAMPLE-PROFILE %s |
| 76 |
// CHECK-SAMPLE-PROFILE: "-lto-sample-profile:{{.*}}/file.prof" |