1# These can be passed to nixpkgs as either the `localSystem` or
2# `crossSystem`. They are put here for user convenience, but also used by cross
3# tests and linux cross stdenv building, so handle with care!
4{ lib }:
5let
6 platforms = import ./platforms.nix { inherit lib; };
7
8 riscv = bits: {
9 config = "riscv${bits}-unknown-linux-gnu";
10 };
11in
12
13rec {
14 #
15 # Linux
16 #
17 powernv = {
18 config = "powerpc64le-unknown-linux-gnu";
19 };
20 musl-power = {
21 config = "powerpc64le-unknown-linux-musl";
22 };
23
24 ppc64 = {
25 config = "powerpc64-unknown-linux-gnuabielfv2";
26 };
27 ppc64-musl = {
28 config = "powerpc64-unknown-linux-musl";
29 gcc = {
30 abi = "elfv2";
31 };
32 };
33
34 sheevaplug = {
35 config = "armv5tel-unknown-linux-gnueabi";
36 } // platforms.sheevaplug;
37
38 raspberryPi = {
39 config = "armv6l-unknown-linux-gnueabihf";
40 } // platforms.raspberrypi;
41
42 bluefield2 = {
43 config = "aarch64-unknown-linux-gnu";
44 } // platforms.bluefield2;
45
46 remarkable1 = {
47 config = "armv7l-unknown-linux-gnueabihf";
48 } // platforms.zero-gravitas;
49
50 remarkable2 = {
51 config = "armv7l-unknown-linux-gnueabihf";
52 } // platforms.zero-sugar;
53
54 armv7l-hf-multiplatform = {
55 config = "armv7l-unknown-linux-gnueabihf";
56 };
57
58 aarch64-multiplatform = {
59 config = "aarch64-unknown-linux-gnu";
60 };
61
62 armv7a-android-prebuilt = {
63 config = "armv7a-unknown-linux-androideabi";
64 rust.rustcTarget = "armv7-linux-androideabi";
65 androidSdkVersion = "33";
66 androidNdkVersion = "26";
67 useAndroidPrebuilt = true;
68 } // platforms.armv7a-android;
69
70 aarch64-android-prebuilt = {
71 config = "aarch64-unknown-linux-android";
72 rust.rustcTarget = "aarch64-linux-android";
73 androidSdkVersion = "33";
74 androidNdkVersion = "26";
75 useAndroidPrebuilt = true;
76 };
77
78 aarch64-android = {
79 config = "aarch64-unknown-linux-android";
80 androidSdkVersion = "33";
81 androidNdkVersion = "26";
82 libc = "bionic";
83 useAndroidPrebuilt = false;
84 useLLVM = true;
85 };
86
87 pogoplug4 = {
88 config = "armv5tel-unknown-linux-gnueabi";
89 } // platforms.pogoplug4;
90
91 ben-nanonote = {
92 config = "mipsel-unknown-linux-uclibc";
93 } // platforms.ben_nanonote;
94
95 fuloongminipc = {
96 config = "mipsel-unknown-linux-gnu";
97 } // platforms.fuloong2f_n32;
98
99 # can execute on 32bit chip
100 mips-linux-gnu = {
101 config = "mips-unknown-linux-gnu";
102 } // platforms.gcc_mips32r2_o32;
103 mipsel-linux-gnu = {
104 config = "mipsel-unknown-linux-gnu";
105 } // platforms.gcc_mips32r2_o32;
106
107 # require 64bit chip (for more registers, 64-bit floating point, 64-bit "long long") but use 32bit pointers
108 mips64-linux-gnuabin32 = {
109 config = "mips64-unknown-linux-gnuabin32";
110 } // platforms.gcc_mips64r2_n32;
111 mips64el-linux-gnuabin32 = {
112 config = "mips64el-unknown-linux-gnuabin32";
113 } // platforms.gcc_mips64r2_n32;
114
115 # 64bit pointers
116 mips64-linux-gnuabi64 = {
117 config = "mips64-unknown-linux-gnuabi64";
118 } // platforms.gcc_mips64r2_64;
119 mips64el-linux-gnuabi64 = {
120 config = "mips64el-unknown-linux-gnuabi64";
121 } // platforms.gcc_mips64r2_64;
122
123 muslpi = raspberryPi // {
124 config = "armv6l-unknown-linux-musleabihf";
125 };
126
127 aarch64-multiplatform-musl = {
128 config = "aarch64-unknown-linux-musl";
129 };
130
131 gnu64 = {
132 config = "x86_64-unknown-linux-gnu";
133 };
134 gnu64_simplekernel = gnu64 // platforms.pc_simplekernel; # see test/cross/default.nix
135 gnu32 = {
136 config = "i686-unknown-linux-gnu";
137 };
138
139 musl64 = {
140 config = "x86_64-unknown-linux-musl";
141 };
142 musl32 = {
143 config = "i686-unknown-linux-musl";
144 };
145
146 riscv64 = riscv "64";
147 riscv32 = riscv "32";
148
149 riscv64-musl = {
150 config = "riscv64-unknown-linux-musl";
151 };
152
153 riscv64-embedded = {
154 config = "riscv64-none-elf";
155 libc = "newlib";
156 };
157
158 riscv32-embedded = {
159 config = "riscv32-none-elf";
160 libc = "newlib";
161 };
162
163 mips64-embedded = {
164 config = "mips64-none-elf";
165 libc = "newlib";
166 };
167
168 mips-embedded = {
169 config = "mips-none-elf";
170 libc = "newlib";
171 };
172
173 loongarch64-linux = {
174 config = "loongarch64-unknown-linux-gnu";
175 };
176
177 mmix = {
178 config = "mmix-unknown-mmixware";
179 libc = "newlib";
180 };
181
182 rx-embedded = {
183 config = "rx-none-elf";
184 libc = "newlib";
185 };
186
187 msp430 = {
188 config = "msp430-elf";
189 libc = "newlib";
190 };
191
192 avr = {
193 config = "avr";
194 };
195
196 vc4 = {
197 config = "vc4-elf";
198 libc = "newlib";
199 };
200
201 or1k = {
202 config = "or1k-elf";
203 libc = "newlib";
204 };
205
206 m68k = {
207 config = "m68k-unknown-linux-gnu";
208 };
209
210 s390 = {
211 config = "s390-unknown-linux-gnu";
212 };
213
214 s390x = {
215 config = "s390x-unknown-linux-gnu";
216 };
217
218 arm-embedded = {
219 config = "arm-none-eabi";
220 libc = "newlib";
221 };
222 arm-embedded-nano = {
223 config = "arm-none-eabi";
224 libc = "newlib-nano";
225 };
226 armhf-embedded = {
227 config = "arm-none-eabihf";
228 libc = "newlib";
229 # GCC8+ does not build without this
230 # (https://www.mail-archive.com/gcc-bugs@gcc.gnu.org/msg552339.html):
231 gcc = {
232 arch = "armv5t";
233 fpu = "vfp";
234 };
235 };
236
237 aarch64-embedded = {
238 config = "aarch64-none-elf";
239 libc = "newlib";
240 rust.rustcTarget = "aarch64-unknown-none";
241 };
242
243 aarch64be-embedded = {
244 config = "aarch64_be-none-elf";
245 libc = "newlib";
246 };
247
248 ppc-embedded = {
249 config = "powerpc-none-eabi";
250 libc = "newlib";
251 };
252
253 ppcle-embedded = {
254 config = "powerpcle-none-eabi";
255 libc = "newlib";
256 };
257
258 i686-embedded = {
259 config = "i686-elf";
260 libc = "newlib";
261 };
262
263 x86_64-embedded = {
264 config = "x86_64-elf";
265 libc = "newlib";
266 };
267
268 microblaze-embedded = {
269 config = "microblazeel-none-elf";
270 libc = "newlib";
271 };
272
273 #
274 # Redox
275 #
276
277 x86_64-unknown-redox = {
278 config = "x86_64-unknown-redox";
279 libc = "relibc";
280 };
281
282 #
283 # Darwin
284 #
285
286 iphone64 = {
287 config = "arm64-apple-ios";
288 # config = "aarch64-apple-darwin14";
289 darwinSdkVersion = "14.3";
290 xcodeVer = "12.3";
291 xcodePlatform = "iPhoneOS";
292 useiOSPrebuilt = true;
293 };
294
295 iphone64-simulator = {
296 config = "x86_64-apple-ios";
297 # config = "x86_64-apple-darwin14";
298 darwinSdkVersion = "14.3";
299 xcodeVer = "12.3";
300 xcodePlatform = "iPhoneSimulator";
301 darwinPlatform = "ios-simulator";
302 useiOSPrebuilt = true;
303 };
304
305 aarch64-darwin = {
306 config = "arm64-apple-darwin";
307 xcodePlatform = "MacOSX";
308 platform = { };
309 };
310
311 x86_64-darwin = {
312 config = "x86_64-apple-darwin";
313 xcodePlatform = "MacOSX";
314 platform = { };
315 };
316
317 #
318 # Windows
319 #
320
321 # 32 bit mingw-w64
322 mingw32 = {
323 config = "i686-w64-mingw32";
324 libc = "msvcrt"; # This distinguishes the mingw (non posix) toolchain
325 };
326
327 # 64 bit mingw-w64
328 mingwW64 = {
329 # That's the triplet they use in the mingw-w64 docs.
330 config = "x86_64-w64-mingw32";
331 libc = "msvcrt"; # This distinguishes the mingw (non posix) toolchain
332 };
333
334 ucrt64 = {
335 config = "x86_64-w64-mingw32";
336 libc = "ucrt"; # This distinguishes the mingw (non posix) toolchain
337 };
338
339 # LLVM-based mingw-w64 for ARM
340 ucrtAarch64 = {
341 config = "aarch64-w64-mingw32";
342 libc = "ucrt";
343 rust.rustcTarget = "aarch64-pc-windows-gnullvm";
344 useLLVM = true;
345 };
346
347 # BSDs
348
349 aarch64-freebsd = {
350 config = "aarch64-unknown-freebsd";
351 useLLVM = true;
352 };
353
354 x86_64-freebsd = {
355 config = "x86_64-unknown-freebsd";
356 useLLVM = true;
357 };
358
359 x86_64-netbsd = {
360 config = "x86_64-unknown-netbsd";
361 };
362
363 # this is broken and never worked fully
364 x86_64-netbsd-llvm = {
365 config = "x86_64-unknown-netbsd";
366 useLLVM = true;
367 };
368
369 x86_64-openbsd = {
370 config = "x86_64-unknown-openbsd";
371 useLLVM = true;
372 };
373
374 #
375 # WASM
376 #
377
378 wasi32 = {
379 config = "wasm32-unknown-wasi";
380 useLLVM = true;
381 };
382
383 wasm32-unknown-none = {
384 config = "wasm32-unknown-none";
385 rust.rustcTarget = "wasm32-unknown-unknown";
386 useLLVM = true;
387 };
388
389 # Ghcjs
390 ghcjs = {
391 # This triple is special to GHC/Cabal/GHCJS and not recognized by autotools
392 # See: https://gitlab.haskell.org/ghc/ghc/-/commit/6636b670233522f01d002c9b97827d00289dbf5c
393 # https://github.com/ghcjs/ghcjs/issues/53
394 config = "javascript-unknown-ghcjs";
395 };
396}