mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 07:14:28 +00:00
Specify DWARF alignment in bits, not bytes.
In DWARF, alignment of types is specified in bits, as is made clear by the parameter name `AlignInBits`. However, `rustc` was incorrectly passing a byte alignment. This commit fixes that. This was noticed in upstream LLVM when I tried to check in a test consisting of LLVM IR generated from `rustc` and it triggered assertions [1]. [1]: https://reviews.llvm.org/D126835
This commit is contained in:
parent
357bc27904
commit
fe533e862c
@ -1365,7 +1365,7 @@ pub fn build_global_var_di_node<'ll>(cx: &CodegenCx<'ll, '_>, def_id: DefId, glo
|
|||||||
is_local_to_unit,
|
is_local_to_unit,
|
||||||
global,
|
global,
|
||||||
None,
|
None,
|
||||||
global_align.bytes() as u32,
|
global_align.bits() as u32,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
8
src/test/codegen/debug-alignment.rs
Normal file
8
src/test/codegen/debug-alignment.rs
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
// Verifies that DWARF alignment is specified properly.
|
||||||
|
//
|
||||||
|
// compile-flags: -C debuginfo=2
|
||||||
|
#![crate_type = "lib"]
|
||||||
|
|
||||||
|
// CHECK: !DIGlobalVariable
|
||||||
|
// CHECK: align: 32
|
||||||
|
pub static A: u32 = 1;
|
Loading…
Reference in New Issue
Block a user