authorgravatar for yangxudong@ymatrix.cnYANG Xudong <yangxudong@ymatrix.cn> 2024-08-08 04:06:29+08:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2024-08-07 13:06:29-07:00
logb8705ed6527e779a140e8beccb48d424dbbdf856
treef9d09269ffe6446ae53ddedc4b3657f97e97bf35
parent4d6429fc4fd299cdfb2256d4aac87bc6551ba09e
signaturebadge-check Signed by PGP key B5690EEEBB952194

loongarch: various architecture specific fixes (#20912)


4 files changed, 12 insertions(+), 1 deletions(-)

lib/std/mem.zig+8
...@@ -17,6 +17,14 @@ pub const page_size = switch (builtin.cpu.arch) {...@@ -17,6 +17,14 @@ pub const page_size = switch (builtin.cpu.arch) {
17 else => 4 * 1024,17 else => 4 * 1024,
18 },18 },
19 .sparc64 => 8 * 1024,19 .sparc64 => 8 * 1024,
20 .loongarch32, .loongarch64 => switch (builtin.os.tag) {
21 // Linux default KConfig value is 16KiB
22 .linux => 16 * 1024,
23 // FIXME:
24 // There is no other OS supported yet. Use the same value
25 // as Linux for now.
26 else => 16 * 1024,
27 },
20 else => 4 * 1024,28 else => 4 * 1024,
21};29};
2230
lib/std/os/linux.zig+1
...@@ -132,6 +132,7 @@ pub const SYS = switch (@import("builtin").cpu.arch) {...@@ -132,6 +132,7 @@ pub const SYS = switch (@import("builtin").cpu.arch) {
132 .riscv64 => syscalls.RiscV64,132 .riscv64 => syscalls.RiscV64,
133 .sparc => syscalls.Sparc,133 .sparc => syscalls.Sparc,
134 .sparc64 => syscalls.Sparc64,134 .sparc64 => syscalls.Sparc64,
135 .loongarch64 => syscalls.LoongArch64,
135 .m68k => syscalls.M68k,136 .m68k => syscalls.M68k,
136 .mips, .mipsel => syscalls.MipsO32,137 .mips, .mipsel => syscalls.MipsO32,
137 .mips64, .mips64el => if (builtin.abi == .gnuabin32)138 .mips64, .mips64el => if (builtin.abi == .gnuabin32)
src/glibc.zig+1
...@@ -1182,6 +1182,7 @@ fn buildSharedLib(...@@ -1182,6 +1182,7 @@ fn buildSharedLib(
1182pub fn needsCrtiCrtn(target: std.Target) bool {1182pub fn needsCrtiCrtn(target: std.Target) bool {
1183 return switch (target.cpu.arch) {1183 return switch (target.cpu.arch) {
1184 .riscv32, .riscv64 => false,1184 .riscv32, .riscv64 => false,
1185 .loongarch64 => false,
1185 else => true,1186 else => true,
1186 };1187 };
1187}1188}
src/musl.zig+2-1
...@@ -293,7 +293,8 @@ pub fn needsCrtiCrtn(target: std.Target) bool {...@@ -293,7 +293,8 @@ pub fn needsCrtiCrtn(target: std.Target) bool {
293 return switch (target.cpu.arch) {293 return switch (target.cpu.arch) {
294 .riscv32,294 .riscv32,
295 .riscv64,295 .riscv64,
296 .wasm32, .wasm64 => return false,296 .wasm32, .wasm64 => false,
297 .loongarch64 => false,
297 else => true,298 else => true,
298 };299 };
299 // zig fmt: on300 // zig fmt: on