From a03d19ef63d342c408d7ec8208bda5b4eb0bacf5 Mon Sep 17 00:00:00 2001 From: Maybe Waffle Date: Wed, 14 Feb 2024 23:43:00 +0000 Subject: Allow targets to override default codegen backend --- compiler/rustc_session/src/config.rs | 2 +- compiler/rustc_session/src/session.rs | 9 ++------- 2 files changed, 3 insertions(+), 8 deletions(-) (limited to 'compiler/rustc_session/src') diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs index d35f951e2ae..63bc902c813 100644 --- a/compiler/rustc_session/src/config.rs +++ b/compiler/rustc_session/src/config.rs @@ -1558,7 +1558,7 @@ pub fn build_configuration(sess: &Session, mut user_cfg: Cfg) -> Cfg { user_cfg } -pub(super) fn build_target_config( +pub fn build_target_config( early_dcx: &EarlyDiagCtxt, opts: &Options, target_override: Option, diff --git a/compiler/rustc_session/src/session.rs b/compiler/rustc_session/src/session.rs index 25c20be8e62..2a8b507a227 100644 --- a/compiler/rustc_session/src/session.rs +++ b/compiler/rustc_session/src/session.rs @@ -1034,7 +1034,8 @@ pub fn build_session( fluent_resources: Vec<&'static str>, driver_lint_caps: FxHashMap, file_loader: Option>, - target_override: Option, + target_cfg: Target, + sysroot: PathBuf, cfg_version: &'static str, ice_file: Option, using_internal_features: Arc, @@ -1051,12 +1052,6 @@ pub fn build_session( let cap_lints_allow = sopts.lint_cap.is_some_and(|cap| cap == lint::Allow); let can_emit_warnings = !(warnings_allow || cap_lints_allow); - let sysroot = match &sopts.maybe_sysroot { - Some(sysroot) => sysroot.clone(), - None => filesearch::get_or_default_sysroot().expect("Failed finding sysroot"), - }; - - let target_cfg = config::build_target_config(&early_dcx, &sopts, target_override, &sysroot); let host_triple = TargetTriple::from_triple(config::host_triple()); let (host, target_warnings) = Target::search(&host_triple, &sysroot).unwrap_or_else(|e| { early_dcx.early_fatal(format!("Error loading host specification: {e}")) -- cgit 1.4.1-3-g733a5