zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 48600bc2b3fbc3843a59d4eab7ce90a425f36272 (tree)
parent 65af60edd004d656beff8f79e4dc19915cfcc6d5
Author: Alex Rønne Petersen <alex@alexrp.com>
Date:   Mon, 25 Aug 2025 06:45:00 +0200

Compilation: avoid ZCU strategy for ubsan-rt in Windows DLLs

Diffstat:
Msrc/Compilation.zig | 9++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/Compilation.zig b/src/Compilation.zig @@ -2053,7 +2053,14 @@ pub fn create(gpa: Allocator, arena: Allocator, diag: *CreateDiagnostic, options break :s .none; // only LLD can handle ubsan-rt for this target } else true, }; - if (have_zcu and (!need_llvm or use_llvm)) break :s .zcu; + if (have_zcu and (!need_llvm or use_llvm)) { + // ubsan-rt's exports use hidden visibility. If we're building a Windows DLL and + // exported functions are going to be dllexported, LLVM will complain that + // dllexported functions must use default or protected visibility. So we can't use + // the ZCU strategy in this case. + if (options.config.dll_export_fns) break :s .lib; + break :s .zcu; + } if (need_llvm and !build_options.have_llvm) break :s .none; // impossible to build without llvm if (is_exe_or_dyn_lib) break :s .lib; break :s .obj;