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 -### /link foo bar baz 2>&1 | FileCheck --check-prefix=LINK %s
6 // RUN: %clang_cl /Tc%s -### /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 -### -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-i386.lib"
17 // ASAN: "-wholearchive:{{.*}}clang_rt.asan-i386.lib"
18 // ASAN: "{{[^"]*}}clang_rt.asan_cxx-i386.lib"
19 // ASAN: "-wholearchive:{{.*}}clang_rt.asan_cxx-i386.lib"
20 // ASAN: "{{.*}}cl-link{{.*}}.obj"
21 
22 // RUN: %clang_cl -m32 -arch:IA32 --target=i386-pc-win32 /MD /Tc%s -### -fsanitize=address 2>&1 | FileCheck --check-prefix=ASAN-MD %s
23 // ASAN-MD: link.exe
24 // ASAN-MD: "-debug"
25 // ASAN-MD: "-incremental:no"
26 // ASAN-MD: "{{.*}}clang_rt.asan_dynamic-i386.lib"
27 // ASAN-MD: "{{[^"]*}}clang_rt.asan_dynamic_runtime_thunk-i386.lib"
28 // ASAN-MD: "-include:___asan_seh_interceptor"
29 // ASAN-MD: "-wholearchive:{{.*}}clang_rt.asan_dynamic_runtime_thunk-i386.lib"
30 // ASAN-MD: "{{.*}}cl-link{{.*}}.obj"
31 
32 // RUN: %clang_cl /LD -### /Tc%s 2>&1 | FileCheck --check-prefix=DLL %s
33 // RUN: %clang_cl /LDd -### /Tc%s 2>&1 | FileCheck --check-prefix=DLL %s
34 // DLL: link.exe
35 // "-dll"
36 
37 // RUN: %clang_cl -m32 -arch:IA32 --target=i386-pc-win32 /LD /Tc%s -### -fsanitize=address 2>&1 | FileCheck --check-prefix=ASAN-DLL %s
38 // RUN: %clang_cl -m32 -arch:IA32 --target=i386-pc-win32 /LDd /Tc%s -### -fsanitize=address 2>&1 | FileCheck --check-prefix=ASAN-DLL %s
39 // ASAN-DLL: link.exe
40 // ASAN-DLL: "-dll"
41 // ASAN-DLL: "-debug"
42 // ASAN-DLL: "-incremental:no"
43 // ASAN-DLL: "{{.*}}clang_rt.asan_dll_thunk-i386.lib"
44 // ASAN-DLL: "{{.*}}cl-link{{.*}}.obj"
45 
46 // RUN: %clang_cl /Zi /Tc%s -### 2>&1 | FileCheck --check-prefix=DEBUG %s
47 // DEBUG: link.exe
48 // DEBUG: "-debug"
49 
50 // PR27234
51 // RUN: %clang_cl /Tc%s nonexistent.obj -### /link /libpath:somepath 2>&1 | FileCheck --check-prefix=NONEXISTENT %s
52 // RUN: %clang_cl /Tc%s nonexistent.lib -### /link /libpath:somepath 2>&1 | FileCheck --check-prefix=NONEXISTENT %s
53 // NONEXISTENT-NOT: no such file
54 // NONEXISTENT: link.exe
55 // NONEXISTENT: "/libpath:somepath"
56 // NONEXISTENT: nonexistent
57 
58 // RUN: %clang_cl /Tc%s -fuse-ld=lld -### 2>&1 | FileCheck --check-prefix=USE_LLD %s
59 // USE_LLD: lld-link
60