Centralize all 32-bit builds on 64-bit platform stuff.

Move the addition of the -m32 and other flags to defs.mk. Remove
redunant copies of -m32 that come from multiple locations.

Sponsored by: Netflix
This commit is contained in:
Warner Losh 2017-11-06 15:22:24 +00:00
parent 9b19f65c83
commit 63c69e1beb
10 changed files with 14 additions and 52 deletions

View File

@ -96,6 +96,16 @@ CFLAGS+= -DLOADER_GELI_SUPPORT
CFLAGS+= -m32 -mcpu=powerpc
.endif
# For amd64, there's a bit of mixed bag. Some of the tree (i386, lib*32) is
# build 32-bit and some 64-bit (lib*, efi). Centralize all the 32-bit magic here
# and activate it when DO32 is explicitly defined to be 1.
.if ${MACHINE_ARCH} == "amd64" && ${DO32:U0} == 1
CFLAGS+= -m32 -mcpu=i386
# LD_FLAGS is passed directly to ${LD}, not via ${CC}:
LD_FLAGS+= -m elf_i386_fbsd
AFLAGS+= --32
.endif
_ILINKS=machine
.if ${MACHINE} != ${MACHINE_CPUARCH} && ${MACHINE} != "arm64"
_ILINKS+=${MACHINE_CPUARCH}

View File

@ -22,10 +22,6 @@ CFLAGS+= -ffreestanding
CFLAGS+= -msoft-float
.endif
.if ${MACHINE_ARCH} == "powerpc64"
CFLAGS+= -m32
.endif
CFLAGS+= -Wformat -Wall
.include <bsd.stand.mk>

View File

@ -14,17 +14,9 @@ FICL_CPUARCH= ${MACHINE_CPUARCH}
.PATH: ${FICLSRC} ${FICLSRC}/${FICL_CPUARCH}
.if ${MACHINE_CPUARCH} == "amd64"
.if ${DO32:U0} == 1
CFLAGS+= -m32 -I.
.else
.if ${MACHINE_CPUARCH} == "amd64" && ${DO32:U0} == 0
CFLAGS+= -fPIC
.endif
.endif
.if ${MACHINE_ARCH} == "powerpc64"
CFLAGS+= -m32 -mcpu=powerpc -I.
.endif
CFLAGS+= -I${FICLSRC} -I${FICLSRC}/${FICL_CPUARCH} -I${LDRSRC}
CFLAGS+= -DBOOT_FORTH

View File

@ -9,13 +9,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
.if ${MACHINE_CPUARCH} == "i386" || \
(${MACHINE_CPUARCH} == "amd64" && defined(DO32))
CFLAGS+= -march=i386
.endif
.if ${MACHINE_CPUARCH} == "amd64" && defined(DO32)
CFLAGS+= -m32
.endif
.if defined(HAVE_PNP)
CFLAGS+= -DHAVE_PNP

View File

@ -14,7 +14,7 @@ NO_PIC=
.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
CFLAGS+= -march=i386
.endif
.if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "powerpc64"
.if ${MACHINE_ARCH} == "amd64"
CFLAGS+= -m32
.endif

View File

@ -25,11 +25,6 @@ LDFLAGS_BIN=-e start -Ttext ${ORG} -Wl,-N,-S,--oformat,binary
LD_FLAGS_BIN=-static -N --gc-sections
.if ${MACHINE_CPUARCH} == "amd64"
CFLAGS+= -m32
ACFLAGS+= -m32
# LD_FLAGS is passed directly to ${LD}, not via ${CC}:
LD_FLAGS+= -m elf_i386_fbsd
AFLAGS+= --32
DO32=1
.endif

View File

@ -5,15 +5,9 @@ DO32=1
.include <bsd.init.mk>
LIB=sa32
.if ${MACHINE_CPUARCH} == "amd64"
LIBSA_CPUARCH=i386
.else
LIBSA_CPUARCH=${MACHINE_CPUARCH}
.endif
LIBSA_CPUARCH=${MACHINE_CPUARCH:C/amd64/i386/}
.if ${MACHINE_ARCH} == "amd64"
CFLAGS+= -m32 -I.
.endif
CFLAGS+= -I.
.PATH: ${SASRC}
.include "${SASRC}/Makefile"

View File

@ -1,8 +1,3 @@
# $FreeBSD$
.if ${MACHINE_ARCH} == "powerpc64"
CFLAGS+= -m32 -mcpu=powerpc
LDFLAGS+= -m elf32ppc_fbsd
.endif
.include "../Makefile.inc"

View File

@ -1,8 +1,3 @@
# $FreeBSD$
.if ${MACHINE_ARCH} == "powerpc64"
CFLAGS+= -m32 -mcpu=powerpc
LDFLAGS+= -m elf32ppc_fbsd
.endif
.include "../Makefile.inc"

View File

@ -16,14 +16,6 @@ CFLAGS+= -I${LDRSRC} -I${SYSDIR} -I.
CFLAGS+= -I${SYSDIR}/cddl/boot/zfs
CFLAGS+= -I${SYSDIR}/crypto/skein
.if ${MACHINE_CPUARCH} == "i386" || \
(${MACHINE_CPUARCH} == "amd64" && defined(DO32))
CFLAGS+= -march=i386
.endif
.if ${MACHINE_CPUARCH} == "amd64" && defined(DO32)
CFLAGS+= -m32
.endif
CFLAGS+= -Wformat -Wall
.include <bsd.stand.mk>