Skip to content

Commit

Permalink
Add loongarch64 support
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaixiaojuan committed Apr 28, 2022
1 parent 40d529f commit 467c34c
Show file tree
Hide file tree
Showing 6 changed files with 901 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/unix/linux_like/linux/align.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ macro_rules! expand_align {
target_arch = "sparc64",
target_arch = "aarch64",
target_arch = "riscv64",
target_arch = "riscv32"),
target_arch = "riscv32",
target_arch = "loongarch64"),
repr(align(4)))]
#[cfg_attr(not(any(target_pointer_width = "32",
target_arch = "x86_64",
Expand All @@ -19,7 +20,8 @@ macro_rules! expand_align {
target_arch = "sparc64",
target_arch = "aarch64",
target_arch = "riscv64",
target_arch = "riscv32")),
target_arch = "riscv32",
target_arch = "loongarch64")),
repr(align(8)))]
pub struct pthread_mutexattr_t {
#[doc(hidden)]
Expand Down
7 changes: 7 additions & 0 deletions src/unix/linux_like/linux/gnu/b64/loongarch64/align.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
s_no_extra_traits! {
#[allow(missing_debug_implementations)]
#[repr(align(16))]
pub struct max_align_t {
priv_: [f64; 4]
}
}
Loading

1 comment on commit 467c34c

@zhaixiaojuan
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For loongarch64, the test results are as follows:

(1) cargo test --no-default-features --manifest-path libc-test/Cargo.toml --target loongarch64-unknown-linux-gnu

[root@zhaixiaojuan libc]# cargo test --no-default-features --manifest-path libc-test/Cargo.toml --target loongarch64-unknown-linux-gnu
   Compiling proc-macro2 v1.0.36
   Compiling unicode-xid v0.2.2
   Compiling syn v1.0.86
   Compiling serde_derive v1.0.136
   Compiling libc v0.2.119
   Compiling serde v1.0.136
   Compiling cfg-if v0.1.10
   Compiling semver v1.0.6
   Compiling serde_json v1.0.79
   Compiling log v0.4.14
   Compiling itoa v1.0.1
   Compiling cfg-if v1.0.0
   Compiling ryu v1.0.9
   Compiling bitflags v1.3.2
   Compiling cc v1.0.73
   Compiling libc v0.2.124 (/home/loongson/github/libc)
   Compiling quote v1.0.15
   Compiling rustc_version v0.4.0
   Compiling dirs-sys v0.3.6
   Compiling dirs v2.0.2
   Compiling term v0.6.1
   Compiling garando_pos v0.1.0
   Compiling garando_errors v0.1.0
   Compiling garando_syntax v0.1.0
   Compiling ctest2 v0.4.3
   Compiling libc-test v0.2.124 (/home/loongson/github/libc/libc-test)
    Finished test [unoptimized + debuginfo] target(s) in 6m 11s
     Running test/cmsg.rs (target/loongarch64-unknown-linux-gnu/debug/deps/cmsg-584fc538b23a4629)

running 5 tests
test t::test_cmsg_data ... ok
test t::test_cmsg_firsthdr ... ok
test t::test_cmsg_len ... ok
test t::test_cmsg_space ... ok
test t::test_cmsg_nxthdr ... ok

test result: ok. 5 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 1.53s

     Running test/errqueue.rs (target/loongarch64-unknown-linux-gnu/debug/deps/errqueue-4406cf1d9eeb544a)

running 1 test
test t::test_cmsg_data ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

