| ... | @@ -192,7 +192,7 @@ pub fn createEmpty( | ... | @@ -192,7 +192,7 @@ pub fn createEmpty( |
| 192 | null | 192 | null |
| 193 | else | 193 | else |
| 194 | try std.fmt.allocPrint(arena, "{s}.o", .{emit.sub_path}); | 194 | try std.fmt.allocPrint(arena, "{s}.o", .{emit.sub_path}); |
| 195 | const allow_shlib_undefined = options.allow_shlib_undefined orelse false; | 195 | const allow_shlib_undefined = options.allow_shlib_undefined orelse comp.config.any_sanitize_thread; |
| 196 | | 196 | |
| 197 | const self = try arena.create(MachO); | 197 | const self = try arena.create(MachO); |
| 198 | self.* = .{ | 198 | self.* = .{ |
| ... | @@ -411,6 +411,11 @@ pub fn flushModule(self: *MachO, arena: Allocator, prog_node: std.Progress.Node) | ... | @@ -411,6 +411,11 @@ pub fn flushModule(self: *MachO, arena: Allocator, prog_node: std.Progress.Node) |
| 411 | | 411 | |
| 412 | if (module_obj_path) |path| try positionals.append(.{ .path = path }); | 412 | if (module_obj_path) |path| try positionals.append(.{ .path = path }); |
| 413 | | 413 | |
| | 414 | // TSAN |
| | 415 | if (comp.config.any_sanitize_thread) { |
| | 416 | try positionals.append(.{ .path = comp.tsan_static_lib.?.full_object_path }); |
| | 417 | } |
| | 418 | |
| 414 | for (positionals.items) |obj| { | 419 | for (positionals.items) |obj| { |
| 415 | self.parsePositional(obj.path, obj.must_link) catch |err| switch (err) { | 420 | self.parsePositional(obj.path, obj.must_link) catch |err| switch (err) { |
| 416 | error.MalformedObject, | 421 | error.MalformedObject, |
| ... | @@ -825,6 +830,10 @@ fn dumpArgv(self: *MachO, comp: *Compilation) !void { | ... | @@ -825,6 +830,10 @@ fn dumpArgv(self: *MachO, comp: *Compilation) !void { |
| 825 | try argv.append(p); | 830 | try argv.append(p); |
| 826 | } | 831 | } |
| 827 | | 832 | |
| | 833 | if (comp.config.any_sanitize_thread) { |
| | 834 | try argv.append(comp.tsan_static_lib.?.full_object_path); |
| | 835 | } |
| | 836 | |
| 828 | for (self.lib_dirs) |lib_dir| { | 837 | for (self.lib_dirs) |lib_dir| { |
| 829 | const arg = try std.fmt.allocPrint(arena, "-L{s}", .{lib_dir}); | 838 | const arg = try std.fmt.allocPrint(arena, "-L{s}", .{lib_dir}); |
| 830 | try argv.append(arg); | 839 | try argv.append(arg); |