aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2021-11-15 18:34:52 -0500
committerGitHub <noreply@github.com>2021-11-15 18:34:52 -0500
commit39c0d8bd2c2bd048da6ea1821c6c46aa60fa2907 (patch)
tree8dd79b588a3b7a20a8589a4fd08a11881a8ff35c /src
parent33889e1974137a54d1a88b87f57462de2a7cc145 (diff)
parent08c768ad82280463410eacc5b7f19389cb1ba49b (diff)
downloadzig-39c0d8bd2c2bd048da6ea1821c6c46aa60fa2907.tar.gz
zig-39c0d8bd2c2bd048da6ea1821c6c46aa60fa2907.zip
Merge pull request #8674 from xxxbxxx/master
build: workaround link error with LTO and mingw
Diffstat (limited to 'src')
-rw-r--r--src/mingw.zig6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/mingw.zig b/src/mingw.zig
index c10dcbe3f0..8738bcbbcd 100644
--- a/src/mingw.zig
+++ b/src/mingw.zig
@@ -92,6 +92,12 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile) !void {
"-D_WIN32_WINNT=0x0f00",
"-D__MSVCRT_VERSION__=0x700",
});
+ if (std.mem.eql(u8, dep, "tlssup.c") and comp.bin_file.options.lto) {
+ // LLD will incorrectly drop the `_tls_index` symbol. Here we work
+ // around it by not using LTO for this one file.
+ // https://github.com/ziglang/zig/issues/8531
+ try args.append("-fno-lto");
+ }
c_source_files[i] = .{
.src_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{
"libc", "mingw", "crt", dep,