aboutsummaryrefslogtreecommitdiff
path: root/lib/std/os.zig
diff options
context:
space:
mode:
authorChristine Dodrill <me@christine.website>2019-12-12 01:31:32 +0000
committerAndrew Kelley <andrew@ziglang.org>2019-12-12 16:00:23 -0500
commitb37acc4d6870a090c3501d81d3f647bc30220e4b (patch)
tree5b906c0cc4c9bb358d64324b25492a4b6cabd48a /lib/std/os.zig
parent81f1f72197113a45e827d5c984e219a28aa28083 (diff)
downloadzig-b37acc4d6870a090c3501d81d3f647bc30220e4b.tar.gz
zig-b37acc4d6870a090c3501d81d3f647bc30220e4b.zip
allow custom OS entrypoint
Also: * Expose `std.start.callMain`. * Other fixes added to fix issues found in development.
Diffstat (limited to 'lib/std/os.zig')
-rw-r--r--lib/std/os.zig20
1 files changed, 12 insertions, 8 deletions
diff --git a/lib/std/os.zig b/lib/std/os.zig
index 04de59d6e1..6d49bcd38e 100644
--- a/lib/std/os.zig
+++ b/lib/std/os.zig
@@ -187,19 +187,23 @@ pub fn abort() noreturn {
}
windows.kernel32.ExitProcess(3);
}
- if (builtin.link_libc) {
- system.abort();
+ if (!builtin.link_libc and builtin.os == .linux) {
+ raise(SIGABRT) catch {};
+
+ // TODO the rest of the implementation of abort() from musl libc here
+
+ raise(SIGKILL) catch {};
+ exit(127);
}
if (builtin.os == .uefi) {
exit(0); // TODO choose appropriate exit code
}
+ if (builtin.os == .wasi) {
+ @breakpoint();
+ exit(1);
+ }
- raise(SIGABRT) catch {};
-
- // TODO the rest of the implementation of abort() from musl libc here
-
- raise(SIGKILL) catch {};
- exit(127);
+ system.abort();
}
pub const RaiseError = UnexpectedError;