1 // RUN: %clangxx -### %s --target=x86_64-unknown-fuchsia \
2 // RUN: -ccc-install-dir %S/Inputs/basic_fuchsia_tree/bin \
3 // RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
4 // RUN: --sysroot=%S/platform -fuse-ld=ld 2>&1 \
5 // RUN: | FileCheck -check-prefixes=CHECK,CHECK-X86_64 %s
6 // RUN: %clangxx -### %s --target=aarch64-unknown-fuchsia \
7 // RUN: -ccc-install-dir %S/Inputs/basic_fuchsia_tree/bin \
8 // RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
9 // RUN: --sysroot=%S/platform -fuse-ld=ld 2>&1 \
10 // RUN: | FileCheck -check-prefixes=CHECK,CHECK-AARCH64 %s
11 // RUN: %clangxx -### %s --target=riscv64-unknown-fuchsia \
12 // RUN: -ccc-install-dir %S/Inputs/basic_fuchsia_tree/bin \
13 // RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
14 // RUN: --sysroot=%S/platform -fuse-ld=ld 2>&1 \
15 // RUN: | FileCheck -check-prefixes=CHECK,CHECK-RISCV64 %s
16 // RUN: %clangxx -### %s --target=x86_64-fuchsia \
17 // RUN: -ccc-install-dir %S/Inputs/basic_fuchsia_tree/bin \
18 // RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
19 // RUN: --sysroot=%S/platform -fuse-ld=ld 2>&1 \
20 // RUN: | FileCheck -check-prefixes=CHECK,CHECK-X86_64 %s
21 // RUN: %clangxx -### %s --target=aarch64-fuchsia \
22 // RUN: -ccc-install-dir %S/Inputs/basic_fuchsia_tree/bin \
23 // RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
24 // RUN: --sysroot=%S/platform -fuse-ld=ld 2>&1 \
25 // RUN: | FileCheck -check-prefixes=CHECK,CHECK-AARCH64 %s
26 // RUN: %clangxx -### %s --target=riscv64-fuchsia \
27 // RUN: -ccc-install-dir %S/Inputs/basic_fuchsia_tree/bin \
28 // RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
29 // RUN: --sysroot=%S/platform -fuse-ld=ld 2>&1 \
30 // RUN: | FileCheck -check-prefixes=CHECK,CHECK-RISCV64 %s
32 // CHECK-X86_64: "-triple" "x86_64-unknown-fuchsia"
33 // CHECK-AARCH64: "-triple" "aarch64-unknown-fuchsia"
34 // CHECK-RISCV64: "-triple" "riscv64-unknown-fuchsia"
35 // CHECK-NOT: "-fno-use-init-array"
36 // CHECK: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
37 // CHECK: "-isysroot" "[[SYSROOT:[^"]+]]"
38 // CHECK-X86_64: "-internal-isystem" "{{.*[/\\]}}include{{/|\\\\}}x86_64-unknown-fuchsia{{/|\\\\}}c++{{/|\\\\}}v1"
39 // CHECK-AARCH64: "-internal-isystem" "{{.*[/\\]}}include{{/|\\\\}}aarch64-unknown-fuchsia{{/|\\\\}}c++{{/|\\\\}}v1"
40 // CHECK-RISCV64: "-internal-isystem" "{{.*[/\\]}}include{{/|\\\\}}riscv64-unknown-fuchsia{{/|\\\\}}c++{{/|\\\\}}v1"
41 // CHECK: "-internal-isystem" "{{.*[/\\]}}include{{/|\\\\}}c++{{/|\\\\}}v1"
42 // CHECK: "-internal-externc-isystem" "[[SYSROOT]]{{/|\\\\}}include"
43 // CHECK: {{.*}}ld.lld{{.*}}" "-z" "now" "-z" "start-stop-visibility=hidden" "-z" "rodynamic" "-z" "separate-loadable-segments" "-z" "rel" "--pack-dyn-relocs=relr"
44 // CHECK: "--sysroot=[[SYSROOT]]"
46 // CHECK: "--build-id"
47 // CHECK: "-dynamic-linker" "ld.so.1"
50 // CHECK-NOT: crtbegin.o
51 // CHECK: "-L[[SYSROOT]]{{/|\\\\}}lib"
52 // CHECK: "--push-state"
53 // CHECK: "--as-needed"
56 // CHECK: "--pop-state"
57 // CHECK-X86_64: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}x86_64-unknown-fuchsia{{/|\\\\}}libclang_rt.builtins.a"
58 // CHECK-AARCH64: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}aarch64-unknown-fuchsia{{/|\\\\}}libclang_rt.builtins.a"
59 // CHECK-RISCV64: "[[RESOURCE_DIR]]{{/|\\\\}}lib{{/|\\\\}}riscv64-unknown-fuchsia{{/|\\\\}}libclang_rt.builtins.a"
61 // CHECK-NOT: crtend.o
64 // RUN: not %clangxx -### %s --target=x86_64-unknown-fuchsia -stdlib=libstdc++ 2>&1 \
65 // RUN: | FileCheck %s -check-prefix=CHECK-STDLIB
66 // CHECK-STDLIB: error: invalid library name in argument '-stdlib=libstdc++'
68 // RUN: %clangxx -### %s --target=x86_64-unknown-fuchsia -static-libstdc++ \
69 // RUN: -fuse-ld=ld 2>&1 \
70 // RUN: | FileCheck %s -check-prefix=CHECK-STATIC
71 // CHECK-STATIC: "--push-state"
72 // CHECK-STATIC: "--as-needed"
73 // CHECK-STATIC: "-Bstatic"
74 // CHECK-STATIC: "-lc++"
75 // CHECK-STATIC: "-Bdynamic"
76 // CHECK-STATIC: "-lm"
77 // CHECK-STATIC: "--pop-state"
78 // CHECK-STATIC: "-lc"
80 // RUN: %clangxx -### %s --target=x86_64-unknown-fuchsia -nostdlib++ -fuse-ld=ld 2>&1 \
81 // RUN: | FileCheck %s -check-prefix=CHECK-NOSTDLIBXX
82 // CHECK-NOSTDLIBXX-NOT: "-lc++"
83 // CHECK-NOSTDLIBXX-NOT: "-lm"
84 // CHECK-NOSTDLIBXX: "-lc"
86 // RUN: %clangxx -### %s --target=x86_64-unknown-fuchsia \
87 // RUN: -ccc-install-dir %S/Inputs/basic_fuchsia_tree/bin \
88 // RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
89 // RUN: -fuse-ld=ld 2>&1\
90 // RUN: | FileCheck %s -check-prefixes=CHECK-MULTILIB-X86
91 // RUN: %clangxx -### %s --target=x86_64-unknown-fuchsia -fsanitize=address \
92 // RUN: -ccc-install-dir %S/Inputs/basic_fuchsia_tree/bin \
93 // RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
94 // RUN: -fuse-ld=ld 2>&1\
95 // RUN: | FileCheck %s -check-prefixes=CHECK-MULTILIB-X86,CHECK-MULTILIB-ASAN-X86
96 // RUN: %clangxx -### %s --target=x86_64-unknown-fuchsia -fno-exceptions \
97 // RUN: -ccc-install-dir %S/Inputs/basic_fuchsia_tree/bin \
98 // RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
99 // RUN: -fuse-ld=ld 2>&1\
100 // RUN: | FileCheck %s -check-prefixes=CHECK-MULTILIB-X86,CHECK-MULTILIB-NOEXCEPT-X86
101 // RUN: %clangxx -### %s --target=x86_64-unknown-fuchsia -fsanitize=address -fno-exceptions \
102 // RUN: -ccc-install-dir %S/Inputs/basic_fuchsia_tree/bin \
103 // RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
104 // RUN: -fuse-ld=ld 2>&1\
105 // RUN: | FileCheck %s -check-prefixes=CHECK-MULTILIB-X86,CHECK-MULTILIB-ASAN-NOEXCEPT-X86
106 // RUN: %clangxx -### %s --target=x86_64-unknown-fuchsia -fsanitize=hwaddress \
107 // RUN: -ccc-install-dir %S/Inputs/basic_fuchsia_tree/bin \
108 // RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
109 // RUN: -fuse-ld=ld 2>&1\
110 // RUN: | FileCheck %s -check-prefixes=CHECK-MULTILIB-X86,CHECK-MULTILIB-HWASAN-X86
111 // RUN: %clangxx -### %s --target=x86_64-unknown-fuchsia -fsanitize=hwaddress -fno-exceptions \
112 // RUN: -ccc-install-dir %S/Inputs/basic_fuchsia_tree/bin \
113 // RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
114 // RUN: -fuse-ld=ld 2>&1\
115 // RUN: | FileCheck %s -check-prefixes=CHECK-MULTILIB-X86,CHECK-MULTILIB-HWASAN-NOEXCEPT-X86
117 // Test compat multilibs.
118 // RUN: %clangxx -### %s --target=x86_64-unknown-fuchsia -fc++-abi=itanium \
119 // RUN: -ccc-install-dir %S/Inputs/basic_fuchsia_tree/bin \
120 // RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
121 // RUN: -fuse-ld=ld 2>&1\
122 // RUN: | FileCheck %s -check-prefixes=CHECK-MULTILIB-X86,CHECK-MULTILIB-COMPAT-X86
123 // RUN: %clangxx -### %s --target=x86_64-unknown-fuchsia -fc++-abi=itanium -fc++-abi=fuchsia \
124 // RUN: -ccc-install-dir %S/Inputs/basic_fuchsia_tree/bin \
125 // RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
126 // RUN: -fuse-ld=ld 2>&1\
127 // RUN: | FileCheck %s -check-prefixes=CHECK-MULTILIB-X86
128 // RUN: %clangxx -### %s --target=x86_64-unknown-fuchsia -fc++-abi=fuchsia -fc++-abi=itanium \
129 // RUN: -ccc-install-dir %S/Inputs/basic_fuchsia_tree/bin \
130 // RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
131 // RUN: -fuse-ld=ld 2>&1\
132 // RUN: | FileCheck %s -check-prefixes=CHECK-MULTILIB-X86,CHECK-MULTILIB-COMPAT-X86
133 // CHECK-MULTILIB-X86: "-resource-dir" "[[RESOURCE_DIR:[^"]+]]"
134 // CHECK-MULTILIB-ASAN-X86: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}lib{{/|\\\\}}x86_64-unknown-fuchsia{{/|\\\\}}asan"
135 // CHECK-MULTILIB-NOEXCEPT-X86: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}lib{{/|\\\\}}x86_64-unknown-fuchsia{{/|\\\\}}noexcept"
136 // CHECK-MULTILIB-ASAN-NOEXCEPT-X86: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}lib{{/|\\\\}}x86_64-unknown-fuchsia{{/|\\\\}}asan+noexcept"
137 // CHECK-MULTILIB-HWASAN-X86: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}lib{{/|\\\\}}x86_64-unknown-fuchsia{{/|\\\\}}hwasan"
138 // CHECK-MULTILIB-HWASAN-NOEXCEPT-X86: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}lib{{/|\\\\}}x86_64-unknown-fuchsia{{/|\\\\}}hwasan+noexcept"
139 // CHECK-MULTILIB-COMPAT-X86: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}lib{{/|\\\\}}x86_64-unknown-fuchsia{{/|\\\\}}compat"
140 // CHECK-MULTILIB-X86: "-L{{.*}}{{/|\\\\}}..{{/|\\\\}}lib{{/|\\\\}}x86_64-unknown-fuchsia"
142 // Check that -print-multi-directory only outputs one multilib directory.
143 // This may be relaxed later but for now preserve existing behaviour.
144 // RUN: %clangxx -print-multi-directory --target=x86_64-unknown-fuchsia -fsanitize=address -fno-exceptions \
145 // RUN: -ccc-install-dir %S/Inputs/basic_fuchsia_tree/bin \
146 // RUN: -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir \
147 // RUN: | FileCheck %s -check-prefixes=CHECK-PRINT-MULTI-LIB
148 // CHECK-PRINT-MULTI-LIB-NOT: .
149 // CHECK-PRINT-MULTI-LIB-NOT: noexcept
150 // CHECK-PRINT-MULTI-LIB-NOT: asan
151 // CHECK-PRINT-MULTI-LIB: asan+noexcept