zig

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

commit 76c3b6b794ebc9ddb910e369bbf2d121a01e06d8 (tree)
parent c9d19ebb7a3d6996ec8b299d1698adf6737d73e5
Author: Jakub Konka <kubkon@jakubkonka.com>
Date:   Thu,  4 Jul 2024 07:26:28 +0200

tsan: add workaround for TSAN Apple bug

Addresses TSAN bug on Apple platforms by always setting the headerpad
size to a non-zero value when building the TSAN dylib.

Diffstat:
Msrc/libtsan.zig | 3+++
1 file changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/libtsan.zig b/src/libtsan.zig @@ -290,6 +290,8 @@ pub fn buildTsan(comp: *Compilation, prog_node: std.Progress.Node) BuildError!vo try std.fmt.allocPrintZ(arena, "@rpath/{s}", .{basename}) else null; + // This is temp conditional on resolving https://github.com/llvm/llvm-project/issues/97627 upstream. + const headerpad_size: ?u32 = if (target.isDarwin()) 32 else null; const sub_compilation = Compilation.create(comp.gpa, arena, .{ .local_cache_directory = comp.global_cache_directory, .global_cache_directory = comp.global_cache_directory, @@ -315,6 +317,7 @@ pub fn buildTsan(comp: *Compilation, prog_node: std.Progress.Node) BuildError!vo .skip_linker_dependencies = skip_linker_dependencies, .linker_allow_shlib_undefined = linker_allow_shlib_undefined, .install_name = install_name, + .headerpad_size = headerpad_size, }) catch |err| { comp.setMiscFailure( .libtsan,