| ... | ... | @@ -1,7 +1,5 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | 2 | const builtin = @import("builtin"); |
| 3 | | const math = std.math; |
| 4 | | const is_test = builtin.is_test; |
| 5 | 3 | |
| 6 | 4 | pub const linkage: std.builtin.GlobalLinkage = if (builtin.is_test) .Internal else .Weak; |
| 7 | 5 | pub const want_aeabi = switch (builtin.abi) { |
| ... | ... | @@ -18,19 +16,44 @@ pub const want_aeabi = switch (builtin.abi) { |
| 18 | 16 | else => false, |
| 19 | 17 | }; |
| 20 | 18 | pub const want_ppc_abi = builtin.cpu.arch.isPPC() or builtin.cpu.arch.isPPC64(); |
| 21 | | pub const want_msvc_abi = builtin.abi == .msvc; |
| 22 | | /// Example symbols: |
| 19 | |
| 20 | /// This governs whether to use these symbol names for f16/f32 conversions |
| 21 | /// rather than the standard names: |
| 23 | 22 | /// * __gnu_f2h_ieee |
| 24 | 23 | /// * __gnu_h2f_ieee |
| 25 | | pub const want_gnu_abi = builtin.abi.isGnu() or builtin.abi.isMusl(); |
| 24 | /// Known correct configurations: |
| 25 | /// x86_64-freestanding-none => true |
| 26 | /// x86_64-linux-none => true |
| 27 | /// x86_64-linux-gnu => true |
| 28 | /// x86_64-linux-musl => true |
| 29 | /// x86_64-linux-eabi => true |
| 30 | /// arm-linux-musleabihf => true |
| 31 | /// arm-linux-gnueabihf => true |
| 32 | /// arm-linux-eabihf => false |
| 33 | /// wasm32-wasi-musl => false |
| 34 | /// wasm32-freestanding-none => false |
| 35 | /// x86_64-windows-gnu => true |
| 36 | /// x86_64-windows-msvc => true |
| 37 | /// any-macos-any => doesn't matter; libSystem has both symbol flavors |
| 38 | pub const gnu_f16_abi = switch (builtin.cpu.arch) { |
| 39 | .wasm32, .wasm64 => false, |
| 40 | |
| 41 | .arm, .armeb, .thumb, .thumbeb => switch (builtin.abi) { |
| 42 | .eabi, .eabihf => false, |
| 43 | else => true, |
| 44 | }, |
| 45 | |
| 46 | else => true, |
| 47 | }; |
| 48 | |
| 26 | 49 | pub const want_sparc_abi = builtin.cpu.arch.isSPARC(); |
| 27 | 50 | |
| 28 | 51 | // Avoid dragging in the runtime safety mechanisms into this .o file, |
| 29 | 52 | // unless we're trying to test compiler-rt. |
| 30 | 53 | pub fn panic(msg: []const u8, error_return_trace: ?*std.builtin.StackTrace) noreturn { |
| 31 | 54 | _ = error_return_trace; |
| 32 | | @setCold(true); |
| 33 | | if (is_test) { |
| 55 | if (builtin.is_test) { |
| 56 | @setCold(true); |
| 34 | 57 | std.debug.panic("{s}", .{msg}); |
| 35 | 58 | } else { |
| 36 | 59 | unreachable; |