Commit d2cace58bd

Jakub Konka <kubkon@jakubkonka.com>
2024-07-04 22:09:57
Compilation: rename tsan_static_lib to tsan_lib
1 parent e42e12d
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),
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
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;
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,
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{