From d2cace58bd031e72b830ebd42f5946f4000e52a4 Mon Sep 17 00:00:00 2001 From: Jakub Konka Date: Thu, 4 Jul 2024 22:09:57 +0200 Subject: [PATCH] Compilation: rename tsan_static_lib to tsan_lib --- src/Compilation.zig | 7 ++----- src/libtsan.zig | 9 ++------- src/link/Elf.zig | 6 +++--- src/link/MachO.zig | 6 +++--- src/link/MachO/load_commands.zig | 2 +- 5 files changed, 11 insertions(+), 19 deletions(-) diff --git a/src/Compilation.zig b/src/Compilation.zig index 412798e09a3d27d954fa4053e5746d805861cd76..b72a58f7fc96eb16183f36fa4acd54fc69c83f91 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 bc72f9d86c6669bb63aba53cf531afcf2fceee19..42b605bf3c2fd9ed495fd52a611afee7784da689 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 5a14a544e85dc09878061653bb1cb88cc1da8388..b1048dfe9da8f3d85d513bde1d70d016ad678383 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 76bea817663007cb5630a468f987592a97f50ccf..4dcc11ef53f928c8d89f62f791e734643a94ba16 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 003612fa2f808487f1ccb12ddf802b1ffc50b7ae..74d0c58cbd284226f0b2c5ed56153b7e7d43ca57 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), -- 2.54.0