libtsan: Build with unwind tables like upstream.

This commit is contained in:
Alex Rønne Petersen 2025-01-25 14:53:25 +01:00
parent 46a1a15861
commit 9f116d38b8
No known key found for this signature in database

View File

@ -53,6 +53,8 @@ pub fn buildTsan(comp: *Compilation, prog_node: std.Progress.Node) BuildError!vo
const optimize_mode = comp.compilerRtOptMode(); const optimize_mode = comp.compilerRtOptMode();
const strip = comp.compilerRtStrip(); const strip = comp.compilerRtStrip();
const link_libcpp = target.isDarwin(); const link_libcpp = target.isDarwin();
const unwind_tables: std.builtin.UnwindTables =
if (target.cpu.arch == .x86 and target.os.tag == .windows) .none else .@"async";
const config = Compilation.Config.resolve(.{ const config = Compilation.Config.resolve(.{
.output_mode = output_mode, .output_mode = output_mode,
@ -65,6 +67,7 @@ pub fn buildTsan(comp: *Compilation, prog_node: std.Progress.Node) BuildError!vo
.root_strip = strip, .root_strip = strip,
.link_libc = true, .link_libc = true,
.link_libcpp = link_libcpp, .link_libcpp = link_libcpp,
.any_unwind_tables = unwind_tables != .none,
// LLVM disables LTO for its libtsan. // LLVM disables LTO for its libtsan.
.lto = .none, .lto = .none,
}) catch |err| { }) catch |err| {
@ -97,6 +100,7 @@ pub fn buildTsan(comp: *Compilation, prog_node: std.Progress.Node) BuildError!vo
.red_zone = comp.root_mod.red_zone, .red_zone = comp.root_mod.red_zone,
.omit_frame_pointer = optimize_mode != .Debug and !target.os.tag.isDarwin(), .omit_frame_pointer = optimize_mode != .Debug and !target.os.tag.isDarwin(),
.valgrind = false, .valgrind = false,
.unwind_tables = unwind_tables,
.optimize_mode = optimize_mode, .optimize_mode = optimize_mode,
.structured_cfg = comp.root_mod.structured_cfg, .structured_cfg = comp.root_mod.structured_cfg,
.pic = true, .pic = true,