]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
libiberty: Account for CHERI alignment requirement in objalloc
authorAlex Coplan <alex.coplan@arm.com>
Thu, 3 Nov 2022 12:11:45 +0000 (12:11 +0000)
committerAlex Coplan <alex.coplan@arm.com>
Thu, 3 Nov 2022 12:11:45 +0000 (12:11 +0000)
commitfb1ff58603dd0ebc184b0e07c0628c6eb746c491
tree613238295d48f807de335a88095ee290d9566ee6
parent74dda148e9eac68f0dde2904485539a3497a2331
libiberty: Account for CHERI alignment requirement in objalloc

The calculation of OBJALLOC_ALIGN in include/objalloc.h ensures that
allocations are sufficiently aligned for doubles, but on CHERI
architectures it is possible that void * has a greater alignment
requirement than double.

Instead of deriving the alignment requirement from double alone, this
patch uses a union to compute the maximum alignment between double and
void *.

This fixes alignment faults seen when compiling the binutils for
pure-capability Morello. With this patch applied, the majority of
binutils tests pass when the binutils themselves are compiled for
purecap.

This patch is a backport of commit
a8af417a8a1559a3ebceb0c761cf26ebce5eab7f, initially upstreamed to
Morello GCC.
include/objalloc.h