aarch64-linux: properly handle 128bit aligned aggregates

This commit is contained in:
Erik Desjardins
2023-06-14 22:39:11 -04:00
parent 7e933b4e26
commit d1e764cb3b
15 changed files with 370 additions and 48 deletions

View File

@@ -1536,6 +1536,11 @@ pub struct LayoutS {
/// Only used on i686-windows, where the argument passing ABI is different when alignment is
/// requested, even if the requested alignment is equal to the natural alignment.
pub repr_align: Option<Align>,
/// The alignment the type would have, ignoring any `repr(align)` but including `repr(packed)`.
/// Only used on aarch64-linux, where the argument passing ABI ignores the requested alignment
/// in some cases.
pub unadjusted_abi_align: Align,
}
impl LayoutS {
@@ -1551,6 +1556,7 @@ impl LayoutS {
size,
align,
repr_align: None,
unadjusted_abi_align: align.abi,
}
}
}
@@ -1560,7 +1566,16 @@ impl fmt::Debug for LayoutS {
// This is how `Layout` used to print before it become
// `Interned<LayoutS>`. We print it like this to avoid having to update
// expected output in a lot of tests.
let LayoutS { size, align, abi, fields, largest_niche, variants, repr_align } = self;
let LayoutS {
size,
align,
abi,
fields,
largest_niche,
variants,
repr_align,
unadjusted_abi_align,
} = self;
f.debug_struct("Layout")
.field("size", size)
.field("align", align)
@@ -1569,6 +1584,7 @@ impl fmt::Debug for LayoutS {
.field("largest_niche", largest_niche)
.field("variants", variants)
.field("repr_align", repr_align)
.field("unadjusted_abi_align", unadjusted_abi_align)
.finish()
}
}
@@ -1613,6 +1629,10 @@ impl<'a> Layout<'a> {
self.0.0.repr_align
}
pub fn unadjusted_abi_align(self) -> Align {
self.0.0.unadjusted_abi_align
}
/// Whether the layout is from a type that implements [`std::marker::PointerLike`].
///
/// Currently, that means that the type is pointer-sized, pointer-aligned,