Skip to content

Commit ab0a33a

Browse files
authored
Unrolled build for #142053
Rollup merge of #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 c31cccb + 38d69c3 commit ab0a33a

File tree

34 files changed

+181
-53
lines changed

34 files changed

+181
-53
lines changed

Cargo.lock

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ version = "0.4.2"
162162
source = "registry+https://github.com/rust-lang/crates.io-index"
163163
checksum = "01667f6f40216b9a0b2945e05fed5f1ad0ab6470e69cb9378001e37b1c0668e4"
164164
dependencies = [
165-
"object",
165+
"object 0.36.7",
166166
]
167167

168168
[[package]]
@@ -235,7 +235,7 @@ dependencies = [
235235
"cfg-if",
236236
"libc",
237237
"miniz_oxide",
238-
"object",
238+
"object 0.36.7",
239239
"rustc-demangle",
240240
"windows-targets 0.52.6",
241241
]
@@ -2509,7 +2509,19 @@ dependencies = [
25092509
"indexmap",
25102510
"memchr",
25112511
"ruzstd",
2512-
"wasmparser 0.222.1",
2512+
]
2513+
2514+
[[package]]
2515+
name = "object"
2516+
version = "0.37.0"
2517+
source = "registry+https://github.com/rust-lang/crates.io-index"
2518+
checksum = "6273adb7096cf9ab4335f258e627d8230e69d40d45567d678f552dcec6245215"
2519+
dependencies = [
2520+
"crc32fast",
2521+
"hashbrown",
2522+
"indexmap",
2523+
"memchr",
2524+
"wasmparser 0.232.0",
25132525
]
25142526

