aboutsummaryrefslogtreecommitdiff
path: root/stand/defs.mk
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2017-12-02 00:06:58 +0000
committerWarner Losh <imp@FreeBSD.org>2017-12-02 00:06:58 +0000
commit4f6b28749442c4138dcc039771e1581c6d02cbb3 (patch)
tree9a54a5011769201b9e6ee8c6f2a465da6ebbf55b /stand/defs.mk
parent4291beb51bd5d8e62133aba10e4ab944adda4b32 (diff)
downloadsrc-4f6b28749442c4138dcc039771e1581c6d02cbb3.tar.gz
src-4f6b28749442c4138dcc039771e1581c6d02cbb3.zip
Notes
Diffstat (limited to 'stand/defs.mk')
-rw-r--r--stand/defs.mk47
1 files changed, 46 insertions, 1 deletions
diff --git a/stand/defs.mk b/stand/defs.mk
index 20e9a7786413..16f1b3bc662a 100644
--- a/stand/defs.mk
+++ b/stand/defs.mk
@@ -39,6 +39,8 @@ LIBSA32= ${BOOTOBJ}/libsa32/libsa32.a
.endif
# Standard options:
+CFLAGS+= -I${SASRC}
+CFLAGS+= -I${SYSDIR}
# Filesystem support
.if ${LOADER_CD9660_SUPPORT:Uno} == "yes"
@@ -104,7 +106,7 @@ LIBGELIBOOT= ${BOOTOBJ}/geli/libgeliboot.a
.endif
.endif
-CFLAGS+= -I${SYSDIR}
+# Machine specific flags for all builds here
# All PowerPC builds are 32 bit. We have no 64-bit loaders on powerpc
# or powerpc64.
@@ -122,6 +124,49 @@ LD_FLAGS+= -m elf_i386_fbsd
AFLAGS+= --32
.endif
+SSP_CFLAGS=
+
+# Add in the no float / no SIMD stuff and announce we're freestanding
+# aarch64 and riscv don't have -msoft-float, but all others do. riscv
+# currently has no /boot/loader, but may soon.
+CFLAGS+= -ffreestanding ${CFLAGS_NO_SIMD}
+.if ${MACHINE_CPUARCH} == "aarch64"
+CFLAGS+= -mgeneral-regs-only
+.elif ${MACHINE_CPUARCH} != "riscv"
+CFLAGS+= -msoft-float
+.endif
+
+.if ${MACHINE_CPUARCH} == "i386" || (${MACHINE_CPUARCH} == "amd64" && ${DO32:U0} == 1)
+CFLAGS+= -march=i386
+CFLAGS.gcc+= -mpreferred-stack-boundary=2
+.endif
+
+
+.if ${MACHINE_CPUARCH} == "arm"
+# Do not generate movt/movw, because the relocation fixup for them does not
+# translate to the -Bsymbolic -pie format required by self_reloc() in loader(8).
+# Also, the fpu is not available in a standalone environment.
+.if ${COMPILER_VERSION} < 30800
+CFLAGS.clang+= -mllvm -arm-use-movt=0
+.else
+CFLAGS.clang+= -mno-movt
+.endif
+CFLAGS.clang+= -mfpu=none
+.endif
+
+# The boot loader build uses dd status=none, where possible, for reproducible
+# build output (since performance varies from run to run). Trouble is that
+# option was recently (10.3) added to FreeBSD and is non-standard. Only use it
+# when this test succeeds rather than require dd to be a bootstrap tool.
+DD_NOSTATUS!=(dd status=none count=0 2> /dev/null && echo status=none) || true
+DD=dd ${DD_NOSTATUS}
+
+.if ${MK_LOADER_FORCE_LE} != "no"
+.if ${MACHINE_ARCH} == "powerpc64"
+CFLAGS+= -mlittle-endian
+.endif
+.endif
+
# Make sure we use the machine link we're about to create
CFLAGS+=-I.