Auto merge of #1411 - acfoltzer:ucontext-compat, r=gnzlbg

Remove new field from ucontext_t for compatibility with earlier glibc versions

Per discussion in #1410 with @gnzlbg, this is necessary to avoid struct size mismatches between Rust and C on systems with glibc < 2.28.
This commit is contained in:
bors 2019-06-27 18:46:59 +00:00
commit 8773f33c95
3 changed files with 13 additions and 3 deletions

View File

@ -117,7 +117,7 @@ fn check_style(file: &str, path: &Path, err: &mut Errors) {
} else {
prev_blank = false;
}
if line != line.trim_right() {
if line != line.trim_end() {
err.error(path, i, "trailing whitespace");
}
if line.contains("\t") {
@ -139,7 +139,7 @@ fn check_style(file: &str, path: &Path, err: &mut Errors) {
}
}
let line = line.trim_left();
let line = line.trim_start();
let is_pub = line.starts_with("pub ");
let line = if is_pub {&line[4..]} else {line};

View File

@ -2098,6 +2098,12 @@ fn test_linux(target: &str) {
// FIXME: musl version using by mips build jobs 1.0.15 is ancient:
"ifmap" | "ifreq" | "ifconf" if mips32_musl => true,
// FIXME: remove once Ubuntu 20.04 LTS is released, somewhere in 2020.
// ucontext_t added a new field as of glibc 2.28; our struct definition is
// conservative and omits the field, but that means the size doesn't match for newer
// glibcs (see https://github.com/rust-lang/libc/issues/1410)
"ucontext_t" if gnu => true,
_ => false,
}
});

View File

@ -285,7 +285,11 @@ s_no_extra_traits! {
pub uc_mcontext: mcontext_t,
pub uc_sigmask: ::sigset_t,
__private: [u8; 512],
__ssp: [::c_ulonglong; 4],
// FIXME: the shadow stack field requires glibc >= 2.28.
// Re-add once we drop compatibility with glibc versions older than
// 2.28.
//
// __ssp: [::c_ulonglong; 4],
}
}