Rollup merge of #142053 - heiher:loong32-none, r=wesleywiser
Add new Tier-3 targets: `loongarch32-unknown-none*` MCP: https://github.com/rust-lang/compiler-team/issues/865 NOTE: LoongArch32 ELF object support is available starting with object v0.37.0.
This commit is contained in:
commit
840baa46ff
34 changed files with 181 additions and 53 deletions
46
Cargo.lock
46
Cargo.lock
|
|
@ -162,7 +162,7 @@ version = "0.4.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "01667f6f40216b9a0b2945e05fed5f1ad0ab6470e69cb9378001e37b1c0668e4"
|
||||
dependencies = [
|
||||
"object",
|
||||
"object 0.36.7",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -235,7 +235,7 @@ dependencies = [
|
|||
"cfg-if",
|
||||
"libc",
|
||||
"miniz_oxide",
|
||||
"object",
|
||||
"object 0.36.7",
|
||||
"rustc-demangle",
|
||||
"windows-targets 0.52.6",
|
||||
]
|
||||
|
|
@ -2509,7 +2509,19 @@ dependencies = [
|
|||
"indexmap",
|
||||
"memchr",
|
||||
"ruzstd",
|
||||
"wasmparser 0.222.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "object"
|
||||
version = "0.37.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6273adb7096cf9ab4335f258e627d8230e69d40d45567d678f552dcec6245215"
|
||||
dependencies = [
|
||||
"crc32fast",
|
||||
"hashbrown",
|
||||
"indexmap",
|
||||
"memchr",
|
||||
"wasmparser 0.232.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -3109,7 +3121,7 @@ dependencies = [
|
|||
"build_helper",
|
||||
"gimli",
|
||||
"libc",
|
||||
"object",
|
||||
"object 0.36.7",
|
||||
"regex",
|
||||
"serde_json",
|
||||
"similar",
|
||||
|
|
@ -3422,7 +3434,7 @@ dependencies = [
|
|||
"itertools",
|
||||
"libc",
|
||||
"measureme",
|
||||
"object",
|
||||
"object 0.37.0",
|
||||
"rustc-demangle",
|
||||
"rustc_abi",
|
||||
"rustc_ast",
|
||||
|
|
@ -3463,7 +3475,7 @@ dependencies = [
|
|||
"either",
|
||||
"itertools",
|
||||
"libc",
|
||||
"object",
|
||||
"object 0.37.0",
|
||||
"pathdiff",
|
||||
"regex",
|
||||
"rustc_abi",
|
||||
|
|
@ -4495,7 +4507,7 @@ name = "rustc_target"
|
|||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"object",
|
||||
"object 0.37.0",
|
||||
"rustc_abi",
|
||||
"rustc_data_structures",
|
||||
"rustc_fs_util",
|
||||
|
|
@ -5247,7 +5259,7 @@ checksum = "9e9c1e705f82a260173f3eec93f2ff6d7807f23ad5a8cc2e7316a891733ea7a1"
|
|||
dependencies = [
|
||||
"gimli",
|
||||
"hashbrown",
|
||||
"object",
|
||||
"object 0.36.7",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
|
|
@ -5908,15 +5920,6 @@ dependencies = [
|
|||
"indexmap",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasmparser"
|
||||
version = "0.222.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fa210fd1788e6b37a1d1930f3389c48e1d6ebd1a013d34fa4b7f9e3e3bf03146"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasmparser"
|
||||
version = "0.229.0"
|
||||
|
|
@ -5941,6 +5944,15 @@ dependencies = [
|
|||
"semver",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasmparser"
|
||||
version = "0.232.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "917739b33bb1eb0e9a49bcd2637a351931be4578d0cc4d37b908d7a797784fbb"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wast"
|
||||
version = "230.0.0"
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
// add fast paths for low alignment values.
|
||||
#[cfg(any(target_arch = "x86",
|
||||
target_arch = "arm",
|
||||
target_arch = "loongarch32",
|
||||
target_arch = "m68k",
|
||||
target_arch = "mips",
|
||||
target_arch = "mips32r6",
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ gimli = "0.31"
|
|||
itertools = "0.12"
|
||||
libc = "0.2"
|
||||
measureme = "12.0.1"
|
||||
object = { version = "0.36.3", default-features = false, features = ["std", "read"] }
|
||||
object = { version = "0.37.0", default-features = false, features = ["std", "read"] }
|
||||
rustc-demangle = "0.1.21"
|
||||
rustc_abi = { path = "../rustc_abi" }
|
||||
rustc_ast = { path = "../rustc_ast" }
|
||||
|
|
|
|||
|
|
@ -251,7 +251,7 @@ impl<'ll, 'tcx> AsmBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> {
|
|||
InlineAsmArch::Nvptx64 => {}
|
||||
InlineAsmArch::PowerPC | InlineAsmArch::PowerPC64 => {}
|
||||
InlineAsmArch::Hexagon => {}
|
||||
InlineAsmArch::LoongArch64 => {
|
||||
InlineAsmArch::LoongArch32 | InlineAsmArch::LoongArch64 => {
|
||||
constraints.extend_from_slice(&[
|
||||
"~{$fcc0}".to_string(),
|
||||
"~{$fcc1}".to_string(),
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ libc = "0.2.50"
|
|||
# tidy-alphabetical-end
|
||||
|
||||
[dependencies.object]
|
||||
version = "0.36.2"
|
||||
version = "0.37.0"
|
||||
default-features = false
|
||||
features = ["read_core", "elf", "macho", "pe", "xcoff", "unaligned", "archive", "write", "wasm"]
|
||||
|
||||
|
|
|
|||
|
|
@ -287,6 +287,7 @@ fn create_elf_raw_dylib_stub(sess: &Session, soname: &str, symbols: &[DllImport]
|
|||
(Architecture::X86_64, None) => elf::EM_X86_64,
|
||||
(Architecture::X86_64_X32, None) => elf::EM_X86_64,
|
||||
(Architecture::Hexagon, None) => elf::EM_HEXAGON,
|
||||
(Architecture::LoongArch32, None) => elf::EM_LOONGARCH,
|
||||
(Architecture::LoongArch64, None) => elf::EM_LOONGARCH,
|
||||
(Architecture::M68k, None) => elf::EM_68K,
|
||||
(Architecture::Mips, None) => elf::EM_MIPS,
|
||||
|
|
|
|||
|
|
@ -348,7 +348,7 @@ pub(super) fn elf_e_flags(architecture: Architecture, sess: &Session) -> u32 {
|
|||
|
||||
e_flags
|
||||
}
|
||||
Architecture::LoongArch64 => {
|
||||
Architecture::LoongArch32 | Architecture::LoongArch64 => {
|
||||
// Source: https://github.com/loongson/la-abi-specs/blob/release/laelf.adoc#e_flags-identifies-abi-type-and-version
|
||||
let mut e_flags: u32 = elf::EF_LARCH_OBJABI_V1;
|
||||
|
||||
|
|
|
|||
|
|
@ -20,5 +20,5 @@ tracing = "0.1"
|
|||
# tidy-alphabetical-start
|
||||
default-features = false
|
||||
features = ["elf", "macho"]
|
||||
version = "0.36.2"
|
||||
version = "0.37.0"
|
||||
# tidy-alphabetical-end
|
||||
|
|
|
|||
|
|
@ -226,6 +226,7 @@ pub enum InlineAsmArch {
|
|||
RiscV64,
|
||||
Nvptx64,
|
||||
Hexagon,
|
||||
LoongArch32,
|
||||
LoongArch64,
|
||||
Mips,
|
||||
Mips64,
|
||||
|
|
@ -260,6 +261,7 @@ impl FromStr for InlineAsmArch {
|
|||
"powerpc" => Ok(Self::PowerPC),
|
||||
"powerpc64" => Ok(Self::PowerPC64),
|
||||
"hexagon" => Ok(Self::Hexagon),
|
||||
"loongarch32" => Ok(Self::LoongArch32),
|
||||
"loongarch64" => Ok(Self::LoongArch64),
|
||||
"mips" | "mips32r6" => Ok(Self::Mips),
|
||||
"mips64" | "mips64r6" => Ok(Self::Mips64),
|
||||
|
|
@ -365,7 +367,9 @@ impl InlineAsmReg {
|
|||
Self::PowerPC(PowerPCInlineAsmReg::parse(name)?)
|
||||
}
|
||||
InlineAsmArch::Hexagon => Self::Hexagon(HexagonInlineAsmReg::parse(name)?),
|
||||
InlineAsmArch::LoongArch64 => Self::LoongArch(LoongArchInlineAsmReg::parse(name)?),
|
||||
InlineAsmArch::LoongArch32 | InlineAsmArch::LoongArch64 => {
|
||||
Self::LoongArch(LoongArchInlineAsmReg::parse(name)?)
|
||||
}
|
||||
InlineAsmArch::Mips | InlineAsmArch::Mips64 => {
|
||||
Self::Mips(MipsInlineAsmReg::parse(name)?)
|
||||
}
|
||||
|
|
@ -652,7 +656,9 @@ impl InlineAsmRegClass {
|
|||
Self::PowerPC(PowerPCInlineAsmRegClass::parse(name)?)
|
||||
}
|
||||
InlineAsmArch::Hexagon => Self::Hexagon(HexagonInlineAsmRegClass::parse(name)?),
|
||||
InlineAsmArch::LoongArch64 => Self::LoongArch(LoongArchInlineAsmRegClass::parse(name)?),
|
||||
InlineAsmArch::LoongArch32 | InlineAsmArch::LoongArch64 => {
|
||||
Self::LoongArch(LoongArchInlineAsmRegClass::parse(name)?)
|
||||
}
|
||||
InlineAsmArch::Mips | InlineAsmArch::Mips64 => {
|
||||
Self::Mips(MipsInlineAsmRegClass::parse(name)?)
|
||||
}
|
||||
|
|
@ -860,7 +866,7 @@ pub fn allocatable_registers(
|
|||
hexagon::fill_reg_map(arch, reloc_model, target_features, target, &mut map);
|
||||
map
|
||||
}
|
||||
InlineAsmArch::LoongArch64 => {
|
||||
InlineAsmArch::LoongArch32 | InlineAsmArch::LoongArch64 => {
|
||||
let mut map = loongarch::regclass_map();
|
||||
loongarch::fill_reg_map(arch, reloc_model, target_features, target, &mut map);
|
||||
map
|
||||
|
|
@ -992,7 +998,7 @@ impl InlineAsmClobberAbi {
|
|||
"C" | "system" => Ok(InlineAsmClobberAbi::Avr),
|
||||
_ => Err(&["C", "system"]),
|
||||
},
|
||||
InlineAsmArch::LoongArch64 => match name {
|
||||
InlineAsmArch::LoongArch32 | InlineAsmArch::LoongArch64 => match name {
|
||||
"C" | "system" => Ok(InlineAsmClobberAbi::LoongArch),
|
||||
_ => Err(&["C", "system"]),
|
||||
},
|
||||
|
|
|
|||
|
|
@ -648,7 +648,7 @@ impl<'a, Ty> FnAbi<'a, Ty> {
|
|||
"amdgpu" => amdgpu::compute_abi_info(cx, self),
|
||||
"arm" => arm::compute_abi_info(cx, self),
|
||||
"avr" => avr::compute_abi_info(self),
|
||||
"loongarch64" => loongarch::compute_abi_info(cx, self),
|
||||
"loongarch32" | "loongarch64" => loongarch::compute_abi_info(cx, self),
|
||||
"m68k" => m68k::compute_abi_info(self),
|
||||
"csky" => csky::compute_abi_info(self),
|
||||
"mips" | "mips32r6" => mips::compute_abi_info(cx, self),
|
||||
|
|
@ -691,7 +691,7 @@ impl<'a, Ty> FnAbi<'a, Ty> {
|
|||
match &*spec.arch {
|
||||
"x86" => x86::compute_rust_abi_info(cx, self),
|
||||
"riscv32" | "riscv64" => riscv::compute_rust_abi_info(cx, self),
|
||||
"loongarch64" => loongarch::compute_rust_abi_info(cx, self),
|
||||
"loongarch32" | "loongarch64" => loongarch::compute_rust_abi_info(cx, self),
|
||||
"aarch64" => aarch64::compute_rust_abi_info(cx, self),
|
||||
_ => {}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1981,6 +1981,8 @@ supported_targets! {
|
|||
|
||||
("sparc-unknown-none-elf", sparc_unknown_none_elf),
|
||||
|
||||
("loongarch32-unknown-none", loongarch32_unknown_none),
|
||||
("loongarch32-unknown-none-softfloat", loongarch32_unknown_none_softfloat),
|
||||
("loongarch64-unknown-none", loongarch64_unknown_none),
|
||||
("loongarch64-unknown-none-softfloat", loongarch64_unknown_none_softfloat),
|
||||
|
||||
|
|
@ -3502,6 +3504,7 @@ impl Target {
|
|||
"msp430" => (Architecture::Msp430, None),
|
||||
"hexagon" => (Architecture::Hexagon, None),
|
||||
"bpf" => (Architecture::Bpf, None),
|
||||
"loongarch32" => (Architecture::LoongArch32, None),
|
||||
"loongarch64" => (Architecture::LoongArch64, None),
|
||||
"csky" => (Architecture::Csky, None),
|
||||
"arm64ec" => (Architecture::Aarch64, Some(object::SubArchitecture::Arm64EC)),
|
||||
|
|
|
|||
|
|
@ -0,0 +1,29 @@
|
|||
use crate::spec::{
|
||||
Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata, TargetOptions,
|
||||
};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
Target {
|
||||
llvm_target: "loongarch32-unknown-none".into(),
|
||||
metadata: TargetMetadata {
|
||||
description: Some("Freestanding/bare-metal LoongArch32".into()),
|
||||
tier: Some(3),
|
||||
host_tools: Some(false),
|
||||
std: Some(false),
|
||||
},
|
||||
pointer_width: 32,
|
||||
data_layout: "e-m:e-p:32:32-i64:64-n32-S128".into(),
|
||||
arch: "loongarch32".into(),
|
||||
options: TargetOptions {
|
||||
cpu: "generic".into(),
|
||||
features: "+f,+d".into(),
|
||||
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
|
||||
linker: Some("rust-lld".into()),
|
||||
llvm_abiname: "ilp32d".into(),
|
||||
max_atomic_width: Some(32),
|
||||
relocation_model: RelocModel::Static,
|
||||
panic_strategy: PanicStrategy::Abort,
|
||||
..Default::default()
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
use crate::spec::{
|
||||
Cc, LinkerFlavor, Lld, PanicStrategy, RelocModel, Target, TargetMetadata, TargetOptions,
|
||||
};
|
||||
|
||||
pub(crate) fn target() -> Target {
|
||||
Target {
|
||||
llvm_target: "loongarch32-unknown-none".into(),
|
||||
metadata: TargetMetadata {
|
||||
description: Some("Freestanding/bare-metal LoongArch32 softfloat".into()),
|
||||
tier: Some(3),
|
||||
host_tools: Some(false),
|
||||
std: Some(false),
|
||||
},
|
||||
pointer_width: 32,
|
||||
data_layout: "e-m:e-p:32:32-i64:64-n32-S128".into(),
|
||||
arch: "loongarch32".into(),
|
||||
options: TargetOptions {
|
||||
cpu: "generic".into(),
|
||||
features: "-f,-d".into(),
|
||||
abi: "softfloat".into(),
|
||||
linker_flavor: LinkerFlavor::Gnu(Cc::No, Lld::Yes),
|
||||
linker: Some("rust-lld".into()),
|
||||
llvm_abiname: "ilp32s".into(),
|
||||
max_atomic_width: Some(32),
|
||||
relocation_model: RelocModel::Static,
|
||||
panic_strategy: PanicStrategy::Abort,
|
||||
..Default::default()
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
@ -846,7 +846,7 @@ impl Target {
|
|||
"wasm32" | "wasm64" => WASM_FEATURES,
|
||||
"bpf" => BPF_FEATURES,
|
||||
"csky" => CSKY_FEATURES,
|
||||
"loongarch64" => LOONGARCH_FEATURES,
|
||||
"loongarch32" | "loongarch64" => LOONGARCH_FEATURES,
|
||||
"s390x" => IBMZ_FEATURES,
|
||||
"sparc" | "sparc64" => SPARC_FEATURES,
|
||||
"m68k" => M68K_FEATURES,
|
||||
|
|
@ -860,7 +860,7 @@ impl Target {
|
|||
"aarch64" | "arm64ec" => AARCH64_FEATURES_FOR_CORRECT_VECTOR_ABI,
|
||||
"arm" => ARM_FEATURES_FOR_CORRECT_VECTOR_ABI,
|
||||
"powerpc" | "powerpc64" => POWERPC_FEATURES_FOR_CORRECT_VECTOR_ABI,
|
||||
"loongarch64" => LOONGARCH_FEATURES_FOR_CORRECT_VECTOR_ABI,
|
||||
"loongarch32" | "loongarch64" => LOONGARCH_FEATURES_FOR_CORRECT_VECTOR_ABI,
|
||||
"riscv32" | "riscv64" => RISCV_FEATURES_FOR_CORRECT_VECTOR_ABI,
|
||||
"wasm32" | "wasm64" => WASM_FEATURES_FOR_CORRECT_VECTOR_ABI,
|
||||
"s390x" => S390X_FEATURES_FOR_CORRECT_VECTOR_ABI,
|
||||
|
|
@ -1034,7 +1034,7 @@ impl Target {
|
|||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
"loongarch64" => {
|
||||
"loongarch32" | "loongarch64" => {
|
||||
// LoongArch handles ABI in a very sane way, being fully explicit via `llvm_abiname`
|
||||
// about what the intended ABI is.
|
||||
match &*self.llvm_abiname {
|
||||
|
|
|
|||
|
|
@ -29,6 +29,8 @@ debug_typeid = []
|
|||
[lints.rust.unexpected_cfgs]
|
||||
level = "warn"
|
||||
check-cfg = [
|
||||
# #[cfg(bootstrap)] loongarch32
|
||||
'cfg(target_arch, values("loongarch32"))',
|
||||
'cfg(no_fp_fmt_parse)',
|
||||
# core use #[path] imports to portable-simd `core_simd` crate
|
||||
# and to stdarch `core_arch` crate which messes-up with Cargo list
|
||||
|
|
|
|||
|
|
@ -178,7 +178,7 @@
|
|||
//!
|
||||
//! | `target_arch` | Size limit |
|
||||
//! |---------------|---------|
|
||||
//! | `x86`, `arm`, `mips`, `mips32r6`, `powerpc`, `riscv32`, `sparc`, `hexagon` | 4 bytes |
|
||||
//! | `x86`, `arm`, `loongarch32`, `mips`, `mips32r6`, `powerpc`, `riscv32`, `sparc`, `hexagon` | 4 bytes |
|
||||
//! | `x86_64`, `aarch64`, `loongarch64`, `mips64`, `mips64r6`, `powerpc64`, `riscv64`, `sparc64`, `s390x` | 8 bytes |
|
||||
//!
|
||||
//! Atomics loads that are larger than this limit as well as atomic loads with ordering other
|
||||
|
|
@ -350,8 +350,12 @@ pub type Atomic<T> = <T as AtomicPrimitive>::AtomicInner;
|
|||
// This list should only contain architectures which have word-sized atomic-or/
|
||||
// atomic-and instructions but don't natively support byte-sized atomics.
|
||||
#[cfg(target_has_atomic = "8")]
|
||||
const EMULATE_ATOMIC_BOOL: bool =
|
||||
cfg!(any(target_arch = "riscv32", target_arch = "riscv64", target_arch = "loongarch64"));
|
||||
const EMULATE_ATOMIC_BOOL: bool = cfg!(any(
|
||||
target_arch = "riscv32",
|
||||
target_arch = "riscv64",
|
||||
target_arch = "loongarch32",
|
||||
target_arch = "loongarch64"
|
||||
));
|
||||
|
||||
/// A boolean type which can be safely shared between threads.
|
||||
///
|
||||
|
|
|
|||
|
|
@ -157,6 +157,8 @@ test = true
|
|||
[lints.rust.unexpected_cfgs]
|
||||
level = "warn"
|
||||
check-cfg = [
|
||||
# #[cfg(bootstrap)] loongarch32
|
||||
'cfg(target_arch, values("loongarch32"))',
|
||||
# std use #[path] imports to portable-simd `std_float` crate
|
||||
# and to the `backtrace` crate which messes-up with Cargo list
|
||||
# of declared features, we therefor expect any feature cfg
|
||||
|
|
|
|||
|
|
@ -1046,6 +1046,7 @@ pub mod consts {
|
|||
/// * `"sparc"`
|
||||
/// * `"sparc64"`
|
||||
/// * `"hexagon"`
|
||||
/// * `"loongarch32"`
|
||||
/// * `"loongarch64"`
|
||||
///
|
||||
/// </details>
|
||||
|
|
|
|||
|
|
@ -231,6 +231,7 @@ mod arch {
|
|||
}
|
||||
|
||||
#[cfg(any(
|
||||
target_arch = "loongarch32",
|
||||
target_arch = "loongarch64",
|
||||
target_arch = "mips64",
|
||||
target_arch = "mips64r6",
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ const MIN_ALIGN: usize = if cfg!(any(
|
|||
target_arch = "arm",
|
||||
target_arch = "m68k",
|
||||
target_arch = "csky",
|
||||
target_arch = "loongarch32",
|
||||
target_arch = "mips",
|
||||
target_arch = "mips32r6",
|
||||
target_arch = "powerpc",
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ const UNWIND_DATA_REG: (i32, i32) = (0, 1); // R0, R1
|
|||
#[cfg(any(target_arch = "riscv64", target_arch = "riscv32"))]
|
||||
const UNWIND_DATA_REG: (i32, i32) = (10, 11); // x10, x11
|
||||
|
||||
#[cfg(target_arch = "loongarch64")]
|
||||
#[cfg(any(target_arch = "loongarch32", target_arch = "loongarch64"))]
|
||||
const UNWIND_DATA_REG: (i32, i32) = (4, 5); // a0, a1
|
||||
|
||||
// The following code is based on GCC's C and C++ personality routines. For reference, see:
|
||||
|
|
|
|||
|
|
@ -37,4 +37,4 @@ system-llvm-libunwind = []
|
|||
|
||||
[lints.rust.unexpected_cfgs]
|
||||
level = "warn"
|
||||
check-cfg = ['cfg(emscripten_wasm_eh)']
|
||||
check-cfg = ['cfg(emscripten_wasm_eh)', 'cfg(target_arch, values("loongarch32"))']
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ pub const unwinder_private_data_size: usize = 2;
|
|||
#[cfg(all(target_arch = "hexagon", target_os = "linux"))]
|
||||
pub const unwinder_private_data_size: usize = 35;
|
||||
|
||||
#[cfg(target_arch = "loongarch64")]
|
||||
#[cfg(any(target_arch = "loongarch32", target_arch = "loongarch64"))]
|
||||
pub const unwinder_private_data_size: usize = 2;
|
||||
|
||||
#[repr(C)]
|
||||
|
|
|
|||
|
|
@ -394,6 +394,7 @@ def default_build_triple(verbose):
|
|||
"i686": "i686",
|
||||
"i686-AT386": "i686",
|
||||
"i786": "i686",
|
||||
"loongarch32": "loongarch32",
|
||||
"loongarch64": "loongarch64",
|
||||
"m68k": "m68k",
|
||||
"csky": "csky",
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@ pub struct Finder {
|
|||
// Targets can be removed from this list once they are present in the stage0 compiler (usually by updating the beta compiler of the bootstrap).
|
||||
const STAGE0_MISSING_TARGETS: &[&str] = &[
|
||||
// just a dummy comment so the list doesn't get onelined
|
||||
"loongarch32-unknown-none",
|
||||
"loongarch32-unknown-none-softfloat",
|
||||
];
|
||||
|
||||
/// Minimum version threshold for libstdc++ required when using prebuilt LLVM
|
||||
|
|
|
|||
|
|
@ -324,6 +324,8 @@ target | std | host | notes
|
|||
[`i686-win7-windows-msvc`](platform-support/win7-windows-msvc.md) | ✓ | | 32-bit Windows 7 support [^x86_32-floats-return-ABI] [^win32-msvc-alignment]
|
||||
[`i686-wrs-vxworks`](platform-support/vxworks.md) | ✓ | | [^x86_32-floats-return-ABI]
|
||||
[`loongarch64-unknown-linux-ohos`](platform-support/openharmony.md) | ✓ | | LoongArch64 OpenHarmony
|
||||
[`loongarch32-unknown-none`](platform-support/loongarch-none.md) | * | LoongArch32 Bare-metal (ILP32D ABI)
|
||||
[`loongarch32-unknown-none-softfloat`](platform-support/loongarch-none.md) | * | LoongArch32 Bare-metal (ILP32S ABI)
|
||||
[`m68k-unknown-linux-gnu`](platform-support/m68k-unknown-linux-gnu.md) | ? | | Motorola 680x0 Linux
|
||||
[`m68k-unknown-none-elf`](platform-support/m68k-unknown-none-elf.md) | | | Motorola 680x0
|
||||
`mips-unknown-linux-gnu` | ✓ | ✓ | MIPS Linux (kernel 4.4, glibc 2.23)
|
||||
|
|
|
|||
|
|
@ -1,18 +1,18 @@
|
|||
# `loongarch*-unknown-none*`
|
||||
|
||||
**Tier: 2**
|
||||
Freestanding/bare-metal LoongArch binaries in ELF format: firmware, kernels, etc.
|
||||
|
||||
Freestanding/bare-metal LoongArch64 binaries in ELF format: firmware, kernels, etc.
|
||||
|
||||
| Target | Description |
|
||||
|--------|-------------|
|
||||
| `loongarch64-unknown-none` | LoongArch 64-bit, LP64D ABI (freestanding, hard-float) |
|
||||
| `loongarch64-unknown-none-softfloat` | LoongArch 64-bit, LP64S ABI (freestanding, soft-float) |
|
||||
| Target | Description | Tier |
|
||||
|--------|-------------|------|
|
||||
| `loongarch32-unknown-none` | LoongArch 32-bit, ILP32D ABI (freestanding, hard-float) | Tier 3 |
|
||||
| `loongarch32-unknown-none-softfloat` | LoongArch 32-bit, ILP32S ABI (freestanding, soft-float) | Tier 3 |
|
||||
| `loongarch64-unknown-none` | LoongArch 64-bit, LP64D ABI (freestanding, hard-float) | Tier 2 |
|
||||
| `loongarch64-unknown-none-softfloat` | LoongArch 64-bit, LP64S ABI (freestanding, soft-float) | Tier 2 |
|
||||
|
||||
## Target maintainers
|
||||
|
||||
[@heiher](https://github.com/heiher)
|
||||
[@xen0n](https://github.com/xen0n)
|
||||
- [@heiher](https://github.com/heiher)
|
||||
- [@xen0n](https://github.com/xen0n)
|
||||
|
||||
## Requirements
|
||||
|
||||
|
|
@ -29,13 +29,13 @@ additional CPU features via the `-C target-feature=` codegen options to rustc, o
|
|||
via the `#[target_feature]` mechanism within Rust code.
|
||||
|
||||
By default, code generated with the soft-float target should run on any
|
||||
LoongArch64 hardware, with the hard-float target additionally requiring an FPU;
|
||||
LoongArch hardware, with the hard-float target additionally requiring an FPU;
|
||||
enabling additional target features may raise this baseline.
|
||||
|
||||
Code generated with the targets will use the `medium` code model by default.
|
||||
You can change this using the `-C code-model=` option to rustc.
|
||||
|
||||
On `loongarch64-unknown-none*`, `extern "C"` uses the [architecture's standard calling convention][lapcs].
|
||||
On `loongarch*-unknown-none*`, `extern "C"` uses the [architecture's standard calling convention][lapcs].
|
||||
|
||||
[lapcs]: https://github.com/loongson/la-abi-specs/blob/release/lapcs.adoc
|
||||
|
||||
|
|
@ -52,6 +52,8 @@ list in `bootstrap.toml`:
|
|||
[build]
|
||||
build-stage = 1
|
||||
target = [
|
||||
"loongarch32-unknown-none",
|
||||
"loongarch32-unknown-none-softfloat",
|
||||
"loongarch64-unknown-none",
|
||||
"loongarch64-unknown-none-softfloat",
|
||||
]
|
||||
|
|
@ -64,13 +66,28 @@ As the targets support a variety of different environments and do not support
|
|||
|
||||
## Building Rust programs
|
||||
|
||||
### loongarch32-unknown-none*
|
||||
|
||||
The `loongarch32-unknown-none*` targets are Tier 3, so you must build the Rust
|
||||
compiler from source to use them.
|
||||
|
||||
```sh
|
||||
# target flag may be used with any cargo or rustc command
|
||||
cargo build --target loongarch32-unknown-none
|
||||
cargo build --target loongarch32-unknown-none-softfloat
|
||||
```
|
||||
|
||||
### loongarch64-unknown-none*
|
||||
|
||||
Starting with Rust 1.74, precompiled artifacts are provided via `rustup`:
|
||||
|
||||
```sh
|
||||
# install cross-compile toolchain
|
||||
rustup target add loongarch64-unknown-none
|
||||
rustup target add loongarch64-unknown-none-softfloat
|
||||
# target flag may be used with any cargo or rustc command
|
||||
cargo build --target loongarch64-unknown-none
|
||||
cargo build --target loongarch64-unknown-none-softfloat
|
||||
```
|
||||
|
||||
## Cross-compilation toolchains and C code
|
||||
|
|
@ -79,10 +96,10 @@ For cross builds, you will need an appropriate LoongArch C/C++ toolchain for
|
|||
linking, or if you want to compile C code along with Rust (such as for Rust
|
||||
crates with C dependencies).
|
||||
|
||||
Rust *may* be able to use an `loongarch64-unknown-linux-gnu-` toolchain with
|
||||
Rust *may* be able to use an `loongarch{32,64}-unknown-linux-{gnu,musl}-` toolchain with
|
||||
appropriate standalone flags to build for this toolchain (depending on the assumptions
|
||||
of that toolchain, see below), or you may wish to use a separate
|
||||
`loongarch64-unknown-none` toolchain.
|
||||
`loongarch{32,64}-unknown-none` toolchain.
|
||||
|
||||
On some LoongArch hosts that use ELF binaries, you *may* be able to use the host
|
||||
C toolchain, if it does not introduce assumptions about the host environment
|
||||
|
|
|
|||
|
|
@ -508,6 +508,7 @@ impl fmt::Display for Display<'_> {
|
|||
(sym::target_arch, Some(arch)) => match arch.as_str() {
|
||||
"aarch64" => "AArch64",
|
||||
"arm" => "ARM",
|
||||
"loongarch32" => "LoongArch LA32",
|
||||
"loongarch64" => "LoongArch LA64",
|
||||
"m68k" => "M68k",
|
||||
"csky" => "CSKY",
|
||||
|
|
|
|||
|
|
@ -113,6 +113,8 @@ static TARGETS: &[&str] = &[
|
|||
"i686-unknown-uefi",
|
||||
"loongarch64-unknown-linux-gnu",
|
||||
"loongarch64-unknown-linux-musl",
|
||||
"loongarch32-unknown-none",
|
||||
"loongarch32-unknown-none-softfloat",
|
||||
"loongarch64-unknown-none",
|
||||
"loongarch64-unknown-none-softfloat",
|
||||
"m68k-unknown-linux-gnu",
|
||||
|
|
|
|||
|
|
@ -495,6 +495,7 @@ impl Config {
|
|||
"arm64ec",
|
||||
"riscv32",
|
||||
"riscv64",
|
||||
"loongarch32",
|
||||
"loongarch64",
|
||||
"s390x",
|
||||
// These targets require an additional asm_experimental_arch feature.
|
||||
|
|
|
|||
|
|
@ -73,6 +73,7 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
|
|||
"ignore-linux",
|
||||
"ignore-lldb",
|
||||
"ignore-llvm-version",
|
||||
"ignore-loongarch32",
|
||||
"ignore-loongarch64",
|
||||
"ignore-macabi",
|
||||
"ignore-macos",
|
||||
|
|
@ -196,6 +197,7 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
|
|||
"only-i686-unknown-linux-gnu",
|
||||
"only-ios",
|
||||
"only-linux",
|
||||
"only-loongarch32",
|
||||
"only-loongarch64",
|
||||
"only-loongarch64-unknown-linux-gnu",
|
||||
"only-macos",
|
||||
|
|
|
|||
|
|
@ -13,10 +13,11 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
|
|||
// alignment requirement and size less than or equal to the size requested."
|
||||
// So first we need to figure out what the limits are for "fundamental alignment".
|
||||
// This is given by `alignof(max_align_t)`. The following list is taken from
|
||||
// `library/std/src/sys/pal/common/alloc.rs` (where this is called `MIN_ALIGN`) and should
|
||||
// `library/std/src/sys/alloc/mod.rs` (where this is called `MIN_ALIGN`) and should
|
||||
// be kept in sync.
|
||||
let max_fundamental_align = match this.tcx.sess.target.arch.as_ref() {
|
||||
"x86" | "arm" | "mips" | "mips32r6" | "powerpc" | "powerpc64" | "wasm32" => 8,
|
||||
"x86" | "arm" | "loongarch32" | "mips" | "mips32r6" | "powerpc" | "powerpc64"
|
||||
| "wasm32" => 8,
|
||||
"x86_64" | "aarch64" | "mips64" | "mips64r6" | "s390x" | "sparc64" | "loongarch64" =>
|
||||
16,
|
||||
arch => bug!("unsupported target architecture for malloc: `{}`", arch),
|
||||
|
|
|
|||
|
|
@ -259,6 +259,12 @@
|
|||
//@ revisions: i686_wrs_vxworks
|
||||
//@ [i686_wrs_vxworks] compile-flags: --target i686-wrs-vxworks
|
||||
//@ [i686_wrs_vxworks] needs-llvm-components: x86
|
||||
//@ revisions: loongarch32_unknown_none
|
||||
//@ [loongarch32_unknown_none] compile-flags: --target loongarch32-unknown-none
|
||||
//@ [loongarch32_unknown_none] needs-llvm-components: loongarch
|
||||
//@ revisions: loongarch32_unknown_none_softfloat
|
||||
//@ [loongarch32_unknown_none_softfloat] compile-flags: --target loongarch32-unknown-none-softfloat
|
||||
//@ [loongarch32_unknown_none_softfloat] needs-llvm-components: loongarch
|
||||
//@ revisions: loongarch64_unknown_linux_gnu
|
||||
//@ [loongarch64_unknown_linux_gnu] compile-flags: --target loongarch64-unknown-linux-gnu
|
||||
//@ [loongarch64_unknown_linux_gnu] needs-llvm-components: loongarch
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
|
|||
LL | target_arch = "_UNEXPECTED_VALUE",
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: expected values for `target_arch` are: `aarch64`, `amdgpu`, `arm`, `arm64ec`, `avr`, `bpf`, `csky`, `hexagon`, `loongarch64`, `m68k`, `mips`, `mips32r6`, `mips64`, `mips64r6`, `msp430`, `nvptx64`, `powerpc`, `powerpc64`, `riscv32`, `riscv64`, `s390x`, `sparc`, `sparc64`, `wasm32`, `wasm64`, `x86`, `x86_64`, and `xtensa`
|
||||
= note: expected values for `target_arch` are: `aarch64`, `amdgpu`, `arm`, `arm64ec`, `avr`, `bpf`, `csky`, `hexagon`, `loongarch32`, `loongarch64`, `m68k`, `mips`, `mips32r6`, `mips64`, `mips64r6`, `msp430`, `nvptx64`, `powerpc`, `powerpc64`, `riscv32`, `riscv64`, `s390x`, `sparc`, `sparc64`, `wasm32`, `wasm64`, `x86`, `x86_64`, and `xtensa`
|
||||
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
|
||||
|
||||
warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue