Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,15 @@ fn main() {
}

if env::var("LIBC_CI").is_ok() {
if let Some(11) = which_freebsd() {
println!("cargo:rustc-cfg=freebsd11");
}
if let Some(12) = which_freebsd() {
println!("cargo:rustc-cfg=freebsd12");
}
if let Some(13) = which_freebsd() {
println!("cargo:rustc-cfg=freebsd13");
}
}

// Rust >= 1.15 supports private module use:
Expand Down Expand Up @@ -100,6 +106,7 @@ fn which_freebsd() -> Option<i32> {
match &stdout {
s if s.starts_with("11") => Some(11),
s if s.starts_with("12") => Some(12),
s if s.starts_with("13") => Some(13),
_ => None,
}
}
5 changes: 4 additions & 1 deletion ci/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ done

# FIXME: https://github.com/rust-lang/rust/issues/58564
# sparc-unknown-linux-gnu
# FIXME: https://github.com/rust-lang/rust/issues/62932
# thumbv6m-none-eabi
RUST_LINUX_NO_CORE_TARGETS="\
aarch64-pc-windows-msvc \
aarch64-unknown-cloudabi \
Expand All @@ -184,6 +186,7 @@ armebv7r-none-eabihf \
armv7-unknown-cloudabi-eabihf \
armv7r-none-eabi \
armv7r-none-eabihf \
hexagon-unknown-linux-musl \
i586-pc-windows-msvc \
i686-pc-windows-msvc \
i686-unknown-cloudabi \
Expand All @@ -199,7 +202,7 @@ powerpc64-unknown-freebsd \
riscv32imac-unknown-none-elf \
riscv32imc-unknown-none-elf \
sparc64-unknown-netbsd \
thumbv6m-none-eabi \

thumbv7em-none-eabi \
thumbv7em-none-eabihf \
thumbv7m-none-eabi \
Expand Down
2 changes: 1 addition & 1 deletion ci/docker/wasm32-wasi/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ ENV PATH=/root/.cargo/bin:$PATH
RUN apt-get install -y --no-install-recommends python
RUN git clone --recursive https://github.com/CraneStation/wasmtime wasmtime && \
cd wasmtime && \
git reset --hard 67edb00f29b62864b00179fe4bfa99bc29973285
git reset --hard a2647878977726935c3d04c05cabad9607ec7606
RUN cargo build --release --manifest-path wasmtime/Cargo.toml

# And finally in the last image we're going to assemble everything together.
Expand Down
13 changes: 8 additions & 5 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1450,10 +1450,12 @@ fn test_freebsd(target: &str) {

let freebsd_ver = which_freebsd();

if let Some(12) = freebsd_ver {
// If the host is FreeBSD 12, run FreeBSD 12 tests
cfg.cfg("freebsd12", None);
}
match freebsd_ver {
Some(11) => cfg.cfg("freebsd11", None),
Some(12) => cfg.cfg("freebsd12", None),
Some(13) => cfg.cfg("freebsd13", None),
_ => &mut cfg,
};

// Required for `getline`:
cfg.define("_WITH_GETLINE", None);
Expand Down Expand Up @@ -1581,7 +1583,7 @@ fn test_freebsd(target: &str) {
| "IP_RECVORIGDSTADDR"
| "IPV6_ORIGDSTADDR"
| "IPV6_RECVORIGDSTADDR"
if Some(12) != freebsd_ver =>
if Some(11) == freebsd_ver =>
{
true
}
Expand Down Expand Up @@ -2468,6 +2470,7 @@ fn which_freebsd() -> Option<i32> {
match &stdout {
s if s.starts_with("11") => Some(11),
s if s.starts_with("12") => Some(12),
s if s.starts_with("13") => Some(13),
_ => None,
}
}
2 changes: 2 additions & 0 deletions src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ cfg_if! {
}
}

pub const ELAST: ::c_int = 96;

extern {
// Return type ::c_int was removed in FreeBSD 12
pub fn setgrent() -> ::c_int;
Expand Down
9 changes: 9 additions & 0 deletions src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,15 @@ cfg_if! {
}
}

cfg_if! {
if #[cfg(not(freebsd13))] {
pub const ELAST: ::c_int = 96;
} else {
pub const EINTEGRITY: ::c_int = 97;
pub const ELAST: ::c_int = 97;
}
}

