Fix Solaris/OpenBSD/Dragonfly build and re-enable CI (#301)
Fixes #216 This also adds two minor CI improvements: - Do a full link on `freebsd` - Build, Link, but don't run on `illumos` - Use the stable toolchain for our Tier 2 Build-only targets - Build (via `build-std`) for Tier 3 targets: `openbsd`, `dragonfly`, `haiku` Signed-off-by: Joe Richey <joerichey@google.com>
This commit is contained in:
parent
f7b733042c
commit
d2ca7695e3
16
.github/workflows/tests.yml
vendored
16
.github/workflows/tests.yml
vendored
@ -166,8 +166,9 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
target: [
|
||||
# See: https://github.com/rust-random/getrandom/issues/254
|
||||
# sparcv9-sun-solaris,
|
||||
sparcv9-sun-solaris,
|
||||
x86_64-unknown-illumos,
|
||||
x86_64-unknown-freebsd,
|
||||
x86_64-unknown-netbsd,
|
||||
]
|
||||
steps:
|
||||
@ -277,7 +278,6 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
target: [
|
||||
x86_64-unknown-freebsd,
|
||||
x86_64-fuchsia,
|
||||
x86_64-unknown-redox,
|
||||
x86_64-fortanix-unknown-sgx,
|
||||
@ -288,7 +288,7 @@ jobs:
|
||||
with:
|
||||
profile: minimal
|
||||
target: ${{ matrix.target }}
|
||||
toolchain: nightly # Required to build libc for Redox
|
||||
toolchain: stable
|
||||
override: true
|
||||
- uses: Swatinem/rust-cache@v1
|
||||
- name: Build
|
||||
@ -319,6 +319,14 @@ jobs:
|
||||
run: cargo build -Z build-std=core --target=aarch64-kmc-solid_asp3
|
||||
- name: Nintendo 3DS
|
||||
run: cargo build -Z build-std=core --target=armv6k-nintendo-3ds
|
||||
- name: RISC-V ESP-IDF
|
||||
run: cargo build -Z build-std=core --target=riscv32imc-esp-espidf
|
||||
- name: OpenBSD
|
||||
run: cargo build -Z build-std=std --target=x86_64-unknown-openbsd --features=std
|
||||
- name: Dragonfly BSD
|
||||
run: cargo build -Z build-std=std --target=x86_64-unknown-dragonfly --features=std
|
||||
- name: Haiku OS
|
||||
run: cargo build -Z build-std=std --target=x86_64-unknown-haiku --features=std
|
||||
|
||||
clippy-fmt:
|
||||
name: Clippy + rustfmt
|
||||
|
@ -12,7 +12,7 @@ use crate::{
|
||||
util_libc::{sys_fill_exact, Weak},
|
||||
Error,
|
||||
};
|
||||
use std::mem::MaybeUninit;
|
||||
use core::mem::MaybeUninit;
|
||||
|
||||
pub fn getrandom_inner(dest: &mut [MaybeUninit<u8>]) -> Result<(), Error> {
|
||||
static GETRANDOM: Weak = unsafe { Weak::new("getrandom\0") };
|
||||
@ -21,7 +21,9 @@ pub fn getrandom_inner(dest: &mut [MaybeUninit<u8>]) -> Result<(), Error> {
|
||||
// getrandom(2) was introduced in DragonflyBSD 5.7
|
||||
if let Some(fptr) = GETRANDOM.ptr() {
|
||||
let func: GetRandomFn = unsafe { core::mem::transmute(fptr) };
|
||||
return sys_fill_exact(dest, |buf| unsafe { func(buf.as_mut_ptr(), buf.len(), 0) });
|
||||
return sys_fill_exact(dest, |buf| unsafe {
|
||||
func(buf.as_mut_ptr() as *mut u8, buf.len(), 0)
|
||||
});
|
||||
} else {
|
||||
use_file::getrandom_inner(dest)
|
||||
}
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
//! Implementation for OpenBSD
|
||||
use crate::{util_libc::last_os_error, Error};
|
||||
use core::mem::MaybeUninit;
|
||||
|
||||
pub fn getrandom_inner(dest: &mut [MaybeUninit<u8>]) -> Result<(), Error> {
|
||||
// getentropy(2) was added in OpenBSD 5.6, so we can use it unconditionally.
|
||||
|
@ -22,7 +22,7 @@ use crate::{
|
||||
util_libc::{sys_fill_exact, Weak},
|
||||
Error,
|
||||
};
|
||||
use core::mem;
|
||||
use core::mem::{self, MaybeUninit};
|
||||
|
||||
#[cfg(target_os = "illumos")]
|
||||
type GetRandomFn = unsafe extern "C" fn(*mut u8, libc::size_t, libc::c_uint) -> libc::ssize_t;
|
||||
@ -38,7 +38,7 @@ pub fn getrandom_inner(dest: &mut [MaybeUninit<u8>]) -> Result<(), Error> {
|
||||
// derived platforms for atomically obtaining random data.
|
||||
for chunk in dest.chunks_mut(256) {
|
||||
sys_fill_exact(chunk, |buf| unsafe {
|
||||
func(buf.as_mut_ptr(), buf.len(), 0) as libc::ssize_t
|
||||
func(buf.as_mut_ptr() as *mut u8, buf.len(), 0) as libc::ssize_t
|
||||
})?
|
||||
}
|
||||
Ok(())
|
||||
|
Loading…
x
Reference in New Issue
Block a user