1 // Test instrumented profiling ld flags.
3 // RUN: %clang -### %s 2>&1 \
4 // RUN: --target=i386-unknown-linux -fprofile-instr-generate -fuse-ld=ld \
5 // RUN: -resource-dir=%S/Inputs/resource_dir \
6 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
7 // RUN: | FileCheck --check-prefix=CHECK-LINUX-I386 %s
9 // CHECK-LINUX-I386: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
10 // CHECK-LINUX-I386: "{{.*}}/Inputs/resource_dir{{/|\\\\}}lib{{/|\\\\}}linux{{/|\\\\}}libclang_rt.profile-i386.a" {{.*}} "-lc"
12 // RUN: %clang -### %s 2>&1 \
13 // RUN: --target=x86_64-unknown-linux -fprofile-instr-generate -fuse-ld=ld \
14 // RUN: -resource-dir=%S/Inputs/resource_dir \
15 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
16 // RUN: | FileCheck --check-prefix=CHECK-LINUX-X86-64 %s
18 // CHECK-LINUX-X86-64: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
19 // CHECK-LINUX-X86-64: "{{.*}}/Inputs/resource_dir{{/|\\\\}}lib{{/|\\\\}}linux{{/|\\\\}}libclang_rt.profile-x86_64.a" {{.*}} "-lc"
21 // RUN: %clang -### %s 2>&1 \
22 // RUN: --target=x86_64-unknown-linux -fprofile-instr-generate -nostdlib -fuse-ld=ld \
23 // RUN: -resource-dir=%S/Inputs/resource_dir \
24 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
25 // RUN: | FileCheck --check-prefix=CHECK-LINUX-NOSTDLIB-X86-64 %s
27 // CHECK-LINUX-NOSTDLIB-X86-64: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
28 // CHECK-LINUX-NOSTDLIB-X86-64: "{{.*}}/Inputs/resource_dir{{/|\\\\}}lib{{/|\\\\}}linux{{/|\\\\}}libclang_rt.profile-x86_64.a"
30 // RUN: %clang -### %s 2>&1 \
31 // RUN: --target=x86_64-unknown-freebsd -fprofile-instr-generate -fuse-ld=ld \
32 // RUN: -resource-dir=%S/Inputs/resource_dir \
33 // RUN: --sysroot=%S/Inputs/basic_freebsd64_tree \
34 // RUN: | FileCheck --check-prefix=CHECK-FREEBSD-X86-64 %s
36 // CHECK-FREEBSD-X86-64: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
37 // CHECK-FREEBSD-X86-64: "{{.*}}/Inputs/resource_dir{{/|\\\\}}lib{{/|\\\\}}freebsd{{/|\\\\}}libclang_rt.profile-x86_64.a"
39 // RUN: %clang -### %s 2>&1 \
40 // RUN: --target=x86_64-unknown-netbsd -fprofile-instr-generate -fuse-ld=ld \
41 // RUN: -resource-dir=%S/Inputs/resource_dir \
42 // RUN: --sysroot=%S/Inputs/basic_netbsd_tree \
43 // RUN: | FileCheck --check-prefix=CHECK-NETBSD-X86-64 %s
45 // CHECK-NETBSD-X86-64: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
46 // CHECK-NETBSD-X86-64: "{{.*}}/Inputs/resource_dir{{/|\\\\}}lib{{/|\\\\}}netbsd{{/|\\\\}}libclang_rt.profile-x86_64.a"
48 // RUN: %clang -### %s 2>&1 \
49 // RUN: --target=x86_64-unknown-openbsd -fprofile-instr-generate -fuse-ld=ld \
50 // RUN: -resource-dir=%S/Inputs/resource_dir \
51 // RUN: --sysroot=%S/Inputs/basic_openbsd_tree \
52 // RUN: | FileCheck --check-prefix=CHECK-OPENBSD-X86-64 %s
54 // CHECK-OPENBSD-X86-64: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
55 // CHECK-OPENBSD-X86-64: "{{.*}}/Inputs/resource_dir{{/|\\\\}}lib{{/|\\\\}}openbsd{{/|\\\\}}libclang_rt.profile-x86_64.a"
57 // RUN: %clang -### %s 2>&1 \
59 // RUN: --target=i386-unknown-linux -fprofile-instr-generate -fuse-ld=ld \
60 // RUN: -resource-dir=%S/Inputs/resource_dir \
61 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
62 // RUN: | FileCheck --check-prefix=CHECK-LINUX-I386-SHARED %s
64 // CHECK-LINUX-I386-SHARED: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
65 // CHECK-LINUX-I386-SHARED: "{{.*}}/Inputs/resource_dir{{/|\\\\}}lib{{/|\\\\}}linux{{/|\\\\}}libclang_rt.profile-i386.a" {{.*}} "-lc"
67 // RUN: %clang -### %s 2>&1 \
69 // RUN: --target=x86_64-unknown-linux -fprofile-instr-generate -fuse-ld=ld \
70 // RUN: -resource-dir=%S/Inputs/resource_dir \
71 // RUN: --sysroot=%S/Inputs/basic_linux_tree \
72 // RUN: | FileCheck --check-prefix=CHECK-LINUX-X86-64-SHARED %s
74 // CHECK-LINUX-X86-64-SHARED: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
75 // CHECK-LINUX-X86-64-SHARED: "{{.*}}/Inputs/resource_dir{{/|\\\\}}lib{{/|\\\\}}linux{{/|\\\\}}libclang_rt.profile-x86_64.a" {{.*}} "-lc"
77 // RUN: %clang -### %s 2>&1 \
79 // RUN: --target=x86_64-unknown-freebsd -fprofile-instr-generate -fuse-ld=ld \
80 // RUN: -resource-dir=%S/Inputs/resource_dir \
81 // RUN: --sysroot=%S/Inputs/basic_freebsd64_tree \
82 // RUN: | FileCheck --check-prefix=CHECK-FREEBSD-X86-64-SHARED %s
84 // CHECK-FREEBSD-X86-64-SHARED: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
85 // CHECK-FREEBSD-X86-64-SHARED: "{{.*}}/Inputs/resource_dir{{/|\\\\}}lib{{/|\\\\}}freebsd{{/|\\\\}}libclang_rt.profile-x86_64.a"
87 // RUN: %clang -### %s 2>&1 \
89 // RUN: --target=x86_64-unknown-netbsd -fprofile-instr-generate -fuse-ld=ld \
90 // RUN: -resource-dir=%S/Inputs/resource_dir \
91 // RUN: --sysroot=%S/Inputs/basic_netbsd_tree \
92 // RUN: | FileCheck --check-prefix=CHECK-NETBSD-X86-64-SHARED %s
94 // CHECK-NETBSD-X86-64-SHARED: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
95 // CHECK-NETBSD-X86-64-SHARED: "{{.*}}/Inputs/resource_dir{{/|\\\\}}lib{{/|\\\\}}netbsd{{/|\\\\}}libclang_rt.profile-x86_64.a"
97 // RUN: %clang -### %s 2>&1 \
99 // RUN: --target=x86_64-unknown-openbsd -fprofile-instr-generate -fuse-ld=ld \
100 // RUN: -resource-dir=%S/Inputs/resource_dir \
101 // RUN: --sysroot=%S/Inputs/basic_openbsd_tree \
102 // RUN: | FileCheck --check-prefix=CHECK-OPENBSD-X86-64-SHARED %s
104 // CHECK-OPENBSD-X86-64-SHARED: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
105 // CHECK-OPENBSD-X86-64-SHARED: "{{.*}}/Inputs/resource_dir{{/|\\\\}}lib{{/|\\\\}}openbsd{{/|\\\\}}libclang_rt.profile-x86_64.a"
107 // RUN: %clang -### %s 2>&1 \
108 // RUN: --target=x86_64-apple-darwin14 -fprofile-instr-generate -fuse-ld=ld \
109 // RUN: -resource-dir=%S/Inputs/resource_dir \
110 // RUN: | FileCheck --check-prefix=CHECK-DARWIN-X86-64 %s
112 // CHECK-DARWIN-X86-64: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
113 // CHECK-DARWIN-X86-64: "{{.*}}/Inputs/resource_dir{{/|\\\\}}lib{{/|\\\\}}darwin{{/|\\\\}}libclang_rt.profile_osx.a"
115 // RUN: %clang -### %s 2>&1 \
116 // RUN: --target=x86_64-apple-darwin14 -fprofile-instr-generate -nostdlib -fuse-ld=ld \
117 // RUN: -resource-dir=%S/Inputs/resource_dir \
118 // RUN: | FileCheck --check-prefix=CHECK-DARWIN-NOSTDLIB-X86-64 %s
120 // CHECK-DARWIN-NOSTDLIB-X86-64: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
121 // CHECK-DARWIN-NOSTDLIB-X86-64: "{{.*}}/Inputs/resource_dir{{/|\\\\}}lib{{/|\\\\}}darwin{{/|\\\\}}libclang_rt.profile_osx.a"
123 // RUN: %clang -### %s 2>&1 \
124 // RUN: --target=arm64-apple-ios -fprofile-instr-generate -fuse-ld=ld \
125 // RUN: -resource-dir=%S/Inputs/resource_dir \
126 // RUN: | FileCheck --check-prefix=CHECK-DARWIN-ARM64 %s
128 // CHECK-DARWIN-ARM64: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
129 // CHECK-DARWIN-ARM64: "{{.*}}/Inputs/resource_dir{{/|\\\\}}lib{{/|\\\\}}darwin{{/|\\\\}}libclang_rt.profile_ios.a"
131 // RUN: %clang -### %s 2>&1 \
132 // RUN: --target=armv7-apple-darwin -mtvos-version-min=8.3 -fprofile-instr-generate -fuse-ld=ld \
133 // RUN: -resource-dir=%S/Inputs/resource_dir \
134 // RUN: | FileCheck --check-prefix=CHECK-TVOS-ARMV7 %s
136 // CHECK-TVOS-ARMV7: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
137 // CHECK-TVOS-ARMV7: "{{.*}}/Inputs/resource_dir{{/|\\\\}}lib{{/|\\\\}}darwin{{/|\\\\}}libclang_rt.profile_tvos.a"
139 // RUN: %clang -### %s 2>&1 \
140 // RUN: --target=armv7s-apple-darwin10 -mwatchos-version-min=2.0 -arch armv7k -fprofile-instr-generate -fuse-ld=ld \
141 // RUN: -resource-dir=%S/Inputs/resource_dir \
142 // RUN: | FileCheck --check-prefix=CHECK-WATCHOS-ARMV7 %s
144 // CHECK-WATCHOS-ARMV7: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
145 // CHECK-WATCHOS-ARMV7: "{{.*}}/Inputs/resource_dir{{/|\\\\}}lib{{/|\\\\}}darwin{{/|\\\\}}libclang_rt.profile_watchos.a"
147 // RUN: %clang -### %s 2>&1 \
148 // RUN: -target x86_64-apple-driverkit19.0 -arch x86_64 -fprofile-instr-generate -fuse-ld=ld \
149 // RUN: -resource-dir=%S/Inputs/resource_dir \
150 // RUN: | FileCheck --check-prefix=CHECK-DRIVERKIT-X86_64 %s
152 // CHECK-DRIVERKIT-X86_64: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
153 // CHECK-DRIVERKIT-X86_64: "{{.*}}/Inputs/resource_dir{{/|\\\\}}lib{{/|\\\\}}darwin{{/|\\\\}}libclang_rt.profile_driverkit.a"
155 // RUN: %clang -### %s 2>&1 \
156 // RUN: --target=i386-pc-win32 -fprofile-instr-generate \
157 // RUN: -resource-dir=%S/Inputs/resource_dir -fuse-ld=link \
158 // RUN: | FileCheck --check-prefix=CHECK-WINDOWS-I386 %s
160 // CHECK-WINDOWS-I386: "{{.*}}link{{(.exe)?}}"
161 // CHECK-WINDOWS-I386: "{{.*}}clang_rt.profile{{(-i386)?}}.lib"
163 // RUN: %clang -### %s 2>&1 \
164 // RUN: --target=x86_64-pc-win32 -fprofile-instr-generate \
165 // RUN: -resource-dir=%S/Inputs/resource_dir -fuse-ld=link \
166 // RUN: | FileCheck --check-prefix=CHECK-WINDOWS-X86-64 %s
168 // CHECK-WINDOWS-X86-64: "{{.*}}link{{(.exe)?}}"
169 // CHECK-WINDOWS-X86-64: "{{.*}}clang_rt.profile{{(-x86_64)?}}.lib"
171 // RUN: %clang -### %s 2>&1 \
172 // RUN: --target=x86_64-mingw32 -fprofile-instr-generate -fuse-ld=ld \
173 // RUN: -resource-dir=%S/Inputs/resource_dir \
174 // RUN: | FileCheck --check-prefix=CHECK-MINGW-X86-64 %s
176 // CHECK-MINGW-X86-64: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
177 // CHECK-MINGW-X86-64: "{{.*}}/Inputs/resource_dir{{/|\\\\}}lib{{/|\\\\}}windows{{/|\\\\}}libclang_rt.profile-x86_64.a"
179 // Test instrumented profiling dependent-lib flags
181 // RUN: %clang -### %s --target=x86_64-pc-win32 \
182 // RUN: -fprofile-instr-generate 2>&1 \
183 // RUN: | FileCheck --check-prefix=CHECK-WINDOWS-X86-64-DEPENDENT-LIB %s
185 // CHECK-WINDOWS-X86-64-DEPENDENT-LIB: "--dependent-lib={{[^"]*}}clang_rt.profile{{[^"]*}}.lib"
187 // RUN: %clang -### %s --target=x86_64-mingw32 \
188 // RUN: -fprofile-instr-generate 2>&1 \
189 // RUN: | FileCheck --check-prefix=CHECK-MINGW-X86-64-DEPENDENT-LIB %s
191 // CHECK-MINGW-X86-64-DEPENDENT-LIB-NOT: "--dependent-lib={{[^"]*}}clang_rt.profile-{{[^"]*}}.a"