zig/std/special/zigrt.zig
Andrew Kelley c400cb429a zig build system: add setLinkerScript and setTarget
* See #204 - zig build system
 * allow builtin types Os, Environ, Arch to be used at runtime.
   they have zero_bits=false and debug info now.
 * Eradicate use of `@alloca` in std for syscalls. See #225
 * add `std.io.writeFile`
 * `std.debug.panic` adds a newline to format
2017-04-03 05:04:46 -04:00

17 lines
671 B
Zig

// This file contains functions that zig depends on to coordinate between
// multiple .o files. The symbols are defined Weak so that multiple
// instances of zig_rt.zig do not conflict with each other.
export coldcc fn __zig_panic(message_ptr: &const u8, message_len: usize) -> noreturn {
@setGlobalLinkage(__zig_panic, GlobalLinkage.Weak);
@setDebugSafety(this, false);
if (@compileVar("panic_implementation_provided")) {
@import("@root").panic(message_ptr[0...message_len]);
} else if (@compileVar("os") == Os.freestanding) {
while (true) {}
} else {
@import("std").debug.panic("{}", message_ptr[0...message_len]);
}
}