rustc_session: Feature gate linker flavors for tier 3 targets
This commit is contained in:
parent
b0ce4164f0
commit
23f177d86d
@ -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;
|
||||
|
2
tests/ui/linkage-attr/unstable-flavor.bpf.stderr
Normal file
2
tests/ui/linkage-attr/unstable-flavor.bpf.stderr
Normal file
@ -0,0 +1,2 @@
|
||||
error: linker flavor `bpf-linker` is unstable, `-Z unstable-options` flag must also be passed to explicitly use it
|
||||
|
2
tests/ui/linkage-attr/unstable-flavor.ptx.stderr
Normal file
2
tests/ui/linkage-attr/unstable-flavor.ptx.stderr
Normal file
@ -0,0 +1,2 @@
|
||||
error: linker flavor `ptx-linker` is unstable, `-Z unstable-options` flag must also be passed to explicitly use it
|
||||
|
10
tests/ui/linkage-attr/unstable-flavor.rs
Normal file
10
tests/ui/linkage-attr/unstable-flavor.rs
Normal file
@ -0,0 +1,10 @@
|
||||
// revisions: bpf ptx
|
||||
// [bpf] compile-flags: --target=bpfel-unknown-none -C linker-flavor=bpf-linker --crate-type=rlib
|
||||
// [bpf] error-pattern: linker flavor `bpf-linker` is unstable, `-Z unstable-options` flag
|
||||
// [bpf] needs-llvm-components:
|
||||
// [ptx] compile-flags: --target=nvptx64-nvidia-cuda -C linker-flavor=ptx-linker --crate-type=rlib
|
||||
// [ptx] error-pattern: linker flavor `ptx-linker` is unstable, `-Z unstable-options` flag
|
||||
// [ptx] needs-llvm-components:
|
||||
|
||||
#![feature(no_core)]
|
||||
#![no_core]
|
Loading…
x
Reference in New Issue
Block a user