From: John Paul Adrian Glaubitz Date: Sun, 16 Jun 2019 00:53:33 +0000 (+0200) Subject: librustc_codegen_llvm: Use repr(transparent) for bitflags over repr(C) (#61306) X-Git-Tag: archive/raspbian/1.39.0+dfsg1-4+rpi1~2^2^2~19 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=df69381d4b4183add7195338e260f245f8dfb8f1;p=rustc.git librustc_codegen_llvm: Use repr(transparent) for bitflags over repr(C) (#61306) In order to make sure that Rust's bitflags types are passed the same way in the Rust ABI as they are in the C ABI, we need to use the attribute repr(transparent) over the repr(C) attribute for the single-field bitflags structs in in order to prevent ABI mismatches. Thanks to Michael Karcher for finding this bug. Gbp-Pq: Name u-sparc64-ffi-abi.patch --- diff --git a/src/librustc_codegen_llvm/llvm/ffi.rs b/src/librustc_codegen_llvm/llvm/ffi.rs index f88923fc9f..ed824c1c14 100644 --- a/src/librustc_codegen_llvm/llvm/ffi.rs +++ b/src/librustc_codegen_llvm/llvm/ffi.rs @@ -564,7 +564,7 @@ pub mod debuginfo { // These values **must** match with LLVMRustDIFlags!! bitflags! { - #[repr(C)] + #[repr(transparent)] #[derive(Default)] pub struct DIFlags: ::libc::uint32_t { const FlagZero = 0; @@ -593,7 +593,7 @@ pub mod debuginfo { // These values **must** match with LLVMRustDISPFlags!! bitflags! { - #[repr(C)] + #[repr(transparent)] #[derive(Default)] pub struct DISPFlags: ::libc::uint32_t { const SPFlagZero = 0;