[PATCH v3] x32: Align sem_t to 8 bytes [BZ #33632]

H.J. Lu hjl.tools@gmail.com
Tue Nov 18 22:52:45 GMT 2025


On Tue, Nov 18, 2025 at 10:46 PM Wilco Dijkstra <Wilco.Dijkstra@arm.com> wrote:
>
> Hi HJ,
>
> > Change x32 sem_t to
> >
> > typedef union
> > {
> >   char __size[16];
> >   long long int __align;
> > } sem_t;
> >
> > to align it to 8 bytes so that the future x32 binaries will always use
> > 64-bit atomic operations on aligned sem_t.  Behavior of the existing x32
> > binaries is unchanged.
>
> That's an ABI break. Also I don't see how the behaviour of existing x32 binaries
> is unchanged - they use unaligned sem_t and thus reintroduce the bug.

The current x32 binaires use 64-bit atomic operations on unaligned
64-bit sem_t.   My patch doesn't change that.   It doesn't reintroduce
the bug.

> I think the previous version looked alright. And before trying to make things
> more hackish, why don't we first quantify the benefit? Is there a benchmark that
> shows clear performance gains with 64-bit atomics when using semaphores?
>
> Cheers,
> Wilco



-- 
H.J.


More information about the Libc-alpha mailing list