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 c54a7b8 commit 69ca9fa
Show file tree
Hide file tree
Showing 15 changed files with 378 additions and 264 deletions.
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) -> () {
100 changes: 48 additions & 52 deletions docker/test-base/patches/libc+armv5te-unknown-linux-uclibceabi.diff
Original file line number Diff line number Diff line change
@@ -1,70 +1,66 @@
diff --git a/src/unix/linux_like/linux/uclibc/mod.rs b/src/unix/linux_like/linux/uclibc/mod.rs
index 4afb98e95..67d5ba1b3 100644
index 48b03e9ee..3df2f7b3c 100644
--- a/src/unix/linux_like/linux/uclibc/mod.rs
+++ b/src/unix/linux_like/linux/uclibc/mod.rs
@@ -107,6 +107,68 @@ struct siginfo_si_value {
}
}

+cfg_if! {
+ if #[cfg(libc_union)] {
+ // Internal, for casts to access union fields
+ #[repr(C)]
+ struct sifields_sigchld {
+ si_pid: ::pid_t,
+ si_uid: ::uid_t,
+ si_status: ::c_int,
+ si_utime: ::c_long,
+ si_stime: ::c_long,
+ }
+ impl ::Copy for sifields_sigchld {}
+ impl ::Clone for sifields_sigchld {
+ fn clone(&self) -> sifields_sigchld {
+ *self
+ }
+ }
+// Internal, for casts to access union fields
+#[repr(C)]
+struct sifields_sigchld {
+ si_pid: ::pid_t,
+ si_uid: ::uid_t,
+ si_status: ::c_int,
+ si_utime: ::c_long,
+ si_stime: ::c_long,
+}
+impl ::Copy for sifields_sigchld {}
+impl ::Clone for sifields_sigchld {
+ fn clone(&self) -> sifields_sigchld {
+ *self
+ }
+}
+
+ // Internal, for casts to access union fields
+ #[repr(C)]
+ union sifields {
+ _align_pointer: *mut ::c_void,
+ sigchld: sifields_sigchld,
+ }
+// Internal, for casts to access union fields
+#[repr(C)]
+union sifields {
+ _align_pointer: *mut ::c_void,
+ sigchld: sifields_sigchld,
+}
+
+ // Internal, for casts to access union fields. Note that some variants
+ // of sifields start with a pointer, which makes the alignment of
+ // sifields vary on 32-bit and 64-bit architectures.
+ #[repr(C)]
+ struct siginfo_f {
+ _siginfo_base: [::c_int; 3],
+ sifields: sifields,
+ }
+// Internal, for casts to access union fields. Note that some variants
+// of sifields start with a pointer, which makes the alignment of
+// sifields vary on 32-bit and 64-bit architectures.
+#[repr(C)]
+struct siginfo_f {
+ _siginfo_base: [::c_int; 3],
+ sifields: sifields,
+}
+
+ impl siginfo_t {
+ unsafe fn sifields(&self) -> &sifields {
+ &(*(self as *const siginfo_t as *const siginfo_f)).sifields
+ }
+impl siginfo_t {
+ unsafe fn sifields(&self) -> &sifields {
+ &(*(self as *const siginfo_t as *const siginfo_f)).sifields
+ }
+
+ pub unsafe fn si_pid(&self) -> ::pid_t {
+ self.sifields().sigchld.si_pid
+ }
+ pub unsafe fn si_pid(&self) -> ::pid_t {
+ self.sifields().sigchld.si_pid
+ }
+
+ pub unsafe fn si_uid(&self) -> ::uid_t {
+ self.sifields().sigchld.si_uid
+ }
+ pub unsafe fn si_uid(&self) -> ::uid_t {
+ self.sifields().sigchld.si_uid
+ }
+
+ pub unsafe fn si_status(&self) -> ::c_int {
+ self.sifields().sigchld.si_status
+ }
+ pub unsafe fn si_status(&self) -> ::c_int {
+ self.sifields().sigchld.si_status
+ }
+
+ pub unsafe fn si_utime(&self) -> ::c_long {
+ self.sifields().sigchld.si_utime
+ }
+ pub unsafe fn si_utime(&self) -> ::c_long {
+ self.sifields().sigchld.si_utime
+ }
+
+ pub unsafe fn si_stime(&self) -> ::c_long {
+ self.sifields().sigchld.si_stime
+ }
+ }
+ pub unsafe fn si_stime(&self) -> ::c_long {
+ self.sifields().sigchld.si_stime
+ }
+}
+
Expand Down
100 changes: 48 additions & 52 deletions docker/test-base/patches/libc+armv7-unknown-linux-uclibceabi.diff
Original file line number Diff line number Diff line change
@@ -1,70 +1,66 @@
diff --git a/src/unix/linux_like/linux/uclibc/mod.rs b/src/unix/linux_like/linux/uclibc/mod.rs
index 4afb98e95..67d5ba1b3 100644
index 48b03e9ee..3df2f7b3c 100644
--- a/src/unix/linux_like/linux/uclibc/mod.rs
+++ b/src/unix/linux_like/linux/uclibc/mod.rs
@@ -107,6 +107,68 @@ struct siginfo_si_value {
}
}

