mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-25 16:13:17 +00:00
5b1c03fd13
The function was defined as taking 4 parameters and returning EFI_STATUS, but all existing callers (in asm code) passed only two parameters and don't use the return value. The function signature now matches that usage, and doesn't refer to efi-specific types. Parameters and variables now use the cannonical typenames set up by elf.h (Elf_Word, Elf_Addr, etc) instead of raw C types. Hopefully this will prevent suprises as new platforms come along and use this code. The function was renamed from _reloc() to self_reloc() to emphasize its difference from the other elf relocation code found in boot/common. Differential Revision: https://reviews.freebsd.org/D2490
134 lines
3.1 KiB
Makefile
134 lines
3.1 KiB
Makefile
# $FreeBSD$
|
|
|
|
MAN=
|
|
|
|
.include <src.opts.mk>
|
|
|
|
# In-tree GCC does not support __attribute__((ms_abi)).
|
|
.if ${COMPILER_TYPE} != "gcc"
|
|
|
|
MK_SSP= no
|
|
|
|
PROG= loader.sym
|
|
INTERNALPROG=
|
|
|
|
.PATH: ${.CURDIR}/../../efi/loader
|
|
# architecture-specific loader code
|
|
SRCS= autoload.c \
|
|
bootinfo.c \
|
|
conf.c \
|
|
copy.c \
|
|
devicename.c \
|
|
main.c \
|
|
self_reloc.c \
|
|
smbios.c \
|
|
vers.c
|
|
|
|
.PATH: ${.CURDIR}/arch/${MACHINE}
|
|
# For smbios.c
|
|
.PATH: ${.CURDIR}/../../i386/libi386
|
|
.include "${.CURDIR}/arch/${MACHINE}/Makefile.inc"
|
|
|
|
CFLAGS+= -I${.CURDIR}
|
|
CFLAGS+= -I${.CURDIR}/arch/${MACHINE}
|
|
CFLAGS+= -I${.CURDIR}/../include
|
|
CFLAGS+= -I${.CURDIR}/../include/${MACHINE}
|
|
CFLAGS+= -I${.CURDIR}/../../../contrib/dev/acpica/include
|
|
CFLAGS+= -I${.CURDIR}/../../..
|
|
CFLAGS+= -I${.CURDIR}/../../i386/libi386
|
|
CFLAGS+= -DNO_PCI -DEFI
|
|
|
|
# make buildenv doesn't set DESTDIR, this means LIBSTAND
|
|
# will be wrong when crossbuilding.
|
|
.if exists(${.OBJDIR}/../../../../lib/libstand/libstand.a)
|
|
LIBSTAND= ${.OBJDIR}/../../../../lib/libstand/libstand.a
|
|
.endif
|
|
|
|
.if ${MK_FORTH} != "no"
|
|
BOOT_FORTH= yes
|
|
CFLAGS+= -DBOOT_FORTH
|
|
CFLAGS+= -I${.CURDIR}/../../ficl
|
|
CFLAGS+= -I${.CURDIR}/../../ficl/${MACHINE_CPUARCH}
|
|
LIBFICL= ${.OBJDIR}/../../ficl/libficl.a
|
|
.endif
|
|
|
|
LOADER_FDT_SUPPORT?= no
|
|
.if ${MK_FDT} != "no" && ${LOADER_FDT_SUPPORT} != "no"
|
|
CFLAGS+= -I${.CURDIR}/../../fdt
|
|
CFLAGS+= -I${.OBJDIR}/../../fdt
|
|
CFLAGS+= -DLOADER_FDT_SUPPORT
|
|
LIBEFI_FDT= ${.OBJDIR}/../../efi/fdt/libefi_fdt.a
|
|
LIBFDT= ${.OBJDIR}/../../fdt/libfdt.a
|
|
.endif
|
|
|
|
# Include bcache code.
|
|
HAVE_BCACHE= yes
|
|
|
|
.if defined(EFI_STAGING_SIZE)
|
|
CFLAGS+= -DEFI_STAGING_SIZE=${EFI_STAGING_SIZE}
|
|
.endif
|
|
|
|
# Always add MI sources
|
|
.PATH: ${.CURDIR}/../../common
|
|
.include "${.CURDIR}/../../common/Makefile.inc"
|
|
CFLAGS+= -I${.CURDIR}/../../common
|
|
|
|
FILES= loader.efi
|
|
FILESMODE_loader.efi= ${BINMODE}
|
|
|
|
LDSCRIPT= ${.CURDIR}/arch/${MACHINE}/ldscript.${MACHINE}
|
|
LDFLAGS+= -Wl,-T${LDSCRIPT} -Wl,-Bsymbolic -shared
|
|
|
|
CLEANFILES= vers.c loader.efi
|
|
|
|
NEWVERSWHAT= "EFI loader" ${MACHINE}
|
|
|
|
vers.c: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/../../efi/loader/version
|
|
sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT}
|
|
|
|
OBJCOPY?= objcopy
|
|
OBJDUMP?= objdump
|
|
|
|
.if ${MACHINE_CPUARCH} == "amd64"
|
|
EFI_TARGET= efi-app-x86_64
|
|
.elif ${MACHINE_CPUARCH} == "i386"
|
|
EFI_TARGET= efi-app-ia32
|
|
.else
|
|
EFI_TARGET= binary
|
|
.endif
|
|
|
|
loader.efi: loader.sym
|
|
if [ `${OBJDUMP} -t ${.ALLSRC} | fgrep '*UND*' | wc -l` != 0 ]; then \
|
|
${OBJDUMP} -t ${.ALLSRC} | fgrep '*UND*'; \
|
|
exit 1; \
|
|
fi
|
|
${OBJCOPY} -j .peheader -j .text -j .sdata -j .data \
|
|
-j .dynamic -j .dynsym -j .rel.dyn \
|
|
-j .rela.dyn -j .reloc -j .eh_frame -j set_Xcommand_set \
|
|
--output-target=${EFI_TARGET} ${.ALLSRC} ${.TARGET}
|
|
|
|
LIBEFI= ${.OBJDIR}/../libefi/libefi.a
|
|
|
|
DPADD= ${LIBFICL} ${LIBEFI} ${LIBFDT} ${LIBEFI_FDT} ${LIBSTAND} \
|
|
${LDSCRIPT}
|
|
LDADD= ${LIBFICL} ${LIBEFI} ${LIBFDT} ${LIBEFI_FDT} ${LIBSTAND}
|
|
|
|
.endif # ${COMPILER_TYPE} != "gcc"
|
|
|
|
.include <bsd.prog.mk>
|
|
|
|
beforedepend ${OBJS}: machine
|
|
|
|
CLEANFILES+= machine
|
|
|
|
machine:
|
|
ln -sf ${.CURDIR}/../../../${MACHINE}/include machine
|
|
|
|
.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
|
|
beforedepend ${OBJS}: x86
|
|
CLEANFILES+= x86
|
|
|
|
x86:
|
|
ln -sf ${.CURDIR}/../../../x86/include x86
|
|
.endif
|