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 06:45:31+02:00
log837e56431232e5257e988227dff45be6f4dececf
tree35595bac8480af82bf6c0f157a1f41011207e3f0
parentbed8171d4e41a2bb6759c96076f957920e039bfd
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
......@@ -2048,7 +2048,14 @@ pub fn create(gpa: Allocator, arena: Allocator, diag: *CreateDiagnostic, options
20482048 break :s .none; // only LLD can handle ubsan-rt for this target
20492049 } else true,
20502050 };
2051 if (have_zcu and (!need_llvm or use_llvm)) break :s .zcu;
2051 if (have_zcu and (!need_llvm or use_llvm)) {
2052 // ubsan-rt's exports use hidden visibility. If we're building a Windows DLL and
2053 // exported functions are going to be dllexported, LLVM will complain that
2054 // dllexported functions must use default or protected visibility. So we can't use
2055 // the ZCU strategy in this case.
2056 if (options.config.dll_export_fns) break :s .lib;
2057 break :s .zcu;
2058 }
20522059 if (need_llvm and !build_options.have_llvm) break :s .none; // impossible to build without llvm
20532060 if (is_exe_or_dyn_lib) break :s .lib;
20542061 break :s .obj;