1
0
mirror of https://git.FreeBSD.org/src.git synced 2026-06-02 11:24:32 +00:00

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.

Unlike the old Intel EFI toolkit, the EDK2 headers expect ia32 builds to
use -malign-double to achive this.

Make EFI versions of libsa32, liblua32, and ficl32. With the difference
being that they are compiled with -malign-double.

Differential Revision:	https://reviews.freebsd.org/D55385
This commit is contained in:
Ahmad Khalifa
2026-05-30 05:40:39 +03:00
parent f048a1a1de
commit d15cc7625d
7 changed files with 22 additions and 4 deletions
+1 -1
View File
@@ -78,7 +78,7 @@ LIBSA= ${BOOTOBJ}/libsa/libsa.a
.if ${MACHINE} == "i386"
LIBSA32= ${LIBSA}
.else
LIBSA32= ${BOOTOBJ}/libsa32/libsa32.a
LIBSA32= ${BOOTOBJ}/${"${LOADER}" == "loader_ia32":?efi/libsa32efi:libsa32}/libsa32.a
.endif
# Standard options:
+7 -1
View File
@@ -3,12 +3,18 @@ NO_OBJ=t
.include <bsd.init.mk>
SUBDIR.yes+= libefi
SUBDIR.${MK_LOADER_IA32}+= libefi32
SUBDIR.${MK_LOADER_IA32}+= libsa32efi libefi32
SUBDIR.${MK_FDT}+= fdt
SUBDIR.yes+= .WAIT
SUBDIR.yes+= boot1 gptboot
.if ${LOADER_DEFAULT_INTERP} == "lua"
SUBDIR.${MK_LOADER_IA32}+= liblua32efi
.elif ${LOADER_DEFAULT_INTERP} == "4th"
SUBDIR.${MK_LOADER_IA32}+= ficl32efi
.endif
SUBDIR.${MK_FORTH}+= loader_4th
SUBDIR.${MK_LOADER_LUA}+= loader_lua
SUBDIR.${MK_LOADER_IA32}+= loader_ia32
+5
View File
@@ -8,6 +8,11 @@ LDFLAGS+= -nostdlib
.if ${MACHINE_CPUARCH} == "amd64"
CFLAGS+= -fshort-wchar
CFLAGS+= -mno-red-zone
.if ${DO32:U0} == 1
# This is needed so the EDK2 EFI structs have the correct layout for
# the ia32 loader.
CFLAGS+= -malign-double
.endif
.endif
.if ${MACHINE_CPUARCH} == "aarch64"
+3
View File
@@ -0,0 +1,3 @@
DO32=1
.include "${.CURDIR}/../../ficl/Makefile"
+3
View File
@@ -0,0 +1,3 @@
DO32=1
.include "${.CURDIR}/../../liblua/Makefile"
+1
View File
@@ -0,0 +1 @@
.include "${.CURDIR}/../../libsa32/Makefile"
+2 -2
View File
@@ -162,14 +162,14 @@ LIBFICL= ${BOOTOBJ}/ficl/libficl.a
.if ${MACHINE} == "i386"
LIBFICL32= ${LIBFICL}
.else
LIBFICL32= ${BOOTOBJ}/ficl32/libficl.a
LIBFICL32= ${BOOTOBJ}/${"${LOADER}" == "loader_ia32":?efi/ficl32efi:ficl32}/libficl.a
.endif
LIBLUA= ${BOOTOBJ}/liblua/liblua.a
.if ${MACHINE} == "i386"
LIBLUA32= ${LIBLUA}
.else
LIBLUA32= ${BOOTOBJ}/liblua32/liblua.a
LIBLUA32= ${BOOTOBJ}/${"${LOADER}" == "loader_ia32":?efi/liblua32efi:liblua32}/liblua.a
.endif
CLEANFILES+= vers.c