mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-04-06 07:38:21 +00:00
build: skip bundled compiler_rt and ubsan_rt in Windows static lib
Zig's compiler_rt produces COFF objects with invalid COMDAT sections that the MSVC linker rejects (LNK1143), and its ubsan_rt emits /exclude-symbols directives that MSVC does not understand (LNK4229). Skip bundling both in the static library on Windows since the MSVC CRT provides the needed builtins (memcpy, memset, etc.). The shared library continues to bundle compiler_rt as it needs to be self-contained.
This commit is contained in:
@@ -94,12 +94,20 @@ fn initLib(
|
||||
);
|
||||
|
||||
if (kind == .static) {
|
||||
const is_windows = target.result.os.tag == .windows;
|
||||
|
||||
// These must be bundled since we're compiling into a static lib.
|
||||
// Otherwise, you get undefined symbol errors. This could cause
|
||||
// problems if you're linking multiple static Zig libraries but
|
||||
// we'll cross that bridge when we get to it.
|
||||
lib.bundle_compiler_rt = true;
|
||||
lib.bundle_ubsan_rt = true;
|
||||
//
|
||||
// On Windows, Zig's compiler_rt produces COFF objects with
|
||||
// invalid COMDAT sections (LNK1143) and its ubsan_rt emits
|
||||
// /exclude-symbols directives the MSVC linker rejects
|
||||
// (LNK4229). Both are skipped since the MSVC CRT provides
|
||||
// the needed builtins (memcpy, memset, etc.).
|
||||
lib.bundle_compiler_rt = !is_windows;
|
||||
lib.bundle_ubsan_rt = !is_windows;
|
||||
|
||||
// Enable PIC so the static library can be linked into PIE
|
||||
// executables, which is the default on most Linux distributions.
|
||||
|
||||
Reference in New Issue
Block a user