-
Notifications
You must be signed in to change notification settings - Fork 167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for loongarch64 #528
Conversation
114726d
to
4b3f3d1
Compare
364706e
to
6d98f02
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now I see why rust-lang/rust#101069 is needed at all at such an early bring-up stage... this crate is being depended upon by Cargo. A lot have changed since I last ported Rust.
cc @heiher
@@ -361,6 +361,8 @@ fn init() { | |||
let ptr = vdso.sym(cstr!("LINUX_2.6"), cstr!("__vdso_clock_gettime64")); | |||
#[cfg(target_arch = "mips64")] | |||
let ptr = vdso.sym(cstr!("LINUX_2.6"), cstr!("__vdso_clock_gettime")); | |||
#[cfg(target_arch = "loongarch64")] | |||
let ptr = vdso.sym(cstr!("LINUX_5.19"), cstr!("__vdso_clock_gettime")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is wrong, LoongArch vDSO symbol version is LINUX_5.10
according to the sources. (It's the version at the time LoongArch upstream work has started, not the time when the port was mainlined, IIUC.)
@@ -328,6 +336,7 @@ pub(crate) fn setpriority_process(pid: Option<Pid>, priority: i32) -> io::Result | |||
} | |||
} | |||
|
|||
#[cfg(not(target_arch = "loongarch64"))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should deprive LoongArch from having old-style {get,set}rlimit
API support. As you can see, this function is actually just a prlimit64
wrapper.
#[cfg(all(target_pointer_width = "64", not(target_arch = "mips64")))] | ||
#[cfg(all( | ||
target_pointer_width = "64", | ||
not(any(target_arch = "mips64", target_arch = "loongarch64")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly we most definitely don't want to force everyone to migrate to statx
if they ever want their code to run on LoongArch systems. We should keep the generic stat
definitions here, but add code for translating between the two ABIs: see my Go adaptation a while ago (check src/syscall/syscall_linux_loong64.go
) or glibc (check sysdeps/unix/sysv/linux/fstatat64.c
). We have to add the code because we're the first 64-bit architecture without fstat
at all.
On architectures it doesn't recognize, rustix should default to using its libc backend, which doesn't use any |
The LoongArch architecture (LoongArch) is an Instruction Set Architecture (ISA) that has a RISC style.
Documentations:
ISA:
https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html
ABI:
https://loongson.github.io/LoongArch-Documentation/LoongArch-ELF-ABI-EN.html
More docs can be found at:
https://loongson.github.io/LoongArch-Documentation/README-EN.html