jasonwhite / syscalls

Raw Linux system calls for Rust.
Other
109 stars 14 forks source link

Add loongarch64 support #53

Closed k0tran closed 2 months ago

k0tran commented 2 months ago

PR implementing loongarch64 support

Tested on loongarch64 rust 1.80.0\ Builds with debug and release flags\ Passes all the tests with debug and release flags

Notes to maintainer:

Might be useful:

jasonwhite commented 2 months ago

NOTE: The CI failures for thumb mode are unrelated to this PR. It looks like a recent Rust version broke this.

k0tran commented 2 months ago

I found that for now there is no macro for defining 7-arg syscall https://github.com/torvalds/linux/blob/1fb918967b56df3262ee984175816f0acb310501/include/linux/syscalls.h#L227

Will redo and force loongarch to not using syscall7

jasonwhite commented 2 months ago

Looks like the loongarch64 CI linker failure is an issue with cross-rs. I suspect this is just because the CI for this repo is using an outdated version of cross-rs as I see there have been some recent fixes for loongarch64.

syscalls-483deb5c79caa4ef.00d8fg4tdgpxcva2mmxyzpx89.rcgu.o: Relocations in generic ELF (EM: 258)
syscalls-483deb5c79caa4ef.00d8fg4tdgpxcva2mmxyzpx89.rcgu.o: error adding symbols: file in wrong format

If you don't want to solve this issue, then I'm okay with simply having it disabled for now.

k0tran commented 2 months ago

On my loongarch64 machine and cross 0.2.5 (on x86 with loongarch64 toolchain) compiles just fine. I'll look if I can update ci cross version

k0tran commented 2 months ago

After installing rust from rustup everything started failing as in CI. Cross version is the same (0.2.5). I think the main cause of the error is this warning:

[cross] warning: `cross` does not provide a Docker image for target loongarch64-unknown-linux-gnu, specify a custom image in `Cross.toml`.
k0tran commented 2 months ago

Found the problem. Right now cross version from cargo install cross does not work, but master (cargo install cross --git https://github.com/cross-rs/cross) does, so CI should wait until next cross-rs release, I suppose.