Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e committed Mar 29, 2024
1 parent 1983362 commit 650c597
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 4 deletions.
1 change: 1 addition & 0 deletions .github/.cspell/project-dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ BUILDKIT
buildpackage
buildroot
buildx
chkstk
cmodel
crtbegin
crtend
Expand Down
5 changes: 3 additions & 2 deletions docker/dragonfly.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ FROM ghcr.io/taiki-e/downloader as sysroot
SHELL ["/bin/bash", "-eEuxo", "pipefail", "-c"]
ARG DRAGONFLY_VERSION
RUN mkdir -p /sysroot
# https://mirror-master.dragonflybsd.org/iso-images
RUN curl --proto '=https' --tlsv1.2 -fsSL --retry 10 --retry-connrefused "https://mirror-master.dragonflybsd.org/iso-images/dfly-x86_64-${DRAGONFLY_VERSION}_REL.iso.bz2" \
# https://mirror-master.dragonflybsd.org/iso-images's certificate has expired...
# https://cdimage.debian.org/mirror/dragonflybsd.org/iso-images
RUN curl --proto '=https' --tlsv1.2 -fsSL --retry 10 --retry-connrefused "https://cdimage.debian.org/mirror/dragonflybsd.org/iso-images/dfly-x86_64-${DRAGONFLY_VERSION}_REL.iso.bz2" \
| bsdtar xjf - -C /sysroot ./lib ./usr/include ./usr/lib

FROM ghcr.io/taiki-e/build-base:ubuntu-"${UBUNTU_VERSION}" as builder
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/src/mem/mod.rs b/src/mem/mod.rs
index ccf1917..dcbbf52 100644
--- a/src/mem/mod.rs
+++ b/src/mem/mod.rs
@@ -130,6 +130,7 @@ fn memset_element_unordered_atomic<T>(s: *mut T, c: u8, bytes: usize)
}
}

+#[cfg(not(target_arch = "m68k"))]
intrinsics! {
#[cfg(target_has_atomic_load_store = "8")]
pub unsafe extern "C" fn __llvm_memcpy_element_unordered_atomic_1(dest: *mut u8, src: *const u8, bytes: usize) -> () {
51 changes: 51 additions & 0 deletions docker/test-base/patches/libc+x86_64-unknown-dragonfly.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
diff --git a/src/unix/bsd/freebsdlike/freebsd/mod.rs b/src/unix/bsd/freebsdlike/freebsd/mod.rs
index 78314084c..195c6cb3e 100644
--- a/src/unix/bsd/freebsdlike/freebsd/mod.rs
+++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs
@@ -3875,11 +3875,6 @@ fn clone(&self) -> dot3Vendors {
// for use with fspacectl
pub const SPACECTL_DEALLOC: ::c_int = 1;

-// For getrandom()
-pub const GRND_NONBLOCK: ::c_uint = 0x1;
-pub const GRND_RANDOM: ::c_uint = 0x2;
-pub const GRND_INSECURE: ::c_uint = 0x4;
-
// For realhostname* api
pub const HOSTNAME_FOUND: ::c_int = 0;
pub const HOSTNAME_INCORRECTNAME: ::c_int = 1;
@@ -5393,8 +5388,6 @@ pub fn shm_rename(

pub fn fdatasync(fd: ::c_int) -> ::c_int;

- pub fn getrandom(buf: *mut ::c_void, buflen: ::size_t, flags: ::c_uint) -> ::ssize_t;
- pub fn getentropy(buf: *mut ::c_void, buflen: ::size_t) -> ::c_int;
pub fn elf_aux_info(aux: ::c_int, buf: *mut ::c_void, buflen: ::c_int) -> ::c_int;
pub fn setproctitle_fast(fmt: *const ::c_char, ...);
pub fn timingsafe_bcmp(a: *const ::c_void, b: *const ::c_void, len: ::size_t) -> ::c_int;
diff --git a/src/unix/bsd/freebsdlike/mod.rs b/src/unix/bsd/freebsdlike/mod.rs
index 00a944e42..9b555e42e 100644
--- a/src/unix/bsd/freebsdlike/mod.rs
+++ b/src/unix/bsd/freebsdlike/mod.rs
@@ -1456,6 +1456,11 @@ fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
pub const RB_MUTE: ::c_int = 0x10000;
pub const RB_SELFTEST: ::c_int = 0x20000;

+// For getrandom()
+pub const GRND_NONBLOCK: ::c_uint = 0x1;
+pub const GRND_RANDOM: ::c_uint = 0x2;
+pub const GRND_INSECURE: ::c_uint = 0x4;
+
safe_f! {
pub {const} fn WIFCONTINUED(status: ::c_int) -> bool {
status == 0x13
@@ -1829,6 +1834,9 @@ pub fn mq_timedsend(
abs_timeout: *const ::timespec,
) -> ::c_int;
pub fn mq_unlink(name: *const ::c_char) -> ::c_int;
+
+ pub fn getrandom(buf: *mut ::c_void, buflen: ::size_t, flags: ::c_uint) -> ::ssize_t;
+ pub fn getentropy(buf: *mut ::c_void, buflen: ::size_t) -> ::c_int;
}

#[link(name = "util")]
2 changes: 2 additions & 0 deletions docker/test/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,8 @@ if [[ -f /BUILD_STD ]]; then
;;
# TODO(mips): LLVM bug: Undefined temporary symbol error when building std.
mips-*-linux-* | mipsel-*-linux-*) build_mode=release ;;
# TODO(m68k): compiler segfault
m68k-*-linux-*) build_mode=release ;;
esac
fi

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 @@ -75,7 +75,7 @@ See [platform-support-status.md](platform-support-status.md) for Tier 1 & Tier 2
- [ ] i686-win7-windows-msvc
- [ ] i686-wrs-vxworks
- [ ] loongarch64-unknown-linux-musl
- [ ] m68k-unknown-linux-gnu
- [x] m68k-unknown-linux-gnu
- [x] mips-unknown-linux-gnu
- [x] mips-unknown-linux-musl
- [x] mips-unknown-linux-uclibc
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 @@ -21,7 +21,7 @@ linux_gnu_targets=(
i586-unknown-linux-gnu
i686-unknown-linux-gnu
loongarch64-unknown-linux-gnu
# m68k-unknown-linux-gnu # tier3, build fail: https://github.com/rust-lang/rust/issues/89498
m68k-unknown-linux-gnu # tier3, build fail: https://github.com/rust-lang/rust/issues/89498
mips-unknown-linux-gnu # tier3
mips64-unknown-linux-gnuabi64 # tier3
mips64el-unknown-linux-gnuabi64 # tier3
Expand Down

0 comments on commit 650c597

Please sign in to comment.