about summary refs log tree commit diff
path: root/library/stdarch/crates/std_detect/src/detect
diff options
context:
space:
mode:
authorWANG Rui <wangrui@loongson.cn>2025-06-28 11:16:39 +0800
committerWANG Rui <wangrui@loongson.cn>2025-06-28 11:28:32 +0800
commitd63e865a958a4e75e20b9b043c22b70094b9f0e1 (patch)
tree97b9f21c89efe909c499c75988ad52836d5a78da /library/stdarch/crates/std_detect/src/detect
parent36462f901e5b45eec36ea52000c8f2caa4b8ea67 (diff)
downloadrust-d63e865a958a4e75e20b9b043c22b70094b9f0e1.tar.gz
rust-d63e865a958a4e75e20b9b043c22b70094b9f0e1.zip
loongarch: Add basic support for LoongArch32
Diffstat (limited to 'library/stdarch/crates/std_detect/src/detect')
-rw-r--r--library/stdarch/crates/std_detect/src/detect/arch/loongarch.rs2
-rw-r--r--library/stdarch/crates/std_detect/src/detect/arch/mod.rs2
-rw-r--r--library/stdarch/crates/std_detect/src/detect/mod.rs1
-rw-r--r--library/stdarch/crates/std_detect/src/detect/os/linux/auxvec.rs2
-rw-r--r--library/stdarch/crates/std_detect/src/detect/os/linux/mod.rs2
5 files changed, 6 insertions, 3 deletions
diff --git a/library/stdarch/crates/std_detect/src/detect/arch/loongarch.rs b/library/stdarch/crates/std_detect/src/detect/arch/loongarch.rs
index e9d68f6a9bf..68fc600fa8e 100644
--- a/library/stdarch/crates/std_detect/src/detect/arch/loongarch.rs
+++ b/library/stdarch/crates/std_detect/src/detect/arch/loongarch.rs
@@ -2,7 +2,7 @@
 
 features! {
     @TARGET: loongarch;
-    @CFG: target_arch = "loongarch64";
+    @CFG: any(target_arch = "loongarch32", target_arch = "loongarch64");
     @MACRO_NAME: is_loongarch_feature_detected;
     @MACRO_ATTRS:
     /// Checks if `loongarch` feature is enabled.
diff --git a/library/stdarch/crates/std_detect/src/detect/arch/mod.rs b/library/stdarch/crates/std_detect/src/detect/arch/mod.rs
index d5a13acc028..b0be554ed89 100644
--- a/library/stdarch/crates/std_detect/src/detect/arch/mod.rs
+++ b/library/stdarch/crates/std_detect/src/detect/arch/mod.rs
@@ -49,7 +49,7 @@ cfg_if! {
     } else if #[cfg(target_arch = "mips64")] {
         #[unstable(feature = "stdarch_mips_feature_detection", issue = "111188")]
         pub use mips64::*;
-    } else if #[cfg(target_arch = "loongarch64")] {
+    } else if #[cfg(any(target_arch = "loongarch32", target_arch = "loongarch64"))] {
         #[stable(feature = "stdarch_loongarch_feature", since = "1.89.0")]
         pub use loongarch::*;
     } else if #[cfg(target_arch = "s390x")] {
diff --git a/library/stdarch/crates/std_detect/src/detect/mod.rs b/library/stdarch/crates/std_detect/src/detect/mod.rs
index 8fd3d957932..a9e9709c1f6 100644
--- a/library/stdarch/crates/std_detect/src/detect/mod.rs
+++ b/library/stdarch/crates/std_detect/src/detect/mod.rs
@@ -103,6 +103,7 @@ pub fn features() -> impl Iterator<Item = (&'static str, bool)> {
             target_arch = "powerpc64",
             target_arch = "mips",
             target_arch = "mips64",
+            target_arch = "loongarch32",
             target_arch = "loongarch64",
             target_arch = "s390x",
         ))] {
diff --git a/library/stdarch/crates/std_detect/src/detect/os/linux/auxvec.rs b/library/stdarch/crates/std_detect/src/detect/os/linux/auxvec.rs
index c30379ff065..54f52aa7533 100644
--- a/library/stdarch/crates/std_detect/src/detect/os/linux/auxvec.rs
+++ b/library/stdarch/crates/std_detect/src/detect/os/linux/auxvec.rs
@@ -80,6 +80,7 @@ pub(crate) fn auxv() -> Result<AuxVec, ()> {
             target_arch = "riscv64",
             target_arch = "mips",
             target_arch = "mips64",
+            target_arch = "loongarch32",
             target_arch = "loongarch64",
         ))]
         {
@@ -182,6 +183,7 @@ fn auxv_from_buf(buf: &[usize]) -> Result<AuxVec, ()> {
         target_arch = "riscv64",
         target_arch = "mips",
         target_arch = "mips64",
+        target_arch = "loongarch32",
         target_arch = "loongarch64",
     ))]
     {
diff --git a/library/stdarch/crates/std_detect/src/detect/os/linux/mod.rs b/library/stdarch/crates/std_detect/src/detect/os/linux/mod.rs
index 8c689d0b1f0..9accd41717b 100644
--- a/library/stdarch/crates/std_detect/src/detect/os/linux/mod.rs
+++ b/library/stdarch/crates/std_detect/src/detect/os/linux/mod.rs
@@ -51,7 +51,7 @@ cfg_if::cfg_if! {
     } else if #[cfg(any(target_arch = "powerpc", target_arch = "powerpc64"))] {
         mod powerpc;
         pub(crate) use self::powerpc::detect_features;
-    } else if #[cfg(target_arch = "loongarch64")] {
+    } else if #[cfg(any(target_arch = "loongarch32", target_arch = "loongarch64"))] {
         mod loongarch;
         pub(crate) use self::loongarch::detect_features;
     } else if #[cfg(target_arch = "s390x")] {