Author: imp
Date: Mon Nov 20 22:42:17 2017
New Revision: 326038
URL: https://svnweb.freebsd.org/changeset/base/326038

Log:
  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

Modified:
  head/stand/Makefile.inc
  head/stand/arm/uboot/Makefile
  head/stand/efi/Makefile.inc
  head/stand/efi/fdt/Makefile
  head/stand/fdt/Makefile
  head/stand/i386/Makefile.inc
  head/stand/mips/beri/Makefile.inc
  head/stand/mips/beri/boot2/Makefile
  head/stand/mips/beri/loader/Makefile
  head/stand/mips/uboot/Makefile
  head/stand/ofw/libofw/Makefile
  head/stand/powerpc/boot1.chrp/Makefile
  head/stand/powerpc/kboot/Makefile
  head/stand/powerpc/ofw/Makefile
  head/stand/powerpc/ps3/Makefile
  head/stand/powerpc/uboot/Makefile
  head/stand/sparc64/Makefile.inc
  head/stand/uboot/fdt/Makefile
  head/stand/uboot/lib/Makefile
  head/stand/usb/Makefile
  head/stand/usb/Makefile.test
  head/stand/userboot/userboot/Makefile

Modified: head/stand/Makefile.inc
==============================================================================
--- head/stand/Makefile.inc     Mon Nov 20 22:41:22 2017        (r326037)
+++ head/stand/Makefile.inc     Mon Nov 20 22:42:17 2017        (r326038)
@@ -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).

Modified: head/stand/arm/uboot/Makefile
==============================================================================
--- head/stand/arm/uboot/Makefile       Mon Nov 20 22:41:22 2017        
(r326037)
+++ head/stand/arm/uboot/Makefile       Mon Nov 20 22:42:17 2017        
(r326038)
@@ -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
 

Modified: head/stand/efi/Makefile.inc
==============================================================================
--- head/stand/efi/Makefile.inc Mon Nov 20 22:41:22 2017        (r326037)
+++ head/stand/efi/Makefile.inc Mon Nov 20 22:42:17 2017        (r326038)
@@ -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"

Modified: head/stand/efi/fdt/Makefile
==============================================================================
--- head/stand/efi/fdt/Makefile Mon Nov 20 22:41:22 2017        (r326037)
+++ head/stand/efi/fdt/Makefile Mon Nov 20 22:42:17 2017        (r326038)
@@ -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}

Modified: head/stand/fdt/Makefile
==============================================================================
--- head/stand/fdt/Makefile     Mon Nov 20 22:41:22 2017        (r326037)
+++ head/stand/fdt/Makefile     Mon Nov 20 22:42:17 2017        (r326038)
@@ -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>

Modified: head/stand/i386/Makefile.inc
==============================================================================
--- head/stand/i386/Makefile.inc        Mon Nov 20 22:41:22 2017        
(r326037)
+++ head/stand/i386/Makefile.inc        Mon Nov 20 22:42:17 2017        
(r326038)
@@ -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

Modified: head/stand/mips/beri/Makefile.inc
==============================================================================
--- head/stand/mips/beri/Makefile.inc   Mon Nov 20 22:41:22 2017        
(r326037)
+++ head/stand/mips/beri/Makefile.inc   Mon Nov 20 22:42:17 2017        
(r326038)
@@ -1,6 +1,5 @@
 # $FreeBSD$
 
-CFLAGS+=       -ffreestanding
 LDFLAGS+=      -nostdlib
 
 .include "../Makefile.inc"

Modified: head/stand/mips/beri/boot2/Makefile
==============================================================================
--- head/stand/mips/beri/boot2/Makefile Mon Nov 20 22:41:22 2017        
(r326037)
+++ head/stand/mips/beri/boot2/Makefile Mon Nov 20 22:42:17 2017        
(r326038)
@@ -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                       \

Modified: head/stand/mips/beri/loader/Makefile
==============================================================================
--- head/stand/mips/beri/loader/Makefile        Mon Nov 20 22:41:22 2017        
(r326037)
+++ head/stand/mips/beri/loader/Makefile        Mon Nov 20 22:42:17 2017        
(r326038)
@@ -83,7 +83,6 @@ CFLAGS+=      -I${.CURDIR}
 CFLAGS+=       -G0                                     \
                -fno-pic                                \
                -mno-abicalls                           \
-               -msoft-float                            \
                -g
 
 LDFLAGS=       -nostdlib                               \

Modified: head/stand/mips/uboot/Makefile
==============================================================================
--- head/stand/mips/uboot/Makefile      Mon Nov 20 22:41:22 2017        
(r326037)
+++ head/stand/mips/uboot/Makefile      Mon Nov 20 22:42:17 2017        
(r326038)
@@ -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}
 

