add stack protector safety when linking libc
* introduce zigrt file. it contains only weak symbols so that multiple instances can be merged. it contains __zig_panic so that multiple .o files can call the same panic function. * remove `@setFnVisible` builtin and add @setGlobalLinkage builtin which is more powerful * add `@panic` builtin function. * fix collision of symbols with extern prototypes and internal function names * add stack protector safety when linking against libc. To add the safety mechanism without libc requires implementing Thread Local Storage. See #276
This commit is contained in:
@@ -1828,6 +1828,18 @@ export fn entry() {
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static void add_debug_safety_test_cases(void) {
|
||||
add_debug_safety_case("calling panic", R"SOURCE(
|
||||
pub fn panic(message: []const u8) -> noreturn {
|
||||
@breakpoint();
|
||||
while (true) {}
|
||||
}
|
||||
pub fn main(args: [][]u8) -> %void {
|
||||
if (!@compileVar("is_release")) {
|
||||
@panic("oh no");
|
||||
}
|
||||
}
|
||||
)SOURCE");
|
||||
|
||||
add_debug_safety_case("out of bounds slice access", R"SOURCE(
|
||||
pub fn panic(message: []const u8) -> noreturn {
|
||||
@breakpoint();
|
||||
|
||||
Reference in New Issue
Block a user