2017-03-26 18:07:07 -07:00
|
|
|
// This file contains functions that zig depends on to coordinate between
|
2017-03-31 02:48:15 -07:00
|
|
|
// multiple .o files. The symbols are defined Weak so that multiple
|
2017-03-26 18:07:07 -07:00
|
|
|
// 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 {
|
2017-03-31 02:48:15 -07:00
|
|
|
@import("std").debug.panic("{}\n", message_ptr[0...message_len]);
|
2017-03-26 18:07:07 -07:00
|
|
|
}
|
|
|
|
}
|