aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2017-11-20 22:42:17 +0000
committerWarner Losh <imp@FreeBSD.org>2017-11-20 22:42:17 +0000
commit8a4217aacf57330755501a349d0ea662d4880386 (patch)
treec654a0b01626c218eb3359addb4cc8cfc19d540c
parentca50d6799da337ffbd58dbaadfed0c9f8a969e32 (diff)
downloadsrc-8a4217aacf57330755501a349d0ea662d4880386.tar.gz
src-8a4217aacf57330755501a349d0ea662d4880386.zip
Move some more common stuff up to Makefile.inc. In particular, the no
simd / no float stuff is centeralized here. Also centralise -ffreestanding since it is specified everywhere. This, along with a change to share/mk/bsd.cpu.mk to include -mno-avx2 in CFLAGS_NO_SIMD should fix building for newer machines (eg with CPUTYPE=haswell) where clang was generating avx2 instructions. Sponsored by: Netflix
Notes
Notes: svn path=/head/; revision=326038
-rw-r--r--stand/Makefile.inc14
-rw-r--r--stand/arm/uboot/Makefile2
-rw-r--r--stand/efi/Makefile.inc12
-rw-r--r--stand/efi/fdt/Makefile7
-rw-r--r--stand/fdt/Makefile6
-rw-r--r--stand/i386/Makefile.inc3
-rw-r--r--stand/mips/beri/Makefile.inc1
-rw-r--r--stand/mips/beri/boot2/Makefile4
-rw-r--r--stand/mips/beri/loader/Makefile1
-rw-r--r--stand/mips/uboot/Makefile2
-rw-r--r--stand/ofw/libofw/Makefile2
-rw-r--r--stand/powerpc/boot1.chrp/Makefile4
-rw-r--r--stand/powerpc/kboot/Makefile2
-rw-r--r--stand/powerpc/ofw/Makefile1
-rw-r--r--stand/powerpc/ps3/Makefile2
-rw-r--r--stand/powerpc/uboot/Makefile2
-rw-r--r--stand/sparc64/Makefile.inc1
-rw-r--r--stand/uboot/fdt/Makefile2
-rw-r--r--stand/uboot/lib/Makefile2
-rw-r--r--stand/usb/Makefile5
-rw-r--r--stand/usb/Makefile.test4
-rw-r--r--stand/userboot/userboot/Makefile1
22 files changed, 20 insertions, 60 deletions
diff --git a/stand/Makefile.inc b/stand/Makefile.inc
index cf833d92423d..b0b11ca7fbcc 100644
--- a/stand/Makefile.inc
+++ b/stand/Makefile.inc
@@ -9,6 +9,20 @@ CFLAGS+=-I${SASRC}
SSP_CFLAGS=
+# Add in the no float / no SIMD stuff and announce we're freestanding
+CFLAGS+= -ffreestanding ${CFLAGS_NO_SIMD}
+.if ${MACHINE_CPUARCH} == "aarch64"
+CFLAGS+= -mgeneral-regs-only
+.else
+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).
diff --git a/stand/arm/uboot/Makefile b/stand/arm/uboot/Makefile
index 5bf7d533b942..2070d8a15ce1 100644
--- a/stand/arm/uboot/Makefile
+++ b/stand/arm/uboot/Makefile
@@ -33,8 +33,6 @@ HELP_FILES+= help.uboot ${BOOTSRC}/fdt/help.fdt
# Always add MI sources
.include "${BOOTSRC}/loader.mk"
-CFLAGS+= -ffreestanding -msoft-float
-
LDFLAGS= -nostdlib -static -T ${.CURDIR}/ldscript.${MACHINE_CPUARCH}
LDFLAGS+= -Wl,-znotext
diff --git a/stand/efi/Makefile.inc b/stand/efi/Makefile.inc
index 4fd8762e1a21..704a77c6c397 100644
--- a/stand/efi/Makefile.inc
+++ b/stand/efi/Makefile.inc
@@ -1,23 +1,13 @@
# $FreeBSD$
-.if ${MACHINE_CPUARCH} == "i386"
-CFLAGS+= -march=i386
-CFLAGS+= -mno-aes
-.endif
-
# Options used when building app-specific efi components
# See conf/kern.mk for the correct set of these
-CFLAGS+= -ffreestanding -Wformat ${CFLAGS_NO_SIMD}
+CFLAGS+= -Wformat
LDFLAGS+= -nostdlib
-.if ${MACHINE_CPUARCH} != "aarch64"
-CFLAGS+= -msoft-float
-.endif
-
.if ${MACHINE_CPUARCH} == "amd64"
CFLAGS+= -fshort-wchar
CFLAGS+= -mno-red-zone
-CFLAGS+= -mno-aes
.endif
.if ${MACHINE_CPUARCH} == "aarch64"
diff --git a/stand/efi/fdt/Makefile b/stand/efi/fdt/Makefile
index 7308ce94e45e..6bae4390f37c 100644
--- a/stand/efi/fdt/Makefile
+++ b/stand/efi/fdt/Makefile
@@ -10,13 +10,6 @@ WARNS?= 6
SRCS= efi_fdt.c
-CFLAGS+= -ffreestanding
-.if ${MACHINE_CPUARCH} == "aarch64"
-CFLAGS+= -mgeneral-regs-only
-.else
-CFLAGS+= -msoft-float
-.endif
-
# EFI library headers
CFLAGS+= -I${EFISRC}/include
CFLAGS+= -I${EFISRC}/include/${MACHINE}
diff --git a/stand/fdt/Makefile b/stand/fdt/Makefile
index a725499d2f78..a5d81d9786dc 100644
--- a/stand/fdt/Makefile
+++ b/stand/fdt/Makefile
@@ -16,12 +16,6 @@ SRCS+= fdt_loader_cmd.c fdt_overlay.c
CFLAGS+= -I${SYSDIR}/contrib/libfdt/ -I${LDRSRC}
-CFLAGS+= -ffreestanding
-
-.if ${MACHINE_CPUARCH} == "powerpc" || ${MACHINE_CPUARCH} == "arm" || ${MACHINE_CPUARCH} == "mips"
-CFLAGS+= -msoft-float
-.endif
-
CFLAGS+= -Wformat -Wall
.include <bsd.stand.mk>
diff --git a/stand/i386/Makefile.inc b/stand/i386/Makefile.inc
index 54391c4d62c2..77dbda54f5a6 100644
--- a/stand/i386/Makefile.inc
+++ b/stand/i386/Makefile.inc
@@ -3,9 +3,6 @@
# $FreeBSD$
LOADER_ADDRESS?=0x200000
-CFLAGS+= -march=i386 -ffreestanding
-CFLAGS.gcc+= -mpreferred-stack-boundary=2
-CFLAGS+= ${CFLAGS_NO_SIMD} -msoft-float
LDFLAGS+= -nostdlib
# BTX components
diff --git a/stand/mips/beri/Makefile.inc b/stand/mips/beri/Makefile.inc
index a12699c3a6f7..5a7b18e393c0 100644
--- a/stand/mips/beri/Makefile.inc
+++ b/stand/mips/beri/Makefile.inc
@@ -1,6 +1,5 @@
# $FreeBSD$
-CFLAGS+= -ffreestanding
LDFLAGS+= -nostdlib
.include "../Makefile.inc"
diff --git a/stand/mips/beri/boot2/Makefile b/stand/mips/beri/boot2/Makefile
index d36934078e1a..c46a15747caa 100644
--- a/stand/mips/beri/boot2/Makefile
+++ b/stand/mips/beri/boot2/Makefile
@@ -47,15 +47,13 @@ MAN=
AFLAGS= -G0
-CFLAGS= -ffreestanding \
- -I${.CURDIR} \
+CFLAGS+= -I${.CURDIR} \
-I${SASRC} \
-I${LDRSRC} \
-D_KERNEL \
-Wall \
-G0 \
-fno-pic -mno-abicalls \
- -msoft-float \
-g
LDFLAGS= -nostdlib \
diff --git a/stand/mips/beri/loader/Makefile b/stand/mips/beri/loader/Makefile
index 763b3b34662e..f2324891edc3 100644
--- a/stand/mips/beri/loader/Makefile
+++ b/stand/mips/beri/loader/Makefile
@@ -83,7 +83,6 @@ CFLAGS+= -I${.CURDIR}
CFLAGS+= -G0 \
-fno-pic \
-mno-abicalls \
- -msoft-float \
-g
LDFLAGS= -nostdlib \
diff --git a/stand/mips/uboot/Makefile b/stand/mips/uboot/Makefile
index b941ba342431..c605af1310e4 100644
--- a/stand/mips/uboot/Makefile
+++ b/stand/mips/uboot/Makefile
@@ -29,7 +29,7 @@ HELP_FILES+= help.uboot ${BOOTSRC}/fdt/help.fdt
# Always add MI sources
.include "${BOOTSRC}/loader.mk"
-CFLAGS+= -ffreestanding -msoft-float -g
+CFLAGS+= -g
LDFLAGS= -nostdlib -static -T ${.CURDIR}/ldscript.${MACHINE_CPUARCH}
diff --git a/stand/ofw/libofw/Makefile b/stand/ofw/libofw/Makefile
index 8e9ac804c5fa..6818e2705f23 100644
--- a/stand/ofw/libofw/Makefile
+++ b/stand/ofw/libofw/Makefile
@@ -14,9 +14,7 @@ SRCS+= devicename_stubs.c
# Pick up the bootstrap header for some interface items
CFLAGS+= -I${LDRSRC}
-CFLAGS+= -ffreestanding
.if ${MACHINE_CPUARCH} == "powerpc"
-CFLAGS+= -msoft-float
SRCS+= ppc64_elf_freebsd.c
.endif
diff --git a/stand/powerpc/boot1.chrp/Makefile b/stand/powerpc/boot1.chrp/Makefile
index 384d0abc2788..ee32ff527d0b 100644
--- a/stand/powerpc/boot1.chrp/Makefile
+++ b/stand/powerpc/boot1.chrp/Makefile
@@ -13,9 +13,7 @@ SRCS= boot1.c ashldi3.c syncicache.c
MAN=
-CFLAGS= -ffreestanding -msoft-float \
- -I${LDRSRC} -I${SYSDIR} -I${SASRC} \
- -D_STANDALONE
+CFLAGS= -I${LDRSRC} -I${SYSDIR} -I${SASRC} -D_STANDALONE
LDFLAGS=-nostdlib -static -Wl,-N
.PATH: ${SYSDIR}/libkern ${SRCTOP}/lib/libc/powerpc/gen ${.CURDIR}
diff --git a/stand/powerpc/kboot/Makefile b/stand/powerpc/kboot/Makefile
index bed586e6732a..b51a06831fcd 100644
--- a/stand/powerpc/kboot/Makefile
+++ b/stand/powerpc/kboot/Makefile
@@ -32,7 +32,7 @@ HELP_FILES= # Disable
.include "${BOOTSRC}/loader.mk"
.PATH: ${SYSDIR}/libkern
-CFLAGS+= -Wall -ffreestanding -msoft-float -DAIM
+CFLAGS+= -Wall -DAIM
# load address. set in linker script
RELOC?= 0x0
CFLAGS+= -DRELOC=${RELOC}
diff --git a/stand/powerpc/ofw/Makefile b/stand/powerpc/ofw/Makefile
index 1853b2596fce..b28665db622c 100644
--- a/stand/powerpc/ofw/Makefile
+++ b/stand/powerpc/ofw/Makefile
@@ -34,7 +34,6 @@ HELP_FILES+= ${FDTSRC}/help.fdt
.PATH: ${SYSDIR}/libkern
-CFLAGS+= -ffreestanding -msoft-float
# load address. set in linker script
RELOC?= 0x1C00000
CFLAGS+= -DRELOC=${RELOC}
diff --git a/stand/powerpc/ps3/Makefile b/stand/powerpc/ps3/Makefile
index 07ad135d9796..fc6ec9cb8b4e 100644
--- a/stand/powerpc/ps3/Makefile
+++ b/stand/powerpc/ps3/Makefile
@@ -30,7 +30,7 @@ HELP_FILES= # Disable
.include "${BOOTSRC}/loader.mk"
.PATH: ${SYSDIR}/libkern
-CFLAGS+= -Wall -ffreestanding -msoft-float -DAIM
+CFLAGS+= -Wall -DAIM
# load address. set in linker script
RELOC?= 0x0
CFLAGS+= -DRELOC=${RELOC}
diff --git a/stand/powerpc/uboot/Makefile b/stand/powerpc/uboot/Makefile
index d543aceeee4c..6622cf18a316 100644
--- a/stand/powerpc/uboot/Makefile
+++ b/stand/powerpc/uboot/Makefile
@@ -25,8 +25,6 @@ HELP_FILES= # Disable
.include "${BOOTSRC}/loader.mk"
.PATH: ${SYSDIR}/libkern
-CFLAGS+= -ffreestanding
-
LDFLAGS= -nostdlib -static -T ${.CURDIR}/ldscript.powerpc
.include "${BOOTSRC}/uboot.mk"
diff --git a/stand/sparc64/Makefile.inc b/stand/sparc64/Makefile.inc
index a12699c3a6f7..5a7b18e393c0 100644
--- a/stand/sparc64/Makefile.inc
+++ b/stand/sparc64/Makefile.inc
@@ -1,6 +1,5 @@
# $FreeBSD$
-CFLAGS+= -ffreestanding
LDFLAGS+= -nostdlib
.include "../Makefile.inc"
diff --git a/stand/uboot/fdt/Makefile b/stand/uboot/fdt/Makefile
index 4bc38ec7c6f0..d88789d29264 100644
--- a/stand/uboot/fdt/Makefile
+++ b/stand/uboot/fdt/Makefile
@@ -10,8 +10,6 @@ WARNS?= 2
SRCS= uboot_fdt.c
-CFLAGS+= -ffreestanding -msoft-float
-
# U-Boot library headers
CFLAGS+= -I${UBOOTSRC}/lib
diff --git a/stand/uboot/lib/Makefile b/stand/uboot/lib/Makefile
index d12d48cafaa1..5e8a5f41821a 100644
--- a/stand/uboot/lib/Makefile
+++ b/stand/uboot/lib/Makefile
@@ -11,8 +11,6 @@ WARNS?= 2
SRCS= console.c copy.c devicename.c elf_freebsd.c glue.c
SRCS+= module.c net.c reboot.c time.c
-CFLAGS+= -ffreestanding -msoft-float
-
.if ${LOADER_DISK_SUPPORT:Uyes} == "yes"
SRCS+= disk.c
.endif
diff --git a/stand/usb/Makefile b/stand/usb/Makefile
index 1b94b3db7d82..ab14a6d002a3 100644
--- a/stand/usb/Makefile
+++ b/stand/usb/Makefile
@@ -36,15 +36,10 @@ INTERNALLIB=
CFLAGS+= -DBOOTPROG=\"usbloader\"
CFLAGS+= -ffunction-sections -fdata-sections
-CFLAGS+= -ffreestanding
CFLAGS+= -Wformat -Wall
CFLAGS+= -g
CFLAGS+= -fno-pic
-.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
-CFLAGS+= -march=i386
-CFLAGS.gcc+= -mpreferred-stack-boundary=2
-.endif
.if ${MACHINE_CPUARCH} == "amd64"
CFLAGS+= -m32
.endif
diff --git a/stand/usb/Makefile.test b/stand/usb/Makefile.test
index 7c6a66d17310..decee690b707 100644
--- a/stand/usb/Makefile.test
+++ b/stand/usb/Makefile.test
@@ -38,10 +38,6 @@ SRCS=
CFLAGS+= -Wall
CFLAGS+= -g
-.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
-CFLAGS+= -march=i386
-CFLAGS.gcc+= -mpreferred-stack-boundary=2
-.endif
.if ${MACHINE_CPUARCH} == "amd64"
CFLAGS+= -m32
.endif
diff --git a/stand/userboot/userboot/Makefile b/stand/userboot/userboot/Makefile
index cbada8227ba0..cf235a9408cf 100644
--- a/stand/userboot/userboot/Makefile
+++ b/stand/userboot/userboot/Makefile
@@ -36,7 +36,6 @@ SRCS+= vers.c
CFLAGS+= -Wall
CFLAGS+= -I${BOOTSRC}/userboot
-CFLAGS+= -ffreestanding
CWARNFLAGS.main.c += -Wno-implicit-function-declaration