25152527
[[package]]
@@ -3109,7 +3121,7 @@ dependencies = [
31093121
"build_helper",
31103122
"gimli",
31113123
"libc",
3112-
"object",
3124+
"object 0.36.7",
31133125
"regex",
31143126
"serde_json",
31153127
"similar",
@@ -3422,7 +3434,7 @@ dependencies = [
34223434
"itertools",
34233435
"libc",
34243436
"measureme",
3425-
"object",
3437+
"object 0.37.0",
34263438
"rustc-demangle",
34273439
"rustc_abi",
34283440
"rustc_ast",
@@ -3463,7 +3475,7 @@ dependencies = [
34633475
"either",
34643476
"itertools",
34653477
"libc",
3466-
"object",
3478+
"object 0.37.0",
34673479
"pathdiff",
34683480
"regex",
34693481
"rustc_abi",
@@ -4495,7 +4507,7 @@ name = "rustc_target"
44954507
version = "0.0.0"
44964508
dependencies = [
44974509
"bitflags",
4498-
"object",
4510+
"object 0.37.0",
44994511
"rustc_abi",
45004512
"rustc_data_structures",
45014513
"rustc_fs_util",
@@ -5247,7 +5259,7 @@ checksum = "9e9c1e705f82a260173f3eec93f2ff6d7807f23ad5a8cc2e7316a891733ea7a1"
52475259
dependencies = [
52485260
"gimli",
52495261
"hashbrown",
5250-
"object",
5262+
"object 0.36.7",
52515263
"tracing",
52525264
]
52535265

@@ -5908,15 +5920,6 @@ dependencies = [
59085920
"indexmap",
59095921
]
59105922

5911-
[[package]]
5912-
name = "wasmparser"
5913-
version = "0.222.1"
5914-
source = "registry+https://github.com/rust-lang/crates.io-index"
5915-
checksum = "fa210fd1788e6b37a1d1930f3389c48e1d6ebd1a013d34fa4b7f9e3e3bf03146"
5916-
dependencies = [
5917-
"bitflags",
5918-
]
5919-
59205923
[[package]]
59215924
name = "wasmparser"
59225925
version = "0.229.0"
@@ -5941,6 +5944,15 @@ dependencies = [
59415944
"semver",
59425945
]
59435946

5947+
[[package]]
5948+
name = "wasmparser"
5949+
version = "0.232.0"
5950+
source = "registry+https://github.com/rust-lang/crates.io-index"
5951+
checksum = "917739b33bb1eb0e9a49bcd2637a351931be4578d0cc4d37b908d7a797784fbb"
5952+
dependencies = [
5953+
"bitflags",
5954+
]
5955+
59445956
[[package]]
59455957
name = "wast"
59465958
version = "230.0.0"

compiler/rustc_codegen_gcc/example/alloc_system.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
// add fast paths for low alignment values.
99
#[cfg(any(target_arch = "x86",
1010
target_arch = "arm",
11+
target_arch = "loongarch32",
1112
target_arch = "m68k",
1213
target_arch = "mips",
1314
target_arch = "mips32r6",

compiler/rustc_codegen_llvm/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ gimli = "0.31"
1515
itertools = "0.12"
1616
libc = "0.2"
1717
measureme = "12.0.1"
18-
object = { version = "0.36.3", default-features = false, features = ["std", "read"] }
18+
object = { version = "0.37.0", default-features = false, features = ["std", "read"] }
1919
rustc-demangle = "0.1.21"
2020
rustc_abi = { path = "../rustc_abi" }
2121
rustc_ast = { path = "../rustc_ast" }

compiler/rustc_codegen_llvm/src/asm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ impl<'ll, 'tcx> AsmBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> {
251251
InlineAsmArch::Nvptx64 => {}
252252
InlineAsmArch::PowerPC | InlineAsmArch::PowerPC64 => {}
253253
InlineAsmArch::Hexagon => {}
254-
InlineAsmArch::LoongArch64 => {
254+
InlineAsmArch::LoongArch32 | InlineAsmArch::LoongArch64 => {
255255
constraints.extend_from_slice(&[
256256
"~{$fcc0}".to_string(),
257257
"~{$fcc1}".to_string(),

compiler/rustc_codegen_ssa/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ libc = "0.2.50"
5454
# tidy-alphabetical-end
5555

5656
[dependencies.object]
57-
version = "0.36.2"
57+
version = "0.37.0"
5858
default-features = false
5959
features = ["read_core", "elf", "macho", "pe", "xcoff", "unaligned", "archive", "write", "wasm"]
6060

compiler/rustc_codegen_ssa/src/back/link/raw_dylib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,7 @@ fn create_elf_raw_dylib_stub(sess: &Session, soname: &str, symbols: &[DllImport]
287287
(Architecture::X86_64, None) => elf::EM_X86_64,
288288
(Architecture::X86_64_X32, None) => elf::EM_X86_64,
289289
(Architecture::Hexagon, None) => elf::EM_HEXAGON,
290+
(Architecture::LoongArch32, None) => elf::EM_LOONGARCH,
290291
(Architecture::LoongArch64, None) => elf::EM_LOONGARCH,
291292
(Architecture::M68k, None) => elf::EM_68K,
292293
(Architecture::Mips, None) => elf::EM_MIPS,

compiler/rustc_codegen_ssa/src/back/metadata.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ pub(super) fn elf_e_flags(architecture: Architecture, sess: &Session) -> u32 {
348348

349349
e_flags
350350
}
351-
Architecture::LoongArch64 => {
351+
Architecture::LoongArch32 | Architecture::LoongArch64 => {
352352
// Source: https://github.com/loongson/la-abi-specs/blob/release/laelf.adoc#e_flags-identifies-abi-type-and-version
353353
let mut e_flags: u32 = elf::EF_LARCH_OBJABI_V1;
354354

compiler/rustc_target/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ tracing = "0.1"
2020
# tidy-alphabetical-start
2121
default-features = false
2222
features = ["elf", "macho"]
23-
version = "0.36.2"
23+
version = "0.37.0"
2424
# tidy-alphabetical-end

compiler/rustc_target/src/asm/mod.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ pub enum InlineAsmArch {
226226
RiscV64,
227227
Nvptx64,
228228
Hexagon,
229+
LoongArch32,
229230
LoongArch64,
230231
Mips,
231232
Mips64,
@@ -260,6 +261,7 @@ impl FromStr for InlineAsmArch {
260261
"powerpc" => Ok(Self::PowerPC),
261262
"powerpc64" => Ok(Self::PowerPC64),
262263
"hexagon" => Ok(Self::Hexagon),
264+
"loongarch32" => Ok(Self::LoongArch32),
263265
"loongarch64" => Ok(Self::LoongArch64),
264266
"mips" | "mips32r6" => Ok(Self::Mips),
265267
"mips64" | "mips64r6" => Ok(Self::Mips64),
@@ -365,7 +367,9 @@ impl InlineAsmReg {
365367
Self::PowerPC(PowerPCInlineAsmReg::parse(name)?)
366368
}
367369
InlineAsmArch::Hexagon => Self::Hexagon(HexagonInlineAsmReg::parse(name)?),
368-
InlineAsmArch::LoongArch64 => Self::LoongArch(LoongArchInlineAsmReg::parse(name)?),
370+
InlineAsmArch::LoongArch32 | InlineAsmArch::LoongArch64 => {
371+
Self::LoongArch(LoongArchInlineAsmReg::parse(name)?)
372+
}
369373
InlineAsmArch::Mips | InlineAsmArch::Mips64 => {
370374
Self::Mips(MipsInlineAsmReg::parse(name)?)
371375
}
@@ -652,7 +656,9 @@ impl InlineAsmRegClass {
652656
Self::PowerPC(PowerPCInlineAsmRegClass::parse(name)?)
653657
}
654658
InlineAsmArch::Hexagon => Self::Hexagon(HexagonInlineAsmRegClass::parse(name)?),
655-
InlineAsmArch::LoongArch64 => Self::LoongArch(LoongArchInlineAsmRegClass::parse(name)?),
659+
InlineAsmArch::LoongArch32 | InlineAsmArch::LoongArch64 => {
660+
Self::LoongArch(LoongArchInlineAsmRegClass::parse(name)?)
661+
}
656662
InlineAsmArch::Mips | InlineAsmArch::Mips64 => {
657663
Self::Mips(MipsInlineAsmRegClass::parse(name)?)
658664
}
@@ -860,7 +866,7 @@ pub fn allocatable_registers(
860866
hexagon::fill_reg_map(arch, reloc_model, target_features, target, &mut map);
861867
map
862868
}
863-
InlineAsmArch::LoongArch64 => {
869+
InlineAsmArch::LoongArch32 | InlineAsmArch::LoongArch64 => {
864870
let mut map = loongarch::regclass_map();
865871
loongarch::fill_reg_map(arch, reloc_model, target_features, target, &mut map);
866872
map
@@ -992,7 +998,7 @@ impl InlineAsmClobberAbi {
992998
"C" | "system" => Ok(InlineAsmClobberAbi::Avr),
993999
_ => Err(&["C", "system"]),
9941000
},
995-
InlineAsmArch::LoongArch64 => match name {
1001+
InlineAsmArch::LoongArch32 | InlineAsmArch::LoongArch64 => match name {
9961002
"C" | "system" => Ok(InlineAsmClobberAbi::LoongArch),
9971003
_ => Err(&["C", "system"]),
9981004
},

compiler/rustc_target/src/callconv/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,7 @@ impl<'a, Ty> FnAbi<'a, Ty> {
648648
"amdgpu" => amdgpu::compute_abi_info(cx, self),
649649
"arm" => arm::compute_abi_info(cx, self),
650650
"avr" => avr::compute_abi_info(self),
651-
"loongarch64" => loongarch::compute_abi_info(cx, self),
651+
"loongarch32" | "loongarch64" => loongarch::compute_abi_info(cx, self),
652652
"m68k" => m68k::compute_abi_info(self),
653653
"csky" => csky::compute_abi_info(self),
654654
"mips" | "mips32r6" => mips::compute_abi_info(cx, self),
@@ -691,7 +691,7 @@ impl<'a, Ty> FnAbi<'a, Ty> {
691691
match &*spec.arch {
692692
"x86" => x86::compute_rust_abi_info(cx, self),
693693
"riscv32" | "riscv64" => riscv::compute_rust_abi_info(cx, self),
694-
"loongarch64" => loongarch::compute_rust_abi_info(cx, self),
694+
"loongarch32" | "loongarch64" => loongarch::compute_rust_abi_info(cx, self),
695695
"aarch64" => aarch64::compute_rust_abi_info(cx, self),
696696
_ => {}
697697
};

0 commit comments

Comments
 (0)