freebsd-skq/stand/mips/uboot/Makefile
Marcin Wojtas cd992885bc Disable PIE for MIPS ubldr
When performing buildworld for MIPS with PIE enabled, the build fails
with "position-independent code requires '-mabicalls'" message.
-mno-abicalls and -fno-pic flags are explicitly set in MIPS ubldr
makefile, so to work around this problem, set MK_PIE=no for MIPS
ubldr.

Submitted by: Dawid Gorecki <dgr@semihalf.com>
Reviewed by: emaste
Obtained from: Semihalf
Sponsored by: Stormshield
Differential Revision: https://reviews.freebsd.org/D28370
2021-02-25 00:26:11 +01:00

65 lines
1.5 KiB
Makefile

# $FreeBSD$
LOADER_CD9660_SUPPORT?= no
LOADER_EXT2FS_SUPPORT?= no
LOADER_MSDOS_SUPPORT?= yes
LOADER_UFS_SUPPORT?= yes
LOADER_NET_SUPPORT?= yes
LOADER_NFS_SUPPORT?= yes
LOADER_TFTP_SUPPORT?= no
LOADER_GZIP_SUPPORT?= no
LOADER_BZIP2_SUPPORT?= no
.include <bsd.init.mk>
FILES+= ubldr
NEWVERSWHAT= "U-Boot loader" ${MACHINE_ARCH}
INSTALLFLAGS= -b
WARNS?= 1
# Address at which ubldr will be loaded.
# This varies for different boards and SOCs.
.if ${MACHINE_ARCH:Mmips64*}
UBLDR_LOADADDR?= 0xffffffff80800000
.else
UBLDR_LOADADDR?= 0x80800000
.endif
# Architecture-specific loader code
SRCS= start.S conf.c vers.c
HELP_FILES= ${.CURDIR}/help.uboot ${BOOTSRC}/fdt/help.fdt
# Always add MI sources
.include "${BOOTSRC}/loader.mk"
CFLAGS+= -g
LDFLAGS= -nostdlib -static -T ${.CURDIR}/ldscript.${MACHINE_CPUARCH}
.include "${BOOTSRC}/uboot.mk"
DPADD= ${LDR_INTERP} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSA}
LDADD= ${LDR_INTERP} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSA}
OBJS+= ${SRCS:N*.h:R:S/$/.o/g}
# ubldr on MIPS is built with '-mno-abicalls' flag,
# which is incompatible with PIE
MK_PIE= no
ldscript.abs:
echo "UBLDR_LOADADDR = ${UBLDR_LOADADDR};" >${.TARGET}
ldscript.pie:
echo "UBLDR_LOADADDR = 0;" >${.TARGET}
ubldr: ${OBJS} ldscript.abs ${.CURDIR}/ldscript.${MACHINE_CPUARCH} ${DPADD}
${CC} ${CFLAGS} -T ldscript.abs ${LDFLAGS} \
-o ${.TARGET} ${OBJS} ${LDADD}
${OBJCOPY} -S -O binary ubldr ubldr.bin
CLEANFILES+= ldscript.abs ldscript.pie ubldr ubldr.pie ubldr.bin
.include <bsd.prog.mk>