authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2024-07-04 22:09:57+02:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2024-07-04 22:09:57+02:00
logd2cace58bd031e72b830ebd42f5946f4000e52a4
tree0de296fd724ee324307f9d64dec0b1f115a7469c
parente42e12dbbf8ebae65589ff08c3b5a454d2d67441

Compilation: rename tsan_static_lib to tsan_lib


5 files changed, 11 insertions(+), 19 deletions(-)

src/Compilation.zig+2-5
...@@ -185,12 +185,9 @@ libcxxabi_static_lib: ?CRTFile = null,...@@ -185,12 +185,9 @@ libcxxabi_static_lib: ?CRTFile = null,
185/// Populated when we build the libunwind static library. A Job to build this is placed in the queue185/// Populated when we build the libunwind static library. A Job to build this is placed in the queue
186/// and resolved before calling linker.flush().186/// and resolved before calling linker.flush().
187libunwind_static_lib: ?CRTFile = null,187libunwind_static_lib: ?CRTFile = null,
188/// Populated when we build the TSAN static library. A Job to build this is placed in the queue188/// Populated when we build the TSAN library. A Job to build this is placed in the queue
189/// and resolved before calling linker.flush().189/// and resolved before calling linker.flush().
190tsan_static_lib: ?CRTFile = null,190tsan_lib: ?CRTFile = null,
191/// Populated when we build the TSAN dynamic library. A Job to build this is placed in the queue
192/// and resolved before calling linker.flush().
193tsan_dynamic_lib: ?CRTFile = null,
194/// Populated when we build the libc static library. A Job to build this is placed in the queue191/// Populated when we build the libc static library. A Job to build this is placed in the queue
195/// and resolved before calling linker.flush().192/// and resolved before calling linker.flush().
196libc_static_lib: ?CRTFile = null,193libc_static_lib: ?CRTFile = null,
src/libtsan.zig+2-7
...@@ -339,13 +339,8 @@ pub fn buildTsan(comp: *Compilation, prog_node: std.Progress.Node) BuildError!vo...@@ -339,13 +339,8 @@ pub fn buildTsan(comp: *Compilation, prog_node: std.Progress.Node) BuildError!vo
339 },339 },
340 };340 };
341341
342 assert(comp.tsan_static_lib == null and comp.tsan_dynamic_lib == null);342 assert(comp.tsan_lib == null);
343343 comp.tsan_lib = try sub_compilation.toCrtFile();
344 if (target.isDarwin()) {
345 comp.tsan_dynamic_lib = try sub_compilation.toCrtFile();
346 } else {
347 comp.tsan_static_lib = try sub_compilation.toCrtFile();
348 }
349}344}
350345
351const tsan_sources = [_][]const u8{346const tsan_sources = [_][]const u8{
src/link/Elf.zig+3-3
...@@ -1145,7 +1145,7 @@ pub fn flushModule(self: *Elf, arena: Allocator, prog_node: std.Progress.Node) l...@@ -1145,7 +1145,7 @@ pub fn flushModule(self: *Elf, arena: Allocator, prog_node: std.Progress.Node) l
11451145
1146 // TSAN1146 // TSAN
1147 if (comp.config.any_sanitize_thread) {1147 if (comp.config.any_sanitize_thread) {
1148 try positionals.append(.{ .path = comp.tsan_static_lib.?.full_object_path });1148 try positionals.append(.{ .path = comp.tsan_lib.?.full_object_path });
1149 }1149 }
11501150
1151 // libc1151 // libc
...@@ -1603,7 +1603,7 @@ fn dumpArgv(self: *Elf, comp: *Compilation) !void {...@@ -1603,7 +1603,7 @@ fn dumpArgv(self: *Elf, comp: *Compilation) !void {
1603 }1603 }
16041604
1605 if (comp.config.any_sanitize_thread) {1605 if (comp.config.any_sanitize_thread) {
1606 try argv.append(comp.tsan_static_lib.?.full_object_path);1606 try argv.append(comp.tsan_lib.?.full_object_path);
1607 }1607 }
16081608
1609 // libc1609 // libc
...@@ -2610,7 +2610,7 @@ fn linkWithLLD(self: *Elf, arena: Allocator, prog_node: std.Progress.Node) !void...@@ -2610,7 +2610,7 @@ fn linkWithLLD(self: *Elf, arena: Allocator, prog_node: std.Progress.Node) !void
2610 }2610 }
26112611
2612 if (comp.config.any_sanitize_thread) {2612 if (comp.config.any_sanitize_thread) {
2613 try argv.append(comp.tsan_static_lib.?.full_object_path);2613 try argv.append(comp.tsan_lib.?.full_object_path);
2614 }2614 }
26152615
2616 // libc2616 // libc
src/link/MachO.zig+3-3
...@@ -413,7 +413,7 @@ pub fn flushModule(self: *MachO, arena: Allocator, prog_node: std.Progress.Node)...@@ -413,7 +413,7 @@ pub fn flushModule(self: *MachO, arena: Allocator, prog_node: std.Progress.Node)
413413
414 // TSAN414 // TSAN
415 if (comp.config.any_sanitize_thread) {415 if (comp.config.any_sanitize_thread) {
416 try positionals.append(.{ .path = comp.tsan_dynamic_lib.?.full_object_path });416 try positionals.append(.{ .path = comp.tsan_lib.?.full_object_path });
417 }417 }
418418
419 for (positionals.items) |obj| {419 for (positionals.items) |obj| {
...@@ -831,7 +831,7 @@ fn dumpArgv(self: *MachO, comp: *Compilation) !void {...@@ -831,7 +831,7 @@ fn dumpArgv(self: *MachO, comp: *Compilation) !void {
831 }831 }
832832
833 if (comp.config.any_sanitize_thread) {833 if (comp.config.any_sanitize_thread) {
834 const path = comp.tsan_dynamic_lib.?.full_object_path;834 const path = comp.tsan_lib.?.full_object_path;
835 try argv.append(path);835 try argv.append(path);
836 try argv.appendSlice(&.{ "-rpath", std.fs.path.dirname(path) orelse "." });836 try argv.appendSlice(&.{ "-rpath", std.fs.path.dirname(path) orelse "." });
837 }837 }
...@@ -3023,7 +3023,7 @@ fn writeLoadCommands(self: *MachO) !struct { usize, usize, u64 } {...@@ -3023,7 +3023,7 @@ fn writeLoadCommands(self: *MachO) !struct { usize, usize, u64 } {
3023 ncmds += 1;3023 ncmds += 1;
3024 }3024 }
3025 if (comp.config.any_sanitize_thread) {3025 if (comp.config.any_sanitize_thread) {
3026 const path = comp.tsan_dynamic_lib.?.full_object_path;3026 const path = comp.tsan_lib.?.full_object_path;
3027 const rpath = std.fs.path.dirname(path) orelse ".";3027 const rpath = std.fs.path.dirname(path) orelse ".";
3028 try load_commands.writeRpathLC(rpath, writer);3028 try load_commands.writeRpathLC(rpath, writer);
3029 ncmds += 1;3029 ncmds += 1;
src/link/MachO/load_commands.zig+1-1
...@@ -72,7 +72,7 @@ pub fn calcLoadCommandsSize(macho_file: *MachO, assume_max_path_len: bool) !u32...@@ -72,7 +72,7 @@ pub fn calcLoadCommandsSize(macho_file: *MachO, assume_max_path_len: bool) !u32
72 }72 }
7373
74 if (comp.config.any_sanitize_thread) {74 if (comp.config.any_sanitize_thread) {
75 const path = comp.tsan_dynamic_lib.?.full_object_path;75 const path = comp.tsan_lib.?.full_object_path;
76 const rpath = std.fs.path.dirname(path) orelse ".";76 const rpath = std.fs.path.dirname(path) orelse ".";
77 sizeofcmds += calcInstallNameLen(77 sizeofcmds += calcInstallNameLen(
78 @sizeOf(macho.rpath_command),78 @sizeOf(macho.rpath_command),