extern {
pub fn setgrent();
pub fn mprotect(addr: *mut ::c_void, len: ::size_t, prot: ::c_int)
Expand Down
4 changes: 3 additions & 1 deletion src/unix/bsd/freebsdlike/freebsd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,6 @@ pub const ENOTCAPABLE: ::c_int = 93;
pub const ECAPMODE: ::c_int = 94;
pub const ENOTRECOVERABLE: ::c_int = 95;
pub const EOWNERDEAD: ::c_int = 96;
pub const ELAST: ::c_int = 96;
pub const RLIMIT_NPTS: ::c_int = 11;
pub const RLIMIT_SWAP: ::c_int = 12;
pub const RLIMIT_KQUEUES: ::c_int = 13;
Expand Down Expand Up @@ -1332,6 +1331,9 @@ cfg_if! {
if #[cfg(freebsd12)] {
mod freebsd12;
pub use self::freebsd12::*;
} else if #[cfg(freebsd13)] {
mod freebsd12;
pub use self::freebsd12::*;
} else {
mod freebsd11;
pub use self::freebsd11::*;
Expand Down
4 changes: 2 additions & 2 deletions src/unix/bsd/freebsdlike/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1152,7 +1152,7 @@ extern {
pub fn getutxline(ut: *const utmpx) -> *mut utmpx;
pub fn initgroups(name: *const ::c_char, basegid: ::gid_t) -> ::c_int;
#[cfg_attr(
all(target_os = "freebsd", not(freebsd12)),
all(target_os = "freebsd", freebsd11),
link_name = "kevent@FBSD_1.0"
)]
pub fn kevent(kq: ::c_int,
Expand All @@ -1171,7 +1171,7 @@ extern {
pub fn mkfifoat(dirfd: ::c_int, pathname: *const ::c_char,
mode: ::mode_t) -> ::c_int;
#[cfg_attr(
all(target_os = "freebsd", not(freebsd12)),
all(target_os = "freebsd", freebsd11),
link_name = "mknodat@FBSD_1.1"
)]
pub fn mknodat(dirfd: ::c_int, pathname: *const ::c_char,
Expand Down
4 changes: 2 additions & 2 deletions src/unix/bsd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ extern {
#[cfg_attr(target_os = "macos", link_name = "glob$INODE64")]
#[cfg_attr(target_os = "netbsd", link_name = "__glob30")]
#[cfg_attr(
all(target_os = "freebsd", not(freebsd12)),
all(target_os = "freebsd", freebsd11),
link_name = "glob@FBSD_1.0"
)]
pub fn glob(pattern: *const ::c_char,
Expand All @@ -546,7 +546,7 @@ extern {
pglob: *mut ::glob_t) -> ::c_int;
#[cfg_attr(target_os = "netbsd", link_name = "__globfree30")]
#[cfg_attr(
all(target_os = "freebsd", not(freebsd12)),
all(target_os = "freebsd", freebsd11),
link_name = "globfree@FBSD_1.0"
)]
pub fn globfree(pglob: *mut ::glob_t);
Expand Down
4 changes: 4 additions & 0 deletions src/unix/linux_like/linux/align.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,15 @@ macro_rules! expand_align {
#[cfg_attr(all(target_pointer_width = "32",
any(target_arch = "mips",
target_arch = "arm",
target_arch = "hexagon",
target_arch = "powerpc",
target_arch = "x86_64",
target_arch = "x86")),
repr(align(4)))]
#[cfg_attr(any(target_pointer_width = "64",
not(any(target_arch = "mips",
target_arch = "arm",
target_arch = "hexagon",
target_arch = "powerpc",
target_arch = "x86_64",
target_arch = "x86"))),
Expand All @@ -79,13 +81,15 @@ macro_rules! expand_align {
#[cfg_attr(all(target_pointer_width = "32",
any(target_arch = "mips",
target_arch = "arm",
target_arch = "hexagon",
target_arch = "powerpc",
target_arch = "x86_64",
target_arch = "x86")),
repr(align(4)))]
#[cfg_attr(any(target_pointer_width = "64",
not(any(target_arch = "mips",
target_arch = "arm",
target_arch = "hexagon",
target_arch = "powerpc",
target_arch = "x86_64",
target_arch = "x86"))),
Expand Down
Loading