authorgravatar for jalgas1998@gmail.comZhalkhas <jalgas1998@gmail.com> 2026-05-28 04:32:23+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-05-28 04:32:23+02:00
logf04799dc9c60189b11f0bbcd4f0027b9928ef6e4
tree5023c546e3b866b34330d6f71b10b1206013b95d
parent7ee6e7d61edcd19c594cb40fdb64703f58e32994

implicitly enable LLVM when TSan is enabled (#35311)

FIxes #32127 Reviewed-on: https://codeberg.org/ziglang/zig/pulls/35311

2 files changed, 8 insertions(+), 0 deletions(-)

src/Compilation/Config.zig+7
...@@ -146,6 +146,7 @@ pub const ResolveError = error{...@@ -146,6 +146,7 @@ pub const ResolveError = error{
146 DynamicLibraryPrecludesPie,146 DynamicLibraryPrecludesPie,
147 TargetRequiresPie,147 TargetRequiresPie,
148 SanitizeThreadRequiresPie,148 SanitizeThreadRequiresPie,
149 SanitizeThreadRequiresLlvmBackend,
149 BackendLacksErrorTracing,150 BackendLacksErrorTracing,
150 LlvmLibraryUnavailable,151 LlvmLibraryUnavailable,
151 LldUnavailable,152 LldUnavailable,
...@@ -342,6 +343,12 @@ pub fn resolve(options: Options) ResolveError!Config {...@@ -342,6 +343,12 @@ pub fn resolve(options: Options) ResolveError!Config {
342 break :b true;343 break :b true;
343 }344 }
344345
346 if (options.any_sanitize_thread) {
347 // Thread sanitization instrumentation requires the LLVM backend.
348 if (options.use_llvm == false) return error.SanitizeThreadRequiresLlvmBackend;
349 break :b true;
350 }
351
345 if (options.use_llvm) |x| break :b x;352 if (options.use_llvm) |x| break :b x;
346353
347 // If we cannot use LLVM libraries, then our own backends will be a354 // If we cannot use LLVM libraries, then our own backends will be a
src/main.zig+1
...@@ -4131,6 +4131,7 @@ fn createModule(...@@ -4131,6 +4131,7 @@ fn createModule(
4131 error.DynamicLibraryPrecludesPie => fatal("dynamic libraries cannot be position independent executables", .{}),4131 error.DynamicLibraryPrecludesPie => fatal("dynamic libraries cannot be position independent executables", .{}),
4132 error.TargetRequiresPie => fatal("the specified target requires position independent executables", .{}),4132 error.TargetRequiresPie => fatal("the specified target requires position independent executables", .{}),
4133 error.SanitizeThreadRequiresPie => fatal("thread sanitization requires position independent executables", .{}),4133 error.SanitizeThreadRequiresPie => fatal("thread sanitization requires position independent executables", .{}),
4134 error.SanitizeThreadRequiresLlvmBackend => fatal("thread sanitization requires the LLVM backend", .{}),
4134 error.BackendLacksErrorTracing => fatal("the selected backend has not yet implemented error return tracing", .{}),4135 error.BackendLacksErrorTracing => fatal("the selected backend has not yet implemented error return tracing", .{}),
4135 error.LlvmLibraryUnavailable => fatal("zig was compiled without LLVM libraries", .{}),4136 error.LlvmLibraryUnavailable => fatal("zig was compiled without LLVM libraries", .{}),
4136 error.LldUnavailable => fatal("zig was compiled without LLD libraries", .{}),4137 error.LldUnavailable => fatal("zig was compiled without LLD libraries", .{}),