frontend: use main Compilation code_model when building libxx

as well as libtsan, libunwind, and libc files
This commit is contained in:
Andrew Kelley 2025-01-27 00:37:18 -08:00
parent 884b1423a4
commit 37037b269e
4 changed files with 5 additions and 0 deletions

View File

@ -6611,6 +6611,7 @@ pub fn build_crt_file(
.structured_cfg = comp.root_mod.structured_cfg, .structured_cfg = comp.root_mod.structured_cfg,
// Some libcs (e.g. musl) are opinionated about -fno-builtin. // Some libcs (e.g. musl) are opinionated about -fno-builtin.
.no_builtin = options.no_builtin orelse comp.root_mod.no_builtin, .no_builtin = options.no_builtin orelse comp.root_mod.no_builtin,
.code_model = comp.root_mod.code_model,
}, },
.global = config, .global = config,
.cc_argv = &.{}, .cc_argv = &.{},

View File

@ -196,6 +196,7 @@ pub fn buildLibCxx(comp: *Compilation, prog_node: std.Progress.Node) BuildError!
.optimize_mode = optimize_mode, .optimize_mode = optimize_mode,
.structured_cfg = comp.root_mod.structured_cfg, .structured_cfg = comp.root_mod.structured_cfg,
.pic = if (target_util.supports_fpic(target)) true else null, .pic = if (target_util.supports_fpic(target)) true else null,
.code_model = comp.root_mod.code_model,
}, },
.global = config, .global = config,
.cc_argv = &.{}, .cc_argv = &.{},
@ -445,6 +446,7 @@ pub fn buildLibCxxAbi(comp: *Compilation, prog_node: std.Progress.Node) BuildErr
.structured_cfg = comp.root_mod.structured_cfg, .structured_cfg = comp.root_mod.structured_cfg,
.unwind_tables = unwind_tables, .unwind_tables = unwind_tables,
.pic = comp.root_mod.pic, .pic = comp.root_mod.pic,
.code_model = comp.root_mod.code_model,
}, },
.global = config, .global = config,
.cc_argv = &.{}, .cc_argv = &.{},

View File

@ -105,6 +105,7 @@ pub fn buildTsan(comp: *Compilation, prog_node: std.Progress.Node) BuildError!vo
.structured_cfg = comp.root_mod.structured_cfg, .structured_cfg = comp.root_mod.structured_cfg,
.pic = true, .pic = true,
.no_builtin = true, .no_builtin = true,
.code_model = comp.root_mod.code_model,
}, },
.global = config, .global = config,
.cc_argv = &common_flags, .cc_argv = &common_flags,

View File

@ -71,6 +71,7 @@ pub fn buildStaticLib(comp: *Compilation, prog_node: std.Progress.Node) BuildErr
.unwind_tables = unwind_tables, .unwind_tables = unwind_tables,
.pic = if (target_util.supports_fpic(target)) true else null, .pic = if (target_util.supports_fpic(target)) true else null,
.optimize_mode = comp.compilerRtOptMode(), .optimize_mode = comp.compilerRtOptMode(),
.code_model = comp.root_mod.code_model,
}, },
.global = config, .global = config,
.cc_argv = &.{}, .cc_argv = &.{},