-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Rebase of "Upgrade musl supported version to 1.2.3" #3791
base: main
Are you sure you want to change the base?
Changes from all commits
c9bf9fc
06f4086
76dc6a9
c8fa1a1
030363e
5e672e9
2120628
b7f429e
06fd916
ccf9e57
b9c6bcd
d4d8e01
e7daf4f
67d56c1
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 |
---|---|---|
|
@@ -17,6 +17,7 @@ const ALLOWED_CFGS: &'static [&'static str] = &[ | |
"libc_const_extern_fn", | ||
"libc_const_extern_fn_unstable", | ||
"libc_deny_warnings", | ||
"musl_time64_abi", | ||
]; | ||
|
||
// Extra values to allow for check-cfg. | ||
|
@@ -67,6 +68,12 @@ fn main() { | |
Some(_) | None => (), | ||
} | ||
|
||
// Some ABIs need to redirect time related symbols to their time64 | ||
// equivalents. See #2088 and #1848 for more information. | ||
if is_musl_time64_abi() { | ||
set_cfg("musl_time64_abi"); | ||
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. We should set two separate configs here:
We need this to be split because musl and glibc share the kernel uapi |
||
} | ||
|
||
// On CI: deny all warnings | ||
if libc_ci { | ||
set_cfg("libc_deny_warnings"); | ||
|
@@ -213,3 +220,22 @@ fn set_cfg(cfg: &str) { | |
} | ||
println!("cargo:rustc-cfg={}", cfg); | ||
} | ||
|
||
fn is_musl_time64_abi() -> bool { | ||
match env::var("TARGET") { | ||
Ok(target) => match &target[..] { | ||
"arm-unknown-linux-musleabi" | ||
| "arm-unknown-linux-musleabihf" | ||
| "armv5te-unknown-linux-musleabi" | ||
| "armv7-unknown-linux-musleabi" | ||
| "armv7-unknown-linux-musleabihf" | ||
| "i586-unknown-linux-musl" | ||
| "i686-unknown-linux-musl" | ||
| "mips-unknown-linux-musl" | ||
| "mipsel-unknown-linux-musl" | ||
| "powerpc-unknown-linux-musl" => true, | ||
_ => false, | ||
}, | ||
Err(_) => false, | ||
} | ||
} | ||
Comment on lines
+224
to
+241
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. We probably shouldn't match literal targets here since we only care about the prefix and the suffix. Instead could we:
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3301,6 +3301,23 @@ fn test_linux(target: &str) { | |
// deprecated since glibc >= 2.29. This allows Rust binaries to link against | ||
// glibc versions older than 2.29. | ||
cfg.define("__GLIBC_USE_DEPRECATED_SCANF", None); | ||
// Some targets use time64 symbols so set the musl_time64_abi appropriately. | ||
// See #2088 and #1848 for more information. | ||
match target { | ||
"arm-unknown-linux-musleabi" | ||
| "arm-unknown-linux-musleabihf" | ||
| "armv5te-unknown-linux-musleabi" | ||
| "armv7-unknown-linux-musleabi" | ||
| "armv7-unknown-linux-musleabihf" | ||
| "i586-unknown-linux-musl" | ||
| "i686-unknown-linux-musl" | ||
| "mips-unknown-linux-musl" | ||
| "mipsel-unknown-linux-musl" | ||
| "powerpc-unknown-linux-musl" => { | ||
cfg.cfg("musl_time64_abi", None); | ||
} | ||
_ => {} | ||
} | ||
Comment on lines
+3304
to
+3320
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. Why do we need this in |
||
|
||
headers! { cfg: | ||
"ctype.h", | ||
|
@@ -3506,6 +3523,10 @@ fn test_linux(target: &str) { | |
|
||
// typedefs don't need any keywords | ||
t if t.ends_with("_t") => t.to_string(), | ||
|
||
// In MUSL, `flock64` is a typedef to `flock` and `stat64` is a typedef to `stat`. | ||
"flock64" | "stat64" if musl => format!("struct {}", ty), | ||
|
||
// put `struct` in front of all structs:. | ||
t if is_struct => format!("struct {}", t), | ||
// put `union` in front of all unions: | ||
|
@@ -3862,6 +3883,9 @@ fn test_linux(target: &str) { | |
// - these constants are used by the glibc implementation. | ||
n if musl && n.contains("__SIZEOF_PTHREAD") => true, | ||
|
||
// FIXME: ctest reports incorrect values for both Rust/libc and C/musl. | ||
"IPC_STAT" if musl => true, | ||
|
||
// FIXME: It was extended to 4096 since glibc 2.31 (Linux 5.4). | ||
// We should do so after a while. | ||
"SOMAXCONN" if gnu => true, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this be renamed to
musl_redir_time64
?Musl uses
_REDIR_TIME64
in their source, I think the name is a bit more intuitive because only 32-bit does these hacks (64-bit always has the 64-bit time interface).