summaryrefslogtreecommitdiff
path: root/docs/BOOT_LOADER_SPECIFICATION.md
diff options
context:
space:
mode:
authorJan Janssen <medhefgo@web.de>2023-04-10 11:43:56 +0200
committerLuca Boccassi <luca.boccassi@gmail.com>2023-04-11 17:09:18 +0100
commitb87d6da4478820d680b9542668b5df41848f937d (patch)
treef0f47ff5460f27da32c505799a001ac768b7b0a1 /docs/BOOT_LOADER_SPECIFICATION.md
parent5f8a9e6905305af88b125ed3d07b20085b8e74da (diff)
downloadsystemd-b87d6da4478820d680b9542668b5df41848f937d.tar.gz
boot: Fix alignment of long long inside structs on x86
On x86 EFI follows the windows ABI, which expects 8-byte aligned long long. The x86 sysv ELF ABI expects them to be 8-byte aligned when used alone, but 4-byte aligned when they appear inside of structs: struct S { int i; long long ll; }; // _Static_assert(sizeof(struct S) == 12, "x86 sysv ABI"); _Static_assert(sizeof(struct S) == 16, "EFI/MS ABI"); To get the behavior we need when building with sysv ELF ABI we need to pass '-malign-double' to the compiler as done by EDK2. This in turn will make ubsan unhappy as the stack may not be properly aligned on entry, so we have to tell the compiler explicitly to re-align the stack on entry to efi_main. This fixes loading EFI drivers on x86 that were previously always rejected as the EFI_LOADED_IMAGE_PROTOCOL had a wrong memory layout. See also: https://github.com/rhboot/shim/pull/516
Diffstat (limited to 'docs/BOOT_LOADER_SPECIFICATION.md')
0 files changed, 0 insertions, 0 deletions