diff --git a/src/Compilation.zig b/src/Compilation.zig index 412798e09a..b72a58f7fc 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -185,12 +185,9 @@ libcxxabi_static_lib: ?CRTFile = null, /// Populated when we build the libunwind static library. A Job to build this is placed in the queue /// and resolved before calling linker.flush(). libunwind_static_lib: ?CRTFile = null, -/// Populated when we build the TSAN static library. A Job to build this is placed in the queue +/// Populated when we build the TSAN library. A Job to build this is placed in the queue /// and resolved before calling linker.flush(). -tsan_static_lib: ?CRTFile = null, -/// Populated when we build the TSAN dynamic library. A Job to build this is placed in the queue -/// and resolved before calling linker.flush(). -tsan_dynamic_lib: ?CRTFile = null, +tsan_lib: ?CRTFile = null, /// Populated when we build the libc static library. A Job to build this is placed in the queue /// and resolved before calling linker.flush(). libc_static_lib: ?CRTFile = null, diff --git a/src/libtsan.zig b/src/libtsan.zig index bc72f9d86c..42b605bf3c 100644 --- a/src/libtsan.zig +++ b/src/libtsan.zig @@ -339,13 +339,8 @@ pub fn buildTsan(comp: *Compilation, prog_node: std.Progress.Node) BuildError!vo }, }; - assert(comp.tsan_static_lib == null and comp.tsan_dynamic_lib == null); - - if (target.isDarwin()) { - comp.tsan_dynamic_lib = try sub_compilation.toCrtFile(); - } else { - comp.tsan_static_lib = try sub_compilation.toCrtFile(); - } + assert(comp.tsan_lib == null); + comp.tsan_lib = try sub_compilation.toCrtFile(); } const tsan_sources = [_][]const u8{ diff --git a/src/link/Elf.zig b/src/link/Elf.zig index 5a14a544e8..b1048dfe9d 100644 --- a/src/link/Elf.zig +++ b/src/link/Elf.zig @@ -1145,7 +1145,7 @@ pub fn flushModule(self: *Elf, arena: Allocator, prog_node: std.Progress.Node) l // TSAN if (comp.config.any_sanitize_thread) { - try positionals.append(.{ .path = comp.tsan_static_lib.?.full_object_path }); + try positionals.append(.{ .path = comp.tsan_lib.?.full_object_path }); } // libc @@ -1603,7 +1603,7 @@ fn dumpArgv(self: *Elf, comp: *Compilation) !void { } if (comp.config.any_sanitize_thread) { - try argv.append(comp.tsan_static_lib.?.full_object_path); + try argv.append(comp.tsan_lib.?.full_object_path); } // libc @@ -2610,7 +2610,7 @@ fn linkWithLLD(self: *Elf, arena: Allocator, prog_node: std.Progress.Node) !void } if (comp.config.any_sanitize_thread) { - try argv.append(comp.tsan_static_lib.?.full_object_path); + try argv.append(comp.tsan_lib.?.full_object_path); } // libc diff --git a/src/link/MachO.zig b/src/link/MachO.zig index 76bea81766..4dcc11ef53 100644 --- a/src/link/MachO.zig +++ b/src/link/MachO.zig @@ -413,7 +413,7 @@ pub fn flushModule(self: *MachO, arena: Allocator, prog_node: std.Progress.Node) // TSAN if (comp.config.any_sanitize_thread) { - try positionals.append(.{ .path = comp.tsan_dynamic_lib.?.full_object_path }); + try positionals.append(.{ .path = comp.tsan_lib.?.full_object_path }); } for (positionals.items) |obj| { @@ -831,7 +831,7 @@ fn dumpArgv(self: *MachO, comp: *Compilation) !void { } if (comp.config.any_sanitize_thread) { - const path = comp.tsan_dynamic_lib.?.full_object_path; + const path = comp.tsan_lib.?.full_object_path; try argv.append(path); try argv.appendSlice(&.{ "-rpath", std.fs.path.dirname(path) orelse "." }); } @@ -3023,7 +3023,7 @@ fn writeLoadCommands(self: *MachO) !struct { usize, usize, u64 } { ncmds += 1; } if (comp.config.any_sanitize_thread) { - const path = comp.tsan_dynamic_lib.?.full_object_path; + const path = comp.tsan_lib.?.full_object_path; const rpath = std.fs.path.dirname(path) orelse "."; try load_commands.writeRpathLC(rpath, writer); ncmds += 1; diff --git a/src/link/MachO/load_commands.zig b/src/link/MachO/load_commands.zig index 003612fa2f..74d0c58cbd 100644 --- a/src/link/MachO/load_commands.zig +++ b/src/link/MachO/load_commands.zig @@ -72,7 +72,7 @@ pub fn calcLoadCommandsSize(macho_file: *MachO, assume_max_path_len: bool) !u32 } if (comp.config.any_sanitize_thread) { - const path = comp.tsan_dynamic_lib.?.full_object_path; + const path = comp.tsan_lib.?.full_object_path; const rpath = std.fs.path.dirname(path) orelse "."; sizeofcmds += calcInstallNameLen( @sizeOf(macho.rpath_command),