     Running test/linux_elf.rs (target/loongarch64-unknown-linux-gnu/debug/deps/linux_elf-1dad2595d35bf057)
RUNNING ALL TESTS
PASSED 52 tests
     Running test/linux_fcntl.rs (target/loongarch64-unknown-linux-gnu/debug/deps/linux_fcntl-5e14cec9480e4e3a)
RUNNING ALL TESTS
PASSED 28 tests
     Running test/linux_if_arp.rs (target/loongarch64-unknown-linux-gnu/debug/deps/linux_if_arp-9cacdd3bd497a541)
RUNNING ALL TESTS
PASSED 2 tests
     Running test/linux_ipv6.rs (target/loongarch64-unknown-linux-gnu/debug/deps/linux_ipv6-ebdc7c85fea2b4e7)
RUNNING ALL TESTS
PASSED 20 tests
     Running test/linux_strerror_r.rs (target/loongarch64-unknown-linux-gnu/debug/deps/linux_strerror_r-966db7168a9b0b56)
RUNNING ALL TESTS
PASSED 1 tests
     Running test/linux_termios.rs (target/loongarch64-unknown-linux-gnu/debug/deps/linux_termios-55a46c6a6bfeccdd)
RUNNING ALL TESTS
PASSED 66 tests
     Running test/main.rs (target/loongarch64-unknown-linux-gnu/debug/deps/main-afa3b9d17f149d11)
RUNNING ALL TESTS
PASSED 20556 tests
     Running test/semver.rs (target/loongarch64-unknown-linux-gnu/debug/deps/semver-ae6b4b93c9622fe4)
PASSED 1 tests
     Running test/sigrt.rs (target/loongarch64-unknown-linux-gnu/debug/deps/sigrt-9b41b2c3fae3039f)

running 2 tests
test t::test_sigrtmax ... ok
test t::test_sigrtmin ... ok

test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

(2) cargo test --manifest-path libc-test/Cargo.toml --target loongarch64-unknown-linux-gnu

[root@zhaixiaojuan libc]# cargo test --manifest-path libc-test/Cargo.toml --target loongarch64-unknown-linux-gnu 
   Compiling proc-macro2 v1.0.36
   Compiling unicode-xid v0.2.2
   Compiling syn v1.0.86
   Compiling serde_derive v1.0.136
   Compiling libc v0.2.119
   Compiling serde v1.0.136
   Compiling cfg-if v0.1.10
   Compiling serde_json v1.0.79
   Compiling log v0.4.14
   Compiling semver v1.0.6
   Compiling ryu v1.0.9
   Compiling cfg-if v1.0.0
   Compiling itoa v1.0.1
   Compiling bitflags v1.3.2
   Compiling cc v1.0.73
   Compiling libc v0.2.124 (/home/loongson/github/libc)
   Compiling quote v1.0.15
   Compiling dirs-sys v0.3.6
   Compiling rustc_version v0.4.0
   Compiling dirs v2.0.2
   Compiling term v0.6.1
   Compiling garando_pos v0.1.0
   Compiling garando_errors v0.1.0
   Compiling garando_syntax v0.1.0
   Compiling ctest2 v0.4.3
   Compiling libc-test v0.2.124 (/home/loongson/github/libc/libc-test)
    Finished test [unoptimized + debuginfo] target(s) in 6m 17s
     Running test/cmsg.rs (target/loongarch64-unknown-linux-gnu/debug/deps/cmsg-edc025916f689a3e)

running 5 tests
test t::test_cmsg_data ... ok
test t::test_cmsg_firsthdr ... ok
test t::test_cmsg_len ... ok
test t::test_cmsg_space ... ok
test t::test_cmsg_nxthdr ... ok

test result: ok. 5 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 1.60s

     Running test/errqueue.rs (target/loongarch64-unknown-linux-gnu/debug/deps/errqueue-35aa8812b9188bbc)

running 1 test
test t::test_cmsg_data ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

