1 // Test instrumented profiling ld flags.
2 //
3 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
4 // RUN:     -target i386-unknown-linux -fprofile-instr-generate \
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
8 //
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"
11 //
12 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
13 // RUN:     -target x86_64-unknown-linux -fprofile-instr-generate \
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
17 //
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"
20 //
21 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
22 // RUN:     -target x86_64-unknown-linux -fprofile-instr-generate -nostdlib \
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
26 //
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"
29 //
30 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
31 // RUN:     -target x86_64-unknown-freebsd -fprofile-instr-generate \
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
35 //
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"
38 //
39 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
40 // RUN:     -shared \
41 // RUN:     -target i386-unknown-linux -fprofile-instr-generate \
42 // RUN:     -resource-dir=%S/Inputs/resource_dir \
43 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
44 // RUN:   | FileCheck --check-prefix=CHECK-LINUX-I386-SHARED %s
45 //
46 // CHECK-LINUX-I386-SHARED: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
47 // CHECK-LINUX-I386-SHARED: "{{.*}}/Inputs/resource_dir{{/|\\\\}}lib{{/|\\\\}}linux{{/|\\\\}}libclang_rt.profile-i386.a" {{.*}} "-lc"
48 //
49 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
50 // RUN:     -shared \
51 // RUN:     -target x86_64-unknown-linux -fprofile-instr-generate \
52 // RUN:     -resource-dir=%S/Inputs/resource_dir \
53 // RUN:     --sysroot=%S/Inputs/basic_linux_tree \
54 // RUN:   | FileCheck --check-prefix=CHECK-LINUX-X86-64-SHARED %s
55 //
56 // CHECK-LINUX-X86-64-SHARED: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
57 // CHECK-LINUX-X86-64-SHARED: "{{.*}}/Inputs/resource_dir{{/|\\\\}}lib{{/|\\\\}}linux{{/|\\\\}}libclang_rt.profile-x86_64.a" {{.*}} "-lc"
58 //
59 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
60 // RUN:     -shared \
61 // RUN:     -target x86_64-unknown-freebsd -fprofile-instr-generate \
62 // RUN:     -resource-dir=%S/Inputs/resource_dir \
63 // RUN:     --sysroot=%S/Inputs/basic_freebsd64_tree \
64 // RUN:   | FileCheck --check-prefix=CHECK-FREEBSD-X86-64-SHARED %s
65 //
66 // CHECK-FREEBSD-X86-64-SHARED: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
67 // CHECK-FREEBSD-X86-64-SHARED: "{{.*}}/Inputs/resource_dir{{/|\\\\}}lib{{/|\\\\}}freebsd{{/|\\\\}}libclang_rt.profile-x86_64.a"
68 //
69 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
70 // RUN:     -target x86_64-apple-darwin14 -fprofile-instr-generate \
71 // RUN:     -resource-dir=%S/Inputs/resource_dir \
72 // RUN:   | FileCheck --check-prefix=CHECK-DARWIN-X86-64 %s
73 //
74 // CHECK-DARWIN-X86-64: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
75 // CHECK-DARWIN-X86-64: "{{.*}}/Inputs/resource_dir{{/|\\\\}}lib{{/|\\\\}}darwin{{/|\\\\}}libclang_rt.profile_osx.a"
76 //
77 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
78 // RUN:     -target x86_64-apple-darwin14 -fprofile-instr-generate -nostdlib \
79 // RUN:     -resource-dir=%S/Inputs/resource_dir \
80 // RUN:   | FileCheck --check-prefix=CHECK-DARWIN-NOSTDLIB-X86-64 %s
81 //
82 // CHECK-DARWIN-NOSTDLIB-X86-64: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
83 // CHECK-DARWIN-NOSTDLIB-X86-64: "{{.*}}/Inputs/resource_dir{{/|\\\\}}lib{{/|\\\\}}darwin{{/|\\\\}}libclang_rt.profile_osx.a"
84 //
85 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
86 // RUN:     -target arm64-apple-ios -fprofile-instr-generate \
87 // RUN:     -resource-dir=%S/Inputs/resource_dir \
88 // RUN:   | FileCheck --check-prefix=CHECK-DARWIN-ARM64 %s
89 //
90 // CHECK-DARWIN-ARM64: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
91 // CHECK-DARWIN-ARM64: "{{.*}}/Inputs/resource_dir{{/|\\\\}}lib{{/|\\\\}}darwin{{/|\\\\}}libclang_rt.profile_ios.a"
92 //
93 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
94 // RUN:     -target armv7-apple-darwin -mtvos-version-min=8.3 -fprofile-instr-generate \
95 // RUN:     -resource-dir=%S/Inputs/resource_dir \
96 // RUN:   | FileCheck --check-prefix=CHECK-TVOS-ARMV7 %s
97 //
98 // CHECK-TVOS-ARMV7: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
99 // CHECK-TVOS-ARMV7: "{{.*}}/Inputs/resource_dir{{/|\\\\}}lib{{/|\\\\}}darwin{{/|\\\\}}libclang_rt.profile_tvos.a"
100 //
101 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
102 // RUN:     -target armv7s-apple-darwin10 -mwatchos-version-min=2.0 -arch armv7k -fprofile-instr-generate \
103 // RUN:     -resource-dir=%S/Inputs/resource_dir \
104 // RUN:   | FileCheck --check-prefix=CHECK-WATCHOS-ARMV7 %s
105 //
106 // CHECK-WATCHOS-ARMV7: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
107 // CHECK-WATCHOS-ARMV7: "{{.*}}/Inputs/resource_dir{{/|\\\\}}lib{{/|\\\\}}darwin{{/|\\\\}}libclang_rt.profile_watchos.a"
108 //
109 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
110 // RUN:     -target i386-pc-win32 -fprofile-instr-generate \
111 // RUN:     -resource-dir=%S/Inputs/resource_dir \
112 // RUN:   | FileCheck --check-prefix=CHECK-WINDOWS-I386 %s
113 //
114 // CHECK-WINDOWS-I386: "{{.*}}link{{(.exe)?}}"
115 // CHECK-WINDOWS-I386: "{{.*}}clang_rt.profile-i386.lib"
116 //
117 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
118 // RUN:     -target x86_64-pc-win32 -fprofile-instr-generate \
119 // RUN:     -resource-dir=%S/Inputs/resource_dir \
120 // RUN:   | FileCheck --check-prefix=CHECK-WINDOWS-X86-64 %s
121 //
122 // CHECK-WINDOWS-X86-64: "{{.*}}link{{(.exe)?}}"
123 // CHECK-WINDOWS-X86-64: "{{.*}}clang_rt.profile-x86_64.lib"
124