diff --git a/share/mk/bsd.stand.mk b/share/mk/bsd.stand.mk deleted file mode 100644 index bb20d98d1f96..000000000000 --- a/share/mk/bsd.stand.mk +++ /dev/null @@ -1,29 +0,0 @@ -# $FreeBSD$ -# -# Common definitons for programs building in the stand-alone environment -# and/or using libstand. -# - -CFLAGS+= -ffreestanding -Wformat -CFLAGS+= ${CFLAGS_NO_SIMD} -D_STANDALONE -.if ${MACHINE_CPUARCH} == "riscv" -CFLAGS+= -march=rv64imac -mabi=lp64 -.elif ${MACHINE_CPUARCH} != "aarch64" -CFLAGS+= -msoft-float -.endif - -.if ${MACHINE_CPUARCH} == "i386" -CFLAGS.gcc+= -mpreferred-stack-boundary=2 -.endif -.if ${MACHINE_CPUARCH} == "amd64" -CFLAGS+= -fPIC -mno-red-zone -.endif -.if ${MACHINE_CPUARCH} == "aarch64" -CFLAGS+= -fPIC -mgeneral-regs-only -.endif -.if ${MACHINE_CPUARCH} == "arm" -CFLAGS+= -fPIC -.endif -.if ${MACHINE_CPUARCH} == "mips" -CFLAGS+= -G0 -fno-pic -mno-abicalls -.endif diff --git a/stand/defs.mk b/stand/defs.mk index eefc764e0ea6..27993650b057 100644 --- a/stand/defs.mk +++ b/stand/defs.mk @@ -101,8 +101,10 @@ SSP_CFLAGS= # 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+= -mgeneral-regs-only -fPIC +.elif ${MACHINE_CPUARCH} == "riscv" +CFLAGS+= -march=rv64imac -mabi=lp64 +.else CFLAGS+= -msoft-float .endif @@ -110,7 +112,9 @@ CFLAGS+= -msoft-float CFLAGS+= -march=i386 CFLAGS.gcc+= -mpreferred-stack-boundary=2 .endif - +.if ${MACHINE_CPUARCH} == "amd64" && ${DO32:U0} == 0 +CFLAGS+= -fPIC -mno-red-zone +.endif .if ${MACHINE_CPUARCH} == "arm" # Do not generate movt/movw, because the relocation fixup for them does not @@ -122,6 +126,7 @@ CFLAGS.clang+= -mllvm -arm-use-movt=0 CFLAGS.clang+= -mno-movt .endif CFLAGS.clang+= -mfpu=none +CFLAGS+= -fPIC .endif # The boot loader build uses dd status=none, where possible, for reproducible @@ -131,6 +136,10 @@ CFLAGS.clang+= -mfpu=none DD_NOSTATUS!=(dd status=none count=0 2> /dev/null && echo status=none) || true DD=dd ${DD_NOSTATUS} +.if ${MACHINE_CPUARCH} == "mips" +CFLAGS+= -G0 -fno-pic -mno-abicalls +.endif + .if ${MK_LOADER_FORCE_LE} != "no" .if ${MACHINE_ARCH} == "powerpc64" CFLAGS+= -mlittle-endian diff --git a/stand/fdt/Makefile b/stand/fdt/Makefile index b4767edad4b6..3eee143a9433 100644 --- a/stand/fdt/Makefile +++ b/stand/fdt/Makefile @@ -17,5 +17,4 @@ CFLAGS+= -I${SYSDIR}/contrib/libfdt/ -I${LDRSRC} CFLAGS+= -Wformat -Wall -.include .include diff --git a/stand/ficl/Makefile b/stand/ficl/Makefile index 1e64ae045060..13e0a10de1fc 100644 --- a/stand/ficl/Makefile +++ b/stand/ficl/Makefile @@ -12,7 +12,6 @@ BASE_SRCS= dict.c ficl.c fileaccess.c float.c loader.c math64.c \ SRCS= ${BASE_SRCS} sysdep.c softcore.c CLEANFILES+= softcore.c testmain testmain.o -.include .ifmake testmain CFLAGS+= -DTESTMAIN -D_TESTMAIN SRCS+= testmain.c diff --git a/stand/geli/Makefile b/stand/geli/Makefile index 24faf125e531..fa77b19d8a7e 100644 --- a/stand/geli/Makefile +++ b/stand/geli/Makefile @@ -34,5 +34,4 @@ SRCS+= geliboot_crypto.c g_eli_hmac.c g_eli_key.c g_eli_key_cache.c pkcs5v2.c .PATH: ${SYSDIR}/opencrypto SRCS+= xform_aes_xts.c -.include .include diff --git a/stand/libsa/Makefile b/stand/libsa/Makefile index 1081caee3dc7..c34bf697cf9f 100644 --- a/stand/libsa/Makefile +++ b/stand/libsa/Makefile @@ -151,5 +151,4 @@ CFLAGS.bzipfs.c+= -I${SRCTOP}/contrib/bzip2 .PATH: ${SYSDIR}/libkern SRCS+= explicit_bzero.c -.include .include diff --git a/stand/mips/uboot/Makefile b/stand/mips/uboot/Makefile index 4323f456cb61..1751bcb80d54 100644 --- a/stand/mips/uboot/Makefile +++ b/stand/mips/uboot/Makefile @@ -53,5 +53,4 @@ ubldr: ${OBJS} ldscript.abs ${.CURDIR}/ldscript.${MACHINE_CPUARCH} ${DPADD} CLEANFILES+= ldscript.abs ldscript.pie ubldr ubldr.pie ubldr.bin -.include .include diff --git a/stand/uboot/fdt/Makefile b/stand/uboot/fdt/Makefile index b1e9f8e756d5..ef60f8bdb6a9 100644 --- a/stand/uboot/fdt/Makefile +++ b/stand/uboot/fdt/Makefile @@ -18,5 +18,4 @@ CFLAGS+= -I${FDTSRC} # Pick up the bootstrap header for some interface items CFLAGS+= -I${LDRSRC} -.include .include diff --git a/stand/uboot/lib/Makefile b/stand/uboot/lib/Makefile index 19e4d3a346ab..19644842a8d8 100644 --- a/stand/uboot/lib/Makefile +++ b/stand/uboot/lib/Makefile @@ -24,5 +24,4 @@ CFLAGS+= -I${LDRSRC} CFLAGS+= -DDISK_DEBUG .endif -.include .include diff --git a/stand/zfs/Makefile b/stand/zfs/Makefile index 3116b32a6f0e..89c1bfdd9c41 100644 --- a/stand/zfs/Makefile +++ b/stand/zfs/Makefile @@ -17,5 +17,4 @@ CFLAGS+= -I${SYSDIR}/crypto/skein CFLAGS+= -Wformat -Wall -.include .include