diff --git a/build.rs b/build.rs index b1e32728de..8f61a6d4b2 100644 --- a/build.rs +++ b/build.rs @@ -13,7 +13,9 @@ fn main() { .flag("-fno-stack-protector") .file("src/c/dlmalloc.c") .file("src/c/fcntl.c") + .file("src/c/stack_chk.c") .file("src/c/stdio.c") + .file("src/c/unistd.c") .compile("relibc_c"); println!("cargo:rustc-link-lib=static=relibc_c"); diff --git a/src/c/stack_chk.c b/src/c/stack_chk.c new file mode 100644 index 0000000000..8574090818 --- /dev/null +++ b/src/c/stack_chk.c @@ -0,0 +1,10 @@ +#include + +void abort(); + +uintptr_t __stack_chk_guard = 0xd048c37519fcadfe; + +__attribute__((noreturn)) +void __stack_chk_fail(void) { + abort(); +}