diff options
| author | LemonBoy <thatlemon@gmail.com> | 2020-10-02 16:48:18 +0200 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2020-10-16 21:22:14 -0400 |
| commit | d44486b274a916823fcf6045a6400ef51e07d544 (patch) | |
| tree | c12a3a3923b644d219f815630941073d99d31889 /lib/std/special/compiler_rt.zig | |
| parent | 2aff27d92247eed3b64ffc68da8fae9e5994ea0b (diff) | |
| download | zig-d44486b274a916823fcf6045a6400ef51e07d544.tar.gz zig-d44486b274a916823fcf6045a6400ef51e07d544.zip | |
std: Add libssp implementation for GNU/Windows targets
Unlike glibc and musl, MinGW provides no libssp symbols leading to
countless compile errors if FORTIFY_SOURCE is defined.
Add a (incomplete) implementation of libssp written in Zig so that
linking succeeds.
Closes #6492
Diffstat (limited to 'lib/std/special/compiler_rt.zig')
| -rw-r--r-- | lib/std/special/compiler_rt.zig | 19 |
1 files changed, 0 insertions, 19 deletions
diff --git a/lib/std/special/compiler_rt.zig b/lib/std/special/compiler_rt.zig index e2105f6084..98d292cce9 100644 --- a/lib/std/special/compiler_rt.zig +++ b/lib/std/special/compiler_rt.zig @@ -284,11 +284,6 @@ comptime { @export(@import("compiler_rt/stack_probe.zig").__chkstk, .{ .name = "__chkstk", .linkage = strong_linkage }); } - if (is_mingw) { - @export(__stack_chk_fail, .{ .name = "__stack_chk_fail", .linkage = strong_linkage }); - @export(__stack_chk_guard, .{ .name = "__stack_chk_guard", .linkage = strong_linkage }); - } - switch (builtin.arch) { .i386 => { @export(@import("compiler_rt/divti3.zig").__divti3, .{ .name = "__divti3", .linkage = linkage }); @@ -311,9 +306,6 @@ comptime { else => {}, } } else { - if (std.Target.current.isGnuLibC() and builtin.link_libc) { - @export(__stack_chk_guard, .{ .name = "__stack_chk_guard", .linkage = linkage }); - } @export(@import("compiler_rt/divti3.zig").__divti3, .{ .name = "__divti3", .linkage = linkage }); @export(@import("compiler_rt/modti3.zig").__modti3, .{ .name = "__modti3", .linkage = linkage }); @export(@import("compiler_rt/multi3.zig").__multi3, .{ .name = "__multi3", .linkage = linkage }); @@ -337,14 +329,3 @@ pub fn panic(msg: []const u8, error_return_trace: ?*builtin.StackTrace) noreturn unreachable; } } - -fn __stack_chk_fail() callconv(.C) noreturn { - @panic("stack smashing detected"); -} - -var __stack_chk_guard: usize = blk: { - var buf = [1]u8{0} ** @sizeOf(usize); - buf[@sizeOf(usize) - 1] = 255; - buf[@sizeOf(usize) - 2] = '\n'; - break :blk @bitCast(usize, buf); -}; |
