mirror of
https://github.com/opnsense/src.git
synced 2026-04-29 18:32:49 -04:00
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
109 lines
2.5 KiB
Makefile
109 lines
2.5 KiB
Makefile
# $FreeBSD$
|
|
|
|
MAN=
|
|
|
|
.include <bsd.own.mk>
|
|
|
|
# In-tree GCC does not support __attribute__((ms_abi)).
|
|
.if ${COMPILER_TYPE} != "gcc"
|
|
|
|
MK_SSP= no
|
|
|
|
PROG= loader.sym
|
|
INTERNALPROG=
|
|
|
|
# architecture-specific loader code
|
|
SRCS= boot1.c self_reloc.c start.S
|
|
|
|
CFLAGS+= -I.
|
|
CFLAGS+= -I${.CURDIR}/../include
|
|
CFLAGS+= -I${.CURDIR}/../include/${MACHINE}
|
|
CFLAGS+= -I${.CURDIR}/../../../contrib/dev/acpica/include
|
|
CFLAGS+= -I${.CURDIR}/../../..
|
|
|
|
# Always add MI sources and REGULAR efi loader bits
|
|
.PATH: ${.CURDIR}/../loader/arch/${MACHINE}
|
|
.PATH: ${.CURDIR}/../loader
|
|
.PATH: ${.CURDIR}/../../common
|
|
CFLAGS+= -I${.CURDIR}/../../common
|
|
|
|
FILES= boot1.efi boot1.efifat
|
|
FILESMODE_boot1.efi= ${BINMODE}
|
|
|
|
LDSCRIPT= ${.CURDIR}/../loader/arch/${MACHINE}/ldscript.${MACHINE}
|
|
LDFLAGS= -Wl,-T${LDSCRIPT} -Wl,-Bsymbolic -shared
|
|
|
|
.if ${MACHINE_CPUARCH} == "aarch64"
|
|
CFLAGS+= -msoft-float -mgeneral-regs-only
|
|
.endif
|
|
.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386"
|
|
CFLAGS+= -fPIC
|
|
LDFLAGS+= -Wl,-znocombreloc
|
|
.endif
|
|
|
|
.if ${MACHINE_CPUARCH} == "arm" || ${MACHINE_CPUARCH} == "i386"
|
|
#
|
|
# Add libstand for the runtime functions used by the compiler - for example
|
|
# __aeabi_* (arm) or __divdi3 (i386).
|
|
#
|
|
DPADD+= ${LIBSTAND}
|
|
LDADD+= -lstand
|
|
.endif
|
|
|
|
${PROG}: ${LDSCRIPT}
|
|
|
|
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
|
|
|
|
boot1.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}
|
|
|
|
boot1.o: ${.CURDIR}/../../common/ufsread.c
|
|
|
|
# The following inserts out objects into a template FAT file system
|
|
# created by generate-fat.sh
|
|
|
|
.include "${.CURDIR}/Makefile.fat"
|
|
|
|
boot1.efifat: boot1.efi
|
|
echo ${.OBJDIR}
|
|
uudecode ${.CURDIR}/fat-${MACHINE}.tmpl.bz2.uu
|
|
mv fat-${MACHINE}.tmpl.bz2 ${.TARGET}.bz2
|
|
bzip2 -f -d ${.TARGET}.bz2
|
|
dd if=boot1.efi of=${.TARGET} seek=${BOOT1_OFFSET} conv=notrunc
|
|
|
|
CLEANFILES= boot1.efi boot1.efifat
|
|
|
|
.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
|