rustc_session: Feature gate linker flavors for tier 3 targets

This commit is contained in:
Vadim Petrochenkov 2023-05-23 00:00:35 +03:00
parent b0ce4164f0
commit 23f177d86d
4 changed files with 28 additions and 1 deletions

View file

@ -12,7 +12,7 @@ use rustc_data_structures::fx::{FxHashMap, FxHashSet};
use rustc_data_structures::stable_hasher::{StableOrd, ToStableHashKey};
use rustc_target::abi::Align;
use rustc_target::spec::{PanicStrategy, SanitizerSet, SplitDebuginfo};
use rustc_target::spec::{LinkerFlavorCli, PanicStrategy, SanitizerSet, SplitDebuginfo};
use rustc_target::spec::{Target, TargetTriple, TargetWarnings, TARGETS};
use crate::parse::{CrateCheckConfig, CrateConfig};
@ -2525,6 +2525,19 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
}
}
if let Some(flavor) = cg.linker_flavor {
if matches!(flavor, LinkerFlavorCli::BpfLinker | LinkerFlavorCli::PtxLinker)
&& !nightly_options::is_unstable_enabled(matches)
{
let msg = format!(
"linker flavor `{}` is unstable, `-Z unstable-options` \
flag must also be passed to explicitly use it",
flavor.desc()
);
early_error(error_format, msg);
}
}
let prints = collect_print_requests(&mut cg, &mut unstable_opts, matches, error_format);
let cg = cg;