diff options
| author | Alex Rønne Petersen <alex@alexrp.com> | 2025-08-25 17:07:33 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-25 17:07:33 +0200 |
| commit | 9924897c065af526f43c82d4b8328b5e72d100bd (patch) | |
| tree | 57014d8d0c5834f0ef98c285b45218b44630ab9f /src/Compilation.zig | |
| parent | 5d019abe4ec70373db7a75c2a8a3e2d76939817c (diff) | |
| parent | 837e56431232e5257e988227dff45be6f4dececf (diff) | |
| download | zig-9924897c065af526f43c82d4b8328b5e72d100bd.tar.gz zig-9924897c065af526f43c82d4b8328b5e72d100bd.zip | |
Merge pull request #24995 from alexrp/ubsan-rt-hidden
ubsan-rt: export symbols with hidden visibility
Diffstat (limited to 'src/Compilation.zig')
| -rw-r--r-- | src/Compilation.zig | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/Compilation.zig b/src/Compilation.zig index 933774afc7..0243e74d00 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -2048,7 +2048,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; |
