| ... | ... | @@ -4,6 +4,7 @@ const assert = std.debug.assert; |
| 4 | 4 | const Compilation = @import("Compilation.zig"); |
| 5 | 5 | const build_options = @import("build_options"); |
| 6 | 6 | const trace = @import("tracy.zig").trace; |
| 7 | const Module = @import("Package/Module.zig"); |
| 7 | 8 | |
| 8 | 9 | pub fn buildTsan(comp: *Compilation, prog_node: *std.Progress.Node) !void { |
| 9 | 10 | if (!build_options.have_llvm) { |
| ... | ... | @@ -195,44 +196,71 @@ pub fn buildTsan(comp: *Compilation, prog_node: *std.Progress.Node) !void { |
| 195 | 196 | "-DTSAN_CONTAINS_UBSAN=0", |
| 196 | 197 | }; |
| 197 | 198 | |
| 199 | const optimize_mode = comp.compilerRtOptMode(); |
| 200 | const strip = comp.compilerRtStrip(); |
| 201 | |
| 202 | const config = try Compilation.Config.resolve(.{ |
| 203 | .output_mode = output_mode, |
| 204 | .link_mode = link_mode, |
| 205 | .resolved_target = comp.root_mod.resolved_target, |
| 206 | .is_test = false, |
| 207 | .have_zcu = false, |
| 208 | .emit_bin = true, |
| 209 | .root_optimize_mode = optimize_mode, |
| 210 | .root_strip = strip, |
| 211 | .link_libc = true, |
| 212 | }); |
| 213 | |
| 214 | const root_mod = try Module.create(arena, .{ |
| 215 | .global_cache_directory = comp.global_cache_directory, |
| 216 | .paths = .{ |
| 217 | .root = .{ .root_dir = comp.zig_lib_directory }, |
| 218 | .root_src_path = "", |
| 219 | }, |
| 220 | .fully_qualified_name = "root", |
| 221 | .inherited = .{ |
| 222 | .strip = strip, |
| 223 | .stack_check = false, |
| 224 | .stack_protector = 0, |
| 225 | .sanitize_c = false, |
| 226 | .sanitize_thread = false, |
| 227 | .red_zone = comp.root_mod.red_zone, |
| 228 | .omit_frame_pointer = comp.root_mod.omit_frame_pointer, |
| 229 | .valgrind = false, |
| 230 | .optimize_mode = optimize_mode, |
| 231 | .structured_cfg = comp.root_mod.structured_cfg, |
| 232 | .pic = true, |
| 233 | .cc_argv = &common_flags, |
| 234 | }, |
| 235 | .global = config, |
| 236 | .cc_argv = &.{}, |
| 237 | .parent = null, |
| 238 | .builtin_mod = null, |
| 239 | }); |
| 240 | |
| 198 | 241 | const sub_compilation = try Compilation.create(comp.gpa, .{ |
| 199 | 242 | .local_cache_directory = comp.global_cache_directory, |
| 200 | 243 | .global_cache_directory = comp.global_cache_directory, |
| 201 | 244 | .zig_lib_directory = comp.zig_lib_directory, |
| 245 | .thread_pool = comp.thread_pool, |
| 246 | .self_exe_path = comp.self_exe_path, |
| 202 | 247 | .cache_mode = .whole, |
| 203 | | .target = target, |
| 248 | .config = config, |
| 249 | .root_mod = root_mod, |
| 204 | 250 | .root_name = root_name, |
| 205 | | .main_mod = null, |
| 206 | | .output_mode = output_mode, |
| 207 | | .thread_pool = comp.thread_pool, |
| 208 | | .libc_installation = comp.bin_file.options.libc_installation, |
| 251 | .libc_installation = comp.libc_installation, |
| 209 | 252 | .emit_bin = emit_bin, |
| 210 | | .optimize_mode = comp.compilerRtOptMode(), |
| 211 | | .link_mode = link_mode, |
| 212 | | .want_sanitize_c = false, |
| 213 | | .want_stack_check = false, |
| 214 | | .want_stack_protector = 0, |
| 215 | | .want_valgrind = false, |
| 216 | | .want_tsan = false, |
| 217 | | .want_pic = true, |
| 218 | | .want_pie = null, |
| 219 | 253 | .emit_h = null, |
| 220 | | .strip = comp.compilerRtStrip(), |
| 221 | | .is_native_os = comp.bin_file.options.is_native_os, |
| 222 | | .is_native_abi = comp.bin_file.options.is_native_abi, |
| 223 | | .self_exe_path = comp.self_exe_path, |
| 224 | 254 | .c_source_files = c_source_files.items, |
| 225 | 255 | .verbose_cc = comp.verbose_cc, |
| 226 | | .verbose_link = comp.bin_file.options.verbose_link, |
| 256 | .verbose_link = comp.verbose_link, |
| 227 | 257 | .verbose_air = comp.verbose_air, |
| 228 | 258 | .verbose_llvm_ir = comp.verbose_llvm_ir, |
| 229 | 259 | .verbose_llvm_bc = comp.verbose_llvm_bc, |
| 230 | 260 | .verbose_cimport = comp.verbose_cimport, |
| 231 | 261 | .verbose_llvm_cpu_features = comp.verbose_llvm_cpu_features, |
| 232 | 262 | .clang_passthrough_mode = comp.clang_passthrough_mode, |
| 233 | | .link_libc = true, |
| 234 | 263 | .skip_linker_dependencies = true, |
| 235 | | .clang_argv = &common_flags, |
| 236 | 264 | }); |
| 237 | 265 | defer sub_compilation.destroy(); |
| 238 | 266 | |
| ... | ... | @@ -240,8 +268,8 @@ pub fn buildTsan(comp: *Compilation, prog_node: *std.Progress.Node) !void { |
| 240 | 268 | |
| 241 | 269 | assert(comp.tsan_static_lib == null); |
| 242 | 270 | comp.tsan_static_lib = Compilation.CRTFile{ |
| 243 | | .full_object_path = try sub_compilation.bin_file.options.emit.?.directory.join(comp.gpa, &[_][]const u8{ |
| 244 | | sub_compilation.bin_file.options.emit.?.sub_path, |
| 271 | .full_object_path = try sub_compilation.bin_file.?.emit.directory.join(comp.gpa, &[_][]const u8{ |
| 272 | sub_compilation.bin_file.?.emit.sub_path, |
| 245 | 273 | }), |
| 246 | 274 | .lock = sub_compilation.bin_file.toOwnedLock(), |
| 247 | 275 | }; |