Skip to content

Commit

Permalink
Support sparc-unknown-linux-gnu again
Browse files Browse the repository at this point in the history
Currently, a patch is needed due to "undefined reference to `__sync_val_compare_and_swap_8'" error
(due to max_atomic_width is wrongly set to 64:
https://github.com/rust-lang/rust/blob/1.70.0/compiler/rustc_target/src/spec/sparc_unknown_linux_gnu.rs#L8)
  • Loading branch information
taiki-e committed Jul 10, 2023
1 parent e820504 commit 02efe1e
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 8 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,10 @@

| libc | GCC | clang | C++ | test | host |
| ---- | --- | ----- | --- | ---- | ---- |
| glibc [1] | [1] | host [3] | ✓ (libstdc++) | ✓ (qemu) [2] | [1] |
| glibc [1] | [1] | host | ✓ (libstdc++) | ✓ (qemu) [2] | [1] |

[1] See target list below for details<br>
[2] Except for powerpc-unknown-linux-gnuspe, riscv32gc-unknown-linux-gnu, and x86_64-unknown-linux-gnux32<br>
[3] Except for sparc-unknown-linux-gnu<br>

([Dockerfile](docker/linux-gnu.Dockerfile))

Expand Down Expand Up @@ -61,6 +60,7 @@
| `riscv64gc-unknown-linux-gnu` | 2.27 | 7.4.0 | x86_64/aarch64 linux (glibc 2.27+) |
| `s390x-unknown-linux-gnu` | 2.27 | 7.4.0 | x86_64/aarch64 linux (glibc 2.27+) |
| `sparc64-unknown-linux-gnu` | 2.27 | 7.4.0 | x86_64 linux (glibc 2.27+) |
| `sparc-unknown-linux-gnu` (tier3) | 2.27 | 7.4.0 | x86_64 linux (glibc 2.27+) |
| `thumbv7neon-unknown-linux-gnueabihf` | 2.27 | 7.4.0 | x86_64/aarch64 linux (glibc 2.27+) |
| `x86_64-unknown-linux-gnu` | host (x86_64 host) / 2.27 (aarch64 host) | host (x86_64 host) / 7.4.0 (aarch64 host) | x86_64/aarch64 linux (glibc 2.27+) |
| `x86_64-unknown-linux-gnux32` | 2.27 | 7.4.0 | x86_64/aarch64 linux (glibc 2.27+) |
Expand Down
13 changes: 13 additions & 0 deletions docker/test-base/patches/std+sparc-unknown-linux-gnu.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/src/thread/mod.rs b/src/thread/mod.rs
index e4581c2..4ff9d03 100644
--- a/src/thread/mod.rs
+++ b/src/thread/mod.rs
@@ -1099,7 +1099,7 @@ fn exhausted() -> ! {
}

cfg_if::cfg_if! {
- if #[cfg(target_has_atomic = "64")] {
+ if #[cfg(all(target_has_atomic = "64", not(target_arch = "sparc")))] {
use crate::sync::atomic::{AtomicU64, Ordering::Relaxed};

static COUNTER: AtomicU64 = AtomicU64::new(0);
6 changes: 2 additions & 4 deletions docker/test/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,10 @@ case "${RUST_TARGET}" in
esac
no_cc_bin=""
case "${RUST_TARGET}" in
# TODO(clang,sparc-unknown-linux-gnu): clang: error: unknown argument: '-mv8plus'
# TODO(clang,linux-uclibc): interpreter should be /lib/ld-uClibc.so.0
# TODO(clang,linux-uclibc): qemu: uncaught target signal 11 (Segmentation fault) - core dumped
# TODO(clang,mips-musl-sf): interpreter should be /lib/ld-musl-mips(el)-sf.so.1
sparc-unknown-linux-gnu | mips-unknown-linux-musl | mipsel-unknown-linux-musl | *-linux-uclibc*)
mips-unknown-linux-musl | mipsel-unknown-linux-musl | *-linux-uclibc*)
case "${cc}" in
clang) no_cc_bin=1 ;;
esac
Expand Down Expand Up @@ -250,11 +249,10 @@ esac
# Whether or not to build the test.
no_build_test=""
case "${RUST_TARGET}" in
# TODO(sparc-unknown-linux-gnu): undefined reference to `__sync_val_compare_and_swap_8'
# TODO(sparc64-unknown-openbsd):
# /sparc64-unknown-openbsd/bin/sparc64-unknown-openbsd7.0-ld: /sparc64-unknown-openbsd/sparc64-unknown-openbsd/usr/lib/libm.a(s_fmin.o): in function `*_libm_fmin':
# /usr/src/lib/libm/src/s_fmin.c:35: undefined reference to `__isnan'
sparc-unknown-linux-gnu | sparc64-unknown-openbsd) no_build_test=1 ;;
sparc64-unknown-openbsd) no_build_test=1 ;;
esac
# Whether or not to run the test.
no_run_test=""
Expand Down
2 changes: 1 addition & 1 deletion platform-support-status-tier3.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ See [platform-support-status.md](platform-support-status.md) for Tier 1 & Tier 2
- [ ] riscv64gc-unknown-netbsd
- [x] riscv64gc-unknown-openbsd
- [x] s390x-unknown-linux-musl
- [ ] sparc-unknown-linux-gnu
- [x] sparc-unknown-linux-gnu
- [x] sparc64-unknown-netbsd
- [x] sparc64-unknown-openbsd
- [ ] thumbv4t-none-eabi
Expand Down
2 changes: 1 addition & 1 deletion tools/target-list-shared.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ linux_gnu_targets=(
riscv32gc-unknown-linux-gnu # tier3
riscv64gc-unknown-linux-gnu
s390x-unknown-linux-gnu
# sparc-unknown-linux-gnu # tier3
sparc-unknown-linux-gnu # tier3
sparc64-unknown-linux-gnu
thumbv7neon-unknown-linux-gnueabihf
x86_64-unknown-linux-gnu
Expand Down

0 comments on commit 02efe1e

Please sign in to comment.