1 // RUN: %clangxx --target=x86_64-unknown-netbsd \
2 // RUN: -stdlib=platform --sysroot=%S/Inputs/basic_netbsd_tree -### %s 2>&1 \
3 // RUN: | FileCheck -check-prefix=X86_64 %s
4 // RUN: %clangxx --target=aarch64-unknown-netbsd \
5 // RUN: -stdlib=platform --sysroot=%S/Inputs/basic_netbsd_tree -### %s 2>&1 \
6 // RUN: | FileCheck -check-prefix=AARCH64 %s
7 // RUN: %clangxx --target=aarch64_be-unknown-netbsd \
8 // RUN: -stdlib=platform --sysroot=%S/Inputs/basic_netbsd_tree -### %s 2>&1 \
9 // RUN: | FileCheck -check-prefix=AARCH64_BE %s
10 // RUN: %clangxx --target=riscv32-unknown-netbsd \
11 // RUN: -stdlib=platform --sysroot=%S/Inputs/basic_netbsd_tree -### %s 2>&1 \
12 // RUN: | FileCheck -check-prefix=RISCV32 %s
13 // RUN: %clangxx --target=riscv64-unknown-netbsd \
14 // RUN: -stdlib=platform --sysroot=%S/Inputs/basic_netbsd_tree -### %s 2>&1 \
15 // RUN: | FileCheck -check-prefix=RISCV64 %s
16 // RUN: %clangxx --target=sparc-unknown-netbsd \
17 // RUN: -stdlib=platform --sysroot=%S/Inputs/basic_netbsd_tree -### %s 2>&1 \
18 // RUN: | FileCheck -check-prefix=SPARC %s
19 // RUN: %clangxx --target=sparc64-unknown-netbsd \
20 // RUN: -stdlib=platform --sysroot=%S/Inputs/basic_netbsd_tree -### %s 2>&1 \
21 // RUN: | FileCheck -check-prefix=SPARC64 %s
22 // RUN: %clangxx --target=powerpc-unknown-netbsd \
23 // RUN: -stdlib=platform --sysroot=%S/Inputs/basic_netbsd_tree -### %s 2>&1 \
24 // RUN: | FileCheck -check-prefix=POWERPC %s
25 // RUN: %clangxx --target=powerpc64-unknown-netbsd \
26 // RUN: -stdlib=platform --sysroot=%S/Inputs/basic_netbsd_tree -### %s 2>&1 \
27 // RUN: | FileCheck -check-prefix=POWERPC64 %s
29 // RUN: %clangxx --target=x86_64-unknown-netbsd -static \
30 // RUN: -stdlib=platform --sysroot=%S/Inputs/basic_netbsd_tree -### %s 2>&1 \
31 // RUN: | FileCheck -check-prefix=S-X86_64 %s
32 // RUN: %clangxx --target=aarch64-unknown-netbsd -static \
33 // RUN: -stdlib=platform --sysroot=%S/Inputs/basic_netbsd_tree -### %s 2>&1 \
34 // RUN: | FileCheck -check-prefix=S-AARCH64 %s
35 // RUN: %clangxx --target=aarch64_be-unknown-netbsd -static \
36 // RUN: -stdlib=platform --sysroot=%S/Inputs/basic_netbsd_tree -### %s 2>&1 \
37 // RUN: | FileCheck -check-prefix=S-AARCH64_BE %s
38 // RUN: %clangxx --target=riscv32-unknown-netbsd -static \
39 // RUN: -stdlib=platform --sysroot=%S/Inputs/basic_netbsd_tree -### %s 2>&1 \
40 // RUN: | FileCheck -check-prefix=S-RISCV32 %s
41 // RUN: %clangxx --target=riscv64-unknown-netbsd -static \
42 // RUN: -stdlib=platform --sysroot=%S/Inputs/basic_netbsd_tree -### %s 2>&1 \
43 // RUN: | FileCheck -check-prefix=S-RISCV64 %s
44 // RUN: %clangxx --target=sparc-unknown-netbsd -static \
45 // RUN: -stdlib=platform --sysroot=%S/Inputs/basic_netbsd_tree -### %s 2>&1 \
46 // RUN: | FileCheck -check-prefix=S-SPARC %s
47 // RUN: %clangxx --target=sparc64-unknown-netbsd -static \
48 // RUN: -stdlib=platform --sysroot=%S/Inputs/basic_netbsd_tree -### %s 2>&1 \
49 // RUN: | FileCheck -check-prefix=S-SPARC64 %s
50 // RUN: %clangxx --target=powerpc-unknown-netbsd -static \
51 // RUN: -stdlib=platform --sysroot=%S/Inputs/basic_netbsd_tree -### %s 2>&1 \
52 // RUN: | FileCheck -check-prefix=S-POWERPC %s
53 // RUN: %clangxx --target=powerpc64-unknown-netbsd -static \
54 // RUN: -stdlib=platform --sysroot=%S/Inputs/basic_netbsd_tree -### %s 2>&1 \
55 // RUN: | FileCheck -check-prefix=S-POWERPC64 %s
57 // X86_64: "-cc1" "-triple" "x86_64-unknown-netbsd"
58 // X86_64: ld{{.*}}" "--eh-frame-hdr" "-dynamic-linker" "/libexec/ld.elf_so"
59 // X86_64: "-o" "a.out" "{{.*}}/usr/lib{{/|\\\\}}crt0.o" "{{.*}}/usr/lib{{/|\\\\}}crti.o"
60 // X86_64: "{{.*}}/usr/lib{{/|\\\\}}crtbegin.o" "{{.*}}.o" "-lc++"
61 // X86_64: "-lm" "-lc" "{{.*}}/usr/lib{{/|\\\\}}crtend.o" "{{.*}}/usr/lib{{/|\\\\}}crtn.o"
63 // AARCH64: "-cc1" "-triple" "aarch64-unknown-netbsd"
64 // AARCH64: ld{{.*}}" "--eh-frame-hdr" "-dynamic-linker" "/libexec/ld.elf_so"
65 // AARCH64: "-o" "a.out" "{{.*}}/usr/lib{{/|\\\\}}crt0.o" "{{.*}}/usr/lib{{/|\\\\}}crti.o"
66 // AARCH64: "{{.*}}/usr/lib{{/|\\\\}}crtbegin.o" "{{.*}}.o" "-lc++"
67 // AARCH64: "-lm" "-lc"
68 // AARCH64: "{{.*}}/usr/lib{{/|\\\\}}crtend.o" "{{.*}}/usr/lib{{/|\\\\}}crtn.o"
70 // AARCH64_BE: "-cc1" "-triple" "aarch64_be-unknown-netbsd"
71 // AARCH64_BE: ld{{.*}}" "--eh-frame-hdr" "-dynamic-linker" "/libexec/ld.elf_so"
72 // AARCH64_BE: "-o" "a.out" "{{.*}}/usr/lib{{/|\\\\}}crt0.o" "{{.*}}/usr/lib{{/|\\\\}}crti.o"
73 // AARCH64_BE: "{{.*}}/usr/lib{{/|\\\\}}crtbegin.o" "{{.*}}.o" "-lc++"
74 // AARCH64_BE: "-lm" "-lc"
75 // AARCH64_BE: "{{.*}}/usr/lib{{/|\\\\}}crtend.o" "{{.*}}/usr/lib{{/|\\\\}}crtn.o"
77 // RISCV32: "-cc1" "-triple" "riscv32-unknown-netbsd"
78 // RISCV32: ld{{.*}}" "--eh-frame-hdr" "-dynamic-linker" "/libexec/ld.elf_so"
80 // RISCV32-SAME: "-o" "a.out" "{{.*}}/usr/lib{{/|\\\\}}crt0.o" "{{.*}}/usr/lib{{/|\\\\}}crti.o"
81 // RISCV32-SAME: "{{.*}}/usr/lib{{/|\\\\}}crtbegin.o" "{{.*}}.o" "-lc++"
82 // RISCV32-SAME: "-lm" "-lc"
83 // RISCV32-SAME: "{{.*}}/usr/lib{{/|\\\\}}crtend.o" "{{.*}}/usr/lib{{/|\\\\}}crtn.o"
85 // RISCV64: "-cc1" "-triple" "riscv64-unknown-netbsd"
86 // RISCV64: ld{{.*}}" "--eh-frame-hdr" "-dynamic-linker" "/libexec/ld.elf_so"
88 // RISCV64-SAME: "-o" "a.out" "{{.*}}/usr/lib{{/|\\\\}}crt0.o" "{{.*}}/usr/lib{{/|\\\\}}crti.o"
89 // RISCV64-SAME: "{{.*}}/usr/lib{{/|\\\\}}crtbegin.o" "{{.*}}.o" "-lc++"
90 // RISCV64-SAME: "-lm" "-lc"
91 // RISCV64-SAME: "{{.*}}/usr/lib{{/|\\\\}}crtend.o" "{{.*}}/usr/lib{{/|\\\\}}crtn.o"
93 // SPARC: "-cc1" "-triple" "sparc-unknown-netbsd"
94 // SPARC: ld{{.*}}" "--eh-frame-hdr" "-dynamic-linker" "/libexec/ld.elf_so"
95 // SPARC: "-o" "a.out" "{{.*}}/usr/lib{{/|\\\\}}crt0.o"
96 // SPARC: "{{.*}}/usr/lib{{/|\\\\}}sparc{{/|\\\\}}crti.o"
97 // SPARC: "{{.*}}/usr/lib{{/|\\\\}}crtbegin.o" "{{.*}}.o" "-lc++"
99 // SPARC: "{{.*}}/usr/lib{{/|\\\\}}crtend.o" "{{.*}}/usr/lib{{/|\\\\}}crtn.o"
101 // SPARC64: "-cc1" "-triple" "sparc64-unknown-netbsd"
102 // SPARC64: ld{{.*}}" "--eh-frame-hdr" "-dynamic-linker" "/libexec/ld.elf_so"
103 // SPARC64: "-o" "a.out" "{{.*}}/usr/lib{{/|\\\\}}crt0.o" "{{.*}}/usr/lib{{/|\\\\}}crti.o"
104 // SPARC64: "{{.*}}/usr/lib{{/|\\\\}}crtbegin.o" "{{.*}}.o" "-lc++"
105 // SPARC64: "-lm" "-lc"
106 // SPARC64: "{{.*}}/usr/lib{{/|\\\\}}crtend.o" "{{.*}}/usr/lib{{/|\\\\}}crtn.o"
108 // POWERPC: "-cc1" "-triple" "powerpc-unknown-netbsd"
109 // POWERPC: ld{{.*}}" "--eh-frame-hdr" "-dynamic-linker" "/libexec/ld.elf_so"
110 // POWERPC: "-o" "a.out" "{{.*}}/usr/lib{{/|\\\\}}crt0.o"
111 // POWERPC: "{{.*}}/usr/lib{{/|\\\\}}powerpc{{/|\\\\}}crti.o"
112 // POWERPC: "{{.*}}/usr/lib{{/|\\\\}}crtbegin.o" "{{.*}}.o" "-lc++"
113 // POWERPC: "-lm" "-lc" "{{.*}}/usr/lib{{/|\\\\}}crtend.o" "{{.*}}/usr/lib{{/|\\\\}}crtn.o"
115 // POWERPC64: "-cc1" "-triple" "powerpc64-unknown-netbsd"
116 // POWERPC64: ld{{.*}}" "--eh-frame-hdr" "-dynamic-linker" "/libexec/ld.elf_so"
117 // POWERPC64: "-o" "a.out" "{{.*}}/usr/lib{{/|\\\\}}crt0.o"
118 // POWERPC64: "{{.*}}/usr/lib{{/|\\\\}}crti.o"
119 // POWERPC64: "{{.*}}/usr/lib{{/|\\\\}}crtbegin.o" "{{.*}}.o" "-lc++"
120 // POWERPC64: "-lm" "-lc" "{{.*}}/usr/lib{{/|\\\\}}crtend.o" "{{.*}}/usr/lib{{/|\\\\}}crtn.o"
122 // S-X86_64: "-cc1" "-triple" "x86_64-unknown-netbsd"
123 // S-X86_64: ld{{.*}}" "--eh-frame-hdr" "-Bstatic"
124 // S-X86_64: "-o" "a.out" "{{.*}}/usr/lib{{/|\\\\}}crt0.o" "{{.*}}/usr/lib{{/|\\\\}}crti.o"
125 // S-X86_64: "{{.*}}/usr/lib{{/|\\\\}}crtbegin.o" "{{.*}}.o" "-lc++"
126 // S-X86_64: "-lm" "-lc" "{{.*}}/usr/lib{{/|\\\\}}crtend.o" "{{.*}}/usr/lib{{/|\\\\}}crtn.o"
128 // S-AARCH64: "-cc1" "-triple" "aarch64-unknown-netbsd"
129 // S-AARCH64: ld{{.*}}" "--eh-frame-hdr" "-Bstatic"
130 // S-AARCH64: "-o" "a.out" "{{.*}}/usr/lib{{/|\\\\}}crt0.o" "{{.*}}/usr/lib{{/|\\\\}}crti.o"
131 // S-AARCH64: "{{.*}}/usr/lib{{/|\\\\}}crtbegin.o" "{{.*}}.o" "-lc++"
132 // S-AARCH64: "-lm" "-lc"
133 // S-AARCH64: "{{.*}}/usr/lib{{/|\\\\}}crtend.o" "{{.*}}/usr/lib{{/|\\\\}}crtn.o"
135 // S-AARCH64_BE: "-cc1" "-triple" "aarch64_be-unknown-netbsd"
136 // S-AARCH64_BE: ld{{.*}}" "--eh-frame-hdr" "-Bstatic"
137 // S-AARCH64_BE: "-o" "a.out" "{{.*}}/usr/lib{{/|\\\\}}crt0.o" "{{.*}}/usr/lib{{/|\\\\}}crti.o"
138 // S-AARCH64_BE: "{{.*}}/usr/lib{{/|\\\\}}crtbegin.o" "{{.*}}.o" "-lc++"
139 // S-AARCH64_BE: "-lm" "-lc"
140 // S-AARCH64_BE: "{{.*}}/usr/lib{{/|\\\\}}crtend.o" "{{.*}}/usr/lib{{/|\\\\}}crtn.o"
142 // S-RISCV32: "-cc1" "-triple" "riscv32-unknown-netbsd"
143 // S-RISCV32: ld{{.*}}" "--eh-frame-hdr" "-Bstatic"
144 // S-RISCV32-SAME: "-X"
145 // S-RISCV32-SAME: "-o" "a.out" "{{.*}}/usr/lib{{/|\\\\}}crt0.o" "{{.*}}/usr/lib{{/|\\\\}}crti.o"
146 // S-RISCV32-SAME: "{{.*}}/usr/lib{{/|\\\\}}crtbegin.o" "{{.*}}.o" "-lc++"
147 // S-RISCV32-SAME: "-lm" "-lc"
148 // S-RISCV32-SAME: "{{.*}}/usr/lib{{/|\\\\}}crtend.o" "{{.*}}/usr/lib{{/|\\\\}}crtn.o"
150 // S-RISCV64: "-cc1" "-triple" "riscv64-unknown-netbsd"
151 // S-RISCV64: ld{{.*}}" "--eh-frame-hdr" "-Bstatic"
152 // S-RISCV64-SAME: "-X"
153 // S-RISCV64-SAME: "-o" "a.out" "{{.*}}/usr/lib{{/|\\\\}}crt0.o" "{{.*}}/usr/lib{{/|\\\\}}crti.o"
154 // S-RISCV64-SAME: "{{.*}}/usr/lib{{/|\\\\}}crtbegin.o" "{{.*}}.o" "-lc++"
155 // S-RISCV64-SAME: "-lm" "-lc"
156 // S-RISCV64-SAME: "{{.*}}/usr/lib{{/|\\\\}}crtend.o" "{{.*}}/usr/lib{{/|\\\\}}crtn.o"
158 // S-SPARC: "-cc1" "-triple" "sparc-unknown-netbsd"
159 // S-SPARC: ld{{.*}}" "--eh-frame-hdr" "-Bstatic"
160 // S-SPARC: "-o" "a.out" "{{.*}}/usr/lib{{/|\\\\}}crt0.o"
161 // S-SPARC: "{{.*}}/usr/lib{{/|\\\\}}sparc{{/|\\\\}}crti.o"
162 // S-SPARC: "{{.*}}/usr/lib{{/|\\\\}}crtbegin.o" "{{.*}}.o" "-lc++"
163 // S-SPARC: "-lm" "-lc"
164 // S-SPARC: "{{.*}}/usr/lib{{/|\\\\}}crtend.o" "{{.*}}/usr/lib{{/|\\\\}}crtn.o"
166 // S-SPARC64: "-cc1" "-triple" "sparc64-unknown-netbsd"
167 // S-SPARC64: ld{{.*}}" "--eh-frame-hdr" "-Bstatic"
168 // S-SPARC64: "-o" "a.out" "{{.*}}/usr/lib{{/|\\\\}}crt0.o" "{{.*}}/usr/lib{{/|\\\\}}crti.o"
169 // S-SPARC64: "{{.*}}/usr/lib{{/|\\\\}}crtbegin.o" "{{.*}}.o" "-lc++"
170 // S-SPARC64: "-lm" "-lc"
171 // S-SPARC64: "{{.*}}/usr/lib{{/|\\\\}}crtend.o" "{{.*}}/usr/lib{{/|\\\\}}crtn.o"
173 // S-POWERPC: "-cc1" "-triple" "powerpc-unknown-netbsd"
174 // S-POWERPC: ld{{.*}}" "--eh-frame-hdr" "-Bstatic"
175 // S-POWERPC: "-o" "a.out" "{{.*}}/usr/lib{{/|\\\\}}crt0.o"
176 // S-POWERPC: "{{.*}}/usr/lib{{/|\\\\}}powerpc{{/|\\\\}}crti.o"
177 // S-POWERPC: "{{.*}}/usr/lib{{/|\\\\}}crtbegin.o" "{{.*}}.o" "-lc++"
178 // S-POWERPC: "-lm" "-lc" "{{.*}}/usr/lib{{/|\\\\}}crtend.o" "{{.*}}/usr/lib{{/|\\\\}}crtn.o"
180 // S-POWERPC64: "-cc1" "-triple" "powerpc64-unknown-netbsd"
181 // S-POWERPC64: ld{{.*}}" "--eh-frame-hdr" "-Bstatic"
182 // S-POWERPC64: "-o" "a.out" "{{.*}}/usr/lib{{/|\\\\}}crt0.o"
183 // S-POWERPC64: "{{.*}}/usr/lib{{/|\\\\}}crti.o"
184 // S-POWERPC64: "{{.*}}/usr/lib{{/|\\\\}}crtbegin.o" "{{.*}}.o" "-lc++"
185 // S-POWERPC64: "-lm" "-lc" "{{.*}}/usr/lib{{/|\\\\}}crtend.o" "{{.*}}/usr/lib{{/|\\\\}}crtn.o"
187 // Check that the driver passes include paths to cc1 on NetBSD.
188 // RUN: %clang -### %s --target=x86_64-unknown-netbsd -r 2>&1 \
189 // RUN: | FileCheck %s --check-prefix=DRIVER-PASS-INCLUDES
190 // DRIVER-PASS-INCLUDES: "-cc1" {{.*}}"-resource-dir" "[[RESOURCE:[^"]+]]"
191 // DRIVER-PASS-INCLUDES: "-internal-isystem" "[[RESOURCE]]{{/|\\\\}}include"
192 // DRIVER-PASS-INCLUDES: "-internal-externc-isystem" "{{.*}}/usr/include"
194 // Test NetBSD with libstdc++ when the sysroot path ends with `/`.
195 // RUN: %clangxx -### %s 2>&1 \
196 // RUN: --target=x86_64-unknown-netbsd \
197 // RUN: -stdlib=libstdc++ \
198 // RUN: --sysroot=%S/Inputs/basic_netbsd_tree/ \
199 // RUN: | FileCheck --check-prefix=CHECK-BASIC-LIBSTDCXX-SYSROOT-SLASH %s
200 // CHECK-BASIC-LIBSTDCXX-SYSROOT-SLASH: "-cc1"
201 // CHECK-BASIC-LIBSTDCXX-SYSROOT-SLASH-SAME: "-isysroot" "[[SYSROOT:[^"]+/]]"
202 // CHECK-BASIC-LIBSTDCXX-SYSROOT-SLASH-SAME: "-internal-isystem" "[[SYSROOT]]usr/include/g++"