     Running test/linux_elf.rs (target/loongarch64-unknown-linux-gnu/debug/deps/linux_elf-14605b650c22e125)
RUNNING ALL TESTS
PASSED 52 tests
     Running test/linux_fcntl.rs (target/loongarch64-unknown-linux-gnu/debug/deps/linux_fcntl-c50202e2497a766e)
RUNNING ALL TESTS
PASSED 28 tests
     Running test/linux_if_arp.rs (target/loongarch64-unknown-linux-gnu/debug/deps/linux_if_arp-551c72e47f8ac780)
RUNNING ALL TESTS
PASSED 2 tests
     Running test/linux_ipv6.rs (target/loongarch64-unknown-linux-gnu/debug/deps/linux_ipv6-75daecd395a605f0)
RUNNING ALL TESTS
PASSED 20 tests
     Running test/linux_strerror_r.rs (target/loongarch64-unknown-linux-gnu/debug/deps/linux_strerror_r-49508a1bb1b2e90c)
RUNNING ALL TESTS
PASSED 1 tests
     Running test/linux_termios.rs (target/loongarch64-unknown-linux-gnu/debug/deps/linux_termios-9a780cae687e787c)
RUNNING ALL TESTS
PASSED 66 tests
     Running test/main.rs (target/loongarch64-unknown-linux-gnu/debug/deps/main-6fb7b45b83453845)
RUNNING ALL TESTS
PASSED 20556 tests
     Running test/semver.rs (target/loongarch64-unknown-linux-gnu/debug/deps/semver-9ef07f4c1475c9d0)
PASSED 1 tests
     Running test/sigrt.rs (target/loongarch64-unknown-linux-gnu/debug/deps/sigrt-da796c231cdb59bb)

running 2 tests
test t::test_sigrtmax ... ok
test t::test_sigrtmin ... ok

test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s

(3) RUST_BACKTRACE=1 cargo test --features extra_traits --manifest-path libc-test/Cargo.toml --target
loongarch64-unknown-linux-gnu

[root@zhaixiaojuan libc]# RUST_BACKTRACE=1 cargo test --features extra_traits --manifest-path libc-test/Cargo.toml --target loongarch64-unknown-linux-gnu
   Compiling proc-macro2 v1.0.36
   Compiling unicode-xid v0.2.2
   Compiling syn v1.0.86
   Compiling serde_derive v1.0.136
   Compiling libc v0.2.119
   Compiling serde v1.0.136
   Compiling cfg-if v0.1.10
   Compiling semver v1.0.6
   Compiling serde_json v1.0.79
   Compiling log v0.4.14
   Compiling itoa v1.0.1
   Compiling cfg-if v1.0.0
   Compiling ryu v1.0.9
   Compiling bitflags v1.3.2
   Compiling cc v1.0.73
   Compiling libc v0.2.124 (/home/loongson/github/libc)
   Compiling quote v1.0.15
   Compiling dirs-sys v0.3.6
   Compiling rustc_version v0.4.0
   Compiling dirs v2.0.2
   Compiling term v0.6.1
   Compiling garando_pos v0.1.0
   Compiling garando_errors v0.1.0
   Compiling garando_syntax v0.1.0
   Compiling ctest2 v0.4.3
   Compiling libc-test v0.2.124 (/home/loongson/github/libc/libc-test)
    Finished test [unoptimized + debuginfo] target(s) in 6m 20s
     Running test/cmsg.rs (target/loongarch64-unknown-linux-gnu/debug/deps/cmsg-3de1ba5421aa4891)

running 5 tests
test t::test_cmsg_data ... ok
test t::test_cmsg_firsthdr ... ok
test t::test_cmsg_len ... ok
test t::test_cmsg_space ... ok
test t::test_cmsg_nxthdr ... ok

test result: ok. 5 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 1.64s

     Running test/errqueue.rs (target/loongarch64-unknown-linux-gnu/debug/deps/errqueue-42edbdf15740f887)

running 1 test
test t::test_cmsg_data ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

     Running test/linux_elf.rs (target/loongarch64-unknown-linux-gnu/debug/deps/linux_elf-5cda351bb149356f)
RUNNING ALL TESTS
PASSED 52 tests
     Running test/linux_fcntl.rs (target/loongarch64-unknown-linux-gnu/debug/deps/linux_fcntl-3c8c49391000590e)
RUNNING ALL TESTS
PASSED 28 tests
     Running test/linux_if_arp.rs (target/loongarch64-unknown-linux-gnu/debug/deps/linux_if_arp-a9043c5ed7566faa)
RUNNING ALL TESTS
PASSED 2 tests
     Running test/linux_ipv6.rs (target/loongarch64-unknown-linux-gnu/debug/deps/linux_ipv6-d097a3d22ae59f5e)
RUNNING ALL TESTS
PASSED 20 tests
     Running test/linux_strerror_r.rs (target/loongarch64-unknown-linux-gnu/debug/deps/linux_strerror_r-5deacbb0a1aa2156)
RUNNING ALL TESTS
PASSED 1 tests
     Running test/linux_termios.rs (target/loongarch64-unknown-linux-gnu/debug/deps/linux_termios-e544451482756964)
RUNNING ALL TESTS
PASSED 66 tests
     Running test/main.rs (target/loongarch64-unknown-linux-gnu/debug/deps/main-a3ad71d782f1f9df)
RUNNING ALL TESTS
PASSED 20556 tests
     Running test/semver.rs (target/loongarch64-unknown-linux-gnu/debug/deps/semver-22a1793abbc523c9)
PASSED 1 tests
     Running test/sigrt.rs (target/loongarch64-unknown-linux-gnu/debug/deps/sigrt-b6c57313d115b66f)

running 2 tests
test t::test_sigrtmax ... ok
test t::test_sigrtmin ... ok

test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

Please sign in to comment.