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> 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 <ggomez@ggo.ifr.lan>
|
||||||
Guillaume Gomez <guillaume1.gomez@gmail.com> Guillaume Gomez <guillaume.gomez@huawei.com>
|
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>
|
gnzlbg <gonzalobg88@gmail.com> <gnzlbg@users.noreply.github.com>
|
||||||
hamidreza kalbasi <hamidrezakalbasi@protonmail.com>
|
hamidreza kalbasi <hamidrezakalbasi@protonmail.com>
|
||||||
Hanna Kruppe <hanna.kruppe@gmail.com> <robin.kruppe@gmail.com>
|
Hanna Kruppe <hanna.kruppe@gmail.com> <robin.kruppe@gmail.com>
|
||||||
|
|||||||
@@ -46,7 +46,7 @@
|
|||||||
use rustc_session::Session;
|
use rustc_session::Session;
|
||||||
use rustc_session::config::OutputFilenames;
|
use rustc_session::config::OutputFilenames;
|
||||||
use rustc_span::{Symbol, sym};
|
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::*;
|
pub use crate::config::*;
|
||||||
use crate::prelude::*;
|
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
|
let has_reliable_f16_f128 = !(sess.target.arch == Arch::X86_64
|
||||||
&& sess.target.os == Os::Windows
|
&& sess.target.os == Os::Windows
|
||||||
&& sess.target.env == Env::Gnu
|
&& 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
|
// 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.
|
// filled in by compiler-builtins. The only libc that provides these currently is glibc.
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
use crate::common::AsCCharPtr;
|
use crate::common::AsCCharPtr;
|
||||||
use crate::errors::{
|
use crate::errors::{
|
||||||
CopyBitcode, FromLlvmDiag, FromLlvmOptimizationDiag, LlvmError, ParseTargetMachineConfig,
|
CopyBitcode, FromLlvmDiag, FromLlvmOptimizationDiag, LlvmError, ParseTargetMachineConfig,
|
||||||
UnknownCompression, WithLlvmError, WriteBytecode,
|
UnsupportedCompression, WithLlvmError, WriteBytecode,
|
||||||
};
|
};
|
||||||
use crate::llvm::diagnostic::OptimizationDiagnosticKind::*;
|
use crate::llvm::diagnostic::OptimizationDiagnosticKind::*;
|
||||||
use crate::llvm::{self, DiagnosticInfo};
|
use crate::llvm::{self, DiagnosticInfo};
|
||||||
@@ -225,7 +225,7 @@ pub(crate) fn target_machine_factory(
|
|||||||
let triple = SmallCStr::new(&versioned_llvm_target(sess));
|
let triple = SmallCStr::new(&versioned_llvm_target(sess));
|
||||||
let cpu = SmallCStr::new(llvm_util::target_cpu(sess));
|
let cpu = SmallCStr::new(llvm_util::target_cpu(sess));
|
||||||
let features = CString::new(target_features.join(",")).unwrap();
|
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 =
|
let trap_unreachable =
|
||||||
sess.opts.unstable_opts.trap_unreachable.unwrap_or(sess.target.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;
|
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() {
|
if llvm::LLVMRustLLVMHasZlibCompression() {
|
||||||
llvm::CompressionKind::Zlib
|
llvm::CompressionKind::Zlib
|
||||||
} else {
|
} else {
|
||||||
sess.dcx().emit_warn(UnknownCompression { algorithm: "zlib" });
|
sess.dcx().emit_warn(UnsupportedCompression { algorithm: "zlib" });
|
||||||
llvm::CompressionKind::None
|
llvm::CompressionKind::None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -256,7 +256,7 @@ pub(crate) fn target_machine_factory(
|
|||||||
if llvm::LLVMRustLLVMHasZstdCompression() {
|
if llvm::LLVMRustLLVMHasZstdCompression() {
|
||||||
llvm::CompressionKind::Zstd
|
llvm::CompressionKind::Zstd
|
||||||
} else {
|
} else {
|
||||||
sess.dcx().emit_warn(UnknownCompression { algorithm: "zstd" });
|
sess.dcx().emit_warn(UnsupportedCompression { algorithm: "zstd" });
|
||||||
llvm::CompressionKind::None
|
llvm::CompressionKind::None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
use rustc_span::{DUMMY_SP, Span, Spanned, Symbol};
|
use rustc_span::{DUMMY_SP, Span, Spanned, Symbol};
|
||||||
use rustc_symbol_mangling::mangle_internal_symbol;
|
use rustc_symbol_mangling::mangle_internal_symbol;
|
||||||
use rustc_target::spec::{
|
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;
|
use smallvec::SmallVec;
|
||||||
|
|
||||||
@@ -344,7 +344,7 @@ pub(crate) unsafe fn create_module<'ll>(
|
|||||||
if sess.target.is_like_msvc
|
if sess.target.is_like_msvc
|
||||||
|| (sess.target.options.os == Os::Windows
|
|| (sess.target.options.os == Os::Windows
|
||||||
&& sess.target.options.env == Env::Gnu
|
&& 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 {
|
match sess.opts.cg.control_flow_guard {
|
||||||
CFGuard::Disabled => {}
|
CFGuard::Disabled => {}
|
||||||
@@ -509,14 +509,13 @@ pub(crate) unsafe fn create_module<'ll>(
|
|||||||
// to workaround lld as the LTO plugin not
|
// to workaround lld as the LTO plugin not
|
||||||
// correctly setting target-abi for the LTO object
|
// correctly setting target-abi for the LTO object
|
||||||
// FIXME: https://github.com/llvm/llvm-project/issues/50591
|
// FIXME: https://github.com/llvm/llvm-project/issues/50591
|
||||||
// If llvm_abiname is empty, emit nothing.
|
|
||||||
let llvm_abiname = &sess.target.options.llvm_abiname;
|
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(
|
llvm::add_module_flag_str(
|
||||||
llmod,
|
llmod,
|
||||||
llvm::ModuleFlagMergeBehavior::Error,
|
llvm::ModuleFlagMergeBehavior::Error,
|
||||||
"target-abi",
|
"target-abi",
|
||||||
llvm_abiname,
|
llvm_abiname.desc(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -182,9 +182,9 @@ pub(crate) struct CopyBitcode {
|
|||||||
|
|
||||||
#[derive(Diagnostic)]
|
#[derive(Diagnostic)]
|
||||||
#[diag(
|
#[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,
|
pub algorithm: &'static str,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
use rustc_session::Session;
|
use rustc_session::Session;
|
||||||
use rustc_session::config::{PrintKind, PrintRequest};
|
use rustc_session::config::{PrintKind, PrintRequest};
|
||||||
use rustc_target::spec::{
|
use rustc_target::spec::{
|
||||||
Abi, Arch, Env, MergeFunctions, Os, PanicStrategy, SmallDataThresholdSupport,
|
Arch, CfgAbi, Env, MergeFunctions, Os, PanicStrategy, SmallDataThresholdSupport,
|
||||||
};
|
};
|
||||||
use smallvec::{SmallVec, smallvec};
|
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_arch = &sess.target.arch;
|
||||||
let target_os = &sess.target.options.os;
|
let target_os = &sess.target.options.os;
|
||||||
let target_env = &sess.target.options.env;
|
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 target_pointer_width = sess.target.pointer_width;
|
||||||
let version = get_version();
|
let version = get_version();
|
||||||
let (major, _, _) = 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)
|
// Unsupported <https://github.com/llvm/llvm-project/issues/94434> (fixed in llvm22)
|
||||||
(Arch::Arm64EC, _) if major < 22 => false,
|
(Arch::Arm64EC, _) if major < 22 => false,
|
||||||
// MinGW ABI bugs <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115054>
|
// 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>
|
// Infinite recursion <https://github.com/llvm/llvm-project/issues/97981>
|
||||||
(Arch::CSky, _) if major < 22 => false, // (fixed in llvm22)
|
(Arch::CSky, _) if major < 22 => false, // (fixed in llvm22)
|
||||||
(Arch::PowerPC | Arch::PowerPC64, _) 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)
|
// ABI unsupported <https://github.com/llvm/llvm-project/issues/41838> (fixed in llvm22)
|
||||||
(Arch::Sparc, _) if major < 22 => false,
|
(Arch::Sparc, _) if major < 22 => false,
|
||||||
// MinGW ABI bugs <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115054>
|
// 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
|
// 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`
|
// are available. `compiler-builtins` provides all symbols required for core `f128`
|
||||||
// support, so this should work for everything else.
|
// support, so this should work for everything else.
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
use rustc_middle::bug;
|
use rustc_middle::bug;
|
||||||
use rustc_middle::ty::Ty;
|
use rustc_middle::ty::Ty;
|
||||||
use rustc_middle::ty::layout::{HasTyCtxt, LayoutOf, TyAndLayout};
|
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::builder::Builder;
|
||||||
use crate::llvm::{Type, Value};
|
use crate::llvm::{Type, Value};
|
||||||
@@ -1077,7 +1077,7 @@ pub(super) fn emit_va_arg<'ll, 'tcx>(
|
|||||||
AllowHigherAlign::Yes,
|
AllowHigherAlign::Yes,
|
||||||
ForceRightAdjust::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:
|
// FIXME: clang manually adjusts the alignment for this ABI. It notes:
|
||||||
//
|
//
|
||||||
// > To be compatible with GCC's behaviors, we force arguments with
|
// > To be compatible with GCC's behaviors, we force arguments with
|
||||||
|
|||||||
@@ -47,7 +47,7 @@
|
|||||||
use rustc_span::Symbol;
|
use rustc_span::Symbol;
|
||||||
use rustc_target::spec::crt_objects::CrtObjects;
|
use rustc_target::spec::crt_objects::CrtObjects;
|
||||||
use rustc_target::spec::{
|
use rustc_target::spec::{
|
||||||
Abi, BinaryFormat, Cc, Env, LinkOutputKind, LinkSelfContainedComponents,
|
BinaryFormat, Cc, CfgAbi, Env, LinkOutputKind, LinkSelfContainedComponents,
|
||||||
LinkSelfContainedDefault, LinkerFeatures, LinkerFlavor, LinkerFlavorCli, Lld, Os, RelocModel,
|
LinkSelfContainedDefault, LinkerFeatures, LinkerFlavor, LinkerFlavorCli, Lld, Os, RelocModel,
|
||||||
RelroLevel, SanitizerSet, SplitDebuginfo,
|
RelroLevel, SanitizerSet, SplitDebuginfo,
|
||||||
};
|
};
|
||||||
@@ -1917,7 +1917,7 @@ fn self_contained_components(
|
|||||||
LinkSelfContainedDefault::InferredForMusl => sess.crt_static(Some(crate_type)),
|
LinkSelfContainedDefault::InferredForMusl => sess.crt_static(Some(crate_type)),
|
||||||
LinkSelfContainedDefault::InferredForMingw => {
|
LinkSelfContainedDefault::InferredForMingw => {
|
||||||
sess.host == sess.target
|
sess.host == sess.target
|
||||||
&& sess.target.abi != Abi::Uwp
|
&& sess.target.cfg_abi != CfgAbi::Uwp
|
||||||
&& detect_self_contained_mingw(sess, linker)
|
&& detect_self_contained_mingw(sess, linker)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
use rustc_middle::ty::TyCtxt;
|
use rustc_middle::ty::TyCtxt;
|
||||||
use rustc_session::Session;
|
use rustc_session::Session;
|
||||||
use rustc_session::config::{self, CrateType, DebugInfo, LinkerPluginLto, Lto, OptLevel, Strip};
|
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 tracing::{debug, warn};
|
||||||
|
|
||||||
use super::command::Command;
|
use super::command::Command;
|
||||||
@@ -84,7 +84,7 @@ pub(crate) fn get_linker<'a>(
|
|||||||
// To comply with the Windows App Certification Kit,
|
// To comply with the Windows App Certification Kit,
|
||||||
// MSVC needs to link with the Store versions of the runtime libraries (vcruntime, msvcrt, etc).
|
// MSVC needs to link with the Store versions of the runtime libraries (vcruntime, msvcrt, etc).
|
||||||
let t = &sess.target;
|
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 {
|
if let Some(ref tool) = msvc_tool {
|
||||||
let original_path = tool.path();
|
let original_path = tool.path();
|
||||||
if let Some(root_lib_path) = original_path.ancestors().nth(4) {
|
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
|
// FIXME: Move `/LIBPATH` addition for uwp targets from the linker construction
|
||||||
// to the linker args 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 {
|
match flavor {
|
||||||
LinkerFlavor::Unix(Cc::No) if sess.target.os == Os::L4Re => {
|
LinkerFlavor::Unix(Cc::No) if sess.target.os == Os::L4Re => {
|
||||||
Box::new(L4Bender::new(cmd, sess)) as Box<dyn Linker>
|
Box::new(L4Bender::new(cmd, sess)) as Box<dyn Linker>
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
use rustc_middle::bug;
|
use rustc_middle::bug;
|
||||||
use rustc_session::Session;
|
use rustc_session::Session;
|
||||||
use rustc_span::sym;
|
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 tracing::debug;
|
||||||
|
|
||||||
use super::apple;
|
use super::apple;
|
||||||
@@ -295,10 +295,10 @@ pub(super) fn elf_e_flags(architecture: Architecture, sess: &Session) -> u32 {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Use the explicitly given ABI.
|
// Use the explicitly given ABI.
|
||||||
match sess.target.options.llvm_abiname.as_ref() {
|
match &sess.target.options.llvm_abiname {
|
||||||
"o32" if is_32bit => e_flags |= elf::EF_MIPS_ABI_O32,
|
LlvmAbi::O32 if is_32bit => e_flags |= elf::EF_MIPS_ABI_O32,
|
||||||
"n32" if !is_32bit => e_flags |= elf::EF_MIPS_ABI2,
|
LlvmAbi::N32 if !is_32bit => e_flags |= elf::EF_MIPS_ABI2,
|
||||||
"n64" if !is_32bit => {}
|
LlvmAbi::N64 if !is_32bit => {}
|
||||||
// The rest is invalid (which is already ensured by the target spec check).
|
// The rest is invalid (which is already ensured by the target spec check).
|
||||||
s => bug!("invalid LLVM ABI `{}` for MIPS target", s),
|
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
|
// Set the appropriate flag based on ABI
|
||||||
// This needs to match LLVM `RISCVELFStreamer.cpp`
|
// This needs to match LLVM `RISCVELFStreamer.cpp`
|
||||||
match &*sess.target.llvm_abiname {
|
match &sess.target.llvm_abiname {
|
||||||
"ilp32" | "lp64" => (),
|
LlvmAbi::Ilp32 | LlvmAbi::Lp64 => (),
|
||||||
"ilp32f" | "lp64f" => e_flags |= elf::EF_RISCV_FLOAT_ABI_SINGLE,
|
LlvmAbi::Ilp32f | LlvmAbi::Lp64f => e_flags |= elf::EF_RISCV_FLOAT_ABI_SINGLE,
|
||||||
"ilp32d" | "lp64d" => e_flags |= elf::EF_RISCV_FLOAT_ABI_DOUBLE,
|
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.
|
// 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"),
|
_ => 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
|
// Set the appropriate flag based on ABI
|
||||||
// This needs to match LLVM `LoongArchELFStreamer.cpp`
|
// This needs to match LLVM `LoongArchELFStreamer.cpp`
|
||||||
match &*sess.target.llvm_abiname {
|
match &sess.target.llvm_abiname {
|
||||||
"ilp32s" | "lp64s" => e_flags |= elf::EF_LARCH_ABI_SOFT_FLOAT,
|
LlvmAbi::Ilp32s | LlvmAbi::Lp64s => e_flags |= elf::EF_LARCH_ABI_SOFT_FLOAT,
|
||||||
"ilp32f" | "lp64f" => e_flags |= elf::EF_LARCH_ABI_SINGLE_FLOAT,
|
LlvmAbi::Ilp32f | LlvmAbi::Lp64f => e_flags |= elf::EF_LARCH_ABI_SINGLE_FLOAT,
|
||||||
"ilp32d" | "lp64d" => e_flags |= elf::EF_LARCH_ABI_DOUBLE_FLOAT,
|
LlvmAbi::Ilp32d | LlvmAbi::Lp64d => e_flags |= elf::EF_LARCH_ABI_DOUBLE_FLOAT,
|
||||||
_ => bug!("unknown LoongArch ABI name"),
|
_ => bug!("unknown LoongArch ABI name"),
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -372,7 +372,7 @@ pub(super) fn elf_e_flags(architecture: Architecture, sess: &Session) -> u32 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Architecture::Csky => {
|
Architecture::Csky => {
|
||||||
if matches!(sess.target.options.abi, Abi::AbiV2) {
|
if matches!(sess.target.options.cfg_abi, CfgAbi::AbiV2) {
|
||||||
elf::EF_CSKY_ABIV2
|
elf::EF_CSKY_ABIV2
|
||||||
} else {
|
} else {
|
||||||
elf::EF_CSKY_ABIV1
|
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_V1: u32 = 1;
|
||||||
const EF_PPC64_ABI_ELF_V2: u32 = 2;
|
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,
|
// If the flags do not correctly indicate the ABI,
|
||||||
// linkers such as ld.lld assume that the ppc64 object files are always ELFv2
|
// 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.
|
// which leads to broken binaries if ELFv1 is used for the object files.
|
||||||
"elfv1" => EF_PPC64_ABI_ELF_V1,
|
LlvmAbi::ElfV1 => EF_PPC64_ABI_ELF_V1,
|
||||||
"elfv2" => EF_PPC64_ABI_ELF_V2,
|
LlvmAbi::ElfV2 => EF_PPC64_ABI_ELF_V2,
|
||||||
"" if sess.target.options.binary_format.to_object() == BinaryFormat::Elf => {
|
_ if sess.target.options.binary_format.to_object() == BinaryFormat::Elf => {
|
||||||
bug!("No ABI specified for this PPC64 ELF target");
|
bug!("invalid ABI specified for this PPC64 ELF target");
|
||||||
}
|
}
|
||||||
// Fall back
|
// Fall back
|
||||||
_ => EF_PPC64_ABI_UNKNOWN,
|
_ => EF_PPC64_ABI_UNKNOWN,
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
use rustc_middle::{bug, mir, span_bug};
|
use rustc_middle::{bug, mir, span_bug};
|
||||||
use rustc_session::cstore::{DllCallingConvention, DllImport, DllImportSymbolType};
|
use rustc_session::cstore::{DllCallingConvention, DllImport, DllImportSymbolType};
|
||||||
use rustc_span::Span;
|
use rustc_span::Span;
|
||||||
use rustc_target::spec::{Abi, Env, Os, Target};
|
use rustc_target::spec::{CfgAbi, Env, Os, Target};
|
||||||
|
|
||||||
use crate::traits::*;
|
use crate::traits::*;
|
||||||
|
|
||||||
@@ -171,7 +171,7 @@ pub fn asm_const_to_str<'tcx>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_mingw_gnu_toolchain(target: &Target) -> bool {
|
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(
|
pub fn i686_decorated_name(
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ fn constness(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Constness {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Node::TraitItem(ti @ TraitItem { kind: TraitItemKind::Fn(..), .. }) => {
|
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
|
Constness::NotConst
|
||||||
} else {
|
} else {
|
||||||
tcx.trait_def(tcx.local_parent(def_id)).constness
|
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
|
/// Allows giving non-const impls custom diagnostic messages if attempted to be used as const
|
||||||
(unstable, diagnostic_on_const, "1.93.0", Some(143874)),
|
(unstable, diagnostic_on_const, "1.93.0", Some(143874)),
|
||||||
/// Allows giving on-move borrowck custom diagnostic messages for a type
|
/// 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(...))]`.
|
/// Allows `#[doc(cfg(...))]`.
|
||||||
(unstable, doc_cfg, "1.21.0", Some(43781)),
|
(unstable, doc_cfg, "1.21.0", Some(43781)),
|
||||||
/// Allows `#[doc(masked)]`.
|
/// Allows `#[doc(masked)]`.
|
||||||
|
|||||||
@@ -13,6 +13,15 @@
|
|||||||
mod encode_cross_crate;
|
mod encode_cross_crate;
|
||||||
mod pretty_printing;
|
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.
|
/// Finds attributes in sequences of attributes by pattern matching.
|
||||||
///
|
///
|
||||||
/// A little like `matches` but for attributes.
|
/// A little like `matches` but for attributes.
|
||||||
@@ -34,10 +43,12 @@
|
|||||||
///
|
///
|
||||||
/// As a convenience, this macro can do that for you!
|
/// 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)
|
/// ```rust,ignore (illustrative)
|
||||||
/// find_attr!(tcx, def_id, <pattern>)
|
/// 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.
|
/// 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)
|
$crate::find_attr!($tcx.hir_krate_attrs(), $pattern $(if $guard)? => $e)
|
||||||
};
|
};
|
||||||
|
|
||||||
($tcx: expr, $def_id: expr, $pattern: pat $(if $guard: expr)?) => {
|
($tcx: expr, $id: expr, $pattern: pat $(if $guard: expr)?) => {
|
||||||
$crate::find_attr!($tcx, $def_id, $pattern $(if $guard)? => ()).is_some()
|
$crate::find_attr!($tcx, $id, $pattern $(if $guard)? => ()).is_some()
|
||||||
};
|
};
|
||||||
($tcx: expr, $def_id: expr, $pattern: pat $(if $guard: expr)? => $e: expr) => {{
|
($tcx: expr, $id: expr, $pattern: pat $(if $guard: expr)? => $e: expr) => {{
|
||||||
#[allow(deprecated)] {
|
$crate::find_attr!(
|
||||||
$crate::find_attr!($tcx.get_all_attrs($def_id), $pattern $(if $guard)? => $e)
|
$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.**
|
/// **Belongs to the type namespace.**
|
||||||
ToolMod,
|
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
|
// Macro namespace
|
||||||
/// An attribute that is *not* implemented via macro.
|
/// An attribute that is *not* implemented via macro.
|
||||||
/// E.g., `#[inline]` and `#[rustfmt::skip]`, which are essentially directives,
|
/// 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::SelfTyAlias { .. }
|
||||||
| Res::SelfCtor(..)
|
| Res::SelfCtor(..)
|
||||||
| Res::ToolMod
|
| Res::ToolMod
|
||||||
|
| Res::OpenMod(..)
|
||||||
| Res::NonMacroAttr(..)
|
| Res::NonMacroAttr(..)
|
||||||
| Res::Err => None,
|
| Res::Err => None,
|
||||||
}
|
}
|
||||||
@@ -869,6 +877,7 @@ pub fn descr(&self) -> &'static str {
|
|||||||
Res::Local(..) => "local variable",
|
Res::Local(..) => "local variable",
|
||||||
Res::SelfTyParam { .. } | Res::SelfTyAlias { .. } => "self type",
|
Res::SelfTyParam { .. } | Res::SelfTyAlias { .. } => "self type",
|
||||||
Res::ToolMod => "tool module",
|
Res::ToolMod => "tool module",
|
||||||
|
Res::OpenMod(..) => "namespaced crate",
|
||||||
Res::NonMacroAttr(attr_kind) => attr_kind.descr(),
|
Res::NonMacroAttr(attr_kind) => attr_kind.descr(),
|
||||||
Res::Err => "unresolved item",
|
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::SelfTyAlias { alias_to, is_trait_impl }
|
||||||
}
|
}
|
||||||
Res::ToolMod => Res::ToolMod,
|
Res::ToolMod => Res::ToolMod,
|
||||||
|
Res::OpenMod(sym) => Res::OpenMod(sym),
|
||||||
Res::NonMacroAttr(attr_kind) => Res::NonMacroAttr(attr_kind),
|
Res::NonMacroAttr(attr_kind) => Res::NonMacroAttr(attr_kind),
|
||||||
Res::Err => Res::Err,
|
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::SelfTyAlias { alias_to, is_trait_impl }
|
||||||
}
|
}
|
||||||
Res::ToolMod => Res::ToolMod,
|
Res::ToolMod => Res::ToolMod,
|
||||||
|
Res::OpenMod(sym) => Res::OpenMod(sym),
|
||||||
Res::NonMacroAttr(attr_kind) => Res::NonMacroAttr(attr_kind),
|
Res::NonMacroAttr(attr_kind) => Res::NonMacroAttr(attr_kind),
|
||||||
Res::Err => Res::Err,
|
Res::Err => Res::Err,
|
||||||
})
|
})
|
||||||
@@ -936,9 +947,11 @@ pub fn macro_kinds(self) -> Option<MacroKinds> {
|
|||||||
pub fn ns(&self) -> Option<Namespace> {
|
pub fn ns(&self) -> Option<Namespace> {
|
||||||
match self {
|
match self {
|
||||||
Res::Def(kind, ..) => kind.ns(),
|
Res::Def(kind, ..) => kind.ns(),
|
||||||
Res::PrimTy(..) | Res::SelfTyParam { .. } | Res::SelfTyAlias { .. } | Res::ToolMod => {
|
Res::PrimTy(..)
|
||||||
Some(Namespace::TypeNS)
|
| Res::SelfTyParam { .. }
|
||||||
}
|
| Res::SelfTyAlias { .. }
|
||||||
|
| Res::ToolMod
|
||||||
|
| Res::OpenMod(..) => Some(Namespace::TypeNS),
|
||||||
Res::SelfCtor(..) | Res::Local(..) => Some(Namespace::ValueNS),
|
Res::SelfCtor(..) | Res::Local(..) => Some(Namespace::ValueNS),
|
||||||
Res::NonMacroAttr(..) => Some(Namespace::MacroNS),
|
Res::NonMacroAttr(..) => Some(Namespace::MacroNS),
|
||||||
Res::Err => None,
|
Res::Err => None,
|
||||||
|
|||||||
@@ -2830,6 +2830,7 @@ fn lower_resolved_const_path(
|
|||||||
| Res::SelfCtor(_)
|
| Res::SelfCtor(_)
|
||||||
| Res::Local(_)
|
| Res::Local(_)
|
||||||
| Res::ToolMod
|
| Res::ToolMod
|
||||||
|
| Res::OpenMod(..)
|
||||||
| Res::NonMacroAttr(_)
|
| Res::NonMacroAttr(_)
|
||||||
| Res::Err) => Const::new_error_with_message(
|
| Res::Err) => Const::new_error_with_message(
|
||||||
tcx,
|
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]`.
|
// 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 Some(label) = break_destination.label else {
|
||||||
let span = e.span;
|
let span = e.span;
|
||||||
self.tcx.dcx().emit_fatal(ConstContinueBadLabel { span });
|
self.tcx.dcx().emit_fatal(ConstContinueBadLabel { span });
|
||||||
@@ -420,7 +420,7 @@ fn is_loop_match(
|
|||||||
e: &'hir hir::Expr<'hir>,
|
e: &'hir hir::Expr<'hir>,
|
||||||
body: &'hir hir::Block<'hir>,
|
body: &'hir hir::Block<'hir>,
|
||||||
) -> Option<Destination> {
|
) -> Option<Destination> {
|
||||||
if !find_attr!(self.tcx.hir_attrs(e.hir_id), LoopMatch(_)) {
|
if !find_attr!(self.tcx, e.hir_id, LoopMatch(_)) {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ fn proc_macro_decls_static(tcx: TyCtxt<'_>, (): ()) -> Option<LocalDefId> {
|
|||||||
let mut decls = None;
|
let mut decls = None;
|
||||||
|
|
||||||
for id in tcx.hir_free_items() {
|
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);
|
decls = Some(id.owner_id.def_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
use rustc_session::search_paths::PathKind;
|
use rustc_session::search_paths::PathKind;
|
||||||
use rustc_span::Symbol;
|
use rustc_span::Symbol;
|
||||||
use rustc_span::def_id::{DefId, LOCAL_CRATE};
|
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;
|
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
|
// 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
|
// 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.
|
// 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::Linux
|
||||||
|| sess.target.os == Os::Fuchsia
|
|| sess.target.os == Os::Fuchsia
|
||||||
|| sess.target.is_like_aix
|
|| sess.target.is_like_aix
|
||||||
|| sess.target.is_like_darwin && !sess.sanitizers().is_empty()
|
|| sess.target.is_like_darwin && !sess.sanitizers().is_empty()
|
||||||
|| sess.target.os == Os::Windows
|
|| sess.target.os == Os::Windows
|
||||||
&& sess.target.env == Env::Gnu
|
&& sess.target.env == Env::Gnu
|
||||||
&& sess.target.abi == Abi::Llvm
|
&& sess.target.cfg_abi == CfgAbi::Llvm
|
||||||
{
|
{
|
||||||
f(&sess.target_tlib_path.dir, false)?;
|
f(&sess.target_tlib_path.dir, false)?;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -164,9 +164,10 @@ pub fn new(
|
|||||||
);
|
);
|
||||||
assert_eq!(red_node_index, DepNodeIndex::FOREVER_RED_NODE);
|
assert_eq!(red_node_index, DepNodeIndex::FOREVER_RED_NODE);
|
||||||
if prev_graph_node_count > 0 {
|
if prev_graph_node_count > 0 {
|
||||||
colors.insert_red(SerializedDepNodeIndex::from_u32(
|
let prev_index =
|
||||||
DepNodeIndex::FOREVER_RED_NODE.as_u32(),
|
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 {
|
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 }
|
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
|
/// Atomically sets the color of a previous-session dep node to either green
|
||||||
/// index if `green` is true, otherwise it will try to atomicaly mark it red.
|
/// 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
|
/// If the node already has a color, the new color is ignored, and the
|
||||||
/// the already allocated index in `Err` if it is green already. If it was already
|
/// return value indicates the existing color.
|
||||||
/// red, `Err(None)` is returned.
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub(super) fn try_mark(
|
pub(super) fn try_set_color(
|
||||||
&self,
|
&self,
|
||||||
prev_index: SerializedDepNodeIndex,
|
prev_index: SerializedDepNodeIndex,
|
||||||
index: DepNodeIndex,
|
color: DesiredColor,
|
||||||
green: bool,
|
) -> TrySetColorResult {
|
||||||
) -> Result<(), Option<DepNodeIndex>> {
|
match self.values[prev_index].compare_exchange(
|
||||||
let value = &self.values[prev_index];
|
|
||||||
match value.compare_exchange(
|
|
||||||
COMPRESSED_UNKNOWN,
|
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,
|
||||||
Ordering::Relaxed,
|
Ordering::Relaxed,
|
||||||
) {
|
) {
|
||||||
Ok(_) => Ok(()),
|
Ok(_) => TrySetColorResult::Success,
|
||||||
Err(v) => Err(if v == COMPRESSED_RED { None } else { Some(DepNodeIndex::from_u32(v)) }),
|
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
|
DepNodeColor::Unknown
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[inline]
|
/// The color that [`DepNodeColorMap::try_set_color`] should try to apply to a node.
|
||||||
pub(super) fn insert_red(&self, index: SerializedDepNodeIndex) {
|
#[derive(Clone, Copy, Debug)]
|
||||||
let value = self.values[index].swap(COMPRESSED_RED, Ordering::Release);
|
pub(super) enum DesiredColor {
|
||||||
// Sanity check for duplicate nodes
|
/// Try to mark the node red.
|
||||||
assert_eq!(value, COMPRESSED_UNKNOWN, "tried to color an already colored node as 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)]
|
#[inline(never)]
|
||||||
|
|||||||
@@ -43,7 +43,7 @@
|
|||||||
use std::cmp::max;
|
use std::cmp::max;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::sync::atomic::Ordering;
|
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::fingerprint::{Fingerprint, PackedFingerprint};
|
||||||
use rustc_data_structures::fx::FxHashMap;
|
use rustc_data_structures::fx::FxHashMap;
|
||||||
@@ -58,7 +58,7 @@
|
|||||||
use rustc_session::Session;
|
use rustc_session::Session;
|
||||||
use tracing::{debug, instrument};
|
use tracing::{debug, instrument};
|
||||||
|
|
||||||
use super::graph::{CurrentDepGraph, DepNodeColorMap};
|
use super::graph::{CurrentDepGraph, DepNodeColorMap, DesiredColor, TrySetColorResult};
|
||||||
use super::retained::RetainedDepGraph;
|
use super::retained::RetainedDepGraph;
|
||||||
use super::{DepKind, DepNode, DepNodeIndex};
|
use super::{DepKind, DepNode, DepNodeIndex};
|
||||||
use crate::dep_graph::edges::EdgesVec;
|
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 mut local = self.status.local.borrow_mut();
|
||||||
|
|
||||||
let index = self.status.next_index(&mut *local);
|
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.
|
// on the same index.
|
||||||
match colors.try_mark(prev_index, index, is_green) {
|
match colors.try_set_color(prev_index, color) {
|
||||||
Ok(()) => (),
|
TrySetColorResult::Success => {}
|
||||||
Err(None) => panic!("dep node {:?} is unexpectedly red", prev_index),
|
TrySetColorResult::AlreadyRed => panic!("dep node {prev_index:?} is unexpectedly red"),
|
||||||
Err(Some(dep_node_index)) => return dep_node_index,
|
TrySetColorResult::AlreadyGreen { index } => return index,
|
||||||
}
|
}
|
||||||
|
|
||||||
self.status.bump_index(&mut *local);
|
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
|
/// from the previous dep graph and expects all edges to already have a new dep node index
|
||||||
/// assigned.
|
/// 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]
|
#[inline]
|
||||||
pub(crate) fn send_promoted(
|
pub(crate) fn send_promoted(
|
||||||
&self,
|
&self,
|
||||||
@@ -935,10 +937,10 @@ pub(crate) fn send_promoted(
|
|||||||
let mut local = self.status.local.borrow_mut();
|
let mut local = self.status.local.borrow_mut();
|
||||||
let index = self.status.next_index(&mut *local);
|
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.
|
// is called concurrently on the same index.
|
||||||
match colors.try_mark(prev_index, index, true) {
|
match colors.try_set_color(prev_index, DesiredColor::Green { index }) {
|
||||||
Ok(()) => {
|
TrySetColorResult::Success => {
|
||||||
self.status.bump_index(&mut *local);
|
self.status.bump_index(&mut *local);
|
||||||
self.status.encode_promoted_node(
|
self.status.encode_promoted_node(
|
||||||
index,
|
index,
|
||||||
@@ -949,7 +951,8 @@ pub(crate) fn send_promoted(
|
|||||||
);
|
);
|
||||||
Some(index)
|
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) {
|
pub fn provide(providers: &mut Providers) {
|
||||||
closure::provide(providers);
|
closure::provide(providers);
|
||||||
context::provide(providers);
|
context::provide(providers);
|
||||||
|
|||||||
@@ -491,7 +491,7 @@ fn construct_fn<'tcx>(
|
|||||||
};
|
};
|
||||||
|
|
||||||
if let Some((dialect, phase)) =
|
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(
|
return custom::build_custom_mir(
|
||||||
tcx,
|
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::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::Become(call) => ExprKind::Become { value: self.mirror_expr(call) },
|
||||||
hir::ExprKind::Break(dest, ref value) => {
|
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 {
|
match dest.target_id {
|
||||||
Ok(target_id) => {
|
Ok(target_id) => {
|
||||||
let (Some(value), Some(_)) = (value, dest.label) else {
|
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,
|
match_source,
|
||||||
},
|
},
|
||||||
hir::ExprKind::Loop(body, ..) => {
|
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();
|
let dcx = self.tcx.dcx();
|
||||||
|
|
||||||
// Accept either `state = expr` or `state = expr;`.
|
// 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),
|
typing_env: ty::TypingEnv::non_body_analysis(tcx, def),
|
||||||
typeck_results,
|
typeck_results,
|
||||||
body_owner: def.to_def_id(),
|
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::Def(_, def_id) => self.check_def_id(def_id),
|
||||||
Res::SelfTyParam { trait_: t } => self.check_def_id(t),
|
Res::SelfTyParam { trait_: t } => self.check_def_id(t),
|
||||||
Res::SelfTyAlias { alias_to: i, .. } => self.check_def_id(i),
|
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 mut check = self.check(item.def_id.expect_local(), vis, effective_vis);
|
||||||
|
|
||||||
let is_assoc_ty = item.is_type();
|
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();
|
check.generics().predicates();
|
||||||
if assoc_has_type_of(self.tcx, item) {
|
if assoc_has_type_of(self.tcx, item) {
|
||||||
check.hard_error = check.hard_error && item.defaultness(self.tcx).has_value();
|
|
||||||
check.ty();
|
check.ty();
|
||||||
}
|
}
|
||||||
if is_assoc_ty && item.container == AssocContainer::Trait {
|
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.hard_error = false;
|
||||||
check.bounds();
|
check.bounds();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -357,6 +357,7 @@ fn build_reduced_graph_for_external_crate_res(
|
|||||||
| Res::SelfTyParam { .. }
|
| Res::SelfTyParam { .. }
|
||||||
| Res::SelfTyAlias { .. }
|
| Res::SelfTyAlias { .. }
|
||||||
| Res::SelfCtor(..)
|
| Res::SelfCtor(..)
|
||||||
|
| Res::OpenMod(..)
|
||||||
| Res::Err => bug!("unexpected resolution: {:?}", res),
|
| Res::Err => bug!("unexpected resolution: {:?}", res),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1740,8 +1740,8 @@ pub(crate) fn unresolved_macro_suggestions(
|
|||||||
Res::Def(DefKind::Macro(kinds), _) => {
|
Res::Def(DefKind::Macro(kinds), _) => {
|
||||||
format!("{} {}", kinds.article(), kinds.descr())
|
format!("{} {}", kinds.article(), kinds.descr())
|
||||||
}
|
}
|
||||||
Res::ToolMod => {
|
Res::ToolMod | Res::OpenMod(..) => {
|
||||||
// Don't confuse the user with tool modules.
|
// Don't confuse the user with tool modules or open modules.
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Res::Def(DefKind::Trait, _) if macro_kind == MacroKind::Derive => {
|
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 {
|
let (built_in, from) = match scope {
|
||||||
Scope::StdLibPrelude | Scope::MacroUsePrelude => ("", " from prelude"),
|
Scope::StdLibPrelude | Scope::MacroUsePrelude => ("", " from prelude"),
|
||||||
Scope::ExternPreludeFlags
|
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`")
|
("", " passed with `--extern`")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
AmbiguityError, AmbiguityKind, AmbiguityWarning, BindingKey, CmResolver, Decl, DeclKind,
|
AmbiguityError, AmbiguityKind, AmbiguityWarning, BindingKey, CmResolver, Decl, DeclKind,
|
||||||
Determinacy, Finalize, IdentKey, ImportKind, LateDecl, Module, ModuleKind, ModuleOrUniformRoot,
|
Determinacy, Finalize, IdentKey, ImportKind, LateDecl, Module, ModuleKind, ModuleOrUniformRoot,
|
||||||
ParentScope, PathResult, PrivacyError, Res, ResolutionError, Resolver, Scope, ScopeSet,
|
ParentScope, PathResult, PrivacyError, Res, ResolutionError, Resolver, Scope, ScopeSet,
|
||||||
Segment, Stage, Used, errors,
|
Segment, Stage, Symbol, Used, errors,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Copy, Clone)]
|
#[derive(Copy, Clone)]
|
||||||
@@ -386,7 +386,6 @@ pub(crate) fn resolve_ident_in_lexical_scope(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Resolve an identifier in the specified set of scopes.
|
/// Resolve an identifier in the specified set of scopes.
|
||||||
#[instrument(level = "debug", skip(self))]
|
|
||||||
pub(crate) fn resolve_ident_in_scope_set<'r>(
|
pub(crate) fn resolve_ident_in_scope_set<'r>(
|
||||||
self: CmResolver<'r, 'ra, 'tcx>,
|
self: CmResolver<'r, 'ra, 'tcx>,
|
||||||
orig_ident: Ident,
|
orig_ident: Ident,
|
||||||
@@ -976,6 +975,14 @@ pub(crate) fn resolve_ident_in_module<'r>(
|
|||||||
ignore_import,
|
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(
|
ModuleOrUniformRoot::ModuleAndExternPrelude(module) => self.resolve_ident_in_scope_set(
|
||||||
ident,
|
ident,
|
||||||
ScopeSet::ModuleAndExternPrelude(ns, module),
|
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);
|
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) {
|
if self.mods_with_parse_errors.contains(&def_id) {
|
||||||
module_had_parse_errors = true;
|
module_had_parse_errors = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
|
|
||||||
/// A potential import declaration in the process of being planted into a module.
|
/// 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.
|
/// 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> {
|
pub(crate) enum PendingDecl<'ra> {
|
||||||
Ready(Option<Decl<'ra>>),
|
Ready(Option<Decl<'ra>>),
|
||||||
#[default]
|
#[default]
|
||||||
|
|||||||
@@ -3381,7 +3381,7 @@ pub(crate) fn detect_and_suggest_const_parameter_error(
|
|||||||
&& def_id.is_local()
|
&& def_id.is_local()
|
||||||
&& let Some(local_def_id) = def_id.as_local()
|
&& let Some(local_def_id) = def_id.as_local()
|
||||||
&& let Some(struct_generics) = self.r.struct_generics.get(&local_def_id)
|
&& 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 GenericParamKind::Const { ty, .. } = &target_param.kind
|
||||||
&& let TyKind::Path(_, path) = &ty.kind
|
&& let TyKind::Path(_, path) = &ty.kind
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -61,6 +61,7 @@
|
|||||||
use rustc_hir::{PrimTy, TraitCandidate, find_attr};
|
use rustc_hir::{PrimTy, TraitCandidate, find_attr};
|
||||||
use rustc_index::bit_set::DenseBitSet;
|
use rustc_index::bit_set::DenseBitSet;
|
||||||
use rustc_metadata::creader::CStore;
|
use rustc_metadata::creader::CStore;
|
||||||
|
use rustc_middle::bug;
|
||||||
use rustc_middle::metadata::{AmbigModChild, ModChild, Reexport};
|
use rustc_middle::metadata::{AmbigModChild, ModChild, Reexport};
|
||||||
use rustc_middle::middle::privacy::EffectiveVisibilities;
|
use rustc_middle::middle::privacy::EffectiveVisibilities;
|
||||||
use rustc_middle::query::Providers;
|
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
|
/// 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.
|
/// are always split into two parts, the first of which should be some kind of module.
|
||||||
CurrentScope,
|
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)]
|
#[derive(Debug)]
|
||||||
@@ -1105,13 +1111,20 @@ fn determined(&self) -> bool {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
struct ExternPreludeEntry<'ra> {
|
struct ExternPreludeEntry<'ra> {
|
||||||
/// Name declaration from an `extern crate` item.
|
/// Name declaration from an `extern crate` item.
|
||||||
/// The boolean flag is true is `item_decl` is non-redundant, happens either when
|
/// 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.
|
/// `flag_decl` is `None`, or when `extern crate` introducing `item_decl` used renaming.
|
||||||
item_decl: Option<(Decl<'ra>, Span, /* introduced by item */ bool)>,
|
item_decl: Option<(Decl<'ra>, Span, /* introduced by item */ bool)>,
|
||||||
/// Name declaration from an `--extern` flag, lazily populated on first use.
|
/// 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<'_> {
|
impl ExternPreludeEntry<'_> {
|
||||||
@@ -1122,7 +1135,14 @@ fn introduced_by_item(&self) -> bool {
|
|||||||
fn flag() -> Self {
|
fn flag() -> Self {
|
||||||
ExternPreludeEntry {
|
ExternPreludeEntry {
|
||||||
item_decl: None,
|
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();
|
let mut invocation_parents = FxHashMap::default();
|
||||||
invocation_parents.insert(LocalExpnId::ROOT, InvocationParent::ROOT);
|
invocation_parents.insert(LocalExpnId::ROOT, InvocationParent::ROOT);
|
||||||
|
|
||||||
let mut extern_prelude: FxIndexMap<_, _> = tcx
|
let extern_prelude = build_extern_prelude(tcx, attrs);
|
||||||
.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 registered_tools = tcx.registered_tools(());
|
let registered_tools = tcx.registered_tools(());
|
||||||
let edition = tcx.sess.edition();
|
let edition = tcx.sess.edition();
|
||||||
|
|
||||||
@@ -2326,10 +2318,10 @@ fn extern_prelude_get_flag(
|
|||||||
) -> Option<Decl<'ra>> {
|
) -> Option<Decl<'ra>> {
|
||||||
let entry = self.extern_prelude.get(&ident);
|
let entry = self.extern_prelude.get(&ident);
|
||||||
entry.and_then(|entry| entry.flag_decl.as_ref()).and_then(|flag_decl| {
|
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 {
|
let decl = match pending_decl {
|
||||||
PendingDecl::Ready(decl) => {
|
PendingDecl::Ready(decl) => {
|
||||||
if finalize && !finalized {
|
if finalize && !finalized && !is_open {
|
||||||
self.cstore_mut().process_path_extern(
|
self.cstore_mut().process_path_extern(
|
||||||
self.tcx,
|
self.tcx,
|
||||||
ident.name,
|
ident.name,
|
||||||
@@ -2340,18 +2332,28 @@ fn extern_prelude_get_flag(
|
|||||||
}
|
}
|
||||||
PendingDecl::Pending => {
|
PendingDecl::Pending => {
|
||||||
debug_assert!(!finalized);
|
debug_assert!(!finalized);
|
||||||
let crate_id = if finalize {
|
if is_open {
|
||||||
self.cstore_mut().process_path_extern(self.tcx, ident.name, orig_ident_span)
|
let res = Res::OpenMod(ident.name);
|
||||||
|
Some(self.arenas.new_pub_def_decl(res, DUMMY_SP, LocalExpnId::ROOT))
|
||||||
} else {
|
} else {
|
||||||
self.cstore_mut().maybe_process_path_extern(self.tcx, ident.name)
|
let crate_id = if finalize {
|
||||||
};
|
self.cstore_mut().process_path_extern(
|
||||||
crate_id.map(|crate_id| {
|
self.tcx,
|
||||||
let res = Res::Def(DefKind::Mod, crate_id.as_def_id());
|
ident.name,
|
||||||
self.arenas.new_pub_def_decl(res, DUMMY_SP, LocalExpnId::ROOT)
|
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))
|
decl.or_else(|| finalize.then_some(self.dummy_decl))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -2393,7 +2395,9 @@ fn resolve_rustdoc_path(
|
|||||||
PathResult::Module(ModuleOrUniformRoot::ExternPrelude) | PathResult::Failed { .. } => {
|
PathResult::Module(ModuleOrUniformRoot::ExternPrelude) | PathResult::Failed { .. } => {
|
||||||
None
|
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 {
|
fn names_to_string(names: impl Iterator<Item = Symbol>) -> String {
|
||||||
let mut result = String::new();
|
let mut result = String::new();
|
||||||
for (i, name) in names.enumerate().filter(|(_, name)| *name != kw::PathRoot) {
|
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_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_sym!(sym::target_arch, sess.target.arch.desc_symbol());
|
||||||
ins_str!(sym::target_endian, sess.target.endian.as_str());
|
ins_str!(sym::target_endian, sess.target.endian.as_str());
|
||||||
ins_sym!(sym::target_env, sess.target.env.desc_symbol());
|
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())) {
|
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_arch.insert(target.arch.desc_symbol());
|
||||||
values_target_endian.insert(Symbol::intern(target.options.endian.as_str()));
|
values_target_endian.insert(Symbol::intern(target.options.endian.as_str()));
|
||||||
values_target_env.insert(target.options.env.desc_symbol());
|
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) {
|
if !valid_crate_name(&crate_name, unstable_opts) {
|
||||||
let mut error = early_dcx.early_struct_fatal(format!(
|
let mut error = early_dcx.early_struct_fatal(format!(
|
||||||
"crate name `{crate_name}` passed to `--extern` is not a valid ASCII identifier"
|
"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_macros::{Decodable, Encodable, HashStable_Generic};
|
||||||
use rustc_span::Symbol;
|
use rustc_span::Symbol;
|
||||||
|
|
||||||
use crate::spec::{Abi, Arch, RelocModel, Target};
|
use crate::spec::{Arch, CfgAbi, RelocModel, Target};
|
||||||
|
|
||||||
pub struct ModifierInfo {
|
pub struct ModifierInfo {
|
||||||
pub modifier: char,
|
pub modifier: char,
|
||||||
@@ -1001,7 +1001,7 @@ pub fn parse(
|
|||||||
_ => Err(&["C", "system", "efiapi"]),
|
_ => Err(&["C", "system", "efiapi"]),
|
||||||
},
|
},
|
||||||
InlineAsmArch::PowerPC | InlineAsmArch::PowerPC64 => match name {
|
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
|
InlineAsmClobberAbi::PowerPCSPE
|
||||||
} else {
|
} else {
|
||||||
InlineAsmClobberAbi::PowerPC
|
InlineAsmClobberAbi::PowerPC
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
use rustc_span::Symbol;
|
use rustc_span::Symbol;
|
||||||
|
|
||||||
use super::{InlineAsmArch, InlineAsmType, ModifierInfo};
|
use super::{InlineAsmArch, InlineAsmType, ModifierInfo};
|
||||||
use crate::spec::{Abi, RelocModel, Target};
|
use crate::spec::{CfgAbi, RelocModel, Target};
|
||||||
|
|
||||||
def_reg_class! {
|
def_reg_class! {
|
||||||
PowerPC PowerPCInlineAsmRegClass {
|
PowerPC PowerPCInlineAsmRegClass {
|
||||||
@@ -105,9 +105,9 @@ fn reserved_v20to31(
|
|||||||
_is_clobber: bool,
|
_is_clobber: bool,
|
||||||
) -> Result<(), &'static str> {
|
) -> Result<(), &'static str> {
|
||||||
if target.is_like_aix {
|
if target.is_like_aix {
|
||||||
match &target.options.abi {
|
match &target.options.cfg_abi {
|
||||||
Abi::VecDefault => Err("v20-v31 (vs52-vs63) are reserved on vec-default ABI"),
|
CfgAbi::VecDefault => Err("v20-v31 (vs52-vs63) are reserved on vec-default ABI"),
|
||||||
Abi::VecExtAbi => Ok(()),
|
CfgAbi::VecExtAbi => Ok(()),
|
||||||
abi => unreachable!("unrecognized AIX ABI: {abi}"),
|
abi => unreachable!("unrecognized AIX ABI: {abi}"),
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -122,7 +122,11 @@ fn spe_acc_target_check(
|
|||||||
target: &Target,
|
target: &Target,
|
||||||
_is_clobber: bool,
|
_is_clobber: bool,
|
||||||
) -> Result<(), &'static str> {
|
) -> 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! {
|
def_regs! {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
use crate::callconv::{ArgAbi, ArgExtension, CastTarget, FnAbi, PassMode, Uniform};
|
use crate::callconv::{ArgAbi, ArgExtension, CastTarget, FnAbi, PassMode, Uniform};
|
||||||
use crate::spec::HasTargetSpec;
|
use crate::spec::{HasTargetSpec, LlvmAbi};
|
||||||
|
|
||||||
#[derive(Copy, Clone)]
|
#[derive(Copy, Clone)]
|
||||||
enum RegPassKind {
|
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,
|
C: HasDataLayout + HasTargetSpec,
|
||||||
{
|
{
|
||||||
let xlen = cx.data_layout().pointer_size().bits();
|
let xlen = cx.data_layout().pointer_size().bits();
|
||||||
let flen = match &cx.target_spec().llvm_abiname[..] {
|
let flen = match &cx.target_spec().llvm_abiname {
|
||||||
"ilp32f" | "lp64f" => 32,
|
LlvmAbi::Ilp32f | LlvmAbi::Lp64f => 32,
|
||||||
"ilp32d" | "lp64d" => 64,
|
LlvmAbi::Ilp32d | LlvmAbi::Lp64d => 64,
|
||||||
_ => 0,
|
_ => 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
use rustc_abi::{Endian, HasDataLayout, TyAbiInterface};
|
use rustc_abi::{Endian, HasDataLayout, TyAbiInterface};
|
||||||
|
|
||||||
use crate::callconv::{Align, ArgAbi, FnAbi, Reg, RegKind, Uniform};
|
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)]
|
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||||
enum ABI {
|
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,
|
Ty: TyAbiInterface<'a, C> + Copy,
|
||||||
C: HasDataLayout + HasTargetSpec,
|
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
|
ELFv2
|
||||||
} else if cx.target_spec().options.llvm_abiname == "elfv1" {
|
} else if cx.target_spec().options.llvm_abiname == LlvmAbi::ElfV1 {
|
||||||
ELFv1
|
ELFv1
|
||||||
} else if cx.target_spec().os == Os::Aix {
|
} else if cx.target_spec().os == Os::Aix {
|
||||||
AIX
|
AIX
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
use crate::callconv::{ArgAbi, ArgExtension, CastTarget, FnAbi, PassMode, Uniform};
|
use crate::callconv::{ArgAbi, ArgExtension, CastTarget, FnAbi, PassMode, Uniform};
|
||||||
use crate::spec::HasTargetSpec;
|
use crate::spec::{HasTargetSpec, LlvmAbi};
|
||||||
|
|
||||||
#[derive(Copy, Clone)]
|
#[derive(Copy, Clone)]
|
||||||
enum RegPassKind {
|
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,
|
Ty: TyAbiInterface<'a, C> + Copy,
|
||||||
C: HasDataLayout + HasTargetSpec,
|
C: HasDataLayout + HasTargetSpec,
|
||||||
{
|
{
|
||||||
let flen = match &cx.target_spec().llvm_abiname[..] {
|
let flen = match &cx.target_spec().llvm_abiname {
|
||||||
"ilp32f" | "lp64f" => 32,
|
LlvmAbi::Ilp32f | LlvmAbi::Lp64f => 32,
|
||||||
"ilp32d" | "lp64d" => 64,
|
LlvmAbi::Ilp32d | LlvmAbi::Lp64d => 64,
|
||||||
_ => 0,
|
_ => 0,
|
||||||
};
|
};
|
||||||
let xlen = cx.data_layout().pointer_size().bits();
|
let xlen = cx.data_layout().pointer_size().bits();
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
use rustc_abi::Endian;
|
use rustc_abi::Endian;
|
||||||
|
|
||||||
use crate::spec::{
|
use crate::spec::{
|
||||||
Abi, BinaryFormat, Cc, CodeModel, LinkOutputKind, LinkerFlavor, Os, TargetOptions, crt_objects,
|
BinaryFormat, Cc, CfgAbi, CodeModel, LinkOutputKind, LinkerFlavor, Os, TargetOptions,
|
||||||
cvs,
|
crt_objects, cvs,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub(crate) fn opts() -> TargetOptions {
|
pub(crate) fn opts() -> TargetOptions {
|
||||||
TargetOptions {
|
TargetOptions {
|
||||||
abi: Abi::VecExtAbi,
|
cfg_abi: CfgAbi::VecExtAbi,
|
||||||
code_model: Some(CodeModel::Large),
|
code_model: Some(CodeModel::Large),
|
||||||
cpu: "pwr7".into(),
|
cpu: "pwr7".into(),
|
||||||
os: Os::Aix,
|
os: Os::Aix,
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
use crate::spec::{
|
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,
|
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.
|
// But let's continue setting them for backwards compatibility.
|
||||||
// FIXME(madsmtm): Warn about using these in the future.
|
// FIXME(madsmtm): Warn about using these in the future.
|
||||||
fn target_abi(self) -> Abi {
|
fn target_abi(self) -> CfgAbi {
|
||||||
match self {
|
match self {
|
||||||
Self::Normal => Abi::Unspecified,
|
Self::Normal => CfgAbi::Unspecified,
|
||||||
Self::MacCatalyst => Abi::MacAbi,
|
Self::MacCatalyst => CfgAbi::MacAbi,
|
||||||
Self::Simulator => Abi::Sim,
|
Self::Simulator => CfgAbi::Sim,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -135,7 +135,7 @@ pub(crate) fn base(
|
|||||||
},
|
},
|
||||||
os,
|
os,
|
||||||
env: env.target_env(),
|
env: env.target_env(),
|
||||||
abi: env.target_abi(),
|
cfg_abi: env.target_abi(),
|
||||||
cpu: arch.target_cpu(env).into(),
|
cpu: arch.target_cpu(env).into(),
|
||||||
link_env_remove,
|
link_env_remove,
|
||||||
vendor: "apple".into(),
|
vendor: "apple".into(),
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
aarch64_apple_watchos_sim, i686_apple_darwin, x86_64_apple_darwin, x86_64_apple_ios,
|
aarch64_apple_watchos_sim, i686_apple_darwin, x86_64_apple_darwin, x86_64_apple_ios,
|
||||||
x86_64_apple_tvos, x86_64_apple_watchos_sim,
|
x86_64_apple_tvos, x86_64_apple_watchos_sim,
|
||||||
};
|
};
|
||||||
use crate::spec::{Abi, Env};
|
use crate::spec::{CfgAbi, Env};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn simulator_targets_set_env() {
|
fn simulator_targets_set_env() {
|
||||||
@@ -21,7 +21,7 @@ fn simulator_targets_set_env() {
|
|||||||
for target in &all_sim_targets {
|
for target in &all_sim_targets {
|
||||||
assert_eq!(target.env, Env::Sim);
|
assert_eq!(target.env, Env::Sim);
|
||||||
// Ensure backwards compat
|
// 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::crt_objects::pre_mingw_self_contained;
|
||||||
use crate::spec::{
|
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,
|
SplitDebuginfo, TargetOptions, add_link_args, cvs,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@ pub(crate) fn opts() -> TargetOptions {
|
|||||||
os: Os::Windows,
|
os: Os::Windows,
|
||||||
env: Env::Gnu,
|
env: Env::Gnu,
|
||||||
vendor: "pc".into(),
|
vendor: "pc".into(),
|
||||||
abi: Abi::Llvm,
|
cfg_abi: CfgAbi::Llvm,
|
||||||
linker: Some("clang".into()),
|
linker: Some("clang".into()),
|
||||||
dynamic_linking: true,
|
dynamic_linking: true,
|
||||||
dll_tls_export: false,
|
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 {
|
pub(crate) fn opts() -> TargetOptions {
|
||||||
let base = base::windows_gnu::opts();
|
let base = base::windows_gnu::opts();
|
||||||
@@ -23,7 +23,7 @@ pub(crate) fn opts() -> TargetOptions {
|
|||||||
let late_link_args_static = LinkArgs::new();
|
let late_link_args_static = LinkArgs::new();
|
||||||
|
|
||||||
TargetOptions {
|
TargetOptions {
|
||||||
abi: Abi::Uwp,
|
cfg_abi: CfgAbi::Uwp,
|
||||||
vendor: "uwp".into(),
|
vendor: "uwp".into(),
|
||||||
limit_rdylib_exports: false,
|
limit_rdylib_exports: false,
|
||||||
late_link_args,
|
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 {
|
pub(crate) fn opts() -> TargetOptions {
|
||||||
let mut opts =
|
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"]);
|
opts.add_pre_link_args(LinkerFlavor::Msvc(Lld::No), &["/APPCONTAINER", "mincore.lib"]);
|
||||||
|
|
||||||
|
|||||||
@@ -5,14 +5,14 @@
|
|||||||
|
|
||||||
use super::crt_objects::CrtObjects;
|
use super::crt_objects::CrtObjects;
|
||||||
use super::{
|
use super::{
|
||||||
Abi, Arch, BinaryFormat, CodeModel, DebuginfoKind, Env, FloatAbi, FramePointer, LinkArgsCli,
|
Arch, BinaryFormat, CfgAbi, CodeModel, DebuginfoKind, Env, FloatAbi, FramePointer, LinkArgsCli,
|
||||||
LinkSelfContainedComponents, LinkSelfContainedDefault, LinkerFlavorCli, LldFlavor,
|
LinkSelfContainedComponents, LinkSelfContainedDefault, LinkerFlavorCli, LldFlavor,
|
||||||
MergeFunctions, Os, PanicStrategy, RelocModel, RelroLevel, RustcAbi, SanitizerSet,
|
MergeFunctions, Os, PanicStrategy, RelocModel, RelroLevel, RustcAbi, SanitizerSet,
|
||||||
SmallDataThresholdSupport, SplitDebuginfo, StackProbeType, StaticCow, SymbolVisibility, Target,
|
SmallDataThresholdSupport, SplitDebuginfo, StackProbeType, StaticCow, SymbolVisibility, Target,
|
||||||
TargetKind, TargetOptions, TargetWarnings, TlsModel,
|
TargetKind, TargetOptions, TargetWarnings, TlsModel,
|
||||||
};
|
};
|
||||||
use crate::json::{Json, ToJson};
|
use crate::json::{Json, ToJson};
|
||||||
use crate::spec::AbiMap;
|
use crate::spec::{AbiMap, LlvmAbi};
|
||||||
|
|
||||||
impl Target {
|
impl Target {
|
||||||
/// Loads a target descriptor from a JSON object.
|
/// 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_opt!(c_enum_min_bits); // if None, matches c_int_width
|
||||||
forward!(os);
|
forward!(os);
|
||||||
forward!(env);
|
forward!(env);
|
||||||
forward!(abi);
|
if let Some(abi) = json.abi {
|
||||||
|
base.cfg_abi = abi;
|
||||||
|
}
|
||||||
forward!(vendor);
|
forward!(vendor);
|
||||||
forward_opt!(linker);
|
forward_opt!(linker);
|
||||||
forward!(linker_flavor_json);
|
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!(c_int_width, "target-c-int-width");
|
||||||
target_option_val!(os);
|
target_option_val!(os);
|
||||||
target_option_val!(env);
|
target_option_val!(env);
|
||||||
target_option_val!(abi);
|
target_option_val!(cfg_abi, "abi");
|
||||||
target_option_val!(vendor);
|
target_option_val!(vendor);
|
||||||
target_option_val!(linker);
|
target_option_val!(linker);
|
||||||
target_option_val!(linker_flavor_json, "linker-flavor");
|
target_option_val!(linker_flavor_json, "linker-flavor");
|
||||||
@@ -505,7 +507,7 @@ struct TargetSpecJson {
|
|||||||
c_enum_min_bits: Option<u64>,
|
c_enum_min_bits: Option<u64>,
|
||||||
os: Option<Os>,
|
os: Option<Os>,
|
||||||
env: Option<Env>,
|
env: Option<Env>,
|
||||||
abi: Option<Abi>,
|
abi: Option<CfgAbi>,
|
||||||
vendor: Option<StaticCow<str>>,
|
vendor: Option<StaticCow<str>>,
|
||||||
linker: Option<StaticCow<str>>,
|
linker: Option<StaticCow<str>>,
|
||||||
#[serde(rename = "linker-flavor")]
|
#[serde(rename = "linker-flavor")]
|
||||||
@@ -609,7 +611,7 @@ struct TargetSpecJson {
|
|||||||
#[serde(rename = "target-mcount")]
|
#[serde(rename = "target-mcount")]
|
||||||
mcount: Option<StaticCow<str>>,
|
mcount: Option<StaticCow<str>>,
|
||||||
llvm_mcount_intrinsic: Option<StaticCow<str>>,
|
llvm_mcount_intrinsic: Option<StaticCow<str>>,
|
||||||
llvm_abiname: Option<StaticCow<str>>,
|
llvm_abiname: Option<LlvmAbi>,
|
||||||
llvm_floatabi: Option<FloatAbi>,
|
llvm_floatabi: Option<FloatAbi>,
|
||||||
rustc_abi: Option<RustcAbi>,
|
rustc_abi: Option<RustcAbi>,
|
||||||
relax_elf_relocations: Option<bool>,
|
relax_elf_relocations: Option<bool>,
|
||||||
|
|||||||
@@ -2065,7 +2065,10 @@ pub fn desc_symbol(&self) -> Symbol {
|
|||||||
}
|
}
|
||||||
|
|
||||||
crate::target_spec_enum! {
|
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",
|
Abi64 = "abi64",
|
||||||
AbiV2 = "abiv2",
|
AbiV2 = "abiv2",
|
||||||
AbiV2Hf = "abiv2hf",
|
AbiV2Hf = "abiv2hf",
|
||||||
@@ -2090,12 +2093,40 @@ pub enum Abi {
|
|||||||
other_variant = Other;
|
other_variant = Other;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Abi {
|
impl CfgAbi {
|
||||||
pub fn desc_symbol(&self) -> Symbol {
|
pub fn desc_symbol(&self) -> Symbol {
|
||||||
Symbol::intern(self.desc())
|
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.
|
/// Everything `rustc` knows about how to compile for a specific target.
|
||||||
///
|
///
|
||||||
/// Every field here must be specified, and has no default value.
|
/// Every field here must be specified, and has no default value.
|
||||||
@@ -2221,13 +2252,18 @@ pub struct TargetOptions {
|
|||||||
pub os: Os,
|
pub os: Os,
|
||||||
/// Environment name to use for conditional compilation (`target_env`). Defaults to [`Env::Unspecified`].
|
/// Environment name to use for conditional compilation (`target_env`). Defaults to [`Env::Unspecified`].
|
||||||
pub env: Env,
|
pub env: Env,
|
||||||
/// ABI name to distinguish multiple ABIs on the same OS and architecture. For instance, `"eabi"`
|
/// ABI name to distinguish multiple ABIs on the same OS and architecture. For instance,
|
||||||
/// or `"eabihf"`. Defaults to [`Abi::Unspecified`].
|
/// `"eabi"` or `"eabihf"`. Defaults to [`CfgAbi::Unspecified`].
|
||||||
/// This field is *not* forwarded directly to LLVM and therefore does not control which ABI (in
|
/// The only purpose of this field is to control `cfg(target_abi)`. This does not control the
|
||||||
/// the sense of function calling convention) is actually used; its primary purpose is
|
/// calling convention used by this target! The actual calling convention is controlled by
|
||||||
/// `cfg(target_abi)`. The actual calling convention is controlled by `llvm_abiname`,
|
/// `llvm_abiname`, `llvm_floatabi`, and `rustc_abi`.
|
||||||
/// `llvm_floatabi`, and `rustc_abi`.
|
///
|
||||||
pub abi: 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".
|
/// Vendor name to use for conditional compilation (`target_vendor`). Defaults to "unknown".
|
||||||
#[rustc_lint_opt_deny_field_access(
|
#[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"
|
"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
|
/// 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`.
|
/// 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
|
/// 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
|
/// 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,
|
/// 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
|
/// it can also affect "C" ABI functions; the point is that this flag is interpreted by
|
||||||
/// rustc and not forwarded to LLVM.
|
/// rustc and not forwarded to LLVM.
|
||||||
/// So far, this is only used on x86.
|
|
||||||
pub rustc_abi: Option<RustcAbi>,
|
pub rustc_abi: Option<RustcAbi>,
|
||||||
|
|
||||||
/// Whether or not RelaxElfRelocation flag will be passed to the linker
|
/// Whether or not RelaxElfRelocation flag will be passed to the linker
|
||||||
@@ -2739,7 +2774,7 @@ fn default() -> TargetOptions {
|
|||||||
c_int_width: 32,
|
c_int_width: 32,
|
||||||
os: Os::None,
|
os: Os::None,
|
||||||
env: Env::Unspecified,
|
env: Env::Unspecified,
|
||||||
abi: Abi::Unspecified,
|
cfg_abi: CfgAbi::Unspecified,
|
||||||
vendor: "unknown".into(),
|
vendor: "unknown".into(),
|
||||||
linker: option_env!("CFG_DEFAULT_LINKER").map(|s| s.into()),
|
linker: option_env!("CFG_DEFAULT_LINKER").map(|s| s.into()),
|
||||||
linker_flavor: LinkerFlavor::Gnu(Cc::Yes, Lld::No),
|
linker_flavor: LinkerFlavor::Gnu(Cc::Yes, Lld::No),
|
||||||
@@ -2835,7 +2870,7 @@ fn default() -> TargetOptions {
|
|||||||
merge_functions: MergeFunctions::Aliases,
|
merge_functions: MergeFunctions::Aliases,
|
||||||
mcount: "mcount".into(),
|
mcount: "mcount".into(),
|
||||||
llvm_mcount_intrinsic: None,
|
llvm_mcount_intrinsic: None,
|
||||||
llvm_abiname: "".into(),
|
llvm_abiname: LlvmAbi::Unspecified,
|
||||||
llvm_floatabi: None,
|
llvm_floatabi: None,
|
||||||
rustc_abi: None,
|
rustc_abi: None,
|
||||||
relax_elf_relocations: false,
|
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.
|
// 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
|
// To ensure targets are trated consistently, please consult with the team before allowing
|
||||||
// new cases.
|
// new cases.
|
||||||
match self.arch {
|
match self.arch {
|
||||||
Arch::X86 => {
|
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!(self.llvm_floatabi.is_none(), "`llvm_floatabi` is unused on x86-32");
|
||||||
check_matches!(
|
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,
|
// FIXME: we do not currently set a target_abi for softfloat targets here,
|
||||||
// but we probably should, so we already allow it.
|
// but we probably should, so we already allow it.
|
||||||
(Some(RustcAbi::Softfloat), Abi::SoftFloat | Abi::Unspecified | Abi::Other(_))
|
(
|
||||||
| (
|
Some(RustcAbi::Softfloat),
|
||||||
Some(RustcAbi::X86Sse2) | None,
|
CfgAbi::SoftFloat | CfgAbi::Unspecified | CfgAbi::Other(_)
|
||||||
Abi::Uwp | Abi::Llvm | Abi::Sim | Abi::Unspecified | Abi::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\
|
"invalid x86-32 Rust-specific ABI and `cfg(target_abi)` combination:\n\
|
||||||
Rust-specific ABI: {:?}\n\
|
Rust-specific ABI: {:?}\n\
|
||||||
cfg(target_abi): {}",
|
cfg(target_abi): {}",
|
||||||
self.rustc_abi,
|
self.rustc_abi,
|
||||||
self.abi,
|
self.cfg_abi,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Arch::X86_64 => {
|
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");
|
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
|
// FIXME: we do not currently set a target_abi for softfloat targets here, but we
|
||||||
// probably should, so we already allow it.
|
// probably should, so we already allow it.
|
||||||
// FIXME: Ensure that target_abi = "x32" correlates with actually using that ABI.
|
// FIXME: Ensure that target_abi = "x32" correlates with actually using that ABI.
|
||||||
// Do any of the others need a similar check?
|
// Do any of the others need a similar check?
|
||||||
check_matches!(
|
check_matches!(
|
||||||
(&self.rustc_abi, &self.abi),
|
(&self.rustc_abi, &self.cfg_abi),
|
||||||
(Some(RustcAbi::Softfloat), Abi::SoftFloat | Abi::Unspecified | Abi::Other(_))
|
(
|
||||||
| (
|
Some(RustcAbi::Softfloat),
|
||||||
None,
|
CfgAbi::SoftFloat | CfgAbi::Unspecified | CfgAbi::Other(_)
|
||||||
Abi::X32
|
) | (
|
||||||
| Abi::Llvm
|
None,
|
||||||
| Abi::Fortanix
|
CfgAbi::X32
|
||||||
| Abi::Uwp
|
| CfgAbi::Llvm
|
||||||
| Abi::MacAbi
|
| CfgAbi::Fortanix
|
||||||
| Abi::Sim
|
| CfgAbi::Uwp
|
||||||
| Abi::Unspecified
|
| CfgAbi::MacAbi
|
||||||
| Abi::Other(_)
|
| CfgAbi::Sim
|
||||||
),
|
| CfgAbi::Unspecified
|
||||||
|
| CfgAbi::Other(_)
|
||||||
|
),
|
||||||
"invalid x86-64 Rust-specific ABI and `cfg(target_abi)` combination:\n\
|
"invalid x86-64 Rust-specific ABI and `cfg(target_abi)` combination:\n\
|
||||||
Rust-specific ABI: {:?}\n\
|
Rust-specific ABI: {:?}\n\
|
||||||
cfg(target_abi): {}",
|
cfg(target_abi): {}",
|
||||||
self.rustc_abi,
|
self.rustc_abi,
|
||||||
self.abi,
|
self.cfg_abi,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Arch::RiscV32 => {
|
Arch::RiscV32 => {
|
||||||
check!(self.llvm_floatabi.is_none(), "`llvm_floatabi` is unused on RISC-V");
|
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!(self.rustc_abi.is_none(), "`rustc_abi` is unused on RISC-V");
|
||||||
check_matches!(
|
check_matches!(
|
||||||
(&*self.llvm_abiname, &self.abi),
|
(&self.llvm_abiname, &self.cfg_abi),
|
||||||
("ilp32", Abi::Unspecified | Abi::Other(_))
|
(LlvmAbi::Ilp32, CfgAbi::Unspecified | CfgAbi::Other(_))
|
||||||
| ("ilp32f", Abi::Unspecified | Abi::Other(_))
|
| (LlvmAbi::Ilp32f, CfgAbi::Unspecified | CfgAbi::Other(_))
|
||||||
| ("ilp32d", Abi::Unspecified | Abi::Other(_))
|
| (LlvmAbi::Ilp32d, CfgAbi::Unspecified | CfgAbi::Other(_))
|
||||||
| ("ilp32e", Abi::Ilp32e),
|
| (LlvmAbi::Ilp32e, CfgAbi::Ilp32e),
|
||||||
"invalid RISC-V ABI name and `cfg(target_abi)` combination:\n\
|
"invalid RISC-V ABI name and `cfg(target_abi)` combination:\n\
|
||||||
ABI name: {}\n\
|
ABI name: {}\n\
|
||||||
cfg(target_abi): {}",
|
cfg(target_abi): {}",
|
||||||
self.llvm_abiname,
|
self.llvm_abiname,
|
||||||
self.abi,
|
self.cfg_abi,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Arch::RiscV64 => {
|
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.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!(self.rustc_abi.is_none(), "`rustc_abi` is unused on RISC-V");
|
||||||
check_matches!(
|
check_matches!(
|
||||||
(&*self.llvm_abiname, &self.abi),
|
(&self.llvm_abiname, &self.cfg_abi),
|
||||||
("lp64", Abi::Unspecified | Abi::Other(_))
|
(LlvmAbi::Lp64, CfgAbi::Unspecified | CfgAbi::Other(_))
|
||||||
| ("lp64f", Abi::Unspecified | Abi::Other(_))
|
| (LlvmAbi::Lp64f, CfgAbi::Unspecified | CfgAbi::Other(_))
|
||||||
| ("lp64d", Abi::Unspecified | Abi::Other(_))
|
| (LlvmAbi::Lp64d, CfgAbi::Unspecified | CfgAbi::Other(_))
|
||||||
| ("lp64e", Abi::Unspecified | Abi::Other(_)),
|
| (LlvmAbi::Lp64e, CfgAbi::Unspecified | CfgAbi::Other(_)),
|
||||||
"invalid RISC-V ABI name and `cfg(target_abi)` combination:\n\
|
"invalid RISC-V ABI name and `cfg(target_abi)` combination:\n\
|
||||||
ABI name: {}\n\
|
ABI name: {}\n\
|
||||||
cfg(target_abi): {}",
|
cfg(target_abi): {}",
|
||||||
self.llvm_abiname,
|
self.llvm_abiname,
|
||||||
self.abi,
|
self.cfg_abi,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Arch::Arm => {
|
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!(self.rustc_abi.is_none(), "`rustc_abi` is unused on ARM");
|
||||||
check_matches!(
|
check_matches!(
|
||||||
(&self.llvm_floatabi, &self.abi),
|
(&self.llvm_floatabi, &self.cfg_abi),
|
||||||
(
|
(
|
||||||
Some(FloatAbi::Hard),
|
Some(FloatAbi::Hard),
|
||||||
Abi::EabiHf | Abi::Uwp | Abi::Unspecified | Abi::Other(_)
|
CfgAbi::EabiHf | CfgAbi::Uwp | CfgAbi::Unspecified | CfgAbi::Other(_)
|
||||||
) | (Some(FloatAbi::Soft), Abi::Eabi),
|
) | (Some(FloatAbi::Soft), CfgAbi::Eabi),
|
||||||
"Invalid combination of float ABI and `cfg(target_abi)` for ARM target\n\
|
"Invalid combination of float ABI and `cfg(target_abi)` for ARM target\n\
|
||||||
float ABI: {:?}\n\
|
float ABI: {:?}\n\
|
||||||
cfg(target_abi): {}",
|
cfg(target_abi): {}",
|
||||||
self.llvm_floatabi,
|
self.llvm_floatabi,
|
||||||
self.abi,
|
self.cfg_abi,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
Arch::AArch64 => {
|
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");
|
check!(self.llvm_floatabi.is_none(), "`llvm_floatabi` is unused on aarch64");
|
||||||
// FIXME: Ensure that target_abi = "ilp32" correlates with actually using that ABI.
|
// FIXME: Ensure that target_abi = "ilp32" correlates with actually using that ABI.
|
||||||
// Do any of the others need a similar check?
|
// Do any of the others need a similar check?
|
||||||
check_matches!(
|
check_matches!(
|
||||||
(&self.rustc_abi, &self.abi),
|
(&self.rustc_abi, &self.cfg_abi),
|
||||||
(Some(RustcAbi::Softfloat), Abi::SoftFloat)
|
(Some(RustcAbi::Softfloat), CfgAbi::SoftFloat)
|
||||||
| (
|
| (
|
||||||
None,
|
None,
|
||||||
Abi::Ilp32
|
CfgAbi::Ilp32
|
||||||
| Abi::Llvm
|
| CfgAbi::Llvm
|
||||||
| Abi::MacAbi
|
| CfgAbi::MacAbi
|
||||||
| Abi::Sim
|
| CfgAbi::Sim
|
||||||
| Abi::Uwp
|
| CfgAbi::Uwp
|
||||||
| Abi::Unspecified
|
| CfgAbi::Unspecified
|
||||||
| Abi::Other(_)
|
| CfgAbi::Other(_)
|
||||||
),
|
),
|
||||||
"invalid aarch64 Rust-specific ABI and `cfg(target_abi)` combination:\n\
|
"invalid aarch64 Rust-specific ABI and `cfg(target_abi)` combination:\n\
|
||||||
Rust-specific ABI: {:?}\n\
|
Rust-specific ABI: {:?}\n\
|
||||||
cfg(target_abi): {}",
|
cfg(target_abi): {}",
|
||||||
self.rustc_abi,
|
self.rustc_abi,
|
||||||
self.abi,
|
self.cfg_abi,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Arch::PowerPC => {
|
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.llvm_floatabi.is_none(), "`llvm_floatabi` is unused on PowerPC");
|
||||||
check!(self.rustc_abi.is_none(), "`rustc_abi` 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
|
// FIXME: Check that `target_abi` matches the actually configured ABI (with or
|
||||||
// without SPE).
|
// without SPE).
|
||||||
check_matches!(
|
check_matches!(
|
||||||
self.abi,
|
self.cfg_abi,
|
||||||
Abi::Spe | Abi::Unspecified | Abi::Other(_),
|
CfgAbi::Spe | CfgAbi::Unspecified | CfgAbi::Other(_),
|
||||||
"invalid `target_abi` for PowerPC"
|
"invalid `target_abi` for PowerPC"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -3328,116 +3407,123 @@ macro_rules! check_matches {
|
|||||||
// FIXME: Check that `target_abi` matches the actually configured ABI
|
// FIXME: Check that `target_abi` matches the actually configured ABI
|
||||||
// (vec-default vs vec-ext).
|
// (vec-default vs vec-ext).
|
||||||
check_matches!(
|
check_matches!(
|
||||||
(&*self.llvm_abiname, &self.abi),
|
(&self.llvm_abiname, &self.cfg_abi),
|
||||||
("", Abi::VecDefault | Abi::VecExtAbi),
|
(LlvmAbi::Unspecified, CfgAbi::VecDefault | CfgAbi::VecExtAbi),
|
||||||
"invalid PowerPC64 AIX ABI name and `cfg(target_abi)` combination:\n\
|
"invalid PowerPC64 AIX ABI name and `cfg(target_abi)` combination:\n\
|
||||||
ABI name: {}\n\
|
ABI name: {}\n\
|
||||||
cfg(target_abi): {}",
|
cfg(target_abi): {}",
|
||||||
self.llvm_abiname,
|
self.llvm_abiname,
|
||||||
self.abi,
|
self.cfg_abi,
|
||||||
);
|
);
|
||||||
} else if self.endian == Endian::Big {
|
} else if self.endian == Endian::Big {
|
||||||
check_matches!(
|
check_matches!(
|
||||||
(&*self.llvm_abiname, &self.abi),
|
(&self.llvm_abiname, &self.cfg_abi),
|
||||||
("elfv1", Abi::ElfV1) | ("elfv2", Abi::ElfV2),
|
(LlvmAbi::ElfV1, CfgAbi::ElfV1) | (LlvmAbi::ElfV2, CfgAbi::ElfV2),
|
||||||
"invalid PowerPC64 big-endian ABI name and `cfg(target_abi)` combination:\n\
|
"invalid PowerPC64 big-endian ABI name and `cfg(target_abi)` combination:\n\
|
||||||
ABI name: {}\n\
|
ABI name: {}\n\
|
||||||
cfg(target_abi): {}",
|
cfg(target_abi): {}",
|
||||||
self.llvm_abiname,
|
self.llvm_abiname,
|
||||||
self.abi,
|
self.cfg_abi,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
check_matches!(
|
check_matches!(
|
||||||
(&*self.llvm_abiname, &self.abi),
|
(&self.llvm_abiname, &self.cfg_abi),
|
||||||
("elfv2", Abi::ElfV2),
|
(LlvmAbi::ElfV2, CfgAbi::ElfV2),
|
||||||
"invalid PowerPC64 little-endian ABI name and `cfg(target_abi)` combination:\n\
|
"invalid PowerPC64 little-endian ABI name and `cfg(target_abi)` combination:\n\
|
||||||
ABI name: {}\n\
|
ABI name: {}\n\
|
||||||
cfg(target_abi): {}",
|
cfg(target_abi): {}",
|
||||||
self.llvm_abiname,
|
self.llvm_abiname,
|
||||||
self.abi,
|
self.cfg_abi,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Arch::S390x => {
|
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!(self.llvm_floatabi.is_none(), "`llvm_floatabi` is unused on s390x");
|
||||||
check_matches!(
|
check_matches!(
|
||||||
(&self.rustc_abi, &self.abi),
|
(&self.rustc_abi, &self.cfg_abi),
|
||||||
(Some(RustcAbi::Softfloat), Abi::SoftFloat)
|
(Some(RustcAbi::Softfloat), CfgAbi::SoftFloat)
|
||||||
| (None, Abi::Unspecified | Abi::Other(_)),
|
| (None, CfgAbi::Unspecified | CfgAbi::Other(_)),
|
||||||
"invalid s390x Rust-specific ABI and `cfg(target_abi)` combination:\n\
|
"invalid s390x Rust-specific ABI and `cfg(target_abi)` combination:\n\
|
||||||
Rust-specific ABI: {:?}\n\
|
Rust-specific ABI: {:?}\n\
|
||||||
cfg(target_abi): {}",
|
cfg(target_abi): {}",
|
||||||
self.rustc_abi,
|
self.rustc_abi,
|
||||||
self.abi,
|
self.cfg_abi,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Arch::LoongArch32 => {
|
Arch::LoongArch32 => {
|
||||||
check!(self.llvm_floatabi.is_none(), "`llvm_floatabi` is unused on LoongArch");
|
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!(self.rustc_abi.is_none(), "`rustc_abi` is unused on LoongArch");
|
||||||
check_matches!(
|
check_matches!(
|
||||||
(&*self.llvm_abiname, &self.abi),
|
(&self.llvm_abiname, &self.cfg_abi),
|
||||||
("ilp32s", Abi::SoftFloat)
|
(LlvmAbi::Ilp32s, CfgAbi::SoftFloat)
|
||||||
| ("ilp32f", Abi::Unspecified | Abi::Other(_))
|
| (LlvmAbi::Ilp32f, CfgAbi::Unspecified | CfgAbi::Other(_))
|
||||||
| ("ilp32d", Abi::Unspecified | Abi::Other(_)),
|
| (LlvmAbi::Ilp32d, CfgAbi::Unspecified | CfgAbi::Other(_)),
|
||||||
"invalid LoongArch ABI name and `cfg(target_abi)` combination:\n\
|
"invalid LoongArch ABI name and `cfg(target_abi)` combination:\n\
|
||||||
ABI name: {}\n\
|
ABI name: {}\n\
|
||||||
cfg(target_abi): {}",
|
cfg(target_abi): {}",
|
||||||
self.llvm_abiname,
|
self.llvm_abiname,
|
||||||
self.abi,
|
self.cfg_abi,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Arch::LoongArch64 => {
|
Arch::LoongArch64 => {
|
||||||
check!(self.llvm_floatabi.is_none(), "`llvm_floatabi` is unused on LoongArch");
|
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!(self.rustc_abi.is_none(), "`rustc_abi` is unused on LoongArch");
|
||||||
check_matches!(
|
check_matches!(
|
||||||
(&*self.llvm_abiname, &self.abi),
|
(&self.llvm_abiname, &self.cfg_abi),
|
||||||
("lp64s", Abi::SoftFloat)
|
(LlvmAbi::Lp64s, CfgAbi::SoftFloat)
|
||||||
| ("lp64f", Abi::Unspecified | Abi::Other(_))
|
| (LlvmAbi::Lp64f, CfgAbi::Unspecified | CfgAbi::Other(_))
|
||||||
| ("lp64d", Abi::Unspecified | Abi::Other(_)),
|
| (LlvmAbi::Lp64d, CfgAbi::Unspecified | CfgAbi::Other(_)),
|
||||||
"invalid LoongArch ABI name and `cfg(target_abi)` combination:\n\
|
"invalid LoongArch ABI name and `cfg(target_abi)` combination:\n\
|
||||||
ABI name: {}\n\
|
ABI name: {}\n\
|
||||||
cfg(target_abi): {}",
|
cfg(target_abi): {}",
|
||||||
self.llvm_abiname,
|
self.llvm_abiname,
|
||||||
self.abi,
|
self.cfg_abi,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Arch::Mips | Arch::Mips32r6 => {
|
Arch::Mips | Arch::Mips32r6 => {
|
||||||
check!(self.llvm_floatabi.is_none(), "`llvm_floatabi` is unused on MIPS");
|
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!(self.rustc_abi.is_none(), "`rustc_abi` is unused on MIPS");
|
||||||
check_matches!(
|
check_matches!(
|
||||||
(&*self.llvm_abiname, &self.abi),
|
(&self.llvm_abiname, &self.cfg_abi),
|
||||||
("o32", Abi::Unspecified | Abi::Other(_)),
|
(LlvmAbi::O32, CfgAbi::Unspecified | CfgAbi::Other(_)),
|
||||||
"invalid MIPS ABI name and `cfg(target_abi)` combination:\n\
|
"invalid MIPS ABI name and `cfg(target_abi)` combination:\n\
|
||||||
ABI name: {}\n\
|
ABI name: {}\n\
|
||||||
cfg(target_abi): {}",
|
cfg(target_abi): {}",
|
||||||
self.llvm_abiname,
|
self.llvm_abiname,
|
||||||
self.abi,
|
self.cfg_abi,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Arch::Mips64 | Arch::Mips64r6 => {
|
Arch::Mips64 | Arch::Mips64r6 => {
|
||||||
check!(self.llvm_floatabi.is_none(), "`llvm_floatabi` is unused on MIPS");
|
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!(self.rustc_abi.is_none(), "`rustc_abi` is unused on MIPS");
|
||||||
check_matches!(
|
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
|
// No in-tree targets use "n32" but at least for now we let out-of-tree targets
|
||||||
// experiment with that.
|
// 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\
|
"invalid MIPS ABI name and `cfg(target_abi)` combination:\n\
|
||||||
ABI name: {}\n\
|
ABI name: {}\n\
|
||||||
cfg(target_abi): {}",
|
cfg(target_abi): {}",
|
||||||
self.llvm_abiname,
|
self.llvm_abiname,
|
||||||
self.abi,
|
self.cfg_abi,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Arch::CSky => {
|
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.llvm_floatabi.is_none(), "`llvm_floatabi` is unused on CSky");
|
||||||
check!(self.rustc_abi.is_none(), "`rustc_abi` 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).
|
// FIXME: Check that `target_abi` matches the actually configured ABI (v2 vs v2hf).
|
||||||
check_matches!(
|
check_matches!(
|
||||||
self.abi,
|
self.cfg_abi,
|
||||||
Abi::AbiV2 | Abi::AbiV2Hf,
|
CfgAbi::AbiV2 | CfgAbi::AbiV2Hf,
|
||||||
"invalid `target_abi` for CSky"
|
"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
|
// Ensure consistency among built-in targets, but give JSON targets the opportunity
|
||||||
// to experiment with these.
|
// to experiment with these.
|
||||||
if kind == TargetKind::Builtin {
|
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!(self.llvm_floatabi.is_none(), "`llvm_floatabi` is unused on {arch}");
|
||||||
check_matches!(
|
check_matches!(
|
||||||
self.abi,
|
self.cfg_abi,
|
||||||
Abi::Unspecified | Abi::Other(_),
|
CfgAbi::Unspecified | CfgAbi::Other(_),
|
||||||
"`target_abi` is unused on {arch}"
|
"`target_abi` is unused on {arch}"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -3665,7 +3754,7 @@ pub fn object_architecture(
|
|||||||
// it using a custom target specification. N32
|
// it using a custom target specification. N32
|
||||||
// is an ILP32 ABI like the Aarch64_Ilp32
|
// is an ILP32 ABI like the Aarch64_Ilp32
|
||||||
// and X86_64_X32 cases above and below this one.
|
// 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
|
Architecture::Mips64_N32
|
||||||
} else {
|
} else {
|
||||||
Architecture::Mips64
|
Architecture::Mips64
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use rustc_abi::Endian;
|
use rustc_abi::Endian;
|
||||||
|
|
||||||
use crate::spec::{
|
use crate::spec::{
|
||||||
Abi, Arch, FramePointer, StackProbeType, Target, TargetMetadata, TargetOptions, base,
|
Arch, CfgAbi, FramePointer, StackProbeType, Target, TargetMetadata, TargetOptions, base,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub(crate) fn target() -> Target {
|
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(),
|
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,
|
arch: Arch::AArch64,
|
||||||
options: TargetOptions {
|
options: TargetOptions {
|
||||||
abi: Abi::Ilp32,
|
cfg_abi: CfgAbi::Ilp32,
|
||||||
features: "+v8a,+outline-atomics".into(),
|
features: "+v8a,+outline-atomics".into(),
|
||||||
// the AAPCS64 expects use of non-leaf frame pointers per
|
// 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
|
// https://github.com/ARM-software/abi-aa/blob/4492d1570eb70c8fd146623e0db65b2d241f12e7/aapcs64/aapcs64.rst#the-frame-pointer
|
||||||
|
|||||||
@@ -8,13 +8,13 @@
|
|||||||
use rustc_abi::Endian;
|
use rustc_abi::Endian;
|
||||||
|
|
||||||
use crate::spec::{
|
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,
|
StackProbeType, Target, TargetMetadata, TargetOptions,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub(crate) fn target() -> Target {
|
pub(crate) fn target() -> Target {
|
||||||
let opts = TargetOptions {
|
let opts = TargetOptions {
|
||||||
abi: Abi::SoftFloat,
|
cfg_abi: CfgAbi::SoftFloat,
|
||||||
rustc_abi: Some(RustcAbi::Softfloat),
|
rustc_abi: Some(RustcAbi::Softfloat),
|
||||||
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
|
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
|
||||||
linker: Some("rust-lld".into()),
|
linker: Some("rust-lld".into()),
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
use crate::spec::{
|
use crate::spec::{
|
||||||
Abi, Arch, FramePointer, StackProbeType, Target, TargetMetadata, TargetOptions, base,
|
Arch, CfgAbi, FramePointer, StackProbeType, Target, TargetMetadata, TargetOptions, base,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub(crate) fn target() -> Target {
|
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(),
|
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,
|
arch: Arch::AArch64,
|
||||||
options: TargetOptions {
|
options: TargetOptions {
|
||||||
abi: Abi::Ilp32,
|
cfg_abi: CfgAbi::Ilp32,
|
||||||
features: "+v8a,+outline-atomics".into(),
|
features: "+v8a,+outline-atomics".into(),
|
||||||
// the AAPCS64 expects use of non-leaf frame pointers per
|
// 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
|
// 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`.
|
// For example, `-C target-cpu=cortex-a53`.
|
||||||
|
|
||||||
use crate::spec::{
|
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,
|
StackProbeType, Target, TargetMetadata, TargetOptions,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub(crate) fn target() -> Target {
|
pub(crate) fn target() -> Target {
|
||||||
let opts = TargetOptions {
|
let opts = TargetOptions {
|
||||||
abi: Abi::SoftFloat,
|
cfg_abi: CfgAbi::SoftFloat,
|
||||||
rustc_abi: Some(RustcAbi::Softfloat),
|
rustc_abi: Some(RustcAbi::Softfloat),
|
||||||
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
|
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
|
||||||
linker: Some("rust-lld".into()),
|
linker: Some("rust-lld".into()),
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
use crate::spec::{
|
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,
|
StackProbeType, Target, TargetMetadata, TargetOptions,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub(crate) fn target() -> Target {
|
pub(crate) fn target() -> Target {
|
||||||
let opts = TargetOptions {
|
let opts = TargetOptions {
|
||||||
abi: Abi::SoftFloat,
|
cfg_abi: CfgAbi::SoftFloat,
|
||||||
rustc_abi: Some(RustcAbi::Softfloat),
|
rustc_abi: Some(RustcAbi::Softfloat),
|
||||||
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
|
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
|
||||||
linker: Some("rust-lld".into()),
|
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 {
|
pub(crate) fn target() -> 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(),
|
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
|
||||||
arch: Arch::Arm,
|
arch: Arch::Arm,
|
||||||
options: TargetOptions {
|
options: TargetOptions {
|
||||||
abi: Abi::Eabi,
|
cfg_abi: CfgAbi::Eabi,
|
||||||
llvm_floatabi: Some(FloatAbi::Soft),
|
llvm_floatabi: Some(FloatAbi::Soft),
|
||||||
// https://developer.android.com/ndk/guides/abis.html#armeabi
|
// https://developer.android.com/ndk/guides/abis.html#armeabi
|
||||||
features: "+strict-align,+v5te".into(),
|
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 {
|
pub(crate) fn target() -> 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(),
|
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
|
||||||
arch: Arch::Arm,
|
arch: Arch::Arm,
|
||||||
options: TargetOptions {
|
options: TargetOptions {
|
||||||
abi: Abi::Eabi,
|
cfg_abi: CfgAbi::Eabi,
|
||||||
llvm_floatabi: Some(FloatAbi::Soft),
|
llvm_floatabi: Some(FloatAbi::Soft),
|
||||||
features: "+strict-align,+v6".into(),
|
features: "+strict-align,+v6".into(),
|
||||||
max_atomic_width: Some(64),
|
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 {
|
pub(crate) fn target() -> 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(),
|
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
|
||||||
arch: Arch::Arm,
|
arch: Arch::Arm,
|
||||||
options: TargetOptions {
|
options: TargetOptions {
|
||||||
abi: Abi::EabiHf,
|
cfg_abi: CfgAbi::EabiHf,
|
||||||
llvm_floatabi: Some(FloatAbi::Hard),
|
llvm_floatabi: Some(FloatAbi::Hard),
|
||||||
features: "+strict-align,+v6,+vfp2".into(),
|
features: "+strict-align,+v6,+vfp2".into(),
|
||||||
max_atomic_width: Some(64),
|
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 {
|
pub(crate) fn target() -> 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(),
|
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
|
||||||
arch: Arch::Arm,
|
arch: Arch::Arm,
|
||||||
options: TargetOptions {
|
options: TargetOptions {
|
||||||
abi: Abi::Eabi,
|
cfg_abi: CfgAbi::Eabi,
|
||||||
llvm_floatabi: Some(FloatAbi::Soft),
|
llvm_floatabi: Some(FloatAbi::Soft),
|
||||||
// Most of these settings are copied from the arm_unknown_linux_gnueabi
|
// Most of these settings are copied from the arm_unknown_linux_gnueabi
|
||||||
// target.
|
// 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 {
|
pub(crate) fn target() -> 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(),
|
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
|
||||||
arch: Arch::Arm,
|
arch: Arch::Arm,
|
||||||
options: TargetOptions {
|
options: TargetOptions {
|
||||||
abi: Abi::EabiHf,
|
cfg_abi: CfgAbi::EabiHf,
|
||||||
llvm_floatabi: Some(FloatAbi::Hard),
|
llvm_floatabi: Some(FloatAbi::Hard),
|
||||||
// Most of these settings are copied from the arm_unknown_linux_gnueabihf
|
// Most of these settings are copied from the arm_unknown_linux_gnueabihf
|
||||||
// target.
|
// target.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
use rustc_abi::Endian;
|
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 {
|
pub(crate) fn target() -> 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(),
|
data_layout: "E-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
|
||||||
arch: Arch::Arm,
|
arch: Arch::Arm,
|
||||||
options: TargetOptions {
|
options: TargetOptions {
|
||||||
abi: Abi::Eabi,
|
cfg_abi: CfgAbi::Eabi,
|
||||||
llvm_floatabi: Some(FloatAbi::Soft),
|
llvm_floatabi: Some(FloatAbi::Soft),
|
||||||
features: "+strict-align,+v8,+crc".into(),
|
features: "+strict-align,+v8,+crc".into(),
|
||||||
endian: Endian::Big,
|
endian: Endian::Big,
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
use rustc_abi::Endian;
|
use rustc_abi::Endian;
|
||||||
|
|
||||||
use crate::spec::{
|
use crate::spec::{
|
||||||
Abi, Arch, Cc, FloatAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata,
|
Arch, Cc, CfgAbi, FloatAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target,
|
||||||
TargetOptions,
|
TargetMetadata, TargetOptions,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub(crate) fn target() -> Target {
|
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(),
|
data_layout: "E-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
|
||||||
arch: Arch::Arm,
|
arch: Arch::Arm,
|
||||||
options: TargetOptions {
|
options: TargetOptions {
|
||||||
abi: Abi::Eabi,
|
cfg_abi: CfgAbi::Eabi,
|
||||||
llvm_floatabi: Some(FloatAbi::Soft),
|
llvm_floatabi: Some(FloatAbi::Soft),
|
||||||
endian: Endian::Big,
|
endian: Endian::Big,
|
||||||
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
|
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
use rustc_abi::Endian;
|
use rustc_abi::Endian;
|
||||||
|
|
||||||
use crate::spec::{
|
use crate::spec::{
|
||||||
Abi, Arch, Cc, FloatAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata,
|
Arch, Cc, CfgAbi, FloatAbi, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target,
|
||||||
TargetOptions,
|
TargetMetadata, TargetOptions,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub(crate) fn target() -> Target {
|
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(),
|
data_layout: "E-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
|
||||||
arch: Arch::Arm,
|
arch: Arch::Arm,
|
||||||
options: TargetOptions {
|
options: TargetOptions {
|
||||||
abi: Abi::EabiHf,
|
cfg_abi: CfgAbi::EabiHf,
|
||||||
llvm_floatabi: Some(FloatAbi::Hard),
|
llvm_floatabi: Some(FloatAbi::Hard),
|
||||||
endian: Endian::Big,
|
endian: Endian::Big,
|
||||||
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
|
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
//! The default link script is very likely wrong, so you should use
|
//! 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.
|
//! `-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 {
|
pub(crate) fn target() -> Target {
|
||||||
Target {
|
Target {
|
||||||
@@ -24,7 +24,7 @@ pub(crate) fn target() -> Target {
|
|||||||
arch: Arch::Arm,
|
arch: Arch::Arm,
|
||||||
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
|
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
|
||||||
options: TargetOptions {
|
options: TargetOptions {
|
||||||
abi: Abi::Eabi,
|
cfg_abi: CfgAbi::Eabi,
|
||||||
llvm_floatabi: Some(FloatAbi::Soft),
|
llvm_floatabi: Some(FloatAbi::Soft),
|
||||||
asm_args: cvs!["-mthumb-interwork", "-march=armv4t", "-mlittle-endian",],
|
asm_args: cvs!["-mthumb-interwork", "-march=armv4t", "-mlittle-endian",],
|
||||||
features: "+soft-float,+strict-align".into(),
|
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 {
|
pub(crate) fn target() -> 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(),
|
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
|
||||||
arch: Arch::Arm,
|
arch: Arch::Arm,
|
||||||
options: TargetOptions {
|
options: TargetOptions {
|
||||||
abi: Abi::Eabi,
|
cfg_abi: CfgAbi::Eabi,
|
||||||
llvm_floatabi: Some(FloatAbi::Soft),
|
llvm_floatabi: Some(FloatAbi::Soft),
|
||||||
features: "+soft-float,+strict-align".into(),
|
features: "+soft-float,+strict-align".into(),
|
||||||
// Atomic operations provided by compiler-builtins
|
// Atomic operations provided by compiler-builtins
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
//! Targets the ARMv5TE architecture, with `a32` code by default.
|
//! 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 {
|
pub(crate) fn target() -> Target {
|
||||||
Target {
|
Target {
|
||||||
@@ -15,7 +15,7 @@ pub(crate) fn target() -> Target {
|
|||||||
arch: Arch::Arm,
|
arch: Arch::Arm,
|
||||||
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
|
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
|
||||||
options: TargetOptions {
|
options: TargetOptions {
|
||||||
abi: Abi::Eabi,
|
cfg_abi: CfgAbi::Eabi,
|
||||||
llvm_floatabi: Some(FloatAbi::Soft),
|
llvm_floatabi: Some(FloatAbi::Soft),
|
||||||
asm_args: cvs!["-mthumb-interwork", "-march=armv5te", "-mlittle-endian",],
|
asm_args: cvs!["-mthumb-interwork", "-march=armv5te", "-mlittle-endian",],
|
||||||
features: "+soft-float,+strict-align".into(),
|
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 {
|
pub(crate) fn target() -> 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(),
|
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
|
||||||
arch: Arch::Arm,
|
arch: Arch::Arm,
|
||||||
options: TargetOptions {
|
options: TargetOptions {
|
||||||
abi: Abi::Eabi,
|
cfg_abi: CfgAbi::Eabi,
|
||||||
llvm_floatabi: Some(FloatAbi::Soft),
|
llvm_floatabi: Some(FloatAbi::Soft),
|
||||||
features: "+soft-float,+strict-align".into(),
|
features: "+soft-float,+strict-align".into(),
|
||||||
// Atomic operations provided by compiler-builtins
|
// 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 {
|
pub(crate) fn target() -> 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(),
|
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
|
||||||
arch: Arch::Arm,
|
arch: Arch::Arm,
|
||||||
options: TargetOptions {
|
options: TargetOptions {
|
||||||
abi: Abi::Eabi,
|
cfg_abi: CfgAbi::Eabi,
|
||||||
llvm_floatabi: Some(FloatAbi::Soft),
|
llvm_floatabi: Some(FloatAbi::Soft),
|
||||||
features: "+soft-float,+strict-align".into(),
|
features: "+soft-float,+strict-align".into(),
|
||||||
// Atomic operations provided by compiler-builtins
|
// 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 {
|
pub(crate) fn target() -> 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(),
|
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
|
||||||
arch: Arch::Arm,
|
arch: Arch::Arm,
|
||||||
options: TargetOptions {
|
options: TargetOptions {
|
||||||
abi: Abi::Eabi,
|
cfg_abi: CfgAbi::Eabi,
|
||||||
llvm_floatabi: Some(FloatAbi::Soft),
|
llvm_floatabi: Some(FloatAbi::Soft),
|
||||||
features: "+soft-float,+strict-align".into(),
|
features: "+soft-float,+strict-align".into(),
|
||||||
// Atomic operations provided by compiler-builtins
|
// Atomic operations provided by compiler-builtins
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
//! Targets the ARMv6K architecture, with `a32` code by default.
|
//! 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 {
|
pub(crate) fn target() -> Target {
|
||||||
Target {
|
Target {
|
||||||
@@ -15,7 +15,7 @@ pub(crate) fn target() -> Target {
|
|||||||
arch: Arch::Arm,
|
arch: Arch::Arm,
|
||||||
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
|
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
|
||||||
options: TargetOptions {
|
options: TargetOptions {
|
||||||
abi: Abi::Eabi,
|
cfg_abi: CfgAbi::Eabi,
|
||||||
llvm_floatabi: Some(FloatAbi::Soft),
|
llvm_floatabi: Some(FloatAbi::Soft),
|
||||||
asm_args: cvs!["-mthumb-interwork", "-march=armv6", "-mlittle-endian",],
|
asm_args: cvs!["-mthumb-interwork", "-march=armv6", "-mlittle-endian",],
|
||||||
features: "+soft-float,+strict-align,+v6k".into(),
|
features: "+soft-float,+strict-align,+v6k".into(),
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
//! Targets the ARMv6K architecture, with `a32` code by default, and hard-float ABI
|
//! 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 {
|
pub(crate) fn target() -> Target {
|
||||||
Target {
|
Target {
|
||||||
@@ -15,7 +15,7 @@ pub(crate) fn target() -> Target {
|
|||||||
arch: Arch::Arm,
|
arch: Arch::Arm,
|
||||||
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
|
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
|
||||||
options: TargetOptions {
|
options: TargetOptions {
|
||||||
abi: Abi::EabiHf,
|
cfg_abi: CfgAbi::EabiHf,
|
||||||
llvm_floatabi: Some(FloatAbi::Hard),
|
llvm_floatabi: Some(FloatAbi::Hard),
|
||||||
asm_args: cvs!["-mthumb-interwork", "-march=armv6", "-mlittle-endian",],
|
asm_args: cvs!["-mthumb-interwork", "-march=armv6", "-mlittle-endian",],
|
||||||
features: "+strict-align,+v6k,+vfp2,-d32".into(),
|
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 {
|
pub(crate) fn target() -> 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(),
|
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
|
||||||
arch: Arch::Arm,
|
arch: Arch::Arm,
|
||||||
options: TargetOptions {
|
options: TargetOptions {
|
||||||
abi: Abi::EabiHf,
|
cfg_abi: CfgAbi::EabiHf,
|
||||||
llvm_floatabi: Some(FloatAbi::Hard),
|
llvm_floatabi: Some(FloatAbi::Hard),
|
||||||
features: "+v6,+vfp2".into(),
|
features: "+v6,+vfp2".into(),
|
||||||
max_atomic_width: Some(64),
|
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 {
|
pub(crate) fn target() -> 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(),
|
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
|
||||||
arch: Arch::Arm,
|
arch: Arch::Arm,
|
||||||
options: TargetOptions {
|
options: TargetOptions {
|
||||||
abi: Abi::EabiHf,
|
cfg_abi: CfgAbi::EabiHf,
|
||||||
llvm_floatabi: Some(FloatAbi::Hard),
|
llvm_floatabi: Some(FloatAbi::Hard),
|
||||||
features: "+v6,+vfp2".into(),
|
features: "+v6,+vfp2".into(),
|
||||||
max_atomic_width: Some(64),
|
max_atomic_width: Some(64),
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
use crate::spec::{
|
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,
|
TargetOptions, cvs,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@ pub(crate) fn target() -> Target {
|
|||||||
env: Env::Newlib,
|
env: Env::Newlib,
|
||||||
vendor: "nintendo".into(),
|
vendor: "nintendo".into(),
|
||||||
cpu: "mpcore".into(),
|
cpu: "mpcore".into(),
|
||||||
abi: Abi::EabiHf,
|
cfg_abi: CfgAbi::EabiHf,
|
||||||
llvm_floatabi: Some(FloatAbi::Hard),
|
llvm_floatabi: Some(FloatAbi::Hard),
|
||||||
families: cvs!["unix"],
|
families: cvs!["unix"],
|
||||||
linker: Some("arm-none-eabi-gcc".into()),
|
linker: Some("arm-none-eabi-gcc".into()),
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
use crate::spec::{
|
use crate::spec::{
|
||||||
Abi, Arch, Cc, FloatAbi, LinkerFlavor, Lld, SanitizerSet, Target, TargetMetadata,
|
Arch, Cc, CfgAbi, FloatAbi, LinkerFlavor, Lld, SanitizerSet, Target, TargetMetadata,
|
||||||
TargetOptions, base,
|
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(),
|
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
|
||||||
arch: Arch::Arm,
|
arch: Arch::Arm,
|
||||||
options: TargetOptions {
|
options: TargetOptions {
|
||||||
abi: Abi::Eabi,
|
cfg_abi: CfgAbi::Eabi,
|
||||||
llvm_floatabi: Some(FloatAbi::Soft),
|
llvm_floatabi: Some(FloatAbi::Soft),
|
||||||
features: "+v7,+thumb-mode,+thumb2,+vfp3d16,-neon".into(),
|
features: "+v7,+thumb-mode,+thumb2,+vfp3d16,-neon".into(),
|
||||||
supported_sanitizers: SanitizerSet::ADDRESS,
|
supported_sanitizers: SanitizerSet::ADDRESS,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
use crate::spec::{
|
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,
|
TargetMetadata, TargetOptions, cvs,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -19,7 +19,7 @@ pub(crate) fn target() -> Target {
|
|||||||
options: TargetOptions {
|
options: TargetOptions {
|
||||||
os: Os::Rtems,
|
os: Os::Rtems,
|
||||||
families: cvs!["unix"],
|
families: cvs!["unix"],
|
||||||
abi: Abi::EabiHf,
|
cfg_abi: CfgAbi::EabiHf,
|
||||||
llvm_floatabi: Some(FloatAbi::Hard),
|
llvm_floatabi: Some(FloatAbi::Hard),
|
||||||
linker_flavor: LinkerFlavor::Gnu(Cc::Yes, Lld::No),
|
linker_flavor: LinkerFlavor::Gnu(Cc::Yes, Lld::No),
|
||||||
linker: None,
|
linker: None,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use rustc_abi::Endian;
|
use rustc_abi::Endian;
|
||||||
|
|
||||||
use crate::spec::{
|
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,
|
TargetOptions, cvs,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -34,7 +34,7 @@ pub(crate) fn target() -> Target {
|
|||||||
c_int_width: 32,
|
c_int_width: 32,
|
||||||
env: Env::Newlib,
|
env: Env::Newlib,
|
||||||
vendor: "sony".into(),
|
vendor: "sony".into(),
|
||||||
abi: Abi::EabiHf,
|
cfg_abi: CfgAbi::EabiHf,
|
||||||
llvm_floatabi: Some(FloatAbi::Hard),
|
llvm_floatabi: Some(FloatAbi::Hard),
|
||||||
linker_flavor: LinkerFlavor::Gnu(Cc::Yes, Lld::No),
|
linker_flavor: LinkerFlavor::Gnu(Cc::Yes, Lld::No),
|
||||||
no_default_libraries: false,
|
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 {
|
pub(crate) fn target() -> 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(),
|
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
|
||||||
arch: Arch::Arm,
|
arch: Arch::Arm,
|
||||||
options: TargetOptions {
|
options: TargetOptions {
|
||||||
abi: Abi::EabiHf,
|
cfg_abi: CfgAbi::EabiHf,
|
||||||
llvm_floatabi: Some(FloatAbi::Hard),
|
llvm_floatabi: Some(FloatAbi::Hard),
|
||||||
features: "+v7,+vfp3d16,+thumb2,-neon".into(),
|
features: "+v7,+vfp3d16,+thumb2,-neon".into(),
|
||||||
max_atomic_width: Some(64),
|
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
|
// This target is for glibc Linux on ARMv7 without thumb-mode, NEON or
|
||||||
// hardfloat.
|
// 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(),
|
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
|
||||||
arch: Arch::Arm,
|
arch: Arch::Arm,
|
||||||
options: TargetOptions {
|
options: TargetOptions {
|
||||||
abi: Abi::Eabi,
|
cfg_abi: CfgAbi::Eabi,
|
||||||
llvm_floatabi: Some(FloatAbi::Soft),
|
llvm_floatabi: Some(FloatAbi::Soft),
|
||||||
features: "+v7,+thumb2,+soft-float,-neon".into(),
|
features: "+v7,+thumb2,+soft-float,-neon".into(),
|
||||||
max_atomic_width: Some(64),
|
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
|
// This target is for glibc Linux on ARMv7 without NEON or
|
||||||
// thumb-mode. See the thumbv7neon variant for enabling both.
|
// 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(),
|
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
|
||||||
arch: Arch::Arm,
|
arch: Arch::Arm,
|
||||||
options: TargetOptions {
|
options: TargetOptions {
|
||||||
abi: Abi::EabiHf,
|
cfg_abi: CfgAbi::EabiHf,
|
||||||
llvm_floatabi: Some(FloatAbi::Hard),
|
llvm_floatabi: Some(FloatAbi::Hard),
|
||||||
// Info about features at https://wiki.debian.org/ArmHardFloatPort
|
// Info about features at https://wiki.debian.org/ArmHardFloatPort
|
||||||
features: "+v7,+vfp3d16,+thumb2,-neon".into(),
|
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
|
// This target is for musl Linux on ARMv7 without thumb-mode, NEON or
|
||||||
// hardfloat.
|
// hardfloat.
|
||||||
@@ -19,7 +19,7 @@ pub(crate) fn target() -> Target {
|
|||||||
arch: Arch::Arm,
|
arch: Arch::Arm,
|
||||||
|
|
||||||
options: TargetOptions {
|
options: TargetOptions {
|
||||||
abi: Abi::Eabi,
|
cfg_abi: CfgAbi::Eabi,
|
||||||
llvm_floatabi: Some(FloatAbi::Soft),
|
llvm_floatabi: Some(FloatAbi::Soft),
|
||||||
features: "+v7,+thumb2,+soft-float,-neon".into(),
|
features: "+v7,+thumb2,+soft-float,-neon".into(),
|
||||||
max_atomic_width: Some(64),
|
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.
|
// 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
|
// Most of these settings are copied from the armv7_unknown_linux_gnueabihf
|
||||||
// target.
|
// target.
|
||||||
options: TargetOptions {
|
options: TargetOptions {
|
||||||
abi: Abi::EabiHf,
|
cfg_abi: CfgAbi::EabiHf,
|
||||||
llvm_floatabi: Some(FloatAbi::Hard),
|
llvm_floatabi: Some(FloatAbi::Hard),
|
||||||
features: "+v7,+vfp3d16,+thumb2,-neon".into(),
|
features: "+v7,+vfp3d16,+thumb2,-neon".into(),
|
||||||
max_atomic_width: Some(64),
|
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
|
// This target is for OpenHarmony on ARMv7 Linux with thumb-mode, but no NEON or
|
||||||
// hardfloat.
|
// hardfloat.
|
||||||
@@ -19,7 +19,7 @@ pub(crate) fn target() -> Target {
|
|||||||
arch: Arch::Arm,
|
arch: Arch::Arm,
|
||||||
|
|
||||||
options: TargetOptions {
|
options: TargetOptions {
|
||||||
abi: Abi::Eabi,
|
cfg_abi: CfgAbi::Eabi,
|
||||||
llvm_floatabi: Some(FloatAbi::Soft),
|
llvm_floatabi: Some(FloatAbi::Soft),
|
||||||
features: "+v7,+thumb2,+soft-float,-neon".into(),
|
features: "+v7,+thumb2,+soft-float,-neon".into(),
|
||||||
max_atomic_width: Some(64),
|
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,
|
// This target is for uclibc Linux on ARMv7 without NEON,
|
||||||
// thumb-mode or hardfloat.
|
// thumb-mode or hardfloat.
|
||||||
@@ -18,7 +18,7 @@ pub(crate) fn target() -> Target {
|
|||||||
arch: Arch::Arm,
|
arch: Arch::Arm,
|
||||||
|
|
||||||
options: TargetOptions {
|
options: TargetOptions {
|
||||||
abi: Abi::Eabi,
|
cfg_abi: CfgAbi::Eabi,
|
||||||
llvm_floatabi: Some(FloatAbi::Soft),
|
llvm_floatabi: Some(FloatAbi::Soft),
|
||||||
features: "+v7,+thumb2,+soft-float,-neon".into(),
|
features: "+v7,+thumb2,+soft-float,-neon".into(),
|
||||||
cpu: "generic".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
|
// This target is for uclibc Linux on ARMv7 without NEON or
|
||||||
// thumb-mode. See the thumbv7neon variant for enabling both.
|
// thumb-mode. See the thumbv7neon variant for enabling both.
|
||||||
@@ -23,7 +23,7 @@ pub(crate) fn target() -> Target {
|
|||||||
cpu: "generic".into(),
|
cpu: "generic".into(),
|
||||||
max_atomic_width: Some(64),
|
max_atomic_width: Some(64),
|
||||||
mcount: "_mcount".into(),
|
mcount: "_mcount".into(),
|
||||||
abi: Abi::EabiHf,
|
cfg_abi: CfgAbi::EabiHf,
|
||||||
llvm_floatabi: Some(FloatAbi::Hard),
|
llvm_floatabi: Some(FloatAbi::Hard),
|
||||||
..base
|
..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 {
|
pub(crate) fn target() -> 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(),
|
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
|
||||||
arch: Arch::Arm,
|
arch: Arch::Arm,
|
||||||
options: TargetOptions {
|
options: TargetOptions {
|
||||||
abi: Abi::EabiHf,
|
cfg_abi: CfgAbi::EabiHf,
|
||||||
llvm_floatabi: Some(FloatAbi::Hard),
|
llvm_floatabi: Some(FloatAbi::Hard),
|
||||||
features: "+v7,+vfp3d16,+thumb2,-neon".into(),
|
features: "+v7,+vfp3d16,+thumb2,-neon".into(),
|
||||||
max_atomic_width: Some(64),
|
max_atomic_width: Some(64),
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
use crate::spec::{
|
use crate::spec::{
|
||||||
Abi, Arch, FloatAbi, LinkSelfContainedDefault, Os, PanicStrategy, RelroLevel, Target,
|
Arch, CfgAbi, FloatAbi, LinkSelfContainedDefault, Os, PanicStrategy, RelroLevel, Target,
|
||||||
TargetMetadata, TargetOptions,
|
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(),
|
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
|
||||||
arch: Arch::Arm,
|
arch: Arch::Arm,
|
||||||
options: TargetOptions {
|
options: TargetOptions {
|
||||||
abi: Abi::Eabi,
|
cfg_abi: CfgAbi::Eabi,
|
||||||
llvm_floatabi: Some(FloatAbi::Soft),
|
llvm_floatabi: Some(FloatAbi::Soft),
|
||||||
features: "+v7,+thumb2,+soft-float,-neon".into(),
|
features: "+v7,+thumb2,+soft-float,-neon".into(),
|
||||||
max_atomic_width: Some(64),
|
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 {
|
pub(crate) fn target() -> 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(),
|
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
|
||||||
arch: Arch::Arm,
|
arch: Arch::Arm,
|
||||||
options: TargetOptions {
|
options: TargetOptions {
|
||||||
abi: Abi::EabiHf,
|
cfg_abi: CfgAbi::EabiHf,
|
||||||
llvm_floatabi: Some(FloatAbi::Hard),
|
llvm_floatabi: Some(FloatAbi::Hard),
|
||||||
// Info about features at https://wiki.debian.org/ArmHardFloatPort
|
// Info about features at https://wiki.debian.org/ArmHardFloatPort
|
||||||
features: "+v7,+vfp3d16,+thumb2,-neon".into(),
|
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 {
|
pub(crate) fn target() -> Target {
|
||||||
let base = base::solid::opts();
|
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(),
|
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
|
||||||
arch: Arch::Arm,
|
arch: Arch::Arm,
|
||||||
options: TargetOptions {
|
options: TargetOptions {
|
||||||
abi: Abi::Eabi,
|
cfg_abi: CfgAbi::Eabi,
|
||||||
llvm_floatabi: Some(FloatAbi::Soft),
|
llvm_floatabi: Some(FloatAbi::Soft),
|
||||||
linker: Some("arm-kmc-eabi-gcc".into()),
|
linker: Some("arm-kmc-eabi-gcc".into()),
|
||||||
features: "+v7,+soft-float,+thumb2,-neon".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 {
|
pub(crate) fn target() -> Target {
|
||||||
let base = base::solid::opts();
|
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(),
|
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
|
||||||
arch: Arch::Arm,
|
arch: Arch::Arm,
|
||||||
options: TargetOptions {
|
options: TargetOptions {
|
||||||
abi: Abi::EabiHf,
|
cfg_abi: CfgAbi::EabiHf,
|
||||||
llvm_floatabi: Some(FloatAbi::Hard),
|
llvm_floatabi: Some(FloatAbi::Hard),
|
||||||
linker: Some("arm-kmc-eabi-gcc".into()),
|
linker: Some("arm-kmc-eabi-gcc".into()),
|
||||||
features: "+v7,+vfp3d16,+thumb2,-neon".into(),
|
features: "+v7,+vfp3d16,+thumb2,-neon".into(),
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// Targets the Little-endian Cortex-A8 (and similar) processors (ARMv7-A)
|
// 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 {
|
pub(crate) fn target() -> 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(),
|
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
|
||||||
arch: Arch::Arm,
|
arch: Arch::Arm,
|
||||||
options: TargetOptions {
|
options: TargetOptions {
|
||||||
abi: Abi::Eabi,
|
cfg_abi: CfgAbi::Eabi,
|
||||||
llvm_floatabi: Some(FloatAbi::Soft),
|
llvm_floatabi: Some(FloatAbi::Soft),
|
||||||
features: "+soft-float,-neon,+strict-align".into(),
|
features: "+soft-float,-neon,+strict-align".into(),
|
||||||
max_atomic_width: Some(64),
|
max_atomic_width: Some(64),
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// Targets the Little-endian Cortex-A8 (and similar) processors (ARMv7-A)
|
// 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 {
|
pub(crate) fn target() -> 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(),
|
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
|
||||||
arch: Arch::Arm,
|
arch: Arch::Arm,
|
||||||
options: TargetOptions {
|
options: TargetOptions {
|
||||||
abi: Abi::EabiHf,
|
cfg_abi: CfgAbi::EabiHf,
|
||||||
llvm_floatabi: Some(FloatAbi::Hard),
|
llvm_floatabi: Some(FloatAbi::Hard),
|
||||||
features: "+vfp3d16,-neon,+strict-align".into(),
|
features: "+vfp3d16,-neon,+strict-align".into(),
|
||||||
max_atomic_width: Some(64),
|
max_atomic_width: Some(64),
|
||||||
|
|||||||
@@ -5,13 +5,13 @@
|
|||||||
// configuration without hardware floating point support.
|
// configuration without hardware floating point support.
|
||||||
|
|
||||||
use crate::spec::{
|
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,
|
TargetMetadata, TargetOptions, cvs,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub(crate) fn target() -> Target {
|
pub(crate) fn target() -> Target {
|
||||||
let opts = TargetOptions {
|
let opts = TargetOptions {
|
||||||
abi: Abi::Eabi,
|
cfg_abi: CfgAbi::Eabi,
|
||||||
llvm_floatabi: Some(FloatAbi::Soft),
|
llvm_floatabi: Some(FloatAbi::Soft),
|
||||||
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
|
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
|
||||||
linker: Some("rust-lld".into()),
|
linker: Some("rust-lld".into()),
|
||||||
|
|||||||
@@ -5,13 +5,13 @@
|
|||||||
// configuration with hardware floating point support.
|
// configuration with hardware floating point support.
|
||||||
|
|
||||||
use crate::spec::{
|
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,
|
TargetMetadata, TargetOptions, cvs,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub(crate) fn target() -> Target {
|
pub(crate) fn target() -> Target {
|
||||||
let opts = TargetOptions {
|
let opts = TargetOptions {
|
||||||
abi: Abi::EabiHf,
|
cfg_abi: CfgAbi::EabiHf,
|
||||||
llvm_floatabi: Some(FloatAbi::Hard),
|
llvm_floatabi: Some(FloatAbi::Hard),
|
||||||
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
|
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
|
||||||
linker: Some("rust-lld".into()),
|
linker: Some("rust-lld".into()),
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
use crate::spec::{
|
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,
|
TargetMetadata, TargetOptions,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -11,7 +11,7 @@ pub(crate) fn target() -> Target {
|
|||||||
env: Env::V5,
|
env: Env::V5,
|
||||||
os: Os::VexOs,
|
os: Os::VexOs,
|
||||||
cpu: "cortex-a9".into(),
|
cpu: "cortex-a9".into(),
|
||||||
abi: Abi::EabiHf,
|
cfg_abi: CfgAbi::EabiHf,
|
||||||
is_like_vexos: true,
|
is_like_vexos: true,
|
||||||
llvm_floatabi: Some(FloatAbi::Hard),
|
llvm_floatabi: Some(FloatAbi::Hard),
|
||||||
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
|
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// Targets the Little-endian Cortex-R4/R5 processor (ARMv7-R)
|
// 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 {
|
pub(crate) fn target() -> 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(),
|
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
|
||||||
arch: Arch::Arm,
|
arch: Arch::Arm,
|
||||||
options: TargetOptions {
|
options: TargetOptions {
|
||||||
abi: Abi::Eabi,
|
cfg_abi: CfgAbi::Eabi,
|
||||||
llvm_floatabi: Some(FloatAbi::Soft),
|
llvm_floatabi: Some(FloatAbi::Soft),
|
||||||
max_atomic_width: Some(64),
|
max_atomic_width: Some(64),
|
||||||
has_thumb_interworking: true,
|
has_thumb_interworking: true,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// Targets the Little-endian Cortex-R4F/R5F processor (ARMv7-R)
|
// 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 {
|
pub(crate) fn target() -> 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(),
|
data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(),
|
||||||
arch: Arch::Arm,
|
arch: Arch::Arm,
|
||||||
options: TargetOptions {
|
options: TargetOptions {
|
||||||
abi: Abi::EabiHf,
|
cfg_abi: CfgAbi::EabiHf,
|
||||||
llvm_floatabi: Some(FloatAbi::Hard),
|
llvm_floatabi: Some(FloatAbi::Hard),
|
||||||
features: "+vfp3d16".into(),
|
features: "+vfp3d16".into(),
|
||||||
max_atomic_width: Some(64),
|
max_atomic_width: Some(64),
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// Targets the Little-endian Cortex-R52 processor (ARMv8-R)
|
// 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 {
|
pub(crate) fn target() -> Target {
|
||||||
Target {
|
Target {
|
||||||
@@ -16,7 +16,7 @@ pub(crate) fn target() -> Target {
|
|||||||
arch: Arch::Arm,
|
arch: Arch::Arm,
|
||||||
|
|
||||||
options: TargetOptions {
|
options: TargetOptions {
|
||||||
abi: Abi::EabiHf,
|
cfg_abi: CfgAbi::EabiHf,
|
||||||
llvm_floatabi: Some(FloatAbi::Hard),
|
llvm_floatabi: Some(FloatAbi::Hard),
|
||||||
// Armv8-R requires a minimum set of floating-point features equivalent to:
|
// Armv8-R requires a minimum set of floating-point features equivalent to:
|
||||||
// fp-armv8, SP-only, with 16 DP (32 SP) registers
|
// 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
|
// 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(),
|
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,
|
arch: Arch::CSky,
|
||||||
options: TargetOptions {
|
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(),
|
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"]),
|
late_link_args: TargetOptions::link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-l:libatomic.a"]),
|
||||||
max_atomic_width: Some(32),
|
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
|
// 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(),
|
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,
|
arch: Arch::CSky,
|
||||||
options: TargetOptions {
|
options: TargetOptions {
|
||||||
abi: Abi::AbiV2Hf,
|
cfg_abi: CfgAbi::AbiV2Hf,
|
||||||
cpu: "ck860fv".into(),
|
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(),
|
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"]),
|
late_link_args: TargetOptions::link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-l:libatomic.a", "-mhard-float"]),
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
use crate::spec::{
|
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 {
|
pub(crate) fn target() -> Target {
|
||||||
@@ -19,7 +20,7 @@ pub(crate) fn target() -> Target {
|
|||||||
features: "+f,+d".into(),
|
features: "+f,+d".into(),
|
||||||
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
|
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
|
||||||
linker: Some("rust-lld".into()),
|
linker: Some("rust-lld".into()),
|
||||||
llvm_abiname: "ilp32d".into(),
|
llvm_abiname: LlvmAbi::Ilp32d,
|
||||||
max_atomic_width: Some(32),
|
max_atomic_width: Some(32),
|
||||||
relocation_model: RelocModel::Static,
|
relocation_model: RelocModel::Static,
|
||||||
panic_strategy: PanicStrategy::Abort,
|
panic_strategy: PanicStrategy::Abort,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
use crate::spec::{
|
use crate::spec::{
|
||||||
Abi, Arch, Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata,
|
Arch, Cc, CfgAbi, LinkerFlavor, Lld, LlvmAbi, PanicStrategy, RelocModel, Target,
|
||||||
TargetOptions,
|
TargetMetadata, TargetOptions,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub(crate) fn target() -> Target {
|
pub(crate) fn target() -> Target {
|
||||||
@@ -18,10 +18,10 @@ pub(crate) fn target() -> Target {
|
|||||||
options: TargetOptions {
|
options: TargetOptions {
|
||||||
cpu: "generic".into(),
|
cpu: "generic".into(),
|
||||||
features: "-f,-d".into(),
|
features: "-f,-d".into(),
|
||||||
abi: Abi::SoftFloat,
|
cfg_abi: CfgAbi::SoftFloat,
|
||||||
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
|
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
|
||||||
linker: Some("rust-lld".into()),
|
linker: Some("rust-lld".into()),
|
||||||
llvm_abiname: "ilp32s".into(),
|
llvm_abiname: LlvmAbi::Ilp32s,
|
||||||
max_atomic_width: Some(32),
|
max_atomic_width: Some(32),
|
||||||
relocation_model: RelocModel::Static,
|
relocation_model: RelocModel::Static,
|
||||||
panic_strategy: PanicStrategy::Abort,
|
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