aboutsummaryrefslogtreecommitdiff
path: root/src/link
diff options
context:
space:
mode:
authorLemonBoy <thatlemon@gmail.com>2020-10-02 16:48:18 +0200
committerAndrew Kelley <andrew@ziglang.org>2020-10-16 21:22:14 -0400
commitd44486b274a916823fcf6045a6400ef51e07d544 (patch)
treec12a3a3923b644d219f815630941073d99d31889 /src/link
parent2aff27d92247eed3b64ffc68da8fae9e5994ea0b (diff)
downloadzig-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 'src/link')
-rw-r--r--src/link/Coff.zig6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/link/Coff.zig b/src/link/Coff.zig
index 334492e164..3eb4d32c95 100644
--- a/src/link/Coff.zig
+++ b/src/link/Coff.zig
@@ -1117,11 +1117,15 @@ fn linkWithLLD(self: *Coff, comp: *Compilation) !void {
try argv.append(comp.libunwind_static_lib.?.full_object_path);
}
- // compiler-rt and libc
+ // compiler-rt, libc and libssp
if (is_exe_or_dyn_lib and !self.base.options.is_compiler_rt_or_libc) {
if (!self.base.options.link_libc) {
try argv.append(comp.libc_static_lib.?.full_object_path);
}
+ // MinGW doesn't provide libssp symbols
+ if (target.abi.isGnu()) {
+ try argv.append(comp.libssp_static_lib.?.full_object_path);
+ }
// MSVC compiler_rt is missing some stuff, so we build it unconditionally but
// and rely on weak linkage to allow MSVC compiler_rt functions to override ours.
try argv.append(comp.compiler_rt_static_lib.?.full_object_path);