2017-03-27 09:07:07 +08:00
|
|
|
// This file contains functions that zig depends on to coordinate between
|
2017-03-31 17:48:15 +08:00
|
|
|
// multiple .o files. The symbols are defined Weak so that multiple
|
2017-03-27 09:07:07 +08:00
|
|
|
// instances of zig_rt.zig do not conflict with each other.
|
|
|
|
|
2017-05-02 01:12:38 +08:00
|
|
|
const builtin = @import("builtin");
|
|
|
|
|
2017-03-27 09:07:07 +08:00
|
|
|
export coldcc fn __zig_panic(message_ptr: &const u8, message_len: usize) -> noreturn {
|
2017-05-02 07:16:48 +08:00
|
|
|
@setGlobalLinkage(__zig_panic, builtin.GlobalLinkage.LinkOnce);
|
2017-03-27 09:07:07 +08:00
|
|
|
@setDebugSafety(this, false);
|
|
|
|
|
2017-05-02 01:12:38 +08:00
|
|
|
if (builtin.__zig_panic_implementation_provided) {
|
2017-03-27 09:07:07 +08:00
|
|
|
@import("@root").panic(message_ptr[0...message_len]);
|
2017-05-02 01:12:38 +08:00
|
|
|
} else if (builtin.os == builtin.Os.freestanding) {
|
2017-03-27 09:07:07 +08:00
|
|
|
while (true) {}
|
|
|
|
} else {
|
2017-04-03 16:58:19 +08:00
|
|
|
@import("std").debug.panic("{}", message_ptr[0...message_len]);
|
2017-03-27 09:07:07 +08:00
|
|
|
}
|
|
|
|
}
|