Skip to content

Commit 11079fd

Browse files
snoggetgross35
authored andcommitted
build.rs: Add linux_time_bits64 to ALLOWED_CFGS
linux_time_bits64 will be used to match __USE_TIME_BITS64 in the uapi headers. The environment variable RUST_LIBC_UNSTABLE_LINUX_TIME_BITS64 can be used by callers to enable the linux_time_bits64 config. (backport <rust-lang#4148>) (cherry picked from commit 5453fe6)
1 parent 54e923a commit 11079fd

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

build.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ const ALLOWED_CFGS: &'static [&'static str] = &[
1818
"libc_deny_warnings",
1919
"libc_thread_local",
2020
"libc_ctest",
21+
// Corresponds to `__USE_TIME_BITS64` in UAPI
22+
"linux_time_bits64",
2123
];
2224

2325
// Extra values to allow for check-cfg.
@@ -43,6 +45,7 @@ fn main() {
4345
let rustc_dep_of_std = env::var("CARGO_FEATURE_RUSTC_DEP_OF_STD").is_ok();
4446
let libc_ci = env::var("LIBC_CI").is_ok();
4547
let libc_check_cfg = env::var("LIBC_CHECK_CFG").is_ok() || rustc_minor_ver >= 80;
48+
let linux_time_bits64 = env::var("RUST_LIBC_UNSTABLE_LINUX_TIME_BITS64").is_ok();
4649

4750
// The ABI of libc used by std is backward compatible with FreeBSD 12.
4851
// The ABI of libc from crates.io is backward compatible with FreeBSD 11.
@@ -79,6 +82,10 @@ fn main() {
7982
_ => (),
8083
}
8184

85+
if linux_time_bits64 {
86+
set_cfg("linux_time_bits64");
87+
}
88+
8289
// On CI: deny all warnings
8390
if libc_ci {
8491
set_cfg("libc_deny_warnings");

ci/verify-build.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@ test_target() {
7272
$cmd --features const-extern-fn
7373
$cmd --features extra_traits
7474

75+
if [ "$os" = "linux" ]; then
76+
# Test with the equivalent of __USE_TIME_BITS64
77+
RUST_LIBC_UNSTABLE_LINUX_TIME_BITS64=1 $cmd
78+
fi
79+
7580
# Test again without default features, i.e. without "std"
7681
$cmd --no-default-features
7782
$cmd --no-default-features --features extra_traits

0 commit comments

Comments
 (0)