authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-04-22 15:30:58+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-04-25 21:49:38+02:00
log47848ba3d619f7bf64adff10933176f6296d1552
treeee9767e81cd0731821d68c1a18a9fe8c41263b5f
parent0a9c4008fd66dd85accb6e5e862849a26500c6ec
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

zig cc: define __CRT__NO_INLINE for MinGW-w64 targets

See added comment for why.

1 files changed, 7 insertions(+), 0 deletions(-)

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