Modified: head/stand/ofw/libofw/Makefile
==============================================================================
--- head/stand/ofw/libofw/Makefile      Mon Nov 20 22:41:22 2017        
(r326037)
+++ head/stand/ofw/libofw/Makefile      Mon Nov 20 22:42:17 2017        
(r326038)
@@ -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
 

Modified: head/stand/powerpc/boot1.chrp/Makefile
==============================================================================
--- head/stand/powerpc/boot1.chrp/Makefile      Mon Nov 20 22:41:22 2017        
(r326037)
+++ head/stand/powerpc/boot1.chrp/Makefile      Mon Nov 20 22:42:17 2017        
(r326038)
@@ -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}

Modified: head/stand/powerpc/kboot/Makefile
==============================================================================
--- head/stand/powerpc/kboot/Makefile   Mon Nov 20 22:41:22 2017        
(r326037)
+++ head/stand/powerpc/kboot/Makefile   Mon Nov 20 22:42:17 2017        
(r326038)
@@ -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}

Modified: head/stand/powerpc/ofw/Makefile
==============================================================================
--- head/stand/powerpc/ofw/Makefile     Mon Nov 20 22:41:22 2017        
(r326037)
+++ head/stand/powerpc/ofw/Makefile     Mon Nov 20 22:42:17 2017        
(r326038)
@@ -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}

Modified: head/stand/powerpc/ps3/Makefile
==============================================================================
--- head/stand/powerpc/ps3/Makefile     Mon Nov 20 22:41:22 2017        
(r326037)
+++ head/stand/powerpc/ps3/Makefile     Mon Nov 20 22:42:17 2017        
(r326038)
@@ -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}

Modified: head/stand/powerpc/uboot/Makefile
==============================================================================
--- head/stand/powerpc/uboot/Makefile   Mon Nov 20 22:41:22 2017        
(r326037)
+++ head/stand/powerpc/uboot/Makefile   Mon Nov 20 22:42:17 2017        
(r326038)
@@ -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"

Modified: head/stand/sparc64/Makefile.inc
==============================================================================
--- head/stand/sparc64/Makefile.inc     Mon Nov 20 22:41:22 2017        
(r326037)
+++ head/stand/sparc64/Makefile.inc     Mon Nov 20 22:42:17 2017        
(r326038)
@@ -1,6 +1,5 @@
 # $FreeBSD$
 
-CFLAGS+=       -ffreestanding
 LDFLAGS+=      -nostdlib
 
 .include "../Makefile.inc"

Modified: head/stand/uboot/fdt/Makefile
==============================================================================
--- head/stand/uboot/fdt/Makefile       Mon Nov 20 22:41:22 2017        
(r326037)
+++ head/stand/uboot/fdt/Makefile       Mon Nov 20 22:42:17 2017        
(r326038)
@@ -10,8 +10,6 @@ WARNS?=               2
 
 SRCS=          uboot_fdt.c
 
-CFLAGS+=       -ffreestanding -msoft-float
-
 # U-Boot library headers
 CFLAGS+=       -I${UBOOTSRC}/lib
 

Modified: head/stand/uboot/lib/Makefile
==============================================================================
--- head/stand/uboot/lib/Makefile       Mon Nov 20 22:41:22 2017        
(r326037)
+++ head/stand/uboot/lib/Makefile       Mon Nov 20 22:42:17 2017        
(r326038)
@@ -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

Modified: head/stand/usb/Makefile
==============================================================================
--- head/stand/usb/Makefile     Mon Nov 20 22:41:22 2017        (r326037)
+++ head/stand/usb/Makefile     Mon Nov 20 22:42:17 2017        (r326038)
@@ -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

Modified: head/stand/usb/Makefile.test
==============================================================================
--- head/stand/usb/Makefile.test        Mon Nov 20 22:41:22 2017        
(r326037)
+++ head/stand/usb/Makefile.test        Mon Nov 20 22:42:17 2017        
(r326038)
@@ -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

Modified: head/stand/userboot/userboot/Makefile
==============================================================================
--- head/stand/userboot/userboot/Makefile       Mon Nov 20 22:41:22 2017        
(r326037)
+++ head/stand/userboot/userboot/Makefile       Mon Nov 20 22:42:17 2017        
(r326038)
@@ -36,7 +36,6 @@ SRCS+=                vers.c
 
 CFLAGS+=       -Wall
 CFLAGS+=       -I${BOOTSRC}/userboot
-CFLAGS+=       -ffreestanding
 
 CWARNFLAGS.main.c += -Wno-implicit-function-declaration
 
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to