mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-08-29 10:31:40 +00:00
build: avoid MSVC C++ runtime in no-libcxx builds
AI-assisted: Codex
This commit is contained in:
committed by
Mitchell Hashimoto
parent
1fe1b2d23c
commit
84254a9d8c
@@ -249,9 +249,14 @@ fn initLib(
|
||||
lib.bundle_ubsan_rt = false;
|
||||
|
||||
if (kind == .static) {
|
||||
// compiler_rt expects ntdll to provide _fltused when libc is
|
||||
// linked, and the Zig standard library uses other NT and kernel32
|
||||
// symbols.
|
||||
if (target.result.abi == .msvc) {
|
||||
// Zig's compiler runtime doesn't provide MSVC's security
|
||||
// cookie symbols when libc is linked. Disable stack-protector
|
||||
// generation so static consumers don't need BufferOverflowU.
|
||||
lib.root_module.stack_protector = false;
|
||||
}
|
||||
|
||||
// The Zig standard library uses NT and kernel32 symbols.
|
||||
lib.root_module.linkSystemLibrary("ntdll", .{});
|
||||
lib.root_module.linkSystemLibrary("kernel32", .{});
|
||||
}
|
||||
|
||||
@@ -991,6 +991,11 @@ pub fn addSimd(
|
||||
"-fno-sanitize=undefined",
|
||||
"-fno-sanitize-trap=undefined",
|
||||
});
|
||||
if (target.result.abi == .msvc) try flags.appendSlice(b.allocator, &.{
|
||||
// -fno-autolink also drops UCRT's /alternatename fallback.
|
||||
"-D_Avx2WmemEnabledWeakValue=_Avx2WmemEnabled",
|
||||
"-fno-autolink",
|
||||
});
|
||||
|
||||
m.addCSourceFiles(.{
|
||||
.files = &.{
|
||||
|
||||
Reference in New Issue
Block a user