+cfg_if! {
+ if #[cfg(libc_union)] {
+ // Internal, for casts to access union fields
+ #[repr(C)]
+ struct sifields_sigchld {
+ si_pid: ::pid_t,
+ si_uid: ::uid_t,
+ si_status: ::c_int,
+ si_utime: ::c_long,
+ si_stime: ::c_long,
+ }
+ impl ::Copy for sifields_sigchld {}
+ impl ::Clone for sifields_sigchld {
+ fn clone(&self) -> sifields_sigchld {
+ *self
+ }
+ }
+// Internal, for casts to access union fields
+#[repr(C)]
+struct sifields_sigchld {
+ si_pid: ::pid_t,
+ si_uid: ::uid_t,
+ si_status: ::c_int,
+ si_utime: ::c_long,
+ si_stime: ::c_long,
+}
+impl ::Copy for sifields_sigchld {}
+impl ::Clone for sifields_sigchld {
+ fn clone(&self) -> sifields_sigchld {
+ *self
+ }
+}
+
+ // Internal, for casts to access union fields
+ #[repr(C)]
+ union sifields {
+ _align_pointer: *mut ::c_void,
+ sigchld: sifields_sigchld,
+ }
+// Internal, for casts to access union fields
+#[repr(C)]
+union sifields {
+ _align_pointer: *mut ::c_void,
+ sigchld: sifields_sigchld,
+}
+
+ // Internal, for casts to access union fields. Note that some variants
+ // of sifields start with a pointer, which makes the alignment of
+ // sifields vary on 32-bit and 64-bit architectures.
+ #[repr(C)]
+ struct siginfo_f {
+ _siginfo_base: [::c_int; 3],
+ sifields: sifields,
+ }
+// Internal, for casts to access union fields. Note that some variants
+// of sifields start with a pointer, which makes the alignment of
+// sifields vary on 32-bit and 64-bit architectures.
+#[repr(C)]
+struct siginfo_f {
+ _siginfo_base: [::c_int; 3],
+ sifields: sifields,
+}
+
+ impl siginfo_t {
+ unsafe fn sifields(&self) -> &sifields {
+ &(*(self as *const siginfo_t as *const siginfo_f)).sifields
+ }
+impl siginfo_t {
+ unsafe fn sifields(&self) -> &sifields {
+ &(*(self as *const siginfo_t as *const siginfo_f)).sifields
+ }
+
+ pub unsafe fn si_pid(&self) -> ::pid_t {
+ self.sifields().sigchld.si_pid
+ }
+ pub unsafe fn si_pid(&self) -> ::pid_t {
+ self.sifields().sigchld.si_pid
+ }
+
+ pub unsafe fn si_uid(&self) -> ::uid_t {
+ self.sifields().sigchld.si_uid
+ }
+ pub unsafe fn si_uid(&self) -> ::uid_t {
+ self.sifields().sigchld.si_uid
+ }
+
+ pub unsafe fn si_status(&self) -> ::c_int {
+ self.sifields().sigchld.si_status
+ }
+ pub unsafe fn si_status(&self) -> ::c_int {
+ self.sifields().sigchld.si_status
+ }
+
+ pub unsafe fn si_utime(&self) -> ::c_long {
+ self.sifields().sigchld.si_utime
+ }
+ pub unsafe fn si_utime(&self) -> ::c_long {
+ self.sifields().sigchld.si_utime
+ }
+
+ pub unsafe fn si_stime(&self) -> ::c_long {
+ self.sifields().sigchld.si_stime
+ }
+ }
+ pub unsafe fn si_stime(&self) -> ::c_long {
+ self.sifields().sigchld.si_stime
+ }
+}
+
Expand Down
100 changes: 48 additions & 52 deletions docker/test-base/patches/libc+armv7-unknown-linux-uclibceabihf.diff
Original file line number Diff line number Diff line change
@@ -1,70 +1,66 @@
diff --git a/src/unix/linux_like/linux/uclibc/mod.rs b/src/unix/linux_like/linux/uclibc/mod.rs
index 4afb98e95..67d5ba1b3 100644
index 48b03e9ee..3df2f7b3c 100644
--- a/src/unix/linux_like/linux/uclibc/mod.rs
+++ b/src/unix/linux_like/linux/uclibc/mod.rs
@@ -107,6 +107,68 @@ struct siginfo_si_value {
}
}

+cfg_if! {
+ if #[cfg(libc_union)] {
+ // Internal, for casts to access union fields
+ #[repr(C)]
+ struct sifields_sigchld {
+ si_pid: ::pid_t,
+ si_uid: ::uid_t,
+ si_status: ::c_int,
+ si_utime: ::c_long,
+ si_stime: ::c_long,
+ }
+ impl ::Copy for sifields_sigchld {}
+ impl ::Clone for sifields_sigchld {
+ fn clone(&self) -> sifields_sigchld {
+ *self
+ }
+ }
+// Internal, for casts to access union fields
+#[repr(C)]
+struct sifields_sigchld {
+ si_pid: ::pid_t,
+ si_uid: ::uid_t,
+ si_status: ::c_int,
+ si_utime: ::c_long,
+ si_stime: ::c_long,
+}
+impl ::Copy for sifields_sigchld {}
+impl ::Clone for sifields_sigchld {
+ fn clone(&self) -> sifields_sigchld {
+ *self
+ }
+}
+
+ // Internal, for casts to access union fields
+ #[repr(C)]
+ union sifields {
+ _align_pointer: *mut ::c_void,
+ sigchld: sifields_sigchld,
+ }
+// Internal, for casts to access union fields
+#[repr(C)]
+union sifields {
+ _align_pointer: *mut ::c_void,
+ sigchld: sifields_sigchld,
+}
+
+ // Internal, for casts to access union fields. Note that some variants
+ // of sifields start with a pointer, which makes the alignment of
+ // sifields vary on 32-bit and 64-bit architectures.
+ #[repr(C)]
+ struct siginfo_f {
+ _siginfo_base: [::c_int; 3],
+ sifields: sifields,
+ }
+// Internal, for casts to access union fields. Note that some variants
+// of sifields start with a pointer, which makes the alignment of
+// sifields vary on 32-bit and 64-bit architectures.
+#[repr(C)]
+struct siginfo_f {
+ _siginfo_base: [::c_int; 3],
+ sifields: sifields,
+}
+
+ impl siginfo_t {
+ unsafe fn sifields(&self) -> &sifields {
+ &(*(self as *const siginfo_t as *const siginfo_f)).sifields
+ }
+impl siginfo_t {
+ unsafe fn sifields(&self) -> &sifields {
+ &(*(self as *const siginfo_t as *const siginfo_f)).sifields
+ }
+
+ pub unsafe fn si_pid(&self) -> ::pid_t {
+ self.sifields().sigchld.si_pid
+ }
+ pub unsafe fn si_pid(&self) -> ::pid_t {
+ self.sifields().sigchld.si_pid
+ }
+
+ pub unsafe fn si_uid(&self) -> ::uid_t {
+ self.sifields().sigchld.si_uid
+ }
+ pub unsafe fn si_uid(&self) -> ::uid_t {
+ self.sifields().sigchld.si_uid
+ }
+
+ pub unsafe fn si_status(&self) -> ::c_int {
+ self.sifields().sigchld.si_status
+ }
+ pub unsafe fn si_status(&self) -> ::c_int {
+ self.sifields().sigchld.si_status
+ }
+
+ pub unsafe fn si_utime(&self) -> ::c_long {
+ self.sifields().sigchld.si_utime
+ }
+ pub unsafe fn si_utime(&self) -> ::c_long {
+ self.sifields().sigchld.si_utime
+ }
+
+ pub unsafe fn si_stime(&self) -> ::c_long {
+ self.sifields().sigchld.si_stime
+ }
+ }
+ pub unsafe fn si_stime(&self) -> ::c_long {
+ self.sifields().sigchld.si_stime
+ }
+}
+
Expand Down
Loading

0 comments on commit 69ca9fa

Please sign in to comment.