1 // Test that gcc-toolchain option is working correctly
2 //
3 // RUN: %clangxx -no-canonical-prefixes %s -### -o %t 2>&1 \
4 // RUN:   --target=x86_64-linux-gnu --gcc-toolchain=%S/Inputs/ubuntu_14.04_multiarch_tree/usr | \
5 // RUN:   FileCheck %s
6 //
7 // Additionally check that the legacy spelling of the flag works.
8 // RUN: %clangxx -no-canonical-prefixes %s -### -o %t 2>&1 \
9 // RUN:   --target=x86_64-linux-gnu -gcc-toolchain %S/Inputs/ubuntu_14.04_multiarch_tree/usr | \
10 // RUN:   FileCheck %s
11 //
12 // Test for header search toolchain detection.
13 // CHECK: "-internal-isystem"
14 // CHECK: "[[TOOLCHAIN:[^"]+]]/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8"
15 // CHECK: "-internal-isystem"
16 // CHECK: "[[TOOLCHAIN]]/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/x86_64-linux-gnu/c++/4.8"
17 // CHECK: "-internal-isystem"
18 // CHECK: "[[TOOLCHAIN]]/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/backward"
19 // CHECK: "-internal-isystem" "/usr/local/include"
20 //
21 // Test for linker toolchain detection. Note that only the '-L' flags will use
22 // the same precise formatting of the path as the '-internal-system' flags
23 // above, so we just blanket wildcard match the 'crtbegin.o'.
24 // CHECK: "{{[^"]*}}ld{{(.exe)?}}"
25 // CHECK-SAME: "{{[^"]*}}/usr/lib/gcc/x86_64-linux-gnu/4.8{{/|\\\\}}crtbegin.o"
26 // CHECK-SAME: "-L[[TOOLCHAIN]]/usr/lib/gcc/x86_64-linux-gnu/4.8"
27 // CHECK-SAME: "-L[[TOOLCHAIN]]/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu"
28 
29 /// Test we don't detect GCC installation under -B.
30 // RUN: %clangxx -no-canonical-prefixes %s -### -o %t 2>&1 \
31 // RUN:   --target=aarch64-suse-linux --gcc-toolchain=%S/Inputs/opensuse_42.2_aarch64_tree/usr | \
32 // RUN:   FileCheck %s --check-prefix=AARCH64
33 // RUN: %clangxx -no-canonical-prefixes %s -### -o %t 2>&1 \
34 // RUN:   --target=aarch64-suse-linux -B%S/Inputs/opensuse_42.2_aarch64_tree/usr | \
35 // RUN:   FileCheck %s --check-prefix=NO_AARCH64
36 
37 // AARCH64:        Inputs{{[^"]+}}aarch64-suse-linux/{{[^"]+}}crt1.o"
38 // NO_AARCH64-NOT: Inputs{{[^"]+}}aarch64-suse-linux/{{[^"]+}}crt1.o"
39