authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-08-25 06:45:00+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-08-25 18:51:09+02:00
log48600bc2b3fbc3843a59d4eab7ce90a425f36272
tree1be620396dd14157dd1cfcc0acee6cd487b7f6f4
parent65af60edd004d656beff8f79e4dc19915cfcc6d5
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

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


1 files changed, 8 insertions(+), 1 deletions(-)

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