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