Skip to content

Commit 1a2fa63

Browse files
Rollup merge of rust-lang#142053 - heiher:loong32-none, r=wesleywiser
Add new Tier-3 targets: `loongarch32-unknown-none*` MCP: rust-lang/compiler-team#865 NOTE: LoongArch32 ELF object support is available starting with object v0.37.0.
2 parents 521041a + 6a5a696 commit 1a2fa63

File tree

9 files changed

+17
-6
lines changed

9 files changed

+17
-6
lines changed

core/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ debug_typeid = []
2929
[lints.rust.unexpected_cfgs]
3030
level = "warn"
3131
check-cfg = [
32+
# #[cfg(bootstrap)] loongarch32
33+
'cfg(target_arch, values("loongarch32"))',
3234
'cfg(no_fp_fmt_parse)',
3335
# core use #[path] imports to portable-simd `core_simd` crate
3436
# and to stdarch `core_arch` crate which messes-up with Cargo list

core/src/sync/atomic.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@
178178
//!
179179
//! | `target_arch` | Size limit |
180180
//! |---------------|---------|
181-
//! | `x86`, `arm`, `mips`, `mips32r6`, `powerpc`, `riscv32`, `sparc`, `hexagon` | 4 bytes |
181+
//! | `x86`, `arm`, `loongarch32`, `mips`, `mips32r6`, `powerpc`, `riscv32`, `sparc`, `hexagon` | 4 bytes |
182182
//! | `x86_64`, `aarch64`, `loongarch64`, `mips64`, `mips64r6`, `powerpc64`, `riscv64`, `sparc64`, `s390x` | 8 bytes |
183183
//!
184184
//! 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;
350350
// This list should only contain architectures which have word-sized atomic-or/
351351
// atomic-and instructions but don't natively support byte-sized atomics.
352352
#[cfg(target_has_atomic = "8")]
353-
const EMULATE_ATOMIC_BOOL: bool =
354-
cfg!(any(target_arch = "riscv32", target_arch = "riscv64", target_arch = "loongarch64"));
353+
const EMULATE_ATOMIC_BOOL: bool = cfg!(any(
354+
target_arch = "riscv32",
355+
target_arch = "riscv64",
356+
target_arch = "loongarch32",
357+
target_arch = "loongarch64"
358+
));
355359

356360
/// A boolean type which can be safely shared between threads.
357361
///

std/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,8 @@ test = true
157157
[lints.rust.unexpected_cfgs]
158158
level = "warn"
159159
check-cfg = [
160+
# #[cfg(bootstrap)] loongarch32
161+
'cfg(target_arch, values("loongarch32"))',
160162
# std use #[path] imports to portable-simd `std_float` crate
161163
# and to the `backtrace` crate which messes-up with Cargo list
162164
# of declared features, we therefor expect any feature cfg

std/src/env.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,6 +1046,7 @@ pub mod consts {
10461046
/// * `"sparc"`
10471047
/// * `"sparc64"`
10481048
/// * `"hexagon"`
1049+
/// * `"loongarch32"`
10491050
/// * `"loongarch64"`
10501051
///
10511052
/// </details>

std/src/os/linux/raw.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ mod arch {
231231
}
232232

233233
#[cfg(any(
234+
target_arch = "loongarch32",
234235
target_arch = "loongarch64",
235236
target_arch = "mips64",
236237
target_arch = "mips64r6",

std/src/sys/alloc/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const MIN_ALIGN: usize = if cfg!(any(
1717
target_arch = "arm",
1818
target_arch = "m68k",
1919
target_arch = "csky",
20+
target_arch = "loongarch32",
2021
target_arch = "mips",
2122
target_arch = "mips32r6",
2223
target_arch = "powerpc",

std/src/sys/personality/gcc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ const UNWIND_DATA_REG: (i32, i32) = (0, 1); // R0, R1
8686
#[cfg(any(target_arch = "riscv64", target_arch = "riscv32"))]
8787
const UNWIND_DATA_REG: (i32, i32) = (10, 11); // x10, x11
8888

89-
#[cfg(target_arch = "loongarch64")]
89+
#[cfg(any(target_arch = "loongarch32", target_arch = "loongarch64"))]
9090
const UNWIND_DATA_REG: (i32, i32) = (4, 5); // a0, a1
9191

9292
// The following code is based on GCC's C and C++ personality routines. For reference, see:

unwind/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@ system-llvm-libunwind = []
3737

3838
[lints.rust.unexpected_cfgs]
3939
level = "warn"
40-
check-cfg = ['cfg(emscripten_wasm_eh)']
40+
check-cfg = ['cfg(emscripten_wasm_eh)', 'cfg(target_arch, values("loongarch32"))']

unwind/src/libunwind.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ pub const unwinder_private_data_size: usize = 2;
8181
#[cfg(all(target_arch = "hexagon", target_os = "linux"))]
8282
pub const unwinder_private_data_size: usize = 35;
8383

84-
#[cfg(target_arch = "loongarch64")]
84+
#[cfg(any(target_arch = "loongarch32", target_arch = "loongarch64"))]
8585
pub const unwinder_private_data_size: usize = 2;
8686

8787
#[repr(C)]

0 commit comments

Comments
 (0)