-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add new cfg gnu_file_offset_bits64 corresponding to _FILE_OFFSET_BITS=64 #4345
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
afa5c65
84a04a1
f10e8e4
a184436
874e399
f44fdc1
862ba8a
6ed2bc8
5c5c364
2b4fafb
0c6d56c
e134959
5a5abc2
96e81e7
169d50b
22ac02c
131efe9
c1e4812
872642a
7ba56f2
4a7c9a9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,8 @@ const ALLOWED_CFGS: &'static [&'static str] = &[ | |
"freebsd13", | ||
"freebsd14", | ||
"freebsd15", | ||
// Corresponds to `_FILE_OFFSET_BITS=64` in glibc | ||
"gnu_file_offset_bits64", | ||
// FIXME(ctest): this config shouldn't be needed but ctest can't parse `const extern fn` | ||
"libc_const_extern_fn", | ||
"libc_deny_warnings", | ||
|
@@ -43,6 +45,10 @@ fn main() { | |
let (rustc_minor_ver, _is_nightly) = rustc_minor_nightly(); | ||
let rustc_dep_of_std = env::var("CARGO_FEATURE_RUSTC_DEP_OF_STD").is_ok(); | ||
let libc_ci = env::var("LIBC_CI").is_ok(); | ||
let target_env = env::var("CARGO_CFG_TARGET_ENV").unwrap_or_default(); | ||
let target_os = env::var("CARGO_CFG_TARGET_OS").unwrap_or_default(); | ||
let target_ptr_width = env::var("CARGO_CFG_TARGET_POINTER_WIDTH").unwrap_or_default(); | ||
let target_arch = env::var("CARGO_CFG_TARGET_ARCH").unwrap_or_default(); | ||
|
||
// The ABI of libc used by std is backward compatible with FreeBSD 12. | ||
// The ABI of libc from crates.io is backward compatible with FreeBSD 12. | ||
|
@@ -84,6 +90,23 @@ fn main() { | |
if linux_time_bits64 { | ||
set_cfg("linux_time_bits64"); | ||
} | ||
println!("cargo:rerun-if-env-changed=RUST_LIBC_UNSTABLE_GNU_FILE_OFFSET_BITS"); | ||
match env::var("RUST_LIBC_UNSTABLE_GNU_FILE_OFFSET_BITS") { | ||
Ok(val) if val == "64" => { | ||
if target_env == "gnu" | ||
&& target_os == "linux" | ||
&& target_ptr_width == "32" | ||
&& target_arch != "riscv32" | ||
&& target_arch != "x86_64" | ||
{ | ||
set_cfg("gnu_file_offset_bits64"); | ||
} | ||
} | ||
Ok(val) if val != "32" => { | ||
panic!("RUST_LIBC_UNSTABLE_GNU_FILE_OFFSET_BITS may only be set to '32' or '64'") | ||
} | ||
_ => {} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you add something like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've added that check for both build.rs and libc-test/build.rs. |
||
} | ||
|
||
// On CI: deny all warnings | ||
if libc_ci { | ||
|
Uh oh!
There was an error while loading. Please reload this page.