zig

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

commit 1e3fb482563cc3ce769c01bb608e5a9424ec426f (tree)
parent a016ca61706b300534a3a3a3c656b9b0ec24591c
Author: Jakub Konka <kubkon@jakubkonka.com>
Date:   Thu, 27 Jun 2024 06:35:53 +0200

Merge pull request #20428 from ziglang/macho-tsan

macho: support TSAN
Diffstat:
Msrc/link/MachO.zig | 11++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/link/MachO.zig b/src/link/MachO.zig @@ -192,7 +192,7 @@ pub fn createEmpty( null else try std.fmt.allocPrint(arena, "{s}.o", .{emit.sub_path}); - const allow_shlib_undefined = options.allow_shlib_undefined orelse false; + const allow_shlib_undefined = options.allow_shlib_undefined orelse comp.config.any_sanitize_thread; const self = try arena.create(MachO); self.* = .{ @@ -411,6 +411,11 @@ pub fn flushModule(self: *MachO, arena: Allocator, prog_node: std.Progress.Node) if (module_obj_path) |path| try positionals.append(.{ .path = path }); + // TSAN + if (comp.config.any_sanitize_thread) { + try positionals.append(.{ .path = comp.tsan_static_lib.?.full_object_path }); + } + for (positionals.items) |obj| { self.parsePositional(obj.path, obj.must_link) catch |err| switch (err) { error.MalformedObject, @@ -825,6 +830,10 @@ fn dumpArgv(self: *MachO, comp: *Compilation) !void { try argv.append(p); } + if (comp.config.any_sanitize_thread) { + try argv.append(comp.tsan_static_lib.?.full_object_path); + } + for (self.lib_dirs) |lib_dir| { const arg = try std.fmt.allocPrint(arena, "-L{s}", .{lib_dir}); try argv.append(arg);