-
Notifications
You must be signed in to change notification settings - Fork 711
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
Layout tests fail on the 32 bit architecture i686 #1823
Comments
I tracked down the autogenerated test on 32 bit: #[repr(C)]
#[repr(align(8))]
#[derive(Debug, Copy, Clone)]
pub struct max_align_t {
pub __clang_max_align_nonce1: ::std::os::raw::c_longlong,
pub __clang_max_align_nonce2: f64,
}
#[test]
fn bindgen_test_layout_max_align_t() {
assert_eq!(
::std::mem::size_of::<max_align_t>(),
24usize,
concat!("Size of: ", stringify!(max_align_t))
);
assert_eq!(
::std::mem::align_of::<max_align_t>(),
8usize,
concat!("Alignment of ", stringify!(max_align_t))
);
assert_eq!(
unsafe {
&(*(::std::ptr::null::<max_align_t>())).__clang_max_align_nonce1 as *const _ as usize
},
0usize,
concat!(
"Offset of field: ",
stringify!(max_align_t),
"::",
stringify!(__clang_max_align_nonce1)
)
);
assert_eq!(
unsafe {
&(*(::std::ptr::null::<max_align_t>())).__clang_max_align_nonce2 as *const _ as usize
},
8usize,
concat!(
"Offset of field: ",
stringify!(max_align_t),
"::",
stringify!(__clang_max_align_nonce2)
)
);
} |
What is the definition of |
It seems you can fix this by using |
Thanks for the response! Here is the definition of
One note is that this is i386 as opposed to i686. I can't get my hands on Fedora 29 (the last 32 bit release) for i686 at the moment so this is the best I can do. However the same error message appears in tests on i386 and i686. |
Yeah, I think this is expected at the moment, and blocked on float128 / u128 / etc being compatible with C's definition I think (rust-lang/rust#54341)... Otherwise making the type opaque is the right workaround. I don't think this is particularly fixable in bindgen otherwise. |
This adds the matrix `--target` to relevant `cargo` commands. Some targets are now “check-only”, which confirms cross-compilation succeeds, without doing a full test run, because running these tests may require emulation. musl and MinGW have been dropped, because musl has no standard C++ setup, and MinGW isn’t a target for us. All this requires some adjustments to boring-sys: - Blocklist max_align_t in bindgen - rust-lang/rust-bindgen#1823) = Don't check for MSVC with target_env - x86_64-pc-windows-gnu is identified as `target_env = "msvc"` too, but doesn't use the Visual Studio CMake generator.
This adds the matrix `--target` to relevant `cargo` commands. Some targets are now “check-only”, which confirms cross-compilation succeeds, without doing a full test run, because running these tests may require emulation. musl and MinGW have been dropped, because musl has no standard C++ setup, and MinGW isn’t a target for us. All this requires some adjustments to boring-sys: - Blocklist max_align_t in bindgen - rust-lang/rust-bindgen#1823) - Don't check for MSVC with target_env - x86_64-pc-windows-gnu is identified as `target_env = "msvc"` too, but doesn't use the Visual Studio CMake generator.
This adds the matrix `--target` to relevant `cargo` commands. Some targets are now “check-only”, which confirms cross-compilation succeeds, without doing a full test run, because running these tests may require emulation. musl and MinGW have been dropped, because musl has no standard C++ setup, and MinGW isn’t a target for us. All this requires some adjustments to boring-sys: - Blocklist max_align_t in bindgen - rust-lang/rust-bindgen#1823 - Don't check for MSVC with target_env - x86_64-pc-windows-gnu is identified as `target_env = "msvc"` too, but doesn't use the Visual Studio CMake generator.
This adds the matrix `--target` to relevant `cargo` commands. Some targets are now “check-only”, which confirms cross-compilation succeeds, without doing a full test run, because running these tests may require emulation. musl and MinGW have been dropped, because musl has no standard C++ setup, and MinGW isn’t a target for us. All this requires some adjustments to boring-sys: - Blocklist max_align_t in bindgen - rust-lang/rust-bindgen#1823 - Don't check for MSVC with target_env - x86_64-pc-windows-gnu is identified as `target_env = "msvc"` too, but doesn't use the Visual Studio CMake generator.
This adds the matrix `--target` to relevant `cargo` commands. Some targets are now “check-only”, which confirms cross-compilation succeeds, without doing a full test run, because running these tests may require emulation. musl and MinGW have been dropped, because musl has no standard C++ setup, and MinGW isn’t a target for us. All this requires some adjustments to boring-sys: - Blocklist max_align_t in bindgen - rust-lang/rust-bindgen#1823 - Don't check for MSVC with target_env - x86_64-pc-windows-gnu is identified as `target_env = "msvc"` too, but doesn't use the Visual Studio CMake generator.
This adds the matrix `--target` to relevant `cargo` commands. Some targets are now “check-only”, which confirms cross-compilation succeeds, without doing a full test run, because running these tests may require emulation. musl and MinGW have been dropped, because musl has no standard C++ setup, and MinGW isn’t a target for us. All this requires some adjustments to boring-sys: - Blocklist max_align_t in bindgen - rust-lang/rust-bindgen#1823 - Don't check for MSVC with target_env - x86_64-pc-windows-gnu is identified as `target_env = "msvc"` too, but doesn't use the Visual Studio CMake generator.
Currently I'm trying to package a crate for Fedora that uses bindgen. I see that I can disable memory layout checks but wanted see if this is a problem with the code generation or my invocation of bindgen. One noteworthy aspect of this is that all of the 64 bit architectures pass all tests so this seems to be specifically related to the alignment test on 32 bit architectures.
Input C/C++ Header
Bindgen Invocation
I've tried both:
and:
The only difference between these two is whether
.size_t_is_usize()
is passedtrue
in one andfalse
in the other. Both fail with the same results. For this specific build, I can guaranteesafe_free_is_needed
is false due to the package version of libcryptsetup available on the build system.Actual Results
The full build log is available here but the failure of note is when running the tests:
Expected Results
I would expect the generated bindings on i686 to pass all tests. I'm currently in the process of getting access to a 32 bit machine to try to reproduce the test failure and inspect the autogenerated bindings and I will report back here. I was able to inspect 64 bit bindings and it appears the
max_align_t
test uses au128
in the structure that it's using to test alignment so I'm interested to see if 32 bit does the same as I'm not sure what Rust support foru128
s looks like on 32 bit architectures.The text was updated successfully, but these errors were encountered: