aboutsummaryrefslogtreecommitdiff
path: root/lib/std/start.zig
diff options
context:
space:
mode:
authorAlex Rønne Petersen <alex@alexrp.com>2025-05-20 02:44:52 +0200
committerAlex Rønne Petersen <alex@alexrp.com>2025-05-20 10:23:16 +0200
commit999777e73aa1bd06b05cbe53f8c2488877e18874 (patch)
tree2a12be70cf488ace84478c9f9f583dc50bfa9717 /lib/std/start.zig
parentd000e53b291afc40da7d676553f1c9685a38f169 (diff)
downloadzig-999777e73aa1bd06b05cbe53f8c2488877e18874.tar.gz
zig-999777e73aa1bd06b05cbe53f8c2488877e18874.zip
compiler: Scaffold stage2_powerpc backend.
Nothing interesting here; literally just the bare minimum so I can work on this on and off in a branch without worrying about merge conflicts in the non-backend code.
Diffstat (limited to 'lib/std/start.zig')
-rw-r--r--lib/std/start.zig27
1 files changed, 18 insertions, 9 deletions
diff --git a/lib/std/start.zig b/lib/std/start.zig
index 477e24bb55..2280bea9e7 100644
--- a/lib/std/start.zig
+++ b/lib/std/start.zig
@@ -14,12 +14,16 @@ const start_sym_name = if (native_arch.isMIPS()) "__start" else "_start";
// The self-hosted compiler is not fully capable of handling all of this start.zig file.
// Until then, we have simplified logic here for self-hosted. TODO remove this once
// self-hosted is capable enough to handle all of the real start.zig logic.
-pub const simplified_logic =
- builtin.zig_backend == .stage2_x86 or
- builtin.zig_backend == .stage2_aarch64 or
- builtin.zig_backend == .stage2_arm or
- builtin.zig_backend == .stage2_sparc64 or
- builtin.zig_backend == .stage2_spirv64;
+pub const simplified_logic = switch (builtin.zig_backend) {
+ .stage2_aarch64,
+ .stage2_arm,
+ .stage2_powerpc,
+ .stage2_sparc64,
+ .stage2_spirv64,
+ .stage2_x86,
+ => true,
+ else => false,
+};
comptime {
// No matter what, we import the root file, so that any export, test, comptime
@@ -669,9 +673,14 @@ pub inline fn callMain() u8 {
if (@typeInfo(ReturnType) != .error_union) @compileError(bad_main_ret);
const result = root.main() catch |err| {
- if (builtin.zig_backend == .stage2_riscv64) {
- std.debug.print("error: failed with error\n", .{});
- return 1;
+ switch (builtin.zig_backend) {
+ .stage2_powerpc,
+ .stage2_riscv64,
+ => {
+ std.debug.print("error: failed with error\n", .{});
+ return 1;
+ },
+ else => {},
}
std.log.err("{s}", .{@errorName(err)});
if (@errorReturnTrace()) |trace| {