diff --git a/src/Compilation.zig b/src/Compilation.zig index dc6401c6f4b9e0c3d5dc394b5f1b4236dfad6d6e..0b906594f9ec7b0a4937666f99b81815266c36c9 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -6362,6 +6362,13 @@ fn addCommonCCArgs( try argv.append( try std.fmt.allocPrint(arena, "-D_WIN32_WINNT=0x{x:0>4}", .{minver}), ); + + // MinGW-w64's inline functions in headers (e.g. `fabs`), which are emitted with `linkonce_odr` + // linkage, sometimes cause duplicate symbol errors due to us providing the same symbols with + // `weak` linkage in compiler-rt or libzigc. So just disable them. Besides, they undermine the + // goal of moving more libc code to Zig, and they're also just kind of unnecessary since LLVM is + // perfectly capable of recognizing and optimizing libcalls. + try argv.append("-D__CRT__NO_INLINE"); } else if (target.isFreeBSDLibC()) { // https://docs.freebsd.org/en/books/porters-handbook/versions const min_ver = target.os.version_range.semver.min;