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
This commit is contained in:
imp 2017-11-20 22:42:21 +00:00
parent 11e5eeaa48
commit f097f35b37
22 changed files with 20 additions and 60 deletions

View File

@ -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).

View File

@ -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

View File

@ -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"

View File

@ -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}

View File

@ -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>

View File

@ -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

View File

@ -1,6 +1,5 @@
# $FreeBSD$
CFLAGS+= -ffreestanding
LDFLAGS+= -nostdlib
.include "../Makefile.inc"

View File

@ -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 \

View File

@ -83,7 +83,6 @@ CFLAGS+= -I${.CURDIR}
CFLAGS+= -G0 \
-fno-pic \
-mno-abicalls \
-msoft-float \
-g
LDFLAGS= -nostdlib \

View File

@ -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}

View File

@ -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

View File

@ -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}

View File

@ -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}

View File

@ -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}

View File

@ -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}

View File

@ -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"

View File

@ -1,6 +1,5 @@
# $FreeBSD$
CFLAGS+= -ffreestanding
LDFLAGS+= -nostdlib
.include "../Makefile.inc"

View File

@ -10,8 +10,6 @@ WARNS?= 2
SRCS= uboot_fdt.c
CFLAGS+= -ffreestanding -msoft-float
# U-Boot library headers
CFLAGS+= -I${UBOOTSRC}/lib

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -36,7 +36,6 @@ SRCS+= vers.c
CFLAGS+= -Wall
CFLAGS+= -I${BOOTSRC}/userboot
CFLAGS+= -ffreestanding
CWARNFLAGS.main.c += -Wno-implicit-function-declaration