authorgravatar for me@gasinfinity.devGasInfinity <me@gasinfinity.dev> 2025-10-18 19:23:19+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-10-18 23:54:27+02:00
log1bca158c6e0a4f301cef18db705d89de78c86bcb
tree9db6581ebcfcd221b150283609a7f5d3208d83af
parent6bf5b7f2b40be1a92c66fed05e53815b3ab07733

fix(std): don't add the default `_start` and `panic` in homebrew targets

* even if std supported those targets, they're not posixy to be in that codepath.

2 files changed, 4 insertions(+), 3 deletions(-)

lib/std/debug.zig+1-1
...@@ -481,7 +481,7 @@ pub fn defaultPanic(...@@ -481,7 +481,7 @@ pub fn defaultPanic(
481 if (use_trap_panic) @trap();481 if (use_trap_panic) @trap();
482482
483 switch (builtin.os.tag) {483 switch (builtin.os.tag) {
484 .freestanding, .other => {484 .freestanding, .other, .@"3ds", .vita => {
485 @trap();485 @trap();
486 },486 },
487 .uefi => {487 .uefi => {
lib/std/start.zig+3-2
...@@ -91,8 +91,9 @@ comptime {...@@ -91,8 +91,9 @@ comptime {
91 // Only call main when defined. For WebAssembly it's allowed to pass `-fno-entry` in which91 // Only call main when defined. For WebAssembly it's allowed to pass `-fno-entry` in which
92 // case it's not required to provide an entrypoint such as main.92 // case it's not required to provide an entrypoint such as main.
93 if (!@hasDecl(root, start_sym_name) and @hasDecl(root, "main")) @export(&wasm_freestanding_start, .{ .name = start_sym_name });93 if (!@hasDecl(root, start_sym_name) and @hasDecl(root, "main")) @export(&wasm_freestanding_start, .{ .name = start_sym_name });
94 } else if (native_os != .other and native_os != .freestanding) {94 } else switch (native_os) {
95 if (!@hasDecl(root, start_sym_name)) @export(&_start, .{ .name = start_sym_name });95 .other, .freestanding, .@"3ds", .vita => {},
96 else => if (!@hasDecl(root, start_sym_name)) @export(&_start, .{ .name = start_sym_name }),
96 }97 }
97 }98 }
98 }99 }