1
Fork 0

Debuginfo for function ZSTs should have alignment of 8 bits, not 1 bit

This commit is contained in:
Zalathar 2025-02-06 23:01:29 +11:00
parent 59588250ad
commit 4385a9e063
3 changed files with 10 additions and 11 deletions

View file

@ -319,19 +319,16 @@ fn build_subroutine_type_di_node<'ll, 'tcx>(
// This is actually a function pointer, so wrap it in pointer DI.
let name = compute_debuginfo_type_name(cx.tcx, fn_ty, false);
let (size, align) = match fn_ty.kind() {
ty::FnDef(..) => (0, 1),
ty::FnPtr(..) => (
cx.tcx.data_layout.pointer_size.bits(),
cx.tcx.data_layout.pointer_align.abi.bits() as u32,
),
ty::FnDef(..) => (Size::ZERO, Align::ONE),
ty::FnPtr(..) => (cx.tcx.data_layout.pointer_size, cx.tcx.data_layout.pointer_align.abi),
_ => unreachable!(),
};
let di_node = unsafe {
llvm::LLVMRustDIBuilderCreatePointerType(
DIB(cx),
fn_di_node,
size,
align,
size.bits(),
align.bits() as u32,
0, // Ignore DWARF address space.
name.as_c_char_ptr(),
name.len(),

View file

@ -633,7 +633,7 @@ impl<'ll, 'tcx> DebugInfoCodegenMethods<'tcx> for CodegenCx<'ll, 'tcx> {
true,
DIFlags::FlagZero,
argument_index,
align.bytes() as u32,
align.bits() as u32,
)
}
}