diff --git a/Cargo.toml b/Cargo.toml index 0463d7da..5bc4b0d8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,6 +8,6 @@ edition = "2018" bitflags = "1" [build-dependencies] -bindgen = "0.51.0" +bindgen = "0.54" cc = "1.0" shlex = "0.1" diff --git a/build.rs b/build.rs index d428b099..f8872e73 100644 --- a/build.rs +++ b/build.rs @@ -139,6 +139,7 @@ fn main() { .use_core() .ctypes_prefix("c_types") .derive_default(true) + .size_t_is_usize(true) .rustfmt_bindings(true); builder = builder.clang_arg(format!("--target={}", target)); diff --git a/src/helpers.c b/src/helpers.c index 2137fb3e..7c6e3120 100644 --- a/src/helpers.c +++ b/src/helpers.c @@ -22,3 +22,7 @@ int access_ok_helper(const void __user *addr, unsigned long n) return access_ok(0, addr, n); #endif } + +/* see https://github.com/rust-lang/rust-bindgen/issues/1671 */ +_Static_assert(__builtin_types_compatible_p(size_t, uintptr_t), + "size_t must match uintptr_t, what architecture is this??");