mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-26 13:01:27 +03:00
Auto merge of #154255 - JonathanBrouwer:rollup-kVSo6wy, r=JonathanBrouwer
Rollup of 21 pull requests Successful merges: - rust-lang/rust#152543 (privacy: Fix type privacy holes in RPITITs) - rust-lang/rust#153107 (Optimize BTreeMap::append() using CursorMut) - rust-lang/rust#153312 (Packages as namespaces part 1) - rust-lang/rust#153534 (Remove a flaky `got_timeout` assert from two channel tests) - rust-lang/rust#153718 (Fix environ on FreeBSD with cdylib targets that use -Wl,--no-undefined .) - rust-lang/rust#153857 (Rename `target.abi` to `target.cfg_abi` and enum-ify llvm_abiname) - rust-lang/rust#153880 (Lifted intersperse and intersperse_with Fused transformation and updated documentation + tests) - rust-lang/rust#153931 (remove usages of to-be-deprecated numeric constants) - rust-lang/rust#150630 (Unknown -> Unsupported compression algorithm) - rust-lang/rust#153491 (Move `freeze_*` methods to `OpenOptionsExt2`) - rust-lang/rust#153582 (Simplify find_attr! for HirId usage) - rust-lang/rust#153623 (std: move `sys::pal::os` to `sys::paths`) - rust-lang/rust#153647 (docs(fs): Clarify That File::lock Coordinates Across Processes) - rust-lang/rust#153936 (Skip stack_start_aligned for immediate-abort) - rust-lang/rust#154011 (implement `BinaryHeap::as_mut_slice`) - rust-lang/rust#154167 (ui/lto: move and rename two tests from issues/) - rust-lang/rust#154174 (allow `incomplete_features` in most UI tests) - rust-lang/rust#154175 (Add new alias for Guillaume Gomez email address) - rust-lang/rust#154182 (diagnostics: avoid ICE for undeclared generic parameter in impl) - rust-lang/rust#154188 (Update the tracking issue for #[diagnostic::on_move]) - rust-lang/rust#154201 (Use enums to clarify `DepNodeColorMap` color marking )
This commit is contained in:
@@ -262,6 +262,7 @@ Guillaume Gomez <guillaume1.gomez@gmail.com>
|
||||
Guillaume Gomez <guillaume1.gomez@gmail.com> ggomez <ggomez@ggo.ifr.lan>
|
||||
Guillaume Gomez <guillaume1.gomez@gmail.com> Guillaume Gomez <ggomez@ggo.ifr.lan>
|
||||
Guillaume Gomez <guillaume1.gomez@gmail.com> Guillaume Gomez <guillaume.gomez@huawei.com>
|
||||
Guillaume Gomez <guillaume1.gomez@gmail.com> Guillaume Gomez <contact@guillaume-gomez.fr>
|
||||
gnzlbg <gonzalobg88@gmail.com> <gnzlbg@users.noreply.github.com>
|
||||
hamidreza kalbasi <hamidrezakalbasi@protonmail.com>
|
||||
Hanna Kruppe <hanna.kruppe@gmail.com> <robin.kruppe@gmail.com>
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
use rustc_session::Session;
|
||||
use rustc_session::config::OutputFilenames;
|
||||
use rustc_span::{Symbol, sym};
|
||||
use rustc_target::spec::{Abi, Arch, Env, Os};
|
||||
use rustc_target::spec::{Arch, CfgAbi, Env, Os};
|
||||
|
||||
pub use crate::config::*;
|
||||
use crate::prelude::*;
|
||||
@@ -178,7 +178,7 @@ fn target_config(&self, sess: &Session) -> TargetConfig {
|
||||
let has_reliable_f16_f128 = !(sess.target.arch == Arch::X86_64
|
||||
&& sess.target.os == Os::Windows
|
||||
&& sess.target.env == Env::Gnu
|
||||
&& sess.target.abi != Abi::Llvm);
|
||||
&& sess.target.cfg_abi != CfgAbi::Llvm);
|
||||
|
||||
// FIXME(f128): f128 math operations need f128 math symbols, which currently aren't always
|
||||
// filled in by compiler-builtins. The only libc that provides these currently is glibc.
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
use crate::common::AsCCharPtr;
|
||||
use crate::errors::{
|
||||
CopyBitcode, FromLlvmDiag, FromLlvmOptimizationDiag, LlvmError, ParseTargetMachineConfig,
|
||||
UnknownCompression, WithLlvmError, WriteBytecode,
|
||||
UnsupportedCompression, WithLlvmError, WriteBytecode,
|
||||
};
|
||||
use crate::llvm::diagnostic::OptimizationDiagnosticKind::*;
|
||||
use crate::llvm::{self, DiagnosticInfo};
|
||||
@@ -225,7 +225,7 @@ pub(crate) fn target_machine_factory(
|
||||
let triple = SmallCStr::new(&versioned_llvm_target(sess));
|
||||
let cpu = SmallCStr::new(llvm_util::target_cpu(sess));
|
||||
let features = CString::new(target_features.join(",")).unwrap();
|
||||
let abi = SmallCStr::new(&sess.target.llvm_abiname);
|
||||
let abi = SmallCStr::new(sess.target.llvm_abiname.desc());
|
||||
let trap_unreachable =
|
||||
sess.opts.unstable_opts.trap_unreachable.unwrap_or(sess.target.trap_unreachable);
|
||||
let emit_stack_size_section = sess.opts.unstable_opts.emit_stack_sizes;
|
||||
@@ -248,7 +248,7 @@ pub(crate) fn target_machine_factory(
|
||||
if llvm::LLVMRustLLVMHasZlibCompression() {
|
||||
llvm::CompressionKind::Zlib
|
||||
} else {
|
||||
sess.dcx().emit_warn(UnknownCompression { algorithm: "zlib" });
|
||||
sess.dcx().emit_warn(UnsupportedCompression { algorithm: "zlib" });
|
||||
llvm::CompressionKind::None
|
||||
}
|
||||
}
|
||||
@@ -256,7 +256,7 @@ pub(crate) fn target_machine_factory(
|
||||
if llvm::LLVMRustLLVMHasZstdCompression() {
|
||||
llvm::CompressionKind::Zstd
|
||||
} else {
|
||||
sess.dcx().emit_warn(UnknownCompression { algorithm: "zstd" });
|
||||
sess.dcx().emit_warn(UnsupportedCompression { algorithm: "zstd" });
|
||||
llvm::CompressionKind::None
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
use rustc_span::{DUMMY_SP, Span, Spanned, Symbol};
|
||||
use rustc_symbol_mangling::mangle_internal_symbol;
|
||||
use rustc_target::spec::{
|
||||
Abi, Arch, Env, HasTargetSpec, Os, RelocModel, SmallDataThresholdSupport, Target, TlsModel,
|
||||
Arch, CfgAbi, Env, HasTargetSpec, Os, RelocModel, SmallDataThresholdSupport, Target, TlsModel,
|
||||
};
|
||||
use smallvec::SmallVec;
|
||||
|
||||
@@ -344,7 +344,7 @@ pub(crate) unsafe fn create_module<'ll>(
|
||||
if sess.target.is_like_msvc
|
||||
|| (sess.target.options.os == Os::Windows
|
||||
&& sess.target.options.env == Env::Gnu
|
||||
&& sess.target.options.abi == Abi::Llvm)
|
||||
&& sess.target.options.cfg_abi == CfgAbi::Llvm)
|
||||
{
|
||||
match sess.opts.cg.control_flow_guard {
|
||||
CFGuard::Disabled => {}
|
||||
@@ -509,14 +509,13 @@ pub(crate) unsafe fn create_module<'ll>(
|
||||
// to workaround lld as the LTO plugin not
|
||||
// correctly setting target-abi for the LTO object
|
||||
// FIXME: https://github.com/llvm/llvm-project/issues/50591
|
||||
// If llvm_abiname is empty, emit nothing.
|
||||
let llvm_abiname = &sess.target.options.llvm_abiname;
|
||||
if matches!(sess.target.arch, Arch::RiscV32 | Arch::RiscV64) && !llvm_abiname.is_empty() {
|
||||
if matches!(sess.target.arch, Arch::RiscV32 | Arch::RiscV64) {
|
||||
llvm::add_module_flag_str(
|
||||
llmod,
|
||||
llvm::ModuleFlagMergeBehavior::Error,
|
||||
"target-abi",
|
||||
llvm_abiname,
|
||||
llvm_abiname.desc(),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -182,9 +182,9 @@ pub(crate) struct CopyBitcode {
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(
|
||||
"unknown debuginfo compression algorithm {$algorithm} - will fall back to uncompressed debuginfo"
|
||||
"unsupported debuginfo compression algorithm {$algorithm} - will fall back to uncompressed debuginfo"
|
||||
)]
|
||||
pub(crate) struct UnknownCompression {
|
||||
pub(crate) struct UnsupportedCompression {
|
||||
pub algorithm: &'static str,
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
use rustc_session::Session;
|
||||
use rustc_session::config::{PrintKind, PrintRequest};
|
||||
use rustc_target::spec::{
|
||||
Abi, Arch, Env, MergeFunctions, Os, PanicStrategy, SmallDataThresholdSupport,
|
||||
Arch, CfgAbi, Env, MergeFunctions, Os, PanicStrategy, SmallDataThresholdSupport,
|
||||
};
|
||||
use smallvec::{SmallVec, smallvec};
|
||||
|
||||
@@ -362,7 +362,7 @@ fn update_target_reliable_float_cfg(sess: &Session, cfg: &mut TargetConfig) {
|
||||
let target_arch = &sess.target.arch;
|
||||
let target_os = &sess.target.options.os;
|
||||
let target_env = &sess.target.options.env;
|
||||
let target_abi = &sess.target.options.abi;
|
||||
let target_abi = &sess.target.options.cfg_abi;
|
||||
let target_pointer_width = sess.target.pointer_width;
|
||||
let version = get_version();
|
||||
let (major, _, _) = version;
|
||||
@@ -371,7 +371,9 @@ fn update_target_reliable_float_cfg(sess: &Session, cfg: &mut TargetConfig) {
|
||||
// Unsupported <https://github.com/llvm/llvm-project/issues/94434> (fixed in llvm22)
|
||||
(Arch::Arm64EC, _) if major < 22 => false,
|
||||
// MinGW ABI bugs <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115054>
|
||||
(Arch::X86_64, Os::Windows) if *target_env == Env::Gnu && *target_abi != Abi::Llvm => false,
|
||||
(Arch::X86_64, Os::Windows) if *target_env == Env::Gnu && *target_abi != CfgAbi::Llvm => {
|
||||
false
|
||||
}
|
||||
// Infinite recursion <https://github.com/llvm/llvm-project/issues/97981>
|
||||
(Arch::CSky, _) if major < 22 => false, // (fixed in llvm22)
|
||||
(Arch::PowerPC | Arch::PowerPC64, _) if major < 22 => false, // (fixed in llvm22)
|
||||
@@ -397,7 +399,9 @@ fn update_target_reliable_float_cfg(sess: &Session, cfg: &mut TargetConfig) {
|
||||
// ABI unsupported <https://github.com/llvm/llvm-project/issues/41838> (fixed in llvm22)
|
||||
(Arch::Sparc, _) if major < 22 => false,
|
||||
// MinGW ABI bugs <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115054>
|
||||
(Arch::X86_64, Os::Windows) if *target_env == Env::Gnu && *target_abi != Abi::Llvm => false,
|
||||
(Arch::X86_64, Os::Windows) if *target_env == Env::Gnu && *target_abi != CfgAbi::Llvm => {
|
||||
false
|
||||
}
|
||||
// There are no known problems on other platforms, so the only requirement is that symbols
|
||||
// are available. `compiler-builtins` provides all symbols required for core `f128`
|
||||
// support, so this should work for everything else.
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
use rustc_middle::bug;
|
||||
use rustc_middle::ty::Ty;
|
||||
use rustc_middle::ty::layout::{HasTyCtxt, LayoutOf, TyAndLayout};
|
||||
use rustc_target::spec::{Arch, Env, RustcAbi};
|
||||
use rustc_target::spec::{Arch, Env, LlvmAbi, RustcAbi};
|
||||
|
||||
use crate::builder::Builder;
|
||||
use crate::llvm::{Type, Value};
|
||||
@@ -1077,7 +1077,7 @@ pub(super) fn emit_va_arg<'ll, 'tcx>(
|
||||
AllowHigherAlign::Yes,
|
||||
ForceRightAdjust::Yes,
|
||||
),
|
||||
Arch::RiscV32 if target.llvm_abiname == "ilp32e" => {
|
||||
Arch::RiscV32 if target.llvm_abiname == LlvmAbi::Ilp32e => {
|
||||
// FIXME: clang manually adjusts the alignment for this ABI. It notes:
|
||||
//
|
||||
// > To be compatible with GCC's behaviors, we force arguments with
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
use rustc_span::Symbol;
|
||||
use rustc_target::spec::crt_objects::CrtObjects;
|
||||
use rustc_target::spec::{
|
||||
Abi, BinaryFormat, Cc, Env, LinkOutputKind, LinkSelfContainedComponents,
|
||||
BinaryFormat, Cc, CfgAbi, Env, LinkOutputKind, LinkSelfContainedComponents,
|
||||
LinkSelfContainedDefault, LinkerFeatures, LinkerFlavor, LinkerFlavorCli, Lld, Os, RelocModel,
|
||||
RelroLevel, SanitizerSet, SplitDebuginfo,
|
||||
};
|
||||
@@ -1917,7 +1917,7 @@ fn self_contained_components(
|
||||
LinkSelfContainedDefault::InferredForMusl => sess.crt_static(Some(crate_type)),
|
||||
LinkSelfContainedDefault::InferredForMingw => {
|
||||
sess.host == sess.target
|
||||
&& sess.target.abi != Abi::Uwp
|
||||
&& sess.target.cfg_abi != CfgAbi::Uwp
|
||||
&& detect_self_contained_mingw(sess, linker)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
use rustc_middle::ty::TyCtxt;
|
||||
use rustc_session::Session;
|
||||
use rustc_session::config::{self, CrateType, DebugInfo, LinkerPluginLto, Lto, OptLevel, Strip};
|
||||
use rustc_target::spec::{Abi, Arch, Cc, LinkOutputKind, LinkerFlavor, Lld, Os};
|
||||
use rustc_target::spec::{Arch, Cc, CfgAbi, LinkOutputKind, LinkerFlavor, Lld, Os};
|
||||
use tracing::{debug, warn};
|
||||
|
||||
use super::command::Command;
|
||||
@@ -84,7 +84,7 @@ pub(crate) fn get_linker<'a>(
|
||||
// To comply with the Windows App Certification Kit,
|
||||
// MSVC needs to link with the Store versions of the runtime libraries (vcruntime, msvcrt, etc).
|
||||
let t = &sess.target;
|
||||
if matches!(flavor, LinkerFlavor::Msvc(..)) && t.abi == Abi::Uwp {
|
||||
if matches!(flavor, LinkerFlavor::Msvc(..)) && t.cfg_abi == CfgAbi::Uwp {
|
||||
if let Some(ref tool) = msvc_tool {
|
||||
let original_path = tool.path();
|
||||
if let Some(root_lib_path) = original_path.ancestors().nth(4) {
|
||||
@@ -135,7 +135,7 @@ pub(crate) fn get_linker<'a>(
|
||||
|
||||
// FIXME: Move `/LIBPATH` addition for uwp targets from the linker construction
|
||||
// to the linker args construction.
|
||||
assert!(cmd.get_args().is_empty() || sess.target.abi == Abi::Uwp);
|
||||
assert!(cmd.get_args().is_empty() || sess.target.cfg_abi == CfgAbi::Uwp);
|
||||
match flavor {
|
||||
LinkerFlavor::Unix(Cc::No) if sess.target.os == Os::L4Re => {
|
||||
Box::new(L4Bender::new(cmd, sess)) as Box<dyn Linker>
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
use rustc_middle::bug;
|
||||
use rustc_session::Session;
|
||||
use rustc_span::sym;
|
||||
use rustc_target::spec::{Abi, Os, RelocModel, Target, ef_avr_arch};
|
||||
use rustc_target::spec::{CfgAbi, LlvmAbi, Os, RelocModel, Target, ef_avr_arch};
|
||||
use tracing::debug;
|
||||
|
||||
use super::apple;
|
||||
@@ -295,10 +295,10 @@ pub(super) fn elf_e_flags(architecture: Architecture, sess: &Session) -> u32 {
|
||||
};
|
||||
|
||||
// Use the explicitly given ABI.
|
||||
match sess.target.options.llvm_abiname.as_ref() {
|
||||
"o32" if is_32bit => e_flags |= elf::EF_MIPS_ABI_O32,
|
||||
"n32" if !is_32bit => e_flags |= elf::EF_MIPS_ABI2,
|
||||
"n64" if !is_32bit => {}
|
||||
match &sess.target.options.llvm_abiname {
|
||||
LlvmAbi::O32 if is_32bit => e_flags |= elf::EF_MIPS_ABI_O32,
|
||||
LlvmAbi::N32 if !is_32bit => e_flags |= elf::EF_MIPS_ABI2,
|
||||
LlvmAbi::N64 if !is_32bit => {}
|
||||
// The rest is invalid (which is already ensured by the target spec check).
|
||||
s => bug!("invalid LLVM ABI `{}` for MIPS target", s),
|
||||
};
|
||||
@@ -336,12 +336,12 @@ pub(super) fn elf_e_flags(architecture: Architecture, sess: &Session) -> u32 {
|
||||
|
||||
// Set the appropriate flag based on ABI
|
||||
// This needs to match LLVM `RISCVELFStreamer.cpp`
|
||||
match &*sess.target.llvm_abiname {
|
||||
"ilp32" | "lp64" => (),
|
||||
"ilp32f" | "lp64f" => e_flags |= elf::EF_RISCV_FLOAT_ABI_SINGLE,
|
||||
"ilp32d" | "lp64d" => e_flags |= elf::EF_RISCV_FLOAT_ABI_DOUBLE,
|
||||
match &sess.target.llvm_abiname {
|
||||
LlvmAbi::Ilp32 | LlvmAbi::Lp64 => (),
|
||||
LlvmAbi::Ilp32f | LlvmAbi::Lp64f => e_flags |= elf::EF_RISCV_FLOAT_ABI_SINGLE,
|
||||
LlvmAbi::Ilp32d | LlvmAbi::Lp64d => e_flags |= elf::EF_RISCV_FLOAT_ABI_DOUBLE,
|
||||
// Note that the `lp64e` is still unstable as it's not (yet) part of the ELF psABI.
|
||||
"ilp32e" | "lp64e" => e_flags |= elf::EF_RISCV_RVE,
|
||||
LlvmAbi::Ilp32e | LlvmAbi::Lp64e => e_flags |= elf::EF_RISCV_RVE,
|
||||
_ => bug!("unknown RISC-V ABI name"),
|
||||
}
|
||||
|
||||
@@ -353,10 +353,10 @@ pub(super) fn elf_e_flags(architecture: Architecture, sess: &Session) -> u32 {
|
||||
|
||||
// Set the appropriate flag based on ABI
|
||||
// This needs to match LLVM `LoongArchELFStreamer.cpp`
|
||||
match &*sess.target.llvm_abiname {
|
||||
"ilp32s" | "lp64s" => e_flags |= elf::EF_LARCH_ABI_SOFT_FLOAT,
|
||||
"ilp32f" | "lp64f" => e_flags |= elf::EF_LARCH_ABI_SINGLE_FLOAT,
|
||||
"ilp32d" | "lp64d" => e_flags |= elf::EF_LARCH_ABI_DOUBLE_FLOAT,
|
||||
match &sess.target.llvm_abiname {
|
||||
LlvmAbi::Ilp32s | LlvmAbi::Lp64s => e_flags |= elf::EF_LARCH_ABI_SOFT_FLOAT,
|
||||
LlvmAbi::Ilp32f | LlvmAbi::Lp64f => e_flags |= elf::EF_LARCH_ABI_SINGLE_FLOAT,
|
||||
LlvmAbi::Ilp32d | LlvmAbi::Lp64d => e_flags |= elf::EF_LARCH_ABI_DOUBLE_FLOAT,
|
||||
_ => bug!("unknown LoongArch ABI name"),
|
||||
}
|
||||
|
||||
@@ -372,7 +372,7 @@ pub(super) fn elf_e_flags(architecture: Architecture, sess: &Session) -> u32 {
|
||||
}
|
||||
}
|
||||
Architecture::Csky => {
|
||||
if matches!(sess.target.options.abi, Abi::AbiV2) {
|
||||
if matches!(sess.target.options.cfg_abi, CfgAbi::AbiV2) {
|
||||
elf::EF_CSKY_ABIV2
|
||||
} else {
|
||||
elf::EF_CSKY_ABIV1
|
||||
@@ -383,14 +383,14 @@ pub(super) fn elf_e_flags(architecture: Architecture, sess: &Session) -> u32 {
|
||||
const EF_PPC64_ABI_ELF_V1: u32 = 1;
|
||||
const EF_PPC64_ABI_ELF_V2: u32 = 2;
|
||||
|
||||
match sess.target.options.llvm_abiname.as_ref() {
|
||||
match sess.target.options.llvm_abiname {
|
||||
// If the flags do not correctly indicate the ABI,
|
||||
// linkers such as ld.lld assume that the ppc64 object files are always ELFv2
|
||||
// which leads to broken binaries if ELFv1 is used for the object files.
|
||||
"elfv1" => EF_PPC64_ABI_ELF_V1,
|
||||
"elfv2" => EF_PPC64_ABI_ELF_V2,
|
||||
"" if sess.target.options.binary_format.to_object() == BinaryFormat::Elf => {
|
||||
bug!("No ABI specified for this PPC64 ELF target");
|
||||
LlvmAbi::ElfV1 => EF_PPC64_ABI_ELF_V1,
|
||||
LlvmAbi::ElfV2 => EF_PPC64_ABI_ELF_V2,
|
||||
_ if sess.target.options.binary_format.to_object() == BinaryFormat::Elf => {
|
||||
bug!("invalid ABI specified for this PPC64 ELF target");
|
||||
}
|
||||
// Fall back
|
||||
_ => EF_PPC64_ABI_UNKNOWN,
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
use rustc_middle::{bug, mir, span_bug};
|
||||
use rustc_session::cstore::{DllCallingConvention, DllImport, DllImportSymbolType};
|
||||
use rustc_span::Span;
|
||||
use rustc_target::spec::{Abi, Env, Os, Target};
|
||||
use rustc_target::spec::{CfgAbi, Env, Os, Target};
|
||||
|
||||
use crate::traits::*;
|
||||
|
||||
@@ -171,7 +171,7 @@ pub fn asm_const_to_str<'tcx>(
|
||||
}
|
||||
|
||||
pub fn is_mingw_gnu_toolchain(target: &Target) -> bool {
|
||||
target.os == Os::Windows && target.env == Env::Gnu && target.abi == Abi::Unspecified
|
||||
target.os == Os::Windows && target.env == Env::Gnu && target.cfg_abi == CfgAbi::Unspecified
|
||||
}
|
||||
|
||||
pub fn i686_decorated_name(
|
||||
|
||||
@@ -37,7 +37,7 @@ fn constness(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Constness {
|
||||
}
|
||||
}
|
||||
Node::TraitItem(ti @ TraitItem { kind: TraitItemKind::Fn(..), .. }) => {
|
||||
if find_attr!(tcx.hir_attrs(ti.hir_id()), RustcNonConstTraitMethod) {
|
||||
if find_attr!(tcx, ti.hir_id(), RustcNonConstTraitMethod) {
|
||||
Constness::NotConst
|
||||
} else {
|
||||
tcx.trait_def(tcx.local_parent(def_id)).constness
|
||||
|
||||
@@ -473,7 +473,7 @@ pub fn internal(&self, feature: Symbol) -> bool {
|
||||
/// Allows giving non-const impls custom diagnostic messages if attempted to be used as const
|
||||
(unstable, diagnostic_on_const, "1.93.0", Some(143874)),
|
||||
/// Allows giving on-move borrowck custom diagnostic messages for a type
|
||||
(unstable, diagnostic_on_move, "CURRENT_RUSTC_VERSION", Some(150935)),
|
||||
(unstable, diagnostic_on_move, "CURRENT_RUSTC_VERSION", Some(154181)),
|
||||
/// Allows `#[doc(cfg(...))]`.
|
||||
(unstable, doc_cfg, "1.21.0", Some(43781)),
|
||||
/// Allows `#[doc(masked)]`.
|
||||
|
||||
@@ -13,6 +13,15 @@
|
||||
mod encode_cross_crate;
|
||||
mod pretty_printing;
|
||||
|
||||
/// A trait for types that can provide a list of attributes given a `TyCtxt`.
|
||||
///
|
||||
/// It allows `find_attr!` to accept either a `DefId`, `LocalDefId`, `OwnerId`, or `HirId`.
|
||||
/// It is defined here with a generic `Tcx` because `rustc_hir` can't depend on `rustc_middle`.
|
||||
/// The concrete implementations are in `rustc_middle`.
|
||||
pub trait HasAttrs<'tcx, Tcx> {
|
||||
fn get_attrs(self, tcx: &Tcx) -> &'tcx [crate::Attribute];
|
||||
}
|
||||
|
||||
/// Finds attributes in sequences of attributes by pattern matching.
|
||||
///
|
||||
/// A little like `matches` but for attributes.
|
||||
@@ -34,10 +43,12 @@
|
||||
///
|
||||
/// As a convenience, this macro can do that for you!
|
||||
///
|
||||
/// Instead of providing an attribute list, provide the `tcx` and a `DefId`.
|
||||
/// Instead of providing an attribute list, provide the `tcx` and an id
|
||||
/// (a `DefId`, `LocalDefId`, `OwnerId` or `HirId`).
|
||||
///
|
||||
/// ```rust,ignore (illustrative)
|
||||
/// find_attr!(tcx, def_id, <pattern>)
|
||||
/// find_attr!(tcx, hir_id, <pattern>)
|
||||
/// ```
|
||||
///
|
||||
/// Another common case is finding attributes applied to the root of the current crate.
|
||||
@@ -55,13 +66,14 @@ macro_rules! find_attr {
|
||||
$crate::find_attr!($tcx.hir_krate_attrs(), $pattern $(if $guard)? => $e)
|
||||
};
|
||||
|
||||
($tcx: expr, $def_id: expr, $pattern: pat $(if $guard: expr)?) => {
|
||||
$crate::find_attr!($tcx, $def_id, $pattern $(if $guard)? => ()).is_some()
|
||||
($tcx: expr, $id: expr, $pattern: pat $(if $guard: expr)?) => {
|
||||
$crate::find_attr!($tcx, $id, $pattern $(if $guard)? => ()).is_some()
|
||||
};
|
||||
($tcx: expr, $def_id: expr, $pattern: pat $(if $guard: expr)? => $e: expr) => {{
|
||||
#[allow(deprecated)] {
|
||||
$crate::find_attr!($tcx.get_all_attrs($def_id), $pattern $(if $guard)? => $e)
|
||||
}
|
||||
($tcx: expr, $id: expr, $pattern: pat $(if $guard: expr)? => $e: expr) => {{
|
||||
$crate::find_attr!(
|
||||
$crate::attrs::HasAttrs::get_attrs($id, &$tcx),
|
||||
$pattern $(if $guard)? => $e
|
||||
)
|
||||
}};
|
||||
|
||||
|
||||
|
||||
@@ -590,6 +590,13 @@ pub enum Res<Id = hir::HirId> {
|
||||
/// **Belongs to the type namespace.**
|
||||
ToolMod,
|
||||
|
||||
/// The resolution for an open module in a namespaced crate. E.g. `my_api`
|
||||
/// in the namespaced crate `my_api::utils` when `my_api` isn't part of the
|
||||
/// extern prelude.
|
||||
///
|
||||
/// **Belongs to the type namespace.**
|
||||
OpenMod(Symbol),
|
||||
|
||||
// Macro namespace
|
||||
/// An attribute that is *not* implemented via macro.
|
||||
/// E.g., `#[inline]` and `#[rustfmt::skip]`, which are essentially directives,
|
||||
@@ -838,6 +845,7 @@ pub fn opt_def_id(&self) -> Option<DefId> {
|
||||
| Res::SelfTyAlias { .. }
|
||||
| Res::SelfCtor(..)
|
||||
| Res::ToolMod
|
||||
| Res::OpenMod(..)
|
||||
| Res::NonMacroAttr(..)
|
||||
| Res::Err => None,
|
||||
}
|
||||
@@ -869,6 +877,7 @@ pub fn descr(&self) -> &'static str {
|
||||
Res::Local(..) => "local variable",
|
||||
Res::SelfTyParam { .. } | Res::SelfTyAlias { .. } => "self type",
|
||||
Res::ToolMod => "tool module",
|
||||
Res::OpenMod(..) => "namespaced crate",
|
||||
Res::NonMacroAttr(attr_kind) => attr_kind.descr(),
|
||||
Res::Err => "unresolved item",
|
||||
}
|
||||
@@ -895,6 +904,7 @@ pub fn map_id<R>(self, mut map: impl FnMut(Id) -> R) -> Res<R> {
|
||||
Res::SelfTyAlias { alias_to, is_trait_impl }
|
||||
}
|
||||
Res::ToolMod => Res::ToolMod,
|
||||
Res::OpenMod(sym) => Res::OpenMod(sym),
|
||||
Res::NonMacroAttr(attr_kind) => Res::NonMacroAttr(attr_kind),
|
||||
Res::Err => Res::Err,
|
||||
}
|
||||
@@ -911,6 +921,7 @@ pub fn apply_id<R, E>(self, mut map: impl FnMut(Id) -> Result<R, E>) -> Result<R
|
||||
Res::SelfTyAlias { alias_to, is_trait_impl }
|
||||
}
|
||||
Res::ToolMod => Res::ToolMod,
|
||||
Res::OpenMod(sym) => Res::OpenMod(sym),
|
||||
Res::NonMacroAttr(attr_kind) => Res::NonMacroAttr(attr_kind),
|
||||
Res::Err => Res::Err,
|
||||
})
|
||||
@@ -936,9 +947,11 @@ pub fn macro_kinds(self) -> Option<MacroKinds> {
|
||||
pub fn ns(&self) -> Option<Namespace> {
|
||||
match self {
|
||||
Res::Def(kind, ..) => kind.ns(),
|
||||
Res::PrimTy(..) | Res::SelfTyParam { .. } | Res::SelfTyAlias { .. } | Res::ToolMod => {
|
||||
Some(Namespace::TypeNS)
|
||||
}
|
||||
Res::PrimTy(..)
|
||||
| Res::SelfTyParam { .. }
|
||||
| Res::SelfTyAlias { .. }
|
||||
| Res::ToolMod
|
||||
| Res::OpenMod(..) => Some(Namespace::TypeNS),
|
||||
Res::SelfCtor(..) | Res::Local(..) => Some(Namespace::ValueNS),
|
||||
Res::NonMacroAttr(..) => Some(Namespace::MacroNS),
|
||||
Res::Err => None,
|
||||
|
||||
@@ -2830,6 +2830,7 @@ fn lower_resolved_const_path(
|
||||
| Res::SelfCtor(_)
|
||||
| Res::Local(_)
|
||||
| Res::ToolMod
|
||||
| Res::OpenMod(..)
|
||||
| Res::NonMacroAttr(_)
|
||||
| Res::Err) => Const::new_error_with_message(
|
||||
tcx,
|
||||
|
||||
@@ -207,7 +207,7 @@ fn visit_expr(&mut self, e: &'hir hir::Expr<'hir>) {
|
||||
};
|
||||
|
||||
// A `#[const_continue]` must break to a block in a `#[loop_match]`.
|
||||
if find_attr!(self.tcx.hir_attrs(e.hir_id), ConstContinue(_)) {
|
||||
if find_attr!(self.tcx, e.hir_id, ConstContinue(_)) {
|
||||
let Some(label) = break_destination.label else {
|
||||
let span = e.span;
|
||||
self.tcx.dcx().emit_fatal(ConstContinueBadLabel { span });
|
||||
@@ -420,7 +420,7 @@ fn is_loop_match(
|
||||
e: &'hir hir::Expr<'hir>,
|
||||
body: &'hir hir::Block<'hir>,
|
||||
) -> Option<Destination> {
|
||||
if !find_attr!(self.tcx.hir_attrs(e.hir_id), LoopMatch(_)) {
|
||||
if !find_attr!(self.tcx, e.hir_id, LoopMatch(_)) {
|
||||
return None;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ fn proc_macro_decls_static(tcx: TyCtxt<'_>, (): ()) -> Option<LocalDefId> {
|
||||
let mut decls = None;
|
||||
|
||||
for id in tcx.hir_free_items() {
|
||||
if find_attr!(tcx.hir_attrs(id.hir_id()), RustcProcMacroDecls) {
|
||||
if find_attr!(tcx, id.hir_id(), RustcProcMacroDecls) {
|
||||
decls = Some(id.owner_id.def_id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
use rustc_session::search_paths::PathKind;
|
||||
use rustc_span::Symbol;
|
||||
use rustc_span::def_id::{DefId, LOCAL_CRATE};
|
||||
use rustc_target::spec::{Abi, Arch, BinaryFormat, Env, LinkSelfContainedComponents, Os};
|
||||
use rustc_target::spec::{Arch, BinaryFormat, CfgAbi, Env, LinkSelfContainedComponents, Os};
|
||||
|
||||
use crate::errors;
|
||||
|
||||
@@ -73,14 +73,14 @@ pub fn walk_native_lib_search_dirs<R>(
|
||||
// FIXME: On AIX this also has the side-effect of making the list of library search paths
|
||||
// non-empty, which is needed or the linker may decide to record the LIBPATH env, if
|
||||
// defined, as the search path instead of appending the default search paths.
|
||||
if sess.target.abi == Abi::Fortanix
|
||||
if sess.target.cfg_abi == CfgAbi::Fortanix
|
||||
|| sess.target.os == Os::Linux
|
||||
|| sess.target.os == Os::Fuchsia
|
||||
|| sess.target.is_like_aix
|
||||
|| sess.target.is_like_darwin && !sess.sanitizers().is_empty()
|
||||
|| sess.target.os == Os::Windows
|
||||
&& sess.target.env == Env::Gnu
|
||||
&& sess.target.abi == Abi::Llvm
|
||||
&& sess.target.cfg_abi == CfgAbi::Llvm
|
||||
{
|
||||
f(&sess.target_tlib_path.dir, false)?;
|
||||
}
|
||||
|
||||
@@ -164,9 +164,10 @@ pub fn new(
|
||||
);
|
||||
assert_eq!(red_node_index, DepNodeIndex::FOREVER_RED_NODE);
|
||||
if prev_graph_node_count > 0 {
|
||||
colors.insert_red(SerializedDepNodeIndex::from_u32(
|
||||
DepNodeIndex::FOREVER_RED_NODE.as_u32(),
|
||||
));
|
||||
let prev_index =
|
||||
const { SerializedDepNodeIndex::from_u32(DepNodeIndex::FOREVER_RED_NODE.as_u32()) };
|
||||
let result = colors.try_set_color(prev_index, DesiredColor::Red);
|
||||
assert_matches!(result, TrySetColorResult::Success);
|
||||
}
|
||||
|
||||
DepGraph {
|
||||
@@ -1415,28 +1416,29 @@ pub(super) fn current(&self, index: SerializedDepNodeIndex) -> Option<DepNodeInd
|
||||
if value <= DepNodeIndex::MAX_AS_U32 { Some(DepNodeIndex::from_u32(value)) } else { None }
|
||||
}
|
||||
|
||||
/// This tries to atomically mark a node green and assign `index` as the new
|
||||
/// index if `green` is true, otherwise it will try to atomicaly mark it red.
|
||||
/// Atomically sets the color of a previous-session dep node to either green
|
||||
/// or red, if it has not already been colored.
|
||||
///
|
||||
/// This returns `Ok` if `index` gets assigned or the node is marked red, otherwise it returns
|
||||
/// the already allocated index in `Err` if it is green already. If it was already
|
||||
/// red, `Err(None)` is returned.
|
||||
/// If the node already has a color, the new color is ignored, and the
|
||||
/// return value indicates the existing color.
|
||||
#[inline(always)]
|
||||
pub(super) fn try_mark(
|
||||
pub(super) fn try_set_color(
|
||||
&self,
|
||||
prev_index: SerializedDepNodeIndex,
|
||||
index: DepNodeIndex,
|
||||
green: bool,
|
||||
) -> Result<(), Option<DepNodeIndex>> {
|
||||
let value = &self.values[prev_index];
|
||||
match value.compare_exchange(
|
||||
color: DesiredColor,
|
||||
) -> TrySetColorResult {
|
||||
match self.values[prev_index].compare_exchange(
|
||||
COMPRESSED_UNKNOWN,
|
||||
if green { index.as_u32() } else { COMPRESSED_RED },
|
||||
match color {
|
||||
DesiredColor::Red => COMPRESSED_RED,
|
||||
DesiredColor::Green { index } => index.as_u32(),
|
||||
},
|
||||
Ordering::Relaxed,
|
||||
Ordering::Relaxed,
|
||||
) {
|
||||
Ok(_) => Ok(()),
|
||||
Err(v) => Err(if v == COMPRESSED_RED { None } else { Some(DepNodeIndex::from_u32(v)) }),
|
||||
Ok(_) => TrySetColorResult::Success,
|
||||
Err(COMPRESSED_RED) => TrySetColorResult::AlreadyRed,
|
||||
Err(index) => TrySetColorResult::AlreadyGreen { index: DepNodeIndex::from_u32(index) },
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1454,13 +1456,28 @@ pub(super) fn get(&self, index: SerializedDepNodeIndex) -> DepNodeColor {
|
||||
DepNodeColor::Unknown
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub(super) fn insert_red(&self, index: SerializedDepNodeIndex) {
|
||||
let value = self.values[index].swap(COMPRESSED_RED, Ordering::Release);
|
||||
// Sanity check for duplicate nodes
|
||||
assert_eq!(value, COMPRESSED_UNKNOWN, "tried to color an already colored node as red");
|
||||
}
|
||||
/// The color that [`DepNodeColorMap::try_set_color`] should try to apply to a node.
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub(super) enum DesiredColor {
|
||||
/// Try to mark the node red.
|
||||
Red,
|
||||
/// Try to mark the node green, associating it with a current-session node index.
|
||||
Green { index: DepNodeIndex },
|
||||
}
|
||||
|
||||
/// Return value of [`DepNodeColorMap::try_set_color`], indicating success or failure,
|
||||
/// and (on failure) what the existing color is.
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub(super) enum TrySetColorResult {
|
||||
/// The [`DesiredColor`] was freshly applied to the node.
|
||||
Success,
|
||||
/// Coloring failed because the node was already marked red.
|
||||
AlreadyRed,
|
||||
/// Coloring failed because the node was already marked green,
|
||||
/// and corresponds to node `index` in the current-session dep graph.
|
||||
AlreadyGreen { index: DepNodeIndex },
|
||||
}
|
||||
|
||||
#[inline(never)]
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
use std::cmp::max;
|
||||
use std::sync::Arc;
|
||||
use std::sync::atomic::Ordering;
|
||||
use std::{iter, mem, u64};
|
||||
use std::{iter, mem};
|
||||
|
||||
use rustc_data_structures::fingerprint::{Fingerprint, PackedFingerprint};
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
@@ -58,7 +58,7 @@
|
||||
use rustc_session::Session;
|
||||
use tracing::{debug, instrument};
|
||||
|
||||
use super::graph::{CurrentDepGraph, DepNodeColorMap};
|
||||
use super::graph::{CurrentDepGraph, DepNodeColorMap, DesiredColor, TrySetColorResult};
|
||||
use super::retained::RetainedDepGraph;
|
||||
use super::{DepKind, DepNode, DepNodeIndex};
|
||||
use crate::dep_graph::edges::EdgesVec;
|
||||
@@ -905,13 +905,14 @@ pub(crate) fn send_and_color(
|
||||
let mut local = self.status.local.borrow_mut();
|
||||
|
||||
let index = self.status.next_index(&mut *local);
|
||||
let color = if is_green { DesiredColor::Green { index } } else { DesiredColor::Red };
|
||||
|
||||
// Use `try_mark` to avoid racing when `send_promoted` is called concurrently
|
||||
// Use `try_set_color` to avoid racing when `send_promoted` is called concurrently
|
||||
// on the same index.
|
||||
match colors.try_mark(prev_index, index, is_green) {
|
||||
Ok(()) => (),
|
||||
Err(None) => panic!("dep node {:?} is unexpectedly red", prev_index),
|
||||
Err(Some(dep_node_index)) => return dep_node_index,
|
||||
match colors.try_set_color(prev_index, color) {
|
||||
TrySetColorResult::Success => {}
|
||||
TrySetColorResult::AlreadyRed => panic!("dep node {prev_index:?} is unexpectedly red"),
|
||||
TrySetColorResult::AlreadyGreen { index } => return index,
|
||||
}
|
||||
|
||||
self.status.bump_index(&mut *local);
|
||||
@@ -923,7 +924,8 @@ pub(crate) fn send_and_color(
|
||||
/// from the previous dep graph and expects all edges to already have a new dep node index
|
||||
/// assigned.
|
||||
///
|
||||
/// This will also ensure the dep node is marked green if `Some` is returned.
|
||||
/// Tries to mark the dep node green, and returns Some if it is now green,
|
||||
/// or None if had already been concurrently marked red.
|
||||
#[inline]
|
||||
pub(crate) fn send_promoted(
|
||||
&self,
|
||||
@@ -935,10 +937,10 @@ pub(crate) fn send_promoted(
|
||||
let mut local = self.status.local.borrow_mut();
|
||||
let index = self.status.next_index(&mut *local);
|
||||
|
||||
// Use `try_mark_green` to avoid racing when `send_promoted` or `send_and_color`
|
||||
// Use `try_set_color` to avoid racing when `send_promoted` or `send_and_color`
|
||||
// is called concurrently on the same index.
|
||||
match colors.try_mark(prev_index, index, true) {
|
||||
Ok(()) => {
|
||||
match colors.try_set_color(prev_index, DesiredColor::Green { index }) {
|
||||
TrySetColorResult::Success => {
|
||||
self.status.bump_index(&mut *local);
|
||||
self.status.encode_promoted_node(
|
||||
index,
|
||||
@@ -949,7 +951,8 @@ pub(crate) fn send_promoted(
|
||||
);
|
||||
Some(index)
|
||||
}
|
||||
Err(dep_node_index) => dep_node_index,
|
||||
TrySetColorResult::AlreadyRed => None,
|
||||
TrySetColorResult::AlreadyGreen { index } => Some(index),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2172,6 +2172,36 @@ pub fn fn_abi_of_instance(
|
||||
}
|
||||
}
|
||||
|
||||
// `HasAttrs` impls: allow `find_attr!(tcx, id, ...)` to work with both DefId-like types and HirId.
|
||||
|
||||
impl<'tcx> hir::attrs::HasAttrs<'tcx, TyCtxt<'tcx>> for DefId {
|
||||
fn get_attrs(self, tcx: &TyCtxt<'tcx>) -> &'tcx [hir::Attribute] {
|
||||
if let Some(did) = self.as_local() {
|
||||
tcx.hir_attrs(tcx.local_def_id_to_hir_id(did))
|
||||
} else {
|
||||
tcx.attrs_for_def(self)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> hir::attrs::HasAttrs<'tcx, TyCtxt<'tcx>> for LocalDefId {
|
||||
fn get_attrs(self, tcx: &TyCtxt<'tcx>) -> &'tcx [hir::Attribute] {
|
||||
tcx.hir_attrs(tcx.local_def_id_to_hir_id(self))
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> hir::attrs::HasAttrs<'tcx, TyCtxt<'tcx>> for hir::OwnerId {
|
||||
fn get_attrs(self, tcx: &TyCtxt<'tcx>) -> &'tcx [hir::Attribute] {
|
||||
hir::attrs::HasAttrs::get_attrs(self.def_id, tcx)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> hir::attrs::HasAttrs<'tcx, TyCtxt<'tcx>> for hir::HirId {
|
||||
fn get_attrs(self, tcx: &TyCtxt<'tcx>) -> &'tcx [hir::Attribute] {
|
||||
tcx.hir_attrs(self)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn provide(providers: &mut Providers) {
|
||||
closure::provide(providers);
|
||||
context::provide(providers);
|
||||
|
||||
@@ -491,7 +491,7 @@ fn construct_fn<'tcx>(
|
||||
};
|
||||
|
||||
if let Some((dialect, phase)) =
|
||||
find_attr!(tcx.hir_attrs(fn_id), CustomMir(dialect, phase, _) => (dialect, phase))
|
||||
find_attr!(tcx, fn_id, CustomMir(dialect, phase, _) => (dialect, phase))
|
||||
{
|
||||
return custom::build_custom_mir(
|
||||
tcx,
|
||||
|
||||
@@ -917,7 +917,7 @@ fn make_mirror_unadjusted(&mut self, expr: &'tcx hir::Expr<'tcx>) -> Expr<'tcx>
|
||||
hir::ExprKind::Ret(v) => ExprKind::Return { value: v.map(|v| self.mirror_expr(v)) },
|
||||
hir::ExprKind::Become(call) => ExprKind::Become { value: self.mirror_expr(call) },
|
||||
hir::ExprKind::Break(dest, ref value) => {
|
||||
if find_attr!(self.tcx.hir_attrs(expr.hir_id), ConstContinue(_)) {
|
||||
if find_attr!(self.tcx, expr.hir_id, ConstContinue(_)) {
|
||||
match dest.target_id {
|
||||
Ok(target_id) => {
|
||||
let (Some(value), Some(_)) = (value, dest.label) else {
|
||||
@@ -982,7 +982,7 @@ fn make_mirror_unadjusted(&mut self, expr: &'tcx hir::Expr<'tcx>) -> Expr<'tcx>
|
||||
match_source,
|
||||
},
|
||||
hir::ExprKind::Loop(body, ..) => {
|
||||
if find_attr!(self.tcx.hir_attrs(expr.hir_id), LoopMatch(_)) {
|
||||
if find_attr!(self.tcx, expr.hir_id, LoopMatch(_)) {
|
||||
let dcx = self.tcx.dcx();
|
||||
|
||||
// Accept either `state = expr` or `state = expr;`.
|
||||
|
||||
@@ -104,7 +104,7 @@ fn new(tcx: TyCtxt<'tcx>, def: LocalDefId) -> Self {
|
||||
typing_env: ty::TypingEnv::non_body_analysis(tcx, def),
|
||||
typeck_results,
|
||||
body_owner: def.to_def_id(),
|
||||
apply_adjustments: !find_attr!(tcx.hir_attrs(hir_id), CustomMir(..) => ()).is_some(),
|
||||
apply_adjustments: !find_attr!(tcx, hir_id, CustomMir(..)),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -157,7 +157,7 @@ fn handle_res(&mut self, res: Res) {
|
||||
Res::Def(_, def_id) => self.check_def_id(def_id),
|
||||
Res::SelfTyParam { trait_: t } => self.check_def_id(t),
|
||||
Res::SelfTyAlias { alias_to: i, .. } => self.check_def_id(i),
|
||||
Res::ToolMod | Res::NonMacroAttr(..) | Res::Err => {}
|
||||
Res::ToolMod | Res::NonMacroAttr(..) | Res::OpenMod(..) | Res::Err => {}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1595,13 +1595,14 @@ fn check_assoc_item(
|
||||
let mut check = self.check(item.def_id.expect_local(), vis, effective_vis);
|
||||
|
||||
let is_assoc_ty = item.is_type();
|
||||
check.hard_error = is_assoc_ty && !item.is_impl_trait_in_trait();
|
||||
check.hard_error = is_assoc_ty;
|
||||
check.generics().predicates();
|
||||
if assoc_has_type_of(self.tcx, item) {
|
||||
check.hard_error = check.hard_error && item.defaultness(self.tcx).has_value();
|
||||
check.ty();
|
||||
}
|
||||
if is_assoc_ty && item.container == AssocContainer::Trait {
|
||||
// FIXME: too much breakage from reporting hard errors here, better wait for a fix
|
||||
// from proper associated type normalization.
|
||||
check.hard_error = false;
|
||||
check.bounds();
|
||||
}
|
||||
|
||||
@@ -357,6 +357,7 @@ fn build_reduced_graph_for_external_crate_res(
|
||||
| Res::SelfTyParam { .. }
|
||||
| Res::SelfTyAlias { .. }
|
||||
| Res::SelfCtor(..)
|
||||
| Res::OpenMod(..)
|
||||
| Res::Err => bug!("unexpected resolution: {:?}", res),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1740,8 +1740,8 @@ pub(crate) fn unresolved_macro_suggestions(
|
||||
Res::Def(DefKind::Macro(kinds), _) => {
|
||||
format!("{} {}", kinds.article(), kinds.descr())
|
||||
}
|
||||
Res::ToolMod => {
|
||||
// Don't confuse the user with tool modules.
|
||||
Res::ToolMod | Res::OpenMod(..) => {
|
||||
// Don't confuse the user with tool modules or open modules.
|
||||
continue;
|
||||
}
|
||||
Res::Def(DefKind::Trait, _) if macro_kind == MacroKind::Derive => {
|
||||
@@ -1978,7 +1978,8 @@ fn decl_description(&self, b: Decl<'_>, ident: Ident, scope: Scope<'_>) -> Strin
|
||||
let (built_in, from) = match scope {
|
||||
Scope::StdLibPrelude | Scope::MacroUsePrelude => ("", " from prelude"),
|
||||
Scope::ExternPreludeFlags
|
||||
if self.tcx.sess.opts.externs.get(ident.as_str()).is_some() =>
|
||||
if self.tcx.sess.opts.externs.get(ident.as_str()).is_some()
|
||||
|| matches!(res, Res::OpenMod(..)) =>
|
||||
{
|
||||
("", " passed with `--extern`")
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
AmbiguityError, AmbiguityKind, AmbiguityWarning, BindingKey, CmResolver, Decl, DeclKind,
|
||||
Determinacy, Finalize, IdentKey, ImportKind, LateDecl, Module, ModuleKind, ModuleOrUniformRoot,
|
||||
ParentScope, PathResult, PrivacyError, Res, ResolutionError, Resolver, Scope, ScopeSet,
|
||||
Segment, Stage, Used, errors,
|
||||
Segment, Stage, Symbol, Used, errors,
|
||||
};
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
@@ -386,7 +386,6 @@ pub(crate) fn resolve_ident_in_lexical_scope(
|
||||
}
|
||||
|
||||
/// Resolve an identifier in the specified set of scopes.
|
||||
#[instrument(level = "debug", skip(self))]
|
||||
pub(crate) fn resolve_ident_in_scope_set<'r>(
|
||||
self: CmResolver<'r, 'ra, 'tcx>,
|
||||
orig_ident: Ident,
|
||||
@@ -976,6 +975,14 @@ pub(crate) fn resolve_ident_in_module<'r>(
|
||||
ignore_import,
|
||||
)
|
||||
}
|
||||
ModuleOrUniformRoot::OpenModule(sym) => {
|
||||
let open_ns_name = format!("{}::{}", sym.as_str(), ident.name);
|
||||
let ns_ident = IdentKey::with_root_ctxt(Symbol::intern(&open_ns_name));
|
||||
match self.extern_prelude_get_flag(ns_ident, ident.span, finalize.is_some()) {
|
||||
Some(decl) => Ok(decl),
|
||||
None => Err(Determinacy::Determined),
|
||||
}
|
||||
}
|
||||
ModuleOrUniformRoot::ModuleAndExternPrelude(module) => self.resolve_ident_in_scope_set(
|
||||
ident,
|
||||
ScopeSet::ModuleAndExternPrelude(ns, module),
|
||||
@@ -1962,7 +1969,10 @@ fn record_segment_res<'r, 'ra, 'tcx>(
|
||||
}
|
||||
|
||||
let maybe_assoc = opt_ns != Some(MacroNS) && PathSource::Type.is_expected(res);
|
||||
if let Some(def_id) = binding.res().module_like_def_id() {
|
||||
if let Res::OpenMod(sym) = binding.res() {
|
||||
module = Some(ModuleOrUniformRoot::OpenModule(sym));
|
||||
record_segment_res(self.reborrow(), finalize, res, id);
|
||||
} else if let Some(def_id) = binding.res().module_like_def_id() {
|
||||
if self.mods_with_parse_errors.contains(&def_id) {
|
||||
module_had_parse_errors = true;
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
|
||||
/// A potential import declaration in the process of being planted into a module.
|
||||
/// Also used for lazily planting names from `--extern` flags to extern prelude.
|
||||
#[derive(Clone, Copy, Default, PartialEq)]
|
||||
#[derive(Clone, Copy, Default, PartialEq, Debug)]
|
||||
pub(crate) enum PendingDecl<'ra> {
|
||||
Ready(Option<Decl<'ra>>),
|
||||
#[default]
|
||||
|
||||
@@ -3381,7 +3381,7 @@ pub(crate) fn detect_and_suggest_const_parameter_error(
|
||||
&& def_id.is_local()
|
||||
&& let Some(local_def_id) = def_id.as_local()
|
||||
&& let Some(struct_generics) = self.r.struct_generics.get(&local_def_id)
|
||||
&& let target_param = &struct_generics.params[idx]
|
||||
&& let Some(target_param) = &struct_generics.params.get(idx)
|
||||
&& let GenericParamKind::Const { ty, .. } = &target_param.kind
|
||||
&& let TyKind::Path(_, path) = &ty.kind
|
||||
{
|
||||
|
||||
@@ -61,6 +61,7 @@
|
||||
use rustc_hir::{PrimTy, TraitCandidate, find_attr};
|
||||
use rustc_index::bit_set::DenseBitSet;
|
||||
use rustc_metadata::creader::CStore;
|
||||
use rustc_middle::bug;
|
||||
use rustc_middle::metadata::{AmbigModChild, ModChild, Reexport};
|
||||
use rustc_middle::middle::privacy::EffectiveVisibilities;
|
||||
use rustc_middle::query::Providers;
|
||||
@@ -445,6 +446,11 @@ enum ModuleOrUniformRoot<'ra> {
|
||||
/// Used only for resolving single-segment imports. The reason it exists is that import paths
|
||||
/// are always split into two parts, the first of which should be some kind of module.
|
||||
CurrentScope,
|
||||
|
||||
/// Virtual module for the resolution of base names of namespaced crates,
|
||||
/// where the base name doesn't correspond to a module in the extern prelude.
|
||||
/// E.g. `my_api::utils` is in the prelude, but `my_api` is not.
|
||||
OpenModule(Symbol),
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
@@ -1105,13 +1111,20 @@ fn determined(&self) -> bool {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
struct ExternPreludeEntry<'ra> {
|
||||
/// Name declaration from an `extern crate` item.
|
||||
/// The boolean flag is true is `item_decl` is non-redundant, happens either when
|
||||
/// `flag_decl` is `None`, or when `extern crate` introducing `item_decl` used renaming.
|
||||
item_decl: Option<(Decl<'ra>, Span, /* introduced by item */ bool)>,
|
||||
/// Name declaration from an `--extern` flag, lazily populated on first use.
|
||||
flag_decl: Option<CacheCell<(PendingDecl<'ra>, /* finalized */ bool)>>,
|
||||
flag_decl: Option<
|
||||
CacheCell<(
|
||||
PendingDecl<'ra>,
|
||||
/* finalized */ bool,
|
||||
/* open flag (namespaced crate) */ bool,
|
||||
)>,
|
||||
>,
|
||||
}
|
||||
|
||||
impl ExternPreludeEntry<'_> {
|
||||
@@ -1122,7 +1135,14 @@ fn introduced_by_item(&self) -> bool {
|
||||
fn flag() -> Self {
|
||||
ExternPreludeEntry {
|
||||
item_decl: None,
|
||||
flag_decl: Some(CacheCell::new((PendingDecl::Pending, false))),
|
||||
flag_decl: Some(CacheCell::new((PendingDecl::Pending, false, false))),
|
||||
}
|
||||
}
|
||||
|
||||
fn open_flag() -> Self {
|
||||
ExternPreludeEntry {
|
||||
item_decl: None,
|
||||
flag_decl: Some(CacheCell::new((PendingDecl::Pending, false, true))),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1643,35 +1663,7 @@ pub fn new(
|
||||
let mut invocation_parents = FxHashMap::default();
|
||||
invocation_parents.insert(LocalExpnId::ROOT, InvocationParent::ROOT);
|
||||
|
||||
let mut extern_prelude: FxIndexMap<_, _> = tcx
|
||||
.sess
|
||||
.opts
|
||||
.externs
|
||||
.iter()
|
||||
.filter_map(|(name, entry)| {
|
||||
// Make sure `self`, `super`, `_` etc do not get into extern prelude.
|
||||
// FIXME: reject `--extern self` and similar in option parsing instead.
|
||||
if entry.add_prelude
|
||||
&& let name = Symbol::intern(name)
|
||||
&& name.can_be_raw()
|
||||
{
|
||||
let ident = IdentKey::with_root_ctxt(name);
|
||||
Some((ident, ExternPreludeEntry::flag()))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
.collect();
|
||||
|
||||
if !attr::contains_name(attrs, sym::no_core) {
|
||||
let ident = IdentKey::with_root_ctxt(sym::core);
|
||||
extern_prelude.insert(ident, ExternPreludeEntry::flag());
|
||||
if !attr::contains_name(attrs, sym::no_std) {
|
||||
let ident = IdentKey::with_root_ctxt(sym::std);
|
||||
extern_prelude.insert(ident, ExternPreludeEntry::flag());
|
||||
}
|
||||
}
|
||||
|
||||
let extern_prelude = build_extern_prelude(tcx, attrs);
|
||||
let registered_tools = tcx.registered_tools(());
|
||||
let edition = tcx.sess.edition();
|
||||
|
||||
@@ -2326,10 +2318,10 @@ fn extern_prelude_get_flag(
|
||||
) -> Option<Decl<'ra>> {
|
||||
let entry = self.extern_prelude.get(&ident);
|
||||
entry.and_then(|entry| entry.flag_decl.as_ref()).and_then(|flag_decl| {
|
||||
let (pending_decl, finalized) = flag_decl.get();
|
||||
let (pending_decl, finalized, is_open) = flag_decl.get();
|
||||
let decl = match pending_decl {
|
||||
PendingDecl::Ready(decl) => {
|
||||
if finalize && !finalized {
|
||||
if finalize && !finalized && !is_open {
|
||||
self.cstore_mut().process_path_extern(
|
||||
self.tcx,
|
||||
ident.name,
|
||||
@@ -2340,18 +2332,28 @@ fn extern_prelude_get_flag(
|
||||
}
|
||||
PendingDecl::Pending => {
|
||||
debug_assert!(!finalized);
|
||||
let crate_id = if finalize {
|
||||
self.cstore_mut().process_path_extern(self.tcx, ident.name, orig_ident_span)
|
||||
if is_open {
|
||||
let res = Res::OpenMod(ident.name);
|
||||
Some(self.arenas.new_pub_def_decl(res, DUMMY_SP, LocalExpnId::ROOT))
|
||||
} else {
|
||||
self.cstore_mut().maybe_process_path_extern(self.tcx, ident.name)
|
||||
};
|
||||
crate_id.map(|crate_id| {
|
||||
let res = Res::Def(DefKind::Mod, crate_id.as_def_id());
|
||||
self.arenas.new_pub_def_decl(res, DUMMY_SP, LocalExpnId::ROOT)
|
||||
})
|
||||
let crate_id = if finalize {
|
||||
self.cstore_mut().process_path_extern(
|
||||
self.tcx,
|
||||
ident.name,
|
||||
orig_ident_span,
|
||||
)
|
||||
} else {
|
||||
self.cstore_mut().maybe_process_path_extern(self.tcx, ident.name)
|
||||
};
|
||||
crate_id.map(|crate_id| {
|
||||
let def_id = crate_id.as_def_id();
|
||||
let res = Res::Def(DefKind::Mod, def_id);
|
||||
self.arenas.new_pub_def_decl(res, DUMMY_SP, LocalExpnId::ROOT)
|
||||
})
|
||||
}
|
||||
}
|
||||
};
|
||||
flag_decl.set((PendingDecl::Ready(decl), finalize || finalized));
|
||||
flag_decl.set((PendingDecl::Ready(decl), finalize || finalized, is_open));
|
||||
decl.or_else(|| finalize.then_some(self.dummy_decl))
|
||||
})
|
||||
}
|
||||
@@ -2393,7 +2395,9 @@ fn resolve_rustdoc_path(
|
||||
PathResult::Module(ModuleOrUniformRoot::ExternPrelude) | PathResult::Failed { .. } => {
|
||||
None
|
||||
}
|
||||
PathResult::Module(..) | PathResult::Indeterminate => unreachable!(),
|
||||
path_result @ (PathResult::Module(..) | PathResult::Indeterminate) => {
|
||||
bug!("got invalid path_result: {path_result:?}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2511,6 +2515,60 @@ fn resolve_main(&mut self) {
|
||||
}
|
||||
}
|
||||
|
||||
fn build_extern_prelude<'tcx, 'ra>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
attrs: &[ast::Attribute],
|
||||
) -> FxIndexMap<IdentKey, ExternPreludeEntry<'ra>> {
|
||||
let mut extern_prelude: FxIndexMap<IdentKey, ExternPreludeEntry<'ra>> = tcx
|
||||
.sess
|
||||
.opts
|
||||
.externs
|
||||
.iter()
|
||||
.filter_map(|(name, entry)| {
|
||||
// Make sure `self`, `super`, `_` etc do not get into extern prelude.
|
||||
// FIXME: reject `--extern self` and similar in option parsing instead.
|
||||
if entry.add_prelude
|
||||
&& let sym = Symbol::intern(name)
|
||||
&& sym.can_be_raw()
|
||||
{
|
||||
Some((IdentKey::with_root_ctxt(sym), ExternPreludeEntry::flag()))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
.collect();
|
||||
|
||||
// Add open base entries for namespaced crates whose base segment
|
||||
// is missing from the prelude (e.g. `foo::bar` without `foo`).
|
||||
// These are necessary in order to resolve the open modules, whereas
|
||||
// the namespaced names are necessary in `extern_prelude` for actually
|
||||
// resolving the namespaced crates.
|
||||
let missing_open_bases: Vec<IdentKey> = extern_prelude
|
||||
.keys()
|
||||
.filter_map(|ident| {
|
||||
let (base, _) = ident.name.as_str().split_once("::")?;
|
||||
let base_sym = Symbol::intern(base);
|
||||
base_sym.can_be_raw().then(|| IdentKey::with_root_ctxt(base_sym))
|
||||
})
|
||||
.filter(|base_ident| !extern_prelude.contains_key(base_ident))
|
||||
.collect();
|
||||
|
||||
extern_prelude.extend(
|
||||
missing_open_bases.into_iter().map(|ident| (ident, ExternPreludeEntry::open_flag())),
|
||||
);
|
||||
|
||||
// Inject `core` / `std` unless suppressed by attributes.
|
||||
if !attr::contains_name(attrs, sym::no_core) {
|
||||
extern_prelude.insert(IdentKey::with_root_ctxt(sym::core), ExternPreludeEntry::flag());
|
||||
|
||||
if !attr::contains_name(attrs, sym::no_std) {
|
||||
extern_prelude.insert(IdentKey::with_root_ctxt(sym::std), ExternPreludeEntry::flag());
|
||||
}
|
||||
}
|
||||
|
||||
extern_prelude
|
||||
}
|
||||
|
||||
fn names_to_string(names: impl Iterator<Item = Symbol>) -> String {
|
||||
let mut result = String::new();
|
||||
for (i, name) in names.enumerate().filter(|(_, name)| *name != kw::PathRoot) {
|
||||
|
||||
@@ -239,7 +239,7 @@ macro_rules! ins_sym {
|
||||
ins_none!(sym::sanitizer_cfi_normalize_integers);
|
||||
}
|
||||
|
||||
ins_sym!(sym::target_abi, sess.target.abi.desc_symbol());
|
||||
ins_sym!(sym::target_abi, sess.target.cfg_abi.desc_symbol());
|
||||
ins_sym!(sym::target_arch, sess.target.arch.desc_symbol());
|
||||
ins_str!(sym::target_endian, sess.target.endian.as_str());
|
||||
ins_sym!(sym::target_env, sess.target.env.desc_symbol());
|
||||
@@ -447,7 +447,7 @@ macro_rules! ins {
|
||||
};
|
||||
|
||||
for target in Target::builtins().chain(iter::once(current_target.clone())) {
|
||||
values_target_abi.insert(target.options.abi.desc_symbol());
|
||||
values_target_abi.insert(target.options.cfg_abi.desc_symbol());
|
||||
values_target_arch.insert(target.arch.desc_symbol());
|
||||
values_target_endian.insert(Symbol::intern(target.options.endian.as_str()));
|
||||
values_target_env.insert(target.options.env.desc_symbol());
|
||||
|
||||
@@ -43,6 +43,13 @@ pub(crate) fn split_extern_opt<'a>(
|
||||
}
|
||||
};
|
||||
|
||||
// Reject paths with more than two segments.
|
||||
if unstable_opts.namespaced_crates && crate_name.split("::").count() > 2 {
|
||||
return Err(early_dcx.early_struct_fatal(format!(
|
||||
"crate name `{crate_name}` passed to `--extern` can have at most two segments."
|
||||
)));
|
||||
}
|
||||
|
||||
if !valid_crate_name(&crate_name, unstable_opts) {
|
||||
let mut error = early_dcx.early_struct_fatal(format!(
|
||||
"crate name `{crate_name}` passed to `--extern` is not a valid ASCII identifier"
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
use rustc_macros::{Decodable, Encodable, HashStable_Generic};
|
||||
use rustc_span::Symbol;
|
||||
|
||||
use crate::spec::{Abi, Arch, RelocModel, Target};
|
||||
use crate::spec::{Arch, CfgAbi, RelocModel, Target};
|
||||
|
||||
pub struct ModifierInfo {
|
||||
pub modifier: char,
|
||||
@@ -1001,7 +1001,7 @@ pub fn parse(
|
||||
_ => Err(&["C", "system", "efiapi"]),
|
||||
},
|
||||
InlineAsmArch::PowerPC | InlineAsmArch::PowerPC64 => match name {
|
||||
"C" | "system" => Ok(if target.abi == Abi::Spe {
|
||||
"C" | "system" => Ok(if target.cfg_abi == CfgAbi::Spe {
|
||||
InlineAsmClobberAbi::PowerPCSPE
|
||||
} else {
|
||||
InlineAsmClobberAbi::PowerPC
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
use rustc_span::Symbol;
|
||||
|
||||
use super::{InlineAsmArch, InlineAsmType, ModifierInfo};
|
||||
use crate::spec::{Abi, RelocModel, Target};
|
||||
use crate::spec::{CfgAbi, RelocModel, Target};
|
||||
|
||||
def_reg_class! {
|
||||
PowerPC PowerPCInlineAsmRegClass {
|
||||
@@ -105,9 +105,9 @@ fn reserved_v20to31(
|
||||
_is_clobber: bool,
|
||||
) -> Result<(), &'static str> {
|
||||
if target.is_like_aix {
|
||||
match &target.options.abi {
|
||||
Abi::VecDefault => Err("v20-v31 (vs52-vs63) are reserved on vec-default ABI"),
|
||||
Abi::VecExtAbi => Ok(()),
|
||||
match &target.options.cfg_abi {
|
||||
CfgAbi::VecDefault => Err("v20-v31 (vs52-vs63) are reserved on vec-default ABI"),
|
||||
CfgAbi::VecExtAbi => Ok(()),
|
||||
abi => unreachable!("unrecognized AIX ABI: {abi}"),
|
||||
}
|
||||
} else {
|
||||
@@ -122,7 +122,11 @@ fn spe_acc_target_check(
|
||||
target: &Target,
|
||||
_is_clobber: bool,
|
||||
) -> Result<(), &'static str> {
|
||||
if target.abi == Abi::Spe { Ok(()) } else { Err("spe_acc is only available on spe targets") }
|
||||
if target.cfg_abi == CfgAbi::Spe {
|
||||
Ok(())
|
||||
} else {
|
||||
Err("spe_acc is only available on spe targets")
|
||||
}
|
||||
}
|
||||
|
||||
def_regs! {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
};
|
||||
|
||||
use crate::callconv::{ArgAbi, ArgExtension, CastTarget, FnAbi, PassMode, Uniform};
|
||||
use crate::spec::HasTargetSpec;
|
||||
use crate::spec::{HasTargetSpec, LlvmAbi};
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
enum RegPassKind {
|
||||
@@ -415,9 +415,9 @@ pub(crate) fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>)
|
||||
C: HasDataLayout + HasTargetSpec,
|
||||
{
|
||||
let xlen = cx.data_layout().pointer_size().bits();
|
||||
let flen = match &cx.target_spec().llvm_abiname[..] {
|
||||
"ilp32f" | "lp64f" => 32,
|
||||
"ilp32d" | "lp64d" => 64,
|
||||
let flen = match &cx.target_spec().llvm_abiname {
|
||||
LlvmAbi::Ilp32f | LlvmAbi::Lp64f => 32,
|
||||
LlvmAbi::Ilp32d | LlvmAbi::Lp64d => 64,
|
||||
_ => 0,
|
||||
};
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
use rustc_abi::{Endian, HasDataLayout, TyAbiInterface};
|
||||
|
||||
use crate::callconv::{Align, ArgAbi, FnAbi, Reg, RegKind, Uniform};
|
||||
use crate::spec::{HasTargetSpec, Os};
|
||||
use crate::spec::{HasTargetSpec, LlvmAbi, Os};
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
enum ABI {
|
||||
@@ -106,9 +106,9 @@ pub(crate) fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>)
|
||||
Ty: TyAbiInterface<'a, C> + Copy,
|
||||
C: HasDataLayout + HasTargetSpec,
|
||||
{
|
||||
let abi = if cx.target_spec().options.llvm_abiname == "elfv2" {
|
||||
let abi = if cx.target_spec().options.llvm_abiname == LlvmAbi::ElfV2 {
|
||||
ELFv2
|
||||
} else if cx.target_spec().options.llvm_abiname == "elfv1" {
|
||||
} else if cx.target_spec().options.llvm_abiname == LlvmAbi::ElfV1 {
|
||||
ELFv1
|
||||
} else if cx.target_spec().os == Os::Aix {
|
||||
AIX
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
};
|
||||
|
||||
use crate::callconv::{ArgAbi, ArgExtension, CastTarget, FnAbi, PassMode, Uniform};
|
||||
use crate::spec::HasTargetSpec;
|
||||
use crate::spec::{HasTargetSpec, LlvmAbi};
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
enum RegPassKind {
|
||||
@@ -419,9 +419,9 @@ pub(crate) fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>)
|
||||
Ty: TyAbiInterface<'a, C> + Copy,
|
||||
C: HasDataLayout + HasTargetSpec,
|
||||
{
|
||||
let flen = match &cx.target_spec().llvm_abiname[..] {
|
||||
"ilp32f" | "lp64f" => 32,
|
||||
"ilp32d" | "lp64d" => 64,
|
||||
let flen = match &cx.target_spec().llvm_abiname {
|
||||
LlvmAbi::Ilp32f | LlvmAbi::Lp64f => 32,
|
||||
LlvmAbi::Ilp32d | LlvmAbi::Lp64d => 64,
|
||||
_ => 0,
|
||||
};
|
||||
let xlen = cx.data_layout().pointer_size().bits();
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
use rustc_abi::Endian;
|
||||
|
||||
use crate::spec::{
|
||||
Abi, BinaryFormat, Cc, CodeModel, LinkOutputKind, LinkerFlavor, Os, TargetOptions, crt_objects,
|
||||
cvs,
|
||||
BinaryFormat, Cc, CfgAbi, CodeModel, LinkOutputKind, LinkerFlavor, Os, TargetOptions,
|
||||
crt_objects, cvs,
|
||||
};
|
||||
|
||||
pub(crate) fn opts() -> TargetOptions {
|
||||
TargetOptions {
|
||||
abi: Abi::VecExtAbi,
|
||||
cfg_abi: CfgAbi::VecExtAbi,
|
||||
code_model: Some(CodeModel::Large),
|
||||
cpu: "pwr7".into(),
|
||||
os: Os::Aix,
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
use std::str::FromStr;
|
||||
|
||||
use crate::spec::{
|
||||
Abi, BinaryFormat, Cc, DebuginfoKind, Env, FloatAbi, FramePointer, LinkerFlavor, Lld, Os,
|
||||
BinaryFormat, Cc, CfgAbi, DebuginfoKind, Env, FloatAbi, FramePointer, LinkerFlavor, Lld, Os,
|
||||
RustcAbi, SplitDebuginfo, StackProbeType, StaticCow, Target, TargetOptions, cvs,
|
||||
};
|
||||
|
||||
@@ -108,11 +108,11 @@ fn target_env(self) -> Env {
|
||||
//
|
||||
// But let's continue setting them for backwards compatibility.
|
||||
// FIXME(madsmtm): Warn about using these in the future.
|
||||
fn target_abi(self) -> Abi {
|
||||
fn target_abi(self) -> CfgAbi {
|
||||
match self {
|
||||
Self::Normal => Abi::Unspecified,
|
||||
Self::MacCatalyst => Abi::MacAbi,
|
||||
Self::Simulator => Abi::Sim,
|
||||
Self::Normal => CfgAbi::Unspecified,
|
||||
Self::MacCatalyst => CfgAbi::MacAbi,
|
||||
Self::Simulator => CfgAbi::Sim,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -135,7 +135,7 @@ pub(crate) fn base(
|
||||
},
|
||||
os,
|
||||
env: env.target_env(),
|
||||
abi: env.target_abi(),
|
||||
cfg_abi: env.target_abi(),
|
||||
cpu: arch.target_cpu(env).into(),
|
||||
link_env_remove,
|
||||
vendor: "apple".into(),
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
aarch64_apple_watchos_sim, i686_apple_darwin, x86_64_apple_darwin, x86_64_apple_ios,
|
||||
x86_64_apple_tvos, x86_64_apple_watchos_sim,
|
||||
};
|
||||
use crate::spec::{Abi, Env};
|
||||
use crate::spec::{CfgAbi, Env};
|
||||
|
||||
#[test]
|
||||
fn simulator_targets_set_env() {
|
||||
@@ -21,7 +21,7 @@ fn simulator_targets_set_env() {
|
||||
for target in &all_sim_targets {
|
||||
assert_eq!(target.env, Env::Sim);
|
||||
// Ensure backwards compat
|
||||
assert_eq!(target.abi, Abi::Sim);
|
||||
assert_eq!(target.cfg_abi, CfgAbi::Sim);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
use crate::spec::crt_objects::pre_mingw_self_contained;
|
||||
use crate::spec::{
|
||||
Abi, BinaryFormat, Cc, DebuginfoKind, Env, LinkSelfContainedDefault, LinkerFlavor, Lld, Os,
|
||||
BinaryFormat, Cc, CfgAbi, DebuginfoKind, Env, LinkSelfContainedDefault, LinkerFlavor, Lld, Os,
|
||||
SplitDebuginfo, TargetOptions, add_link_args, cvs,
|
||||
};
|
||||
|
||||
@@ -26,7 +26,7 @@ pub(crate) fn opts() -> TargetOptions {
|
||||
os: Os::Windows,
|
||||
env: Env::Gnu,
|
||||
vendor: "pc".into(),
|
||||
abi: Abi::Llvm,
|
||||
cfg_abi: CfgAbi::Llvm,
|
||||
linker: Some("clang".into()),
|
||||
dynamic_linking: true,
|
||||
dll_tls_export: false,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::spec::{Abi, Cc, LinkArgs, LinkerFlavor, Lld, TargetOptions, add_link_args, base};
|
||||
use crate::spec::{Cc, CfgAbi, LinkArgs, LinkerFlavor, Lld, TargetOptions, add_link_args, base};
|
||||
|
||||
pub(crate) fn opts() -> TargetOptions {
|
||||
let base = base::windows_gnu::opts();
|
||||
@@ -23,7 +23,7 @@ pub(crate) fn opts() -> TargetOptions {
|
||||
let late_link_args_static = LinkArgs::new();
|
||||
|
||||
TargetOptions {
|
||||
abi: Abi::Uwp,
|
||||
cfg_abi: CfgAbi::Uwp,
|
||||
vendor: "uwp".into(),
|
||||
limit_rdylib_exports: false,
|
||||
late_link_args,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use crate::spec::{Abi, LinkerFlavor, Lld, TargetOptions, base};
|
||||
use crate::spec::{CfgAbi, LinkerFlavor, Lld, TargetOptions, base};
|
||||
|
||||
pub(crate) fn opts() -> TargetOptions {
|
||||
let mut opts =
|
||||
TargetOptions { abi: Abi::Uwp, vendor: "uwp".into(), ..base::windows_msvc::opts() };
|
||||
TargetOptions { cfg_abi: CfgAbi::Uwp, vendor: "uwp".into(), ..base::windows_msvc::opts() };
|
||||
|
||||
opts.add_pre_link_args(LinkerFlavor::Msvc(Lld::No), &["/APPCONTAINER", "mincore.lib"]);
|
||||
|
||||
|
||||
@@ -5,14 +5,14 @@
|
||||
|
||||
use super::crt_objects::CrtObjects;
|
||||
use super::{
|
||||
Abi, Arch, BinaryFormat, CodeModel, DebuginfoKind, Env, FloatAbi, FramePointer, LinkArgsCli,
|
||||
Arch, BinaryFormat, CfgAbi, CodeModel, DebuginfoKind, Env, FloatAbi, FramePointer, LinkArgsCli,
|
||||
LinkSelfContainedComponents, LinkSelfContainedDefault, LinkerFlavorCli, LldFlavor,
|
||||
MergeFunctions, Os, PanicStrategy, RelocModel, RelroLevel, RustcAbi, SanitizerSet,
|
||||
SmallDataThresholdSupport, SplitDebuginfo, StackProbeType, StaticCow, SymbolVisibility, Target,
|
||||
TargetKind, TargetOptions, TargetWarnings, TlsModel,
|
||||
};
|
||||
use crate::json::{Json, ToJson};
|
||||
use crate::spec::AbiMap;
|
||||
use crate::spec::{AbiMap, LlvmAbi};
|
||||
|
||||
impl Target {
|
||||
/// Loads a target descriptor from a JSON object.
|
||||
@@ -69,7 +69,9 @@ macro_rules! forward_opt {
|
||||
forward_opt!(c_enum_min_bits); // if None, matches c_int_width
|
||||
forward!(os);
|
||||
forward!(env);
|
||||
forward!(abi);
|
||||
if let Some(abi) = json.abi {
|
||||
base.cfg_abi = abi;
|
||||
}
|
||||
forward!(vendor);
|
||||
forward_opt!(linker);
|
||||
forward!(linker_flavor_json);
|
||||
@@ -297,7 +299,7 @@ macro_rules! target_option_val {
|
||||
target_option_val!(c_int_width, "target-c-int-width");
|
||||
target_option_val!(os);
|
||||
target_option_val!(env);
|
||||
target_option_val!(abi);
|
||||
target_option_val!(cfg_abi, "abi");
|
||||
target_option_val!(vendor);
|
||||
target_option_val!(linker);
|
||||
target_option_val!(linker_flavor_json, "linker-flavor");
|
||||
@@ -505,7 +507,7 @@ struct TargetSpecJson {
|
||||
c_enum_min_bits: Option<u64>,
|
||||
os: Option<Os>,
|
||||
env: Option<Env>,
|
||||
abi: Option<Abi>,
|
||||
abi: Option<CfgAbi>,
|
||||
vendor: Option<StaticCow<str>>,
|
||||
linker: Option<StaticCow<str>>,
|
||||
#[serde(rename = "linker-flavor")]
|
||||
@@ -609,7 +611,7 @@ struct TargetSpecJson {
|
||||
#[serde(rename = "target-mcount")]
|
||||
mcount: Option<StaticCow<str>>,
|
||||
llvm_mcount_intrinsic: Option<StaticCow<str>>,
|
||||
llvm_abiname: Option<StaticCow<str>>,
|
||||
llvm_abiname: Option<LlvmAbi>,
|
||||
llvm_floatabi: Option<FloatAbi>,
|
||||
rustc_abi: Option<RustcAbi>,
|
||||
relax_elf_relocations: Option<bool>,
|
||||
|
||||
@@ -2065,7 +2065,10 @@ pub fn desc_symbol(&self) -> Symbol {
|
||||
}
|
||||
|
||||
crate::target_spec_enum! {
|
||||
pub enum Abi {
|
||||
/// An enum representing possible values for `cfg(target_abi)`.
|
||||
/// This field is not forwarded to LLVM so it does not by itself affect codegen.
|
||||
/// See the `cfg_abi` field of [`TargetOptions`] for more details.
|
||||
pub enum CfgAbi {
|
||||
Abi64 = "abi64",
|
||||
AbiV2 = "abiv2",
|
||||
AbiV2Hf = "abiv2hf",
|
||||
@@ -2090,12 +2093,40 @@ pub enum Abi {
|
||||
other_variant = Other;
|
||||
}
|
||||
|
||||
impl Abi {
|
||||
impl CfgAbi {
|
||||
pub fn desc_symbol(&self) -> Symbol {
|
||||
Symbol::intern(self.desc())
|
||||
}
|
||||
}
|
||||
|
||||
crate::target_spec_enum! {
|
||||
/// An enum representing possible values for the `llvm_abiname` field of [`TargetOptions`].
|
||||
/// This field is used by LLVM on some targets to control which ABI to use.
|
||||
pub enum LlvmAbi {
|
||||
// RISC-V and LoongArch
|
||||
Ilp32 = "ilp32",
|
||||
Ilp32f = "ilp32f",
|
||||
Ilp32d = "ilp32d",
|
||||
Ilp32e = "ilp32e",
|
||||
Ilp32s = "ilp32s",
|
||||
Lp64 = "lp64",
|
||||
Lp64f = "lp64f",
|
||||
Lp64d = "lp64d",
|
||||
Lp64e = "lp64e",
|
||||
Lp64s = "lp64s",
|
||||
// MIPS
|
||||
O32 = "o32",
|
||||
N32 = "n32",
|
||||
N64 = "n64",
|
||||
// PowerPC
|
||||
ElfV1 = "elfv1",
|
||||
ElfV2 = "elfv2",
|
||||
|
||||
Unspecified = "",
|
||||
}
|
||||
other_variant = Other;
|
||||
}
|
||||
|
||||
/// Everything `rustc` knows about how to compile for a specific target.
|
||||
///
|
||||
/// Every field here must be specified, and has no default value.
|
||||
@@ -2221,13 +2252,18 @@ pub struct TargetOptions {
|
||||
pub os: Os,
|
||||
/// Environment name to use for conditional compilation (`target_env`). Defaults to [`Env::Unspecified`].
|
||||
pub env: Env,
|
||||
/// ABI name to distinguish multiple ABIs on the same OS and architecture. For instance, `"eabi"`
|
||||
/// or `"eabihf"`. Defaults to [`Abi::Unspecified`].
|
||||
/// This field is *not* forwarded directly to LLVM and therefore does not control which ABI (in
|
||||
/// the sense of function calling convention) is actually used; its primary purpose is
|
||||
/// `cfg(target_abi)`. The actual calling convention is controlled by `llvm_abiname`,
|
||||
/// `llvm_floatabi`, and `rustc_abi`.
|
||||
pub abi: Abi,
|
||||
/// ABI name to distinguish multiple ABIs on the same OS and architecture. For instance,
|
||||
/// `"eabi"` or `"eabihf"`. Defaults to [`CfgAbi::Unspecified`].
|
||||
/// The only purpose of this field is to control `cfg(target_abi)`. This does not control the
|
||||
/// calling convention used by this target! The actual calling convention is controlled by
|
||||
/// `llvm_abiname`, `llvm_floatabi`, and `rustc_abi`.
|
||||
///
|
||||
/// In a target spec, this field generally *informs* the user about what the ABI is, but you
|
||||
/// have to also set up other parts of the target spec to ensure that this information is
|
||||
/// correct. In the rest of the compiler, do not check this field if what you actually need to
|
||||
/// know about is the calling convention. Most targets have an open-ended set of values for this
|
||||
/// field.
|
||||
pub cfg_abi: CfgAbi,
|
||||
/// Vendor name to use for conditional compilation (`target_vendor`). Defaults to "unknown".
|
||||
#[rustc_lint_opt_deny_field_access(
|
||||
"use `Target::is_like_*` instead of this field; see https://github.com/rust-lang/rust/issues/100343 for rationale"
|
||||
@@ -2537,7 +2573,7 @@ pub struct TargetOptions {
|
||||
|
||||
/// LLVM ABI name, corresponds to the '-mabi' parameter available in multilib C compilers
|
||||
/// and the `-target-abi` flag in llc. In the LLVM API this is `MCOptions.ABIName`.
|
||||
pub llvm_abiname: StaticCow<str>,
|
||||
pub llvm_abiname: LlvmAbi,
|
||||
|
||||
/// Control the float ABI to use, for architectures that support it. The only architecture we
|
||||
/// currently use this for is ARM. Corresponds to the `-float-abi` flag in llc. In the LLVM API
|
||||
@@ -2550,7 +2586,6 @@ pub struct TargetOptions {
|
||||
/// Picks a specific ABI for this target. This is *not* just for "Rust" ABI functions,
|
||||
/// it can also affect "C" ABI functions; the point is that this flag is interpreted by
|
||||
/// rustc and not forwarded to LLVM.
|
||||
/// So far, this is only used on x86.
|
||||
pub rustc_abi: Option<RustcAbi>,
|
||||
|
||||
/// Whether or not RelaxElfRelocation flag will be passed to the linker
|
||||
@@ -2739,7 +2774,7 @@ fn default() -> TargetOptions {
|
||||
c_int_width: 32,
|
||||
os: Os::None,
|
||||
env: Env::Unspecified,
|
||||
abi: Abi::Unspecified,
|
||||
cfg_abi: CfgAbi::Unspecified,
|
||||
vendor: "unknown".into(),
|
||||
linker: option_env!("CFG_DEFAULT_LINKER").map(|s| s.into()),
|
||||
linker_flavor: LinkerFlavor::Gnu(Cc::Yes, Lld::No),
|
||||
@@ -2835,7 +2870,7 @@ fn default() -> TargetOptions {
|
||||
merge_functions: MergeFunctions::Aliases,
|
||||
mcount: "mcount".into(),
|
||||
llvm_mcount_intrinsic: None,
|
||||
llvm_abiname: "".into(),
|
||||
llvm_abiname: LlvmAbi::Unspecified,
|
||||
llvm_floatabi: None,
|
||||
rustc_abi: None,
|
||||
relax_elf_relocations: false,
|
||||
@@ -3183,71 +3218,106 @@ macro_rules! check_matches {
|
||||
);
|
||||
}
|
||||
|
||||
// Ensure built-in targets don't use the `Other` variants.
|
||||
if kind == TargetKind::Builtin {
|
||||
check!(
|
||||
!matches!(self.arch, Arch::Other(_)),
|
||||
"`Arch::Other` is only meant for JSON targets"
|
||||
);
|
||||
check!(!matches!(self.os, Os::Other(_)), "`Os::Other` is only meant for JSON targets");
|
||||
check!(
|
||||
!matches!(self.env, Env::Other(_)),
|
||||
"`Env::Other` is only meant for JSON targets"
|
||||
);
|
||||
check!(
|
||||
!matches!(self.cfg_abi, CfgAbi::Other(_)),
|
||||
"`CfgAbi::Other` is only meant for JSON targets"
|
||||
);
|
||||
check!(
|
||||
!matches!(self.llvm_abiname, LlvmAbi::Other(_)),
|
||||
"`LlvmAbi::Other` is only meant for JSON targets"
|
||||
);
|
||||
}
|
||||
|
||||
// Check ABI flag consistency, for the architectures where we have proper ABI treatment.
|
||||
// To ensure targets are trated consistently, please consult with the team before allowing
|
||||
// new cases.
|
||||
match self.arch {
|
||||
Arch::X86 => {
|
||||
check!(self.llvm_abiname.is_empty(), "`llvm_abiname` is unused on x86-32");
|
||||
check!(
|
||||
self.llvm_abiname == LlvmAbi::Unspecified,
|
||||
"`llvm_abiname` is unused on x86-32"
|
||||
);
|
||||
check!(self.llvm_floatabi.is_none(), "`llvm_floatabi` is unused on x86-32");
|
||||
check_matches!(
|
||||
(&self.rustc_abi, &self.abi),
|
||||
(&self.rustc_abi, &self.cfg_abi),
|
||||
// FIXME: we do not currently set a target_abi for softfloat targets here,
|
||||
// but we probably should, so we already allow it.
|
||||
(Some(RustcAbi::Softfloat), Abi::SoftFloat | Abi::Unspecified | Abi::Other(_))
|
||||
| (
|
||||
Some(RustcAbi::X86Sse2) | None,
|
||||
Abi::Uwp | Abi::Llvm | Abi::Sim | Abi::Unspecified | Abi::Other(_)
|
||||
),
|
||||
(
|
||||
Some(RustcAbi::Softfloat),
|
||||
CfgAbi::SoftFloat | CfgAbi::Unspecified | CfgAbi::Other(_)
|
||||
) | (
|
||||
Some(RustcAbi::X86Sse2) | None,
|
||||
CfgAbi::Uwp
|
||||
| CfgAbi::Llvm
|
||||
| CfgAbi::Sim
|
||||
| CfgAbi::Unspecified
|
||||
| CfgAbi::Other(_)
|
||||
),
|
||||
"invalid x86-32 Rust-specific ABI and `cfg(target_abi)` combination:\n\
|
||||
Rust-specific ABI: {:?}\n\
|
||||
cfg(target_abi): {}",
|
||||
self.rustc_abi,
|
||||
self.abi,
|
||||
self.cfg_abi,
|
||||
);
|
||||
}
|
||||
Arch::X86_64 => {
|
||||
check!(self.llvm_abiname.is_empty(), "`llvm_abiname` is unused on x86-64");
|
||||
check!(
|
||||
self.llvm_abiname == LlvmAbi::Unspecified,
|
||||
"`llvm_abiname` is unused on x86-64"
|
||||
);
|
||||
check!(self.llvm_floatabi.is_none(), "`llvm_floatabi` is unused on x86-64");
|
||||
// FIXME: we do not currently set a target_abi for softfloat targets here, but we
|
||||
// probably should, so we already allow it.
|
||||
// FIXME: Ensure that target_abi = "x32" correlates with actually using that ABI.
|
||||
// Do any of the others need a similar check?
|
||||
check_matches!(
|
||||
(&self.rustc_abi, &self.abi),
|
||||
(Some(RustcAbi::Softfloat), Abi::SoftFloat | Abi::Unspecified | Abi::Other(_))
|
||||
| (
|
||||
None,
|
||||
Abi::X32
|
||||
| Abi::Llvm
|
||||
| Abi::Fortanix
|
||||
| Abi::Uwp
|
||||
| Abi::MacAbi
|
||||
| Abi::Sim
|
||||
| Abi::Unspecified
|
||||
| Abi::Other(_)
|
||||
),
|
||||
(&self.rustc_abi, &self.cfg_abi),
|
||||
(
|
||||
Some(RustcAbi::Softfloat),
|
||||
CfgAbi::SoftFloat | CfgAbi::Unspecified | CfgAbi::Other(_)
|
||||
) | (
|
||||
None,
|
||||
CfgAbi::X32
|
||||
| CfgAbi::Llvm
|
||||
| CfgAbi::Fortanix
|
||||
| CfgAbi::Uwp
|
||||
| CfgAbi::MacAbi
|
||||
| CfgAbi::Sim
|
||||
| CfgAbi::Unspecified
|
||||
| CfgAbi::Other(_)
|
||||
),
|
||||
"invalid x86-64 Rust-specific ABI and `cfg(target_abi)` combination:\n\
|
||||
Rust-specific ABI: {:?}\n\
|
||||
cfg(target_abi): {}",
|
||||
self.rustc_abi,
|
||||
self.abi,
|
||||
self.cfg_abi,
|
||||
);
|
||||
}
|
||||
Arch::RiscV32 => {
|
||||
check!(self.llvm_floatabi.is_none(), "`llvm_floatabi` is unused on RISC-V");
|
||||
check!(self.rustc_abi.is_none(), "`rustc_abi` is unused on RISC-V");
|
||||
check_matches!(
|
||||
(&*self.llvm_abiname, &self.abi),
|
||||
("ilp32", Abi::Unspecified | Abi::Other(_))
|
||||
| ("ilp32f", Abi::Unspecified | Abi::Other(_))
|
||||
| ("ilp32d", Abi::Unspecified | Abi::Other(_))
|
||||
| ("ilp32e", Abi::Ilp32e),
|
||||
(&self.llvm_abiname, &self.cfg_abi),
|
||||
(LlvmAbi::Ilp32, CfgAbi::Unspecified | CfgAbi::Other(_))
|
||||
| (LlvmAbi::Ilp32f, CfgAbi::Unspecified | CfgAbi::Other(_))
|
||||
| (LlvmAbi::Ilp32d, CfgAbi::Unspecified | CfgAbi::Other(_))
|
||||
| (LlvmAbi::Ilp32e, CfgAbi::Ilp32e),
|
||||
"invalid RISC-V ABI name and `cfg(target_abi)` combination:\n\
|
||||
ABI name: {}\n\
|
||||
cfg(target_abi): {}",
|
||||
self.llvm_abiname,
|
||||
self.abi,
|
||||
self.cfg_abi,
|
||||
);
|
||||
}
|
||||
Arch::RiscV64 => {
|
||||
@@ -3255,68 +3325,77 @@ macro_rules! check_matches {
|
||||
check!(self.llvm_floatabi.is_none(), "`llvm_floatabi` is unused on RISC-V");
|
||||
check!(self.rustc_abi.is_none(), "`rustc_abi` is unused on RISC-V");
|
||||
check_matches!(
|
||||
(&*self.llvm_abiname, &self.abi),
|
||||
("lp64", Abi::Unspecified | Abi::Other(_))
|
||||
| ("lp64f", Abi::Unspecified | Abi::Other(_))
|
||||
| ("lp64d", Abi::Unspecified | Abi::Other(_))
|
||||
| ("lp64e", Abi::Unspecified | Abi::Other(_)),
|
||||
(&self.llvm_abiname, &self.cfg_abi),
|
||||
(LlvmAbi::Lp64, CfgAbi::Unspecified | CfgAbi::Other(_))
|
||||
| (LlvmAbi::Lp64f, CfgAbi::Unspecified | CfgAbi::Other(_))
|
||||
| (LlvmAbi::Lp64d, CfgAbi::Unspecified | CfgAbi::Other(_))
|
||||
| (LlvmAbi::Lp64e, CfgAbi::Unspecified | CfgAbi::Other(_)),
|
||||
"invalid RISC-V ABI name and `cfg(target_abi)` combination:\n\
|
||||
ABI name: {}\n\
|
||||
cfg(target_abi): {}",
|
||||
self.llvm_abiname,
|
||||
self.abi,
|
||||
self.cfg_abi,
|
||||
);
|
||||
}
|
||||
Arch::Arm => {
|
||||
check!(self.llvm_abiname.is_empty(), "`llvm_abiname` is unused on ARM");
|
||||
check!(
|
||||
self.llvm_abiname == LlvmAbi::Unspecified,
|
||||
"`llvm_abiname` is unused on ARM"
|
||||
);
|
||||
check!(self.rustc_abi.is_none(), "`rustc_abi` is unused on ARM");
|
||||
check_matches!(
|
||||
(&self.llvm_floatabi, &self.abi),
|
||||
(&self.llvm_floatabi, &self.cfg_abi),
|
||||
(
|
||||
Some(FloatAbi::Hard),
|
||||
Abi::EabiHf | Abi::Uwp | Abi::Unspecified | Abi::Other(_)
|
||||
) | (Some(FloatAbi::Soft), Abi::Eabi),
|
||||
CfgAbi::EabiHf | CfgAbi::Uwp | CfgAbi::Unspecified | CfgAbi::Other(_)
|
||||
) | (Some(FloatAbi::Soft), CfgAbi::Eabi),
|
||||
"Invalid combination of float ABI and `cfg(target_abi)` for ARM target\n\
|
||||
float ABI: {:?}\n\
|
||||
cfg(target_abi): {}",
|
||||
self.llvm_floatabi,
|
||||
self.abi,
|
||||
self.cfg_abi,
|
||||
)
|
||||
}
|
||||
Arch::AArch64 => {
|
||||
check!(self.llvm_abiname.is_empty(), "`llvm_abiname` is unused on aarch64");
|
||||
check!(
|
||||
self.llvm_abiname == LlvmAbi::Unspecified,
|
||||
"`llvm_abiname` is unused on aarch64"
|
||||
);
|
||||
check!(self.llvm_floatabi.is_none(), "`llvm_floatabi` is unused on aarch64");
|
||||
// FIXME: Ensure that target_abi = "ilp32" correlates with actually using that ABI.
|
||||
// Do any of the others need a similar check?
|
||||
check_matches!(
|
||||
(&self.rustc_abi, &self.abi),
|
||||
(Some(RustcAbi::Softfloat), Abi::SoftFloat)
|
||||
(&self.rustc_abi, &self.cfg_abi),
|
||||
(Some(RustcAbi::Softfloat), CfgAbi::SoftFloat)
|
||||
| (
|
||||
None,
|
||||
Abi::Ilp32
|
||||
| Abi::Llvm
|
||||
| Abi::MacAbi
|
||||
| Abi::Sim
|
||||
| Abi::Uwp
|
||||
| Abi::Unspecified
|
||||
| Abi::Other(_)
|
||||
CfgAbi::Ilp32
|
||||
| CfgAbi::Llvm
|
||||
| CfgAbi::MacAbi
|
||||
| CfgAbi::Sim
|
||||
| CfgAbi::Uwp
|
||||
| CfgAbi::Unspecified
|
||||
| CfgAbi::Other(_)
|
||||
),
|
||||
"invalid aarch64 Rust-specific ABI and `cfg(target_abi)` combination:\n\
|
||||
Rust-specific ABI: {:?}\n\
|
||||
cfg(target_abi): {}",
|
||||
self.rustc_abi,
|
||||
self.abi,
|
||||
self.cfg_abi,
|
||||
);
|
||||
}
|
||||
Arch::PowerPC => {
|
||||
check!(self.llvm_abiname.is_empty(), "`llvm_abiname` is unused on PowerPC");
|
||||
check!(
|
||||
self.llvm_abiname == LlvmAbi::Unspecified,
|
||||
"`llvm_abiname` is unused on PowerPC"
|
||||
);
|
||||
check!(self.llvm_floatabi.is_none(), "`llvm_floatabi` is unused on PowerPC");
|
||||
check!(self.rustc_abi.is_none(), "`rustc_abi` is unused on PowerPC");
|
||||
// FIXME: Check that `target_abi` matches the actually configured ABI (with or
|
||||
// without SPE).
|
||||
check_matches!(
|
||||
self.abi,
|
||||
Abi::Spe | Abi::Unspecified | Abi::Other(_),
|
||||
self.cfg_abi,
|
||||
CfgAbi::Spe | CfgAbi::Unspecified | CfgAbi::Other(_),
|
||||
"invalid `target_abi` for PowerPC"
|
||||
);
|
||||
}
|
||||
@@ -3328,116 +3407,123 @@ macro_rules! check_matches {
|
||||
// FIXME: Check that `target_abi` matches the actually configured ABI
|
||||
// (vec-default vs vec-ext).
|
||||
check_matches!(
|
||||
(&*self.llvm_abiname, &self.abi),
|
||||
("", Abi::VecDefault | Abi::VecExtAbi),
|
||||
(&self.llvm_abiname, &self.cfg_abi),
|
||||
(LlvmAbi::Unspecified, CfgAbi::VecDefault | CfgAbi::VecExtAbi),
|
||||
"invalid PowerPC64 AIX ABI name and `cfg(target_abi)` combination:\n\
|
||||
ABI name: {}\n\
|
||||
cfg(target_abi): {}",
|
||||
self.llvm_abiname,
|
||||
self.abi,
|
||||
self.cfg_abi,
|
||||
);
|
||||
} else if self.endian == Endian::Big {
|
||||
check_matches!(
|
||||
(&*self.llvm_abiname, &self.abi),
|
||||
("elfv1", Abi::ElfV1) | ("elfv2", Abi::ElfV2),
|
||||
(&self.llvm_abiname, &self.cfg_abi),
|
||||
(LlvmAbi::ElfV1, CfgAbi::ElfV1) | (LlvmAbi::ElfV2, CfgAbi::ElfV2),
|
||||
"invalid PowerPC64 big-endian ABI name and `cfg(target_abi)` combination:\n\
|
||||
ABI name: {}\n\
|
||||
cfg(target_abi): {}",
|
||||
self.llvm_abiname,
|
||||
self.abi,
|
||||
self.cfg_abi,
|
||||
);
|
||||
} else {
|
||||
check_matches!(
|
||||
(&*self.llvm_abiname, &self.abi),
|
||||
("elfv2", Abi::ElfV2),
|
||||
(&self.llvm_abiname, &self.cfg_abi),
|
||||
(LlvmAbi::ElfV2, CfgAbi::ElfV2),
|
||||
"invalid PowerPC64 little-endian ABI name and `cfg(target_abi)` combination:\n\
|
||||
ABI name: {}\n\
|
||||
cfg(target_abi): {}",
|
||||
self.llvm_abiname,
|
||||
self.abi,
|
||||
self.cfg_abi,
|
||||
);
|
||||
}
|
||||
}
|
||||
Arch::S390x => {
|
||||
check!(self.llvm_abiname.is_empty(), "`llvm_abiname` is unused on s390x");
|
||||
check!(
|
||||
self.llvm_abiname == LlvmAbi::Unspecified,
|
||||
"`llvm_abiname` is unused on s390x"
|
||||
);
|
||||
check!(self.llvm_floatabi.is_none(), "`llvm_floatabi` is unused on s390x");
|
||||
check_matches!(
|
||||
(&self.rustc_abi, &self.abi),
|
||||
(Some(RustcAbi::Softfloat), Abi::SoftFloat)
|
||||
| (None, Abi::Unspecified | Abi::Other(_)),
|
||||
(&self.rustc_abi, &self.cfg_abi),
|
||||
(Some(RustcAbi::Softfloat), CfgAbi::SoftFloat)
|
||||
| (None, CfgAbi::Unspecified | CfgAbi::Other(_)),
|
||||
"invalid s390x Rust-specific ABI and `cfg(target_abi)` combination:\n\
|
||||
Rust-specific ABI: {:?}\n\
|
||||
cfg(target_abi): {}",
|
||||
self.rustc_abi,
|
||||
self.abi,
|
||||
self.cfg_abi,
|
||||
);
|
||||
}
|
||||
Arch::LoongArch32 => {
|
||||
check!(self.llvm_floatabi.is_none(), "`llvm_floatabi` is unused on LoongArch");
|
||||
check!(self.rustc_abi.is_none(), "`rustc_abi` is unused on LoongArch");
|
||||
check_matches!(
|
||||
(&*self.llvm_abiname, &self.abi),
|
||||
("ilp32s", Abi::SoftFloat)
|
||||
| ("ilp32f", Abi::Unspecified | Abi::Other(_))
|
||||
| ("ilp32d", Abi::Unspecified | Abi::Other(_)),
|
||||
(&self.llvm_abiname, &self.cfg_abi),
|
||||
(LlvmAbi::Ilp32s, CfgAbi::SoftFloat)
|
||||
| (LlvmAbi::Ilp32f, CfgAbi::Unspecified | CfgAbi::Other(_))
|
||||
| (LlvmAbi::Ilp32d, CfgAbi::Unspecified | CfgAbi::Other(_)),
|
||||
"invalid LoongArch ABI name and `cfg(target_abi)` combination:\n\
|
||||
ABI name: {}\n\
|
||||
cfg(target_abi): {}",
|
||||
self.llvm_abiname,
|
||||
self.abi,
|
||||
self.cfg_abi,
|
||||
);
|
||||
}
|
||||
Arch::LoongArch64 => {
|
||||
check!(self.llvm_floatabi.is_none(), "`llvm_floatabi` is unused on LoongArch");
|
||||
check!(self.rustc_abi.is_none(), "`rustc_abi` is unused on LoongArch");
|
||||
check_matches!(
|
||||
(&*self.llvm_abiname, &self.abi),
|
||||
("lp64s", Abi::SoftFloat)
|
||||
| ("lp64f", Abi::Unspecified | Abi::Other(_))
|
||||
| ("lp64d", Abi::Unspecified | Abi::Other(_)),
|
||||
(&self.llvm_abiname, &self.cfg_abi),
|
||||
(LlvmAbi::Lp64s, CfgAbi::SoftFloat)
|
||||
| (LlvmAbi::Lp64f, CfgAbi::Unspecified | CfgAbi::Other(_))
|
||||
| (LlvmAbi::Lp64d, CfgAbi::Unspecified | CfgAbi::Other(_)),
|
||||
"invalid LoongArch ABI name and `cfg(target_abi)` combination:\n\
|
||||
ABI name: {}\n\
|
||||
cfg(target_abi): {}",
|
||||
self.llvm_abiname,
|
||||
self.abi,
|
||||
self.cfg_abi,
|
||||
);
|
||||
}
|
||||
Arch::Mips | Arch::Mips32r6 => {
|
||||
check!(self.llvm_floatabi.is_none(), "`llvm_floatabi` is unused on MIPS");
|
||||
check!(self.rustc_abi.is_none(), "`rustc_abi` is unused on MIPS");
|
||||
check_matches!(
|
||||
(&*self.llvm_abiname, &self.abi),
|
||||
("o32", Abi::Unspecified | Abi::Other(_)),
|
||||
(&self.llvm_abiname, &self.cfg_abi),
|
||||
(LlvmAbi::O32, CfgAbi::Unspecified | CfgAbi::Other(_)),
|
||||
"invalid MIPS ABI name and `cfg(target_abi)` combination:\n\
|
||||
ABI name: {}\n\
|
||||
cfg(target_abi): {}",
|
||||
self.llvm_abiname,
|
||||
self.abi,
|
||||
self.cfg_abi,
|
||||
);
|
||||
}
|
||||
Arch::Mips64 | Arch::Mips64r6 => {
|
||||
check!(self.llvm_floatabi.is_none(), "`llvm_floatabi` is unused on MIPS");
|
||||
check!(self.rustc_abi.is_none(), "`rustc_abi` is unused on MIPS");
|
||||
check_matches!(
|
||||
(&*self.llvm_abiname, &self.abi),
|
||||
(&self.llvm_abiname, &self.cfg_abi),
|
||||
// No in-tree targets use "n32" but at least for now we let out-of-tree targets
|
||||
// experiment with that.
|
||||
("n64", Abi::Abi64) | ("n32", Abi::Unspecified | Abi::Other(_)),
|
||||
(LlvmAbi::N64, CfgAbi::Abi64)
|
||||
| (LlvmAbi::N32, CfgAbi::Unspecified | CfgAbi::Other(_)),
|
||||
"invalid MIPS ABI name and `cfg(target_abi)` combination:\n\
|
||||
ABI name: {}\n\
|
||||
cfg(target_abi): {}",
|
||||
self.llvm_abiname,
|
||||
self.abi,
|
||||
self.cfg_abi,
|
||||
);
|
||||
}
|
||||
Arch::CSky => {
|
||||
check!(self.llvm_abiname.is_empty(), "`llvm_abiname` is unused on CSky");
|
||||
check!(
|
||||
self.llvm_abiname == LlvmAbi::Unspecified,
|
||||
"`llvm_abiname` is unused on CSky"
|
||||
);
|
||||
check!(self.llvm_floatabi.is_none(), "`llvm_floatabi` is unused on CSky");
|
||||
check!(self.rustc_abi.is_none(), "`rustc_abi` is unused on CSky");
|
||||
// FIXME: Check that `target_abi` matches the actually configured ABI (v2 vs v2hf).
|
||||
check_matches!(
|
||||
self.abi,
|
||||
Abi::AbiV2 | Abi::AbiV2Hf,
|
||||
self.cfg_abi,
|
||||
CfgAbi::AbiV2 | CfgAbi::AbiV2Hf,
|
||||
"invalid `target_abi` for CSky"
|
||||
);
|
||||
}
|
||||
@@ -3446,11 +3532,14 @@ macro_rules! check_matches {
|
||||
// Ensure consistency among built-in targets, but give JSON targets the opportunity
|
||||
// to experiment with these.
|
||||
if kind == TargetKind::Builtin {
|
||||
check!(self.llvm_abiname.is_empty(), "`llvm_abiname` is unused on {arch}");
|
||||
check!(
|
||||
self.llvm_abiname == LlvmAbi::Unspecified,
|
||||
"`llvm_abiname` is unused on {arch}"
|
||||
);
|
||||
check!(self.llvm_floatabi.is_none(), "`llvm_floatabi` is unused on {arch}");
|
||||
check_matches!(
|
||||
self.abi,
|
||||
Abi::Unspecified | Abi::Other(_),
|
||||
self.cfg_abi,
|
||||
CfgAbi::Unspecified | CfgAbi::Other(_),
|
||||
"`target_abi` is unused on {arch}"
|
||||
);
|
||||
}
|
||||
@@ -3665,7 +3754,7 @@ pub fn object_architecture(
|
||||
// it using a custom target specification. N32
|
||||
// is an ILP32 ABI like the Aarch64_Ilp32
|
||||
// and X86_64_X32 cases above and below this one.
|
||||
if self.options.llvm_abiname.as_ref() == "n32" {
|
||||
if self.options.llvm_abiname == LlvmAbi::N32 {
|
||||
Architecture::Mips64_N32
|
||||
} else {
|
||||
Architecture::Mips64
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use rustc_abi::Endian;
|
||||
|
||||
use crate::spec::{
|
||||
Abi, Arch, FramePointer, StackProbeType, Target, TargetMetadata, TargetOptions, base,
|
||||
Arch, CfgAbi, FramePointer, StackProbeType, Target, TargetMetadata, TargetOptions, base,
|
||||
};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
@@ -20,7 +20,7 @@ pub(crate) fn target() -> Target {
|
||||
data_layout: "E-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32".into(),
|
||||
arch: Arch::AArch64,
|
||||
options: TargetOptions {
|
||||
abi: Abi::Ilp32,
|
||||
cfg_abi: CfgAbi::Ilp32,
|
||||
features: "+v8a,+outline-atomics".into(),
|
||||
// the AAPCS64 expects use of non-leaf frame pointers per
|
||||
// https://github.com/ARM-software/abi-aa/blob/4492d1570eb70c8fd146623e0db65b2d241f12e7/aapcs64/aapcs64.rst#the-frame-pointer
|
||||
|
||||
@@ -8,13 +8,13 @@
|
||||
use rustc_abi::Endian;
|
||||
|
||||
use crate::spec::{
|
||||
Abi, Arch, Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, RustcAbi, SanitizerSet,
|
||||
Arch, Cc, CfgAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, RustcAbi, SanitizerSet,
|
||||
StackProbeType, Target, TargetMetadata, TargetOptions,
|
||||
};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
let opts = TargetOptions {
|
||||
abi: Abi::SoftFloat,
|
||||
cfg_abi: CfgAbi::SoftFloat,
|
||||
rustc_abi: Some(RustcAbi::Softfloat),
|
||||
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
|
||||
linker: Some("rust-lld".into()),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use crate::spec::{
|
||||
Abi, Arch, FramePointer, StackProbeType, Target, TargetMetadata, TargetOptions, base,
|
||||
Arch, CfgAbi, FramePointer, StackProbeType, Target, TargetMetadata, TargetOptions, base,
|
||||
};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
@@ -15,7 +15,7 @@ pub(crate) fn target() -> Target {
|
||||
data_layout: "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128-Fn32".into(),
|
||||
arch: Arch::AArch64,
|
||||
options: TargetOptions {
|
||||
abi: Abi::Ilp32,
|
||||
cfg_abi: CfgAbi::Ilp32,
|
||||
features: "+v8a,+outline-atomics".into(),
|
||||
// the AAPCS64 expects use of non-leaf frame pointers per
|
||||
// https://github.com/ARM-software/abi-aa/blob/4492d1570eb70c8fd146623e0db65b2d241f12e7/aapcs64/aapcs64.rst#the-frame-pointer
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
// For example, `-C target-cpu=cortex-a53`.
|
||||
|
||||
use crate::spec::{
|
||||
Abi, Arch, Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, RustcAbi, SanitizerSet,
|
||||
Arch, Cc, CfgAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, RustcAbi, SanitizerSet,
|
||||
StackProbeType, Target, TargetMetadata, TargetOptions,
|
||||
};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
let opts = TargetOptions {
|
||||
abi: Abi::SoftFloat,
|
||||
cfg_abi: CfgAbi::SoftFloat,
|
||||
rustc_abi: Some(RustcAbi::Softfloat),
|
||||
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
|
||||
linker: Some("rust-lld".into()),
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
use crate::spec::{
|
||||
Abi, Arch, Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, RustcAbi, SanitizerSet,
|
||||
Arch, Cc, CfgAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, RustcAbi, SanitizerSet,
|
||||
StackProbeType, Target, TargetMetadata, TargetOptions,
|
||||
};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
let opts = TargetOptions {
|
||||
abi: Abi::SoftFloat,
|
||||
cfg_abi: CfgAbi::SoftFloat,
|
||||
rustc_abi: Some(RustcAbi::Softfloat),
|
||||
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
|
||||
linker: Some("rust-lld".into()),
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
use crate::spec::{Abi, Arch, FloatAbi, SanitizerSet, Target, TargetMetadata, TargetOptions, base};
|
||||
use crate::spec::{
|
||||
Arch, CfgAbi, FloatAbi, SanitizerSet, Target, TargetMetadata, TargetOptions, base,
|
||||
};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
Target {
|
||||
@@ -13,7 +15,7 @@ pub(crate) fn target() -> Target {
|
||||
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
|
||||
arch: Arch::Arm,
|
||||
options: TargetOptions {
|
||||
abi: Abi::Eabi,
|
||||
cfg_abi: CfgAbi::Eabi,
|
||||
llvm_floatabi: Some(FloatAbi::Soft),
|
||||
// https://developer.android.com/ndk/guides/abis.html#armeabi
|
||||
features: "+strict-align,+v5te".into(),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
|
||||
use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
Target {
|
||||
@@ -13,7 +13,7 @@ pub(crate) fn target() -> Target {
|
||||
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
|
||||
arch: Arch::Arm,
|
||||
options: TargetOptions {
|
||||
abi: Abi::Eabi,
|
||||
cfg_abi: CfgAbi::Eabi,
|
||||
llvm_floatabi: Some(FloatAbi::Soft),
|
||||
features: "+strict-align,+v6".into(),
|
||||
max_atomic_width: Some(64),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
|
||||
use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
Target {
|
||||
@@ -13,7 +13,7 @@ pub(crate) fn target() -> Target {
|
||||
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
|
||||
arch: Arch::Arm,
|
||||
options: TargetOptions {
|
||||
abi: Abi::EabiHf,
|
||||
cfg_abi: CfgAbi::EabiHf,
|
||||
llvm_floatabi: Some(FloatAbi::Hard),
|
||||
features: "+strict-align,+v6,+vfp2".into(),
|
||||
max_atomic_width: Some(64),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
|
||||
use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
Target {
|
||||
@@ -13,7 +13,7 @@ pub(crate) fn target() -> Target {
|
||||
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
|
||||
arch: Arch::Arm,
|
||||
options: TargetOptions {
|
||||
abi: Abi::Eabi,
|
||||
cfg_abi: CfgAbi::Eabi,
|
||||
llvm_floatabi: Some(FloatAbi::Soft),
|
||||
// Most of these settings are copied from the arm_unknown_linux_gnueabi
|
||||
// target.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
|
||||
use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
Target {
|
||||
@@ -13,7 +13,7 @@ pub(crate) fn target() -> Target {
|
||||
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
|
||||
arch: Arch::Arm,
|
||||
options: TargetOptions {
|
||||
abi: Abi::EabiHf,
|
||||
cfg_abi: CfgAbi::EabiHf,
|
||||
llvm_floatabi: Some(FloatAbi::Hard),
|
||||
// Most of these settings are copied from the arm_unknown_linux_gnueabihf
|
||||
// target.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use rustc_abi::Endian;
|
||||
|
||||
use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
|
||||
use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
Target {
|
||||
@@ -15,7 +15,7 @@ pub(crate) fn target() -> Target {
|
||||
data_layout: "E-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
|
||||
arch: Arch::Arm,
|
||||
options: TargetOptions {
|
||||
abi: Abi::Eabi,
|
||||
cfg_abi: CfgAbi::Eabi,
|
||||
llvm_floatabi: Some(FloatAbi::Soft),
|
||||
features: "+strict-align,+v8,+crc".into(),
|
||||
endian: Endian::Big,
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
use rustc_abi::Endian;
|
||||
|
||||
use crate::spec::{
|
||||
Abi, Arch, Cc, FloatAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata,
|
||||
TargetOptions,
|
||||
Arch, Cc, CfgAbi, FloatAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target,
|
||||
TargetMetadata, TargetOptions,
|
||||
};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
@@ -20,7 +20,7 @@ pub(crate) fn target() -> Target {
|
||||
data_layout: "E-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
|
||||
arch: Arch::Arm,
|
||||
options: TargetOptions {
|
||||
abi: Abi::Eabi,
|
||||
cfg_abi: CfgAbi::Eabi,
|
||||
llvm_floatabi: Some(FloatAbi::Soft),
|
||||
endian: Endian::Big,
|
||||
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
use rustc_abi::Endian;
|
||||
|
||||
use crate::spec::{
|
||||
Abi, Arch, Cc, FloatAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata,
|
||||
TargetOptions,
|
||||
Arch, Cc, CfgAbi, FloatAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target,
|
||||
TargetMetadata, TargetOptions,
|
||||
};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
@@ -20,7 +20,7 @@ pub(crate) fn target() -> Target {
|
||||
data_layout: "E-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
|
||||
arch: Arch::Arm,
|
||||
options: TargetOptions {
|
||||
abi: Abi::EabiHf,
|
||||
cfg_abi: CfgAbi::EabiHf,
|
||||
llvm_floatabi: Some(FloatAbi::Hard),
|
||||
endian: Endian::Big,
|
||||
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
//! The default link script is very likely wrong, so you should use
|
||||
//! `-Clink-arg=-Tmy_script.ld` to override that with a correct linker script.
|
||||
|
||||
use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base, cvs};
|
||||
use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base, cvs};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
Target {
|
||||
@@ -24,7 +24,7 @@ pub(crate) fn target() -> Target {
|
||||
arch: Arch::Arm,
|
||||
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
|
||||
options: TargetOptions {
|
||||
abi: Abi::Eabi,
|
||||
cfg_abi: CfgAbi::Eabi,
|
||||
llvm_floatabi: Some(FloatAbi::Soft),
|
||||
asm_args: cvs!["-mthumb-interwork", "-march=armv4t", "-mlittle-endian",],
|
||||
features: "+soft-float,+strict-align".into(),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
|
||||
use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
Target {
|
||||
@@ -13,7 +13,7 @@ pub(crate) fn target() -> Target {
|
||||
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
|
||||
arch: Arch::Arm,
|
||||
options: TargetOptions {
|
||||
abi: Abi::Eabi,
|
||||
cfg_abi: CfgAbi::Eabi,
|
||||
llvm_floatabi: Some(FloatAbi::Soft),
|
||||
features: "+soft-float,+strict-align".into(),
|
||||
// Atomic operations provided by compiler-builtins
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//! Targets the ARMv5TE architecture, with `a32` code by default.
|
||||
|
||||
use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base, cvs};
|
||||
use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base, cvs};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
Target {
|
||||
@@ -15,7 +15,7 @@ pub(crate) fn target() -> Target {
|
||||
arch: Arch::Arm,
|
||||
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
|
||||
options: TargetOptions {
|
||||
abi: Abi::Eabi,
|
||||
cfg_abi: CfgAbi::Eabi,
|
||||
llvm_floatabi: Some(FloatAbi::Soft),
|
||||
asm_args: cvs!["-mthumb-interwork", "-march=armv5te", "-mlittle-endian",],
|
||||
features: "+soft-float,+strict-align".into(),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
|
||||
use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
Target {
|
||||
@@ -13,7 +13,7 @@ pub(crate) fn target() -> Target {
|
||||
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
|
||||
arch: Arch::Arm,
|
||||
options: TargetOptions {
|
||||
abi: Abi::Eabi,
|
||||
cfg_abi: CfgAbi::Eabi,
|
||||
llvm_floatabi: Some(FloatAbi::Soft),
|
||||
features: "+soft-float,+strict-align".into(),
|
||||
// Atomic operations provided by compiler-builtins
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
|
||||
use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
Target {
|
||||
@@ -13,7 +13,7 @@ pub(crate) fn target() -> Target {
|
||||
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
|
||||
arch: Arch::Arm,
|
||||
options: TargetOptions {
|
||||
abi: Abi::Eabi,
|
||||
cfg_abi: CfgAbi::Eabi,
|
||||
llvm_floatabi: Some(FloatAbi::Soft),
|
||||
features: "+soft-float,+strict-align".into(),
|
||||
// Atomic operations provided by compiler-builtins
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
|
||||
use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
Target {
|
||||
@@ -13,7 +13,7 @@ pub(crate) fn target() -> Target {
|
||||
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
|
||||
arch: Arch::Arm,
|
||||
options: TargetOptions {
|
||||
abi: Abi::Eabi,
|
||||
cfg_abi: CfgAbi::Eabi,
|
||||
llvm_floatabi: Some(FloatAbi::Soft),
|
||||
features: "+soft-float,+strict-align".into(),
|
||||
// Atomic operations provided by compiler-builtins
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//! Targets the ARMv6K architecture, with `a32` code by default.
|
||||
|
||||
use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base, cvs};
|
||||
use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base, cvs};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
Target {
|
||||
@@ -15,7 +15,7 @@ pub(crate) fn target() -> Target {
|
||||
arch: Arch::Arm,
|
||||
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
|
||||
options: TargetOptions {
|
||||
abi: Abi::Eabi,
|
||||
cfg_abi: CfgAbi::Eabi,
|
||||
llvm_floatabi: Some(FloatAbi::Soft),
|
||||
asm_args: cvs!["-mthumb-interwork", "-march=armv6", "-mlittle-endian",],
|
||||
features: "+soft-float,+strict-align,+v6k".into(),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//! Targets the ARMv6K architecture, with `a32` code by default, and hard-float ABI
|
||||
|
||||
use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base, cvs};
|
||||
use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base, cvs};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
Target {
|
||||
@@ -15,7 +15,7 @@ pub(crate) fn target() -> Target {
|
||||
arch: Arch::Arm,
|
||||
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
|
||||
options: TargetOptions {
|
||||
abi: Abi::EabiHf,
|
||||
cfg_abi: CfgAbi::EabiHf,
|
||||
llvm_floatabi: Some(FloatAbi::Hard),
|
||||
asm_args: cvs!["-mthumb-interwork", "-march=armv6", "-mlittle-endian",],
|
||||
features: "+strict-align,+v6k,+vfp2,-d32".into(),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
|
||||
use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
Target {
|
||||
@@ -13,7 +13,7 @@ pub(crate) fn target() -> Target {
|
||||
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
|
||||
arch: Arch::Arm,
|
||||
options: TargetOptions {
|
||||
abi: Abi::EabiHf,
|
||||
cfg_abi: CfgAbi::EabiHf,
|
||||
llvm_floatabi: Some(FloatAbi::Hard),
|
||||
features: "+v6,+vfp2".into(),
|
||||
max_atomic_width: Some(64),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
|
||||
use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
Target {
|
||||
@@ -13,7 +13,7 @@ pub(crate) fn target() -> Target {
|
||||
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
|
||||
arch: Arch::Arm,
|
||||
options: TargetOptions {
|
||||
abi: Abi::EabiHf,
|
||||
cfg_abi: CfgAbi::EabiHf,
|
||||
llvm_floatabi: Some(FloatAbi::Hard),
|
||||
features: "+v6,+vfp2".into(),
|
||||
max_atomic_width: Some(64),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use crate::spec::{
|
||||
Abi, Arch, Cc, Env, FloatAbi, LinkerFlavor, Lld, Os, RelocModel, Target, TargetMetadata,
|
||||
Arch, Cc, CfgAbi, Env, FloatAbi, LinkerFlavor, Lld, Os, RelocModel, Target, TargetMetadata,
|
||||
TargetOptions, cvs,
|
||||
};
|
||||
|
||||
@@ -29,7 +29,7 @@ pub(crate) fn target() -> Target {
|
||||
env: Env::Newlib,
|
||||
vendor: "nintendo".into(),
|
||||
cpu: "mpcore".into(),
|
||||
abi: Abi::EabiHf,
|
||||
cfg_abi: CfgAbi::EabiHf,
|
||||
llvm_floatabi: Some(FloatAbi::Hard),
|
||||
families: cvs!["unix"],
|
||||
linker: Some("arm-none-eabi-gcc".into()),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use crate::spec::{
|
||||
Abi, Arch, Cc, FloatAbi, LinkerFlavor, Lld, SanitizerSet, Target, TargetMetadata,
|
||||
Arch, Cc, CfgAbi, FloatAbi, LinkerFlavor, Lld, SanitizerSet, Target, TargetMetadata,
|
||||
TargetOptions, base,
|
||||
};
|
||||
|
||||
@@ -26,7 +26,7 @@ pub(crate) fn target() -> Target {
|
||||
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
|
||||
arch: Arch::Arm,
|
||||
options: TargetOptions {
|
||||
abi: Abi::Eabi,
|
||||
cfg_abi: CfgAbi::Eabi,
|
||||
llvm_floatabi: Some(FloatAbi::Soft),
|
||||
features: "+v7,+thumb-mode,+thumb2,+vfp3d16,-neon".into(),
|
||||
supported_sanitizers: SanitizerSet::ADDRESS,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use crate::spec::{
|
||||
Abi, Arch, Cc, Env, FloatAbi, LinkerFlavor, Lld, Os, PanicStrategy, RelocModel, Target,
|
||||
Arch, Cc, CfgAbi, Env, FloatAbi, LinkerFlavor, Lld, Os, PanicStrategy, RelocModel, Target,
|
||||
TargetMetadata, TargetOptions, cvs,
|
||||
};
|
||||
|
||||
@@ -19,7 +19,7 @@ pub(crate) fn target() -> Target {
|
||||
options: TargetOptions {
|
||||
os: Os::Rtems,
|
||||
families: cvs!["unix"],
|
||||
abi: Abi::EabiHf,
|
||||
cfg_abi: CfgAbi::EabiHf,
|
||||
llvm_floatabi: Some(FloatAbi::Hard),
|
||||
linker_flavor: LinkerFlavor::Gnu(Cc::Yes, Lld::No),
|
||||
linker: None,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use rustc_abi::Endian;
|
||||
|
||||
use crate::spec::{
|
||||
Abi, Arch, Cc, Env, FloatAbi, LinkerFlavor, Lld, Os, RelocModel, Target, TargetMetadata,
|
||||
Arch, Cc, CfgAbi, Env, FloatAbi, LinkerFlavor, Lld, Os, RelocModel, Target, TargetMetadata,
|
||||
TargetOptions, cvs,
|
||||
};
|
||||
|
||||
@@ -34,7 +34,7 @@ pub(crate) fn target() -> Target {
|
||||
c_int_width: 32,
|
||||
env: Env::Newlib,
|
||||
vendor: "sony".into(),
|
||||
abi: Abi::EabiHf,
|
||||
cfg_abi: CfgAbi::EabiHf,
|
||||
llvm_floatabi: Some(FloatAbi::Hard),
|
||||
linker_flavor: LinkerFlavor::Gnu(Cc::Yes, Lld::No),
|
||||
no_default_libraries: false,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
|
||||
use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
Target {
|
||||
@@ -13,7 +13,7 @@ pub(crate) fn target() -> Target {
|
||||
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
|
||||
arch: Arch::Arm,
|
||||
options: TargetOptions {
|
||||
abi: Abi::EabiHf,
|
||||
cfg_abi: CfgAbi::EabiHf,
|
||||
llvm_floatabi: Some(FloatAbi::Hard),
|
||||
features: "+v7,+vfp3d16,+thumb2,-neon".into(),
|
||||
max_atomic_width: Some(64),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
|
||||
use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base};
|
||||
|
||||
// This target is for glibc Linux on ARMv7 without thumb-mode, NEON or
|
||||
// hardfloat.
|
||||
@@ -16,7 +16,7 @@ pub(crate) fn target() -> Target {
|
||||
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
|
||||
arch: Arch::Arm,
|
||||
options: TargetOptions {
|
||||
abi: Abi::Eabi,
|
||||
cfg_abi: CfgAbi::Eabi,
|
||||
llvm_floatabi: Some(FloatAbi::Soft),
|
||||
features: "+v7,+thumb2,+soft-float,-neon".into(),
|
||||
max_atomic_width: Some(64),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
|
||||
use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base};
|
||||
|
||||
// This target is for glibc Linux on ARMv7 without NEON or
|
||||
// thumb-mode. See the thumbv7neon variant for enabling both.
|
||||
@@ -16,7 +16,7 @@ pub(crate) fn target() -> Target {
|
||||
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
|
||||
arch: Arch::Arm,
|
||||
options: TargetOptions {
|
||||
abi: Abi::EabiHf,
|
||||
cfg_abi: CfgAbi::EabiHf,
|
||||
llvm_floatabi: Some(FloatAbi::Hard),
|
||||
// Info about features at https://wiki.debian.org/ArmHardFloatPort
|
||||
features: "+v7,+vfp3d16,+thumb2,-neon".into(),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
|
||||
use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base};
|
||||
|
||||
// This target is for musl Linux on ARMv7 without thumb-mode, NEON or
|
||||
// hardfloat.
|
||||
@@ -19,7 +19,7 @@ pub(crate) fn target() -> Target {
|
||||
arch: Arch::Arm,
|
||||
|
||||
options: TargetOptions {
|
||||
abi: Abi::Eabi,
|
||||
cfg_abi: CfgAbi::Eabi,
|
||||
llvm_floatabi: Some(FloatAbi::Soft),
|
||||
features: "+v7,+thumb2,+soft-float,-neon".into(),
|
||||
max_atomic_width: Some(64),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
|
||||
use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base};
|
||||
|
||||
// This target is for musl Linux on ARMv7 without thumb-mode or NEON.
|
||||
|
||||
@@ -18,7 +18,7 @@ pub(crate) fn target() -> Target {
|
||||
// Most of these settings are copied from the armv7_unknown_linux_gnueabihf
|
||||
// target.
|
||||
options: TargetOptions {
|
||||
abi: Abi::EabiHf,
|
||||
cfg_abi: CfgAbi::EabiHf,
|
||||
llvm_floatabi: Some(FloatAbi::Hard),
|
||||
features: "+v7,+vfp3d16,+thumb2,-neon".into(),
|
||||
max_atomic_width: Some(64),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
|
||||
use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base};
|
||||
|
||||
// This target is for OpenHarmony on ARMv7 Linux with thumb-mode, but no NEON or
|
||||
// hardfloat.
|
||||
@@ -19,7 +19,7 @@ pub(crate) fn target() -> Target {
|
||||
arch: Arch::Arm,
|
||||
|
||||
options: TargetOptions {
|
||||
abi: Abi::Eabi,
|
||||
cfg_abi: CfgAbi::Eabi,
|
||||
llvm_floatabi: Some(FloatAbi::Soft),
|
||||
features: "+v7,+thumb2,+soft-float,-neon".into(),
|
||||
max_atomic_width: Some(64),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
|
||||
use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base};
|
||||
|
||||
// This target is for uclibc Linux on ARMv7 without NEON,
|
||||
// thumb-mode or hardfloat.
|
||||
@@ -18,7 +18,7 @@ pub(crate) fn target() -> Target {
|
||||
arch: Arch::Arm,
|
||||
|
||||
options: TargetOptions {
|
||||
abi: Abi::Eabi,
|
||||
cfg_abi: CfgAbi::Eabi,
|
||||
llvm_floatabi: Some(FloatAbi::Soft),
|
||||
features: "+v7,+thumb2,+soft-float,-neon".into(),
|
||||
cpu: "generic".into(),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
|
||||
use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base};
|
||||
|
||||
// This target is for uclibc Linux on ARMv7 without NEON or
|
||||
// thumb-mode. See the thumbv7neon variant for enabling both.
|
||||
@@ -23,7 +23,7 @@ pub(crate) fn target() -> Target {
|
||||
cpu: "generic".into(),
|
||||
max_atomic_width: Some(64),
|
||||
mcount: "_mcount".into(),
|
||||
abi: Abi::EabiHf,
|
||||
cfg_abi: CfgAbi::EabiHf,
|
||||
llvm_floatabi: Some(FloatAbi::Hard),
|
||||
..base
|
||||
},
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
|
||||
use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
Target {
|
||||
@@ -13,7 +13,7 @@ pub(crate) fn target() -> Target {
|
||||
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
|
||||
arch: Arch::Arm,
|
||||
options: TargetOptions {
|
||||
abi: Abi::EabiHf,
|
||||
cfg_abi: CfgAbi::EabiHf,
|
||||
llvm_floatabi: Some(FloatAbi::Hard),
|
||||
features: "+v7,+vfp3d16,+thumb2,-neon".into(),
|
||||
max_atomic_width: Some(64),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use crate::spec::{
|
||||
Abi, Arch, FloatAbi, LinkSelfContainedDefault, Os, PanicStrategy, RelroLevel, Target,
|
||||
Arch, CfgAbi, FloatAbi, LinkSelfContainedDefault, Os, PanicStrategy, RelroLevel, Target,
|
||||
TargetMetadata, TargetOptions,
|
||||
};
|
||||
|
||||
@@ -19,7 +19,7 @@ pub(crate) fn target() -> Target {
|
||||
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
|
||||
arch: Arch::Arm,
|
||||
options: TargetOptions {
|
||||
abi: Abi::Eabi,
|
||||
cfg_abi: CfgAbi::Eabi,
|
||||
llvm_floatabi: Some(FloatAbi::Soft),
|
||||
features: "+v7,+thumb2,+soft-float,-neon".into(),
|
||||
max_atomic_width: Some(64),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
|
||||
use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
Target {
|
||||
@@ -13,7 +13,7 @@ pub(crate) fn target() -> Target {
|
||||
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
|
||||
arch: Arch::Arm,
|
||||
options: TargetOptions {
|
||||
abi: Abi::EabiHf,
|
||||
cfg_abi: CfgAbi::EabiHf,
|
||||
llvm_floatabi: Some(FloatAbi::Hard),
|
||||
// Info about features at https://wiki.debian.org/ArmHardFloatPort
|
||||
features: "+v7,+vfp3d16,+thumb2,-neon".into(),
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
use crate::spec::{Abi, Arch, FloatAbi, RelocModel, Target, TargetMetadata, TargetOptions, base};
|
||||
use crate::spec::{
|
||||
Arch, CfgAbi, FloatAbi, RelocModel, Target, TargetMetadata, TargetOptions, base,
|
||||
};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
let base = base::solid::opts();
|
||||
@@ -14,7 +16,7 @@ pub(crate) fn target() -> Target {
|
||||
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
|
||||
arch: Arch::Arm,
|
||||
options: TargetOptions {
|
||||
abi: Abi::Eabi,
|
||||
cfg_abi: CfgAbi::Eabi,
|
||||
llvm_floatabi: Some(FloatAbi::Soft),
|
||||
linker: Some("arm-kmc-eabi-gcc".into()),
|
||||
features: "+v7,+soft-float,+thumb2,-neon".into(),
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
use crate::spec::{Abi, Arch, FloatAbi, RelocModel, Target, TargetMetadata, TargetOptions, base};
|
||||
use crate::spec::{
|
||||
Arch, CfgAbi, FloatAbi, RelocModel, Target, TargetMetadata, TargetOptions, base,
|
||||
};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
let base = base::solid::opts();
|
||||
@@ -14,7 +16,7 @@ pub(crate) fn target() -> Target {
|
||||
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
|
||||
arch: Arch::Arm,
|
||||
options: TargetOptions {
|
||||
abi: Abi::EabiHf,
|
||||
cfg_abi: CfgAbi::EabiHf,
|
||||
llvm_floatabi: Some(FloatAbi::Hard),
|
||||
linker: Some("arm-kmc-eabi-gcc".into()),
|
||||
features: "+v7,+vfp3d16,+thumb2,-neon".into(),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Targets the Little-endian Cortex-A8 (and similar) processors (ARMv7-A)
|
||||
|
||||
use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
|
||||
use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
Target {
|
||||
@@ -15,7 +15,7 @@ pub(crate) fn target() -> Target {
|
||||
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
|
||||
arch: Arch::Arm,
|
||||
options: TargetOptions {
|
||||
abi: Abi::Eabi,
|
||||
cfg_abi: CfgAbi::Eabi,
|
||||
llvm_floatabi: Some(FloatAbi::Soft),
|
||||
features: "+soft-float,-neon,+strict-align".into(),
|
||||
max_atomic_width: Some(64),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Targets the Little-endian Cortex-A8 (and similar) processors (ARMv7-A)
|
||||
|
||||
use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
|
||||
use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
Target {
|
||||
@@ -15,7 +15,7 @@ pub(crate) fn target() -> Target {
|
||||
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
|
||||
arch: Arch::Arm,
|
||||
options: TargetOptions {
|
||||
abi: Abi::EabiHf,
|
||||
cfg_abi: CfgAbi::EabiHf,
|
||||
llvm_floatabi: Some(FloatAbi::Hard),
|
||||
features: "+vfp3d16,-neon,+strict-align".into(),
|
||||
max_atomic_width: Some(64),
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
// configuration without hardware floating point support.
|
||||
|
||||
use crate::spec::{
|
||||
Abi, Arch, Cc, FloatAbi, LinkerFlavor, Lld, Os, PanicStrategy, RelocModel, Target,
|
||||
Arch, Cc, CfgAbi, FloatAbi, LinkerFlavor, Lld, Os, PanicStrategy, RelocModel, Target,
|
||||
TargetMetadata, TargetOptions, cvs,
|
||||
};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
let opts = TargetOptions {
|
||||
abi: Abi::Eabi,
|
||||
cfg_abi: CfgAbi::Eabi,
|
||||
llvm_floatabi: Some(FloatAbi::Soft),
|
||||
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
|
||||
linker: Some("rust-lld".into()),
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
// configuration with hardware floating point support.
|
||||
|
||||
use crate::spec::{
|
||||
Abi, Arch, Cc, FloatAbi, LinkerFlavor, Lld, Os, PanicStrategy, RelocModel, Target,
|
||||
Arch, Cc, CfgAbi, FloatAbi, LinkerFlavor, Lld, Os, PanicStrategy, RelocModel, Target,
|
||||
TargetMetadata, TargetOptions, cvs,
|
||||
};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
let opts = TargetOptions {
|
||||
abi: Abi::EabiHf,
|
||||
cfg_abi: CfgAbi::EabiHf,
|
||||
llvm_floatabi: Some(FloatAbi::Hard),
|
||||
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
|
||||
linker: Some("rust-lld".into()),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use crate::spec::{
|
||||
Abi, Arch, Cc, Env, FloatAbi, LinkerFlavor, Lld, Os, PanicStrategy, RelocModel, Target,
|
||||
Arch, Cc, CfgAbi, Env, FloatAbi, LinkerFlavor, Lld, Os, PanicStrategy, RelocModel, Target,
|
||||
TargetMetadata, TargetOptions,
|
||||
};
|
||||
|
||||
@@ -11,7 +11,7 @@ pub(crate) fn target() -> Target {
|
||||
env: Env::V5,
|
||||
os: Os::VexOs,
|
||||
cpu: "cortex-a9".into(),
|
||||
abi: Abi::EabiHf,
|
||||
cfg_abi: CfgAbi::EabiHf,
|
||||
is_like_vexos: true,
|
||||
llvm_floatabi: Some(FloatAbi::Hard),
|
||||
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Targets the Little-endian Cortex-R4/R5 processor (ARMv7-R)
|
||||
|
||||
use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
|
||||
use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
Target {
|
||||
@@ -15,7 +15,7 @@ pub(crate) fn target() -> Target {
|
||||
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
|
||||
arch: Arch::Arm,
|
||||
options: TargetOptions {
|
||||
abi: Abi::Eabi,
|
||||
cfg_abi: CfgAbi::Eabi,
|
||||
llvm_floatabi: Some(FloatAbi::Soft),
|
||||
max_atomic_width: Some(64),
|
||||
has_thumb_interworking: true,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Targets the Little-endian Cortex-R4F/R5F processor (ARMv7-R)
|
||||
|
||||
use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
|
||||
use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
Target {
|
||||
@@ -15,7 +15,7 @@ pub(crate) fn target() -> Target {
|
||||
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
|
||||
arch: Arch::Arm,
|
||||
options: TargetOptions {
|
||||
abi: Abi::EabiHf,
|
||||
cfg_abi: CfgAbi::EabiHf,
|
||||
llvm_floatabi: Some(FloatAbi::Hard),
|
||||
features: "+vfp3d16".into(),
|
||||
max_atomic_width: Some(64),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Targets the Little-endian Cortex-R52 processor (ARMv8-R)
|
||||
|
||||
use crate::spec::{Abi, Arch, FloatAbi, Target, TargetMetadata, TargetOptions, base};
|
||||
use crate::spec::{Arch, CfgAbi, FloatAbi, Target, TargetMetadata, TargetOptions, base};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
Target {
|
||||
@@ -16,7 +16,7 @@ pub(crate) fn target() -> Target {
|
||||
arch: Arch::Arm,
|
||||
|
||||
options: TargetOptions {
|
||||
abi: Abi::EabiHf,
|
||||
cfg_abi: CfgAbi::EabiHf,
|
||||
llvm_floatabi: Some(FloatAbi::Hard),
|
||||
// Armv8-R requires a minimum set of floating-point features equivalent to:
|
||||
// fp-armv8, SP-only, with 16 DP (32 SP) registers
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
use crate::spec::{Abi, Arch, Cc, LinkerFlavor, Lld, Target, TargetMetadata, TargetOptions, base};
|
||||
use crate::spec::{
|
||||
Arch, Cc, CfgAbi, LinkerFlavor, Lld, Target, TargetMetadata, TargetOptions, base,
|
||||
};
|
||||
|
||||
// This target is for glibc Linux on Csky
|
||||
|
||||
@@ -16,7 +18,7 @@ pub(crate) fn target() -> Target {
|
||||
data_layout: "e-m:e-S32-p:32:32-i32:32:32-i64:32:32-f32:32:32-f64:32:32-v64:32:32-v128:32:32-a:0:32-Fi32-n32".into(),
|
||||
arch: Arch::CSky,
|
||||
options: TargetOptions {
|
||||
abi: Abi::AbiV2,
|
||||
cfg_abi: CfgAbi::AbiV2,
|
||||
features: "+2e3,+3e7,+7e10,+cache,+dsp1e2,+dspe60,+e1,+e2,+edsp,+elrw,+hard-tp,+high-registers,+hwdiv,+mp,+mp1e2,+nvic,+trust".into(),
|
||||
late_link_args: TargetOptions::link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-l:libatomic.a"]),
|
||||
max_atomic_width: Some(32),
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
use crate::spec::{Abi, Arch, Cc, LinkerFlavor, Lld, Target, TargetMetadata, TargetOptions, base};
|
||||
use crate::spec::{
|
||||
Arch, Cc, CfgAbi, LinkerFlavor, Lld, Target, TargetMetadata, TargetOptions, base,
|
||||
};
|
||||
|
||||
// This target is for glibc Linux on Csky
|
||||
|
||||
@@ -16,7 +18,7 @@ pub(crate) fn target() -> Target {
|
||||
data_layout: "e-m:e-S32-p:32:32-i32:32:32-i64:32:32-f32:32:32-f64:32:32-v64:32:32-v128:32:32-a:0:32-Fi32-n32".into(),
|
||||
arch: Arch::CSky,
|
||||
options: TargetOptions {
|
||||
abi: Abi::AbiV2Hf,
|
||||
cfg_abi: CfgAbi::AbiV2Hf,
|
||||
cpu: "ck860fv".into(),
|
||||
features: "+hard-float,+hard-float-abi,+2e3,+3e7,+7e10,+cache,+dsp1e2,+dspe60,+e1,+e2,+edsp,+elrw,+hard-tp,+high-registers,+hwdiv,+mp,+mp1e2,+nvic,+trust".into(),
|
||||
late_link_args: TargetOptions::link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-l:libatomic.a", "-mhard-float"]),
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
use crate::spec::{
|
||||
Arch, Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata, TargetOptions,
|
||||
Arch, Cc, LinkerFlavor, Lld, LlvmAbi, PanicStrategy, RelocModel, Target, TargetMetadata,
|
||||
TargetOptions,
|
||||
};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
@@ -19,7 +20,7 @@ pub(crate) fn target() -> Target {
|
||||
features: "+f,+d".into(),
|
||||
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
|
||||
linker: Some("rust-lld".into()),
|
||||
llvm_abiname: "ilp32d".into(),
|
||||
llvm_abiname: LlvmAbi::Ilp32d,
|
||||
max_atomic_width: Some(32),
|
||||
relocation_model: RelocModel::Static,
|
||||
panic_strategy: PanicStrategy::Abort,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use crate::spec::{
|
||||
Abi, Arch, Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata,
|
||||
TargetOptions,
|
||||
Arch, Cc, CfgAbi, LinkerFlavor, Lld, LlvmAbi, PanicStrategy, RelocModel, Target,
|
||||
TargetMetadata, TargetOptions,
|
||||
};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
@@ -18,10 +18,10 @@ pub(crate) fn target() -> Target {
|
||||
options: TargetOptions {
|
||||
cpu: "generic".into(),
|
||||
features: "-f,-d".into(),
|
||||
abi: Abi::SoftFloat,
|
||||
cfg_abi: CfgAbi::SoftFloat,
|
||||
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
|
||||
linker: Some("rust-lld".into()),
|
||||
llvm_abiname: "ilp32s".into(),
|
||||
llvm_abiname: LlvmAbi::Ilp32s,
|
||||
max_atomic_width: Some(32),
|
||||
relocation_model: RelocModel::Static,
|
||||
panic_strategy: PanicStrategy::Abort,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user