Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 15 Feb 2026 07:56:21 -0800
From:      Ahmad Khalifa <ahmadkhalifa570@gmail.com>
To:        Jessica Clarke <jrtc27@freebsd.org>
Cc:        "src-committers@freebsd.org" <src-committers@freebsd.org>,  "dev-commits-src-all@freebsd.org" <dev-commits-src-all@freebsd.org>,  "dev-commits-src-main@freebsd.org" <dev-commits-src-main@freebsd.org>
Subject:   Re: git: a60e7e6ff0ec - main - stand: compile ia32 EFI loader with -malign-double
Message-ID:  <CAMLT6uDpnYb%2B1DFCwYizOku%2Bpa4%2BAxGMa%2BFhJGztTjVpdyx9sw@mail.gmail.com>
In-Reply-To: <CAMLT6uBpSKUH9Q6RRg65-jtW%2BoO3-TK0TeejqbVXxnrND2EQPQ@mail.gmail.com>
References:  <6991d07b.43f21.696cde4f@gitrepo.freebsd.org> <0B6A645E-D9E4-4337-B280-7E3CBA1FDC1B@freebsd.org> <CAMLT6uBpSKUH9Q6RRg65-jtW%2BoO3-TK0TeejqbVXxnrND2EQPQ@mail.gmail.com>

index | next in thread | previous in thread | raw e-mail

On Sun Feb 15, 2026 at 4:27 PM +0200, Ahmad Khalifa wrote:
> On Sun Feb 15, 2026 at 4:02 PM +0200, Jessica Clarke wrote:
>> On 15 Feb 2026, at 13:56, Ahmad Khalifa <vexeduxr@FreeBSD.org> wrote:
>>>
>>> The branch main has been updated by vexeduxr:
>>>
>>> URL: https://cgit.FreeBSD.org/src/commit/?id=a60e7e6ff0ec1fdd66c2568ac6c03b843dbb3c9d
>>>
>>> commit a60e7e6ff0ec1fdd66c2568ac6c03b843dbb3c9d
>>> Author:     Ahmad Khalifa <vexeduxr@FreeBSD.org>
>>> AuthorDate: 2026-02-15 12:23:26 +0000
>>> Commit:     Ahmad Khalifa <vexeduxr@FreeBSD.org>
>>> CommitDate: 2026-02-15 13:30:06 +0000
>>>
>>>    stand: compile ia32 EFI loader with -malign-double
>>>
>>>    The UEFI spec says:
>>>> Structures are aligned on boundaries equal to the largest internal
>>>> datum of the structure and internal data are implicitly padded to
>>>> achieve natural alignment.
>>>
>>>    By default, structs containing members of type "long long" have 4 byte
>>>    alignment on i386. This caused some EFI structures to be subtly wrong.
>>>
>>>    Fix this by compiling the ia32 EFI loader with -malign-double, which
>>>    bumps the alignment up to 8 if such members are present.
>>
>> This seems like a dangerously big hammer. Are there any types shared
>> with libsa or the kernel itself that would change layout? (I suppose
>> for the latter they already need to be aligned as the kernel is 64-bit?)
>
> For the kernel, any shared types would have already needed to be
> aligned, yes. I didn't consider shared types with either libsa or libefi
> though, I'll look into it now. Nice catch.
>

Okay, so libsa, libefi, liblua and ficl all share types with the loader.
Quite obvious in hindsight... I'll back this out until I come up with
something better.

>>
>> Annotating just the EFI types would seem more appropriate, like how we
>> annotate function pointers to use the Microsoft calling convention.
>
> They're all under contrib unfortunately. Not sure if we want to
> introduce that big of a diff with upstream.
>
>>
>> Jessica


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAMLT6uDpnYb%2B1DFCwYizOku%2Bpa4%2BAxGMa%2BFhJGztTjVpdyx9sw>