Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 6 Nov 2017 15:22:24 +0000 (UTC)
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r325485 - in head/sys/boot: . fdt ficl geli i386 libsa32 ofw uboot zfs
Message-ID:  <201711061522.vA6FMOtZ036626@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: imp
Date: Mon Nov  6 15:22:24 2017
New Revision: 325485
URL: https://svnweb.freebsd.org/changeset/base/325485

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

Modified:
  head/sys/boot/defs.mk
  head/sys/boot/fdt/Makefile
  head/sys/boot/ficl.mk
  head/sys/boot/ficl/Makefile
  head/sys/boot/geli/Makefile
  head/sys/boot/i386/Makefile.inc
  head/sys/boot/libsa32/Makefile
  head/sys/boot/ofw/Makefile.inc
  head/sys/boot/uboot/Makefile.inc
  head/sys/boot/zfs/Makefile

Modified: head/sys/boot/defs.mk
==============================================================================
--- head/sys/boot/defs.mk	Mon Nov  6 15:22:17 2017	(r325484)
+++ head/sys/boot/defs.mk	Mon Nov  6 15:22:24 2017	(r325485)
@@ -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}

Modified: head/sys/boot/fdt/Makefile
==============================================================================
--- head/sys/boot/fdt/Makefile	Mon Nov  6 15:22:17 2017	(r325484)
+++ head/sys/boot/fdt/Makefile	Mon Nov  6 15:22:24 2017	(r325485)
@@ -22,10 +22,6 @@ CFLAGS+=	-ffreestanding
 CFLAGS+=	-msoft-float
 .endif
 
-.if ${MACHINE_ARCH} == "powerpc64"
-CFLAGS+=	-m32
-.endif
-
 CFLAGS+=	-Wformat -Wall
 
 .include <bsd.stand.mk>

Modified: head/sys/boot/ficl.mk
==============================================================================
--- head/sys/boot/ficl.mk	Mon Nov  6 15:22:17 2017	(r325484)
+++ head/sys/boot/ficl.mk	Mon Nov  6 15:22:24 2017	(r325485)
@@ -14,16 +14,8 @@ 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}

Modified: head/sys/boot/ficl/Makefile
==============================================================================
--- head/sys/boot/ficl/Makefile	Mon Nov  6 15:22:17 2017	(r325484)
+++ head/sys/boot/ficl/Makefile	Mon Nov  6 15:22:24 2017	(r325485)
@@ -9,13 +9,6 @@ BASE_SRCS=	dict.c ficl.c fileaccess.c float.c loader.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

Modified: head/sys/boot/geli/Makefile
==============================================================================
--- head/sys/boot/geli/Makefile	Mon Nov  6 15:22:17 2017	(r325484)
+++ head/sys/boot/geli/Makefile	Mon Nov  6 15:22:24 2017	(r325485)
@@ -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
 

Modified: head/sys/boot/i386/Makefile.inc
==============================================================================
--- head/sys/boot/i386/Makefile.inc	Mon Nov  6 15:22:17 2017	(r325484)
+++ head/sys/boot/i386/Makefile.inc	Mon Nov  6 15:22:24 2017	(r325485)
@@ -25,11 +25,6 @@ LDFLAGS_BIN=-e start -Ttext ${ORG} -Wl,-N,-S,--oformat
 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
 

Modified: head/sys/boot/libsa32/Makefile
==============================================================================
--- head/sys/boot/libsa32/Makefile	Mon Nov  6 15:22:17 2017	(r325484)
+++ head/sys/boot/libsa32/Makefile	Mon Nov  6 15:22:24 2017	(r325485)
@@ -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"

Modified: head/sys/boot/ofw/Makefile.inc
==============================================================================
--- head/sys/boot/ofw/Makefile.inc	Mon Nov  6 15:22:17 2017	(r325484)
+++ head/sys/boot/ofw/Makefile.inc	Mon Nov  6 15:22:24 2017	(r325485)
@@ -1,8 +1,3 @@
 # $FreeBSD$
 
-.if ${MACHINE_ARCH} == "powerpc64"
-CFLAGS+=	-m32 -mcpu=powerpc
-LDFLAGS+=	-m elf32ppc_fbsd
-.endif
-
 .include "../Makefile.inc"

Modified: head/sys/boot/uboot/Makefile.inc
==============================================================================
--- head/sys/boot/uboot/Makefile.inc	Mon Nov  6 15:22:17 2017	(r325484)
+++ head/sys/boot/uboot/Makefile.inc	Mon Nov  6 15:22:24 2017	(r325485)
@@ -1,8 +1,3 @@
 # $FreeBSD$
 
-.if ${MACHINE_ARCH} == "powerpc64"
-CFLAGS+=	-m32 -mcpu=powerpc
-LDFLAGS+=	-m elf32ppc_fbsd
-.endif
-
 .include "../Makefile.inc"

Modified: head/sys/boot/zfs/Makefile
==============================================================================
--- head/sys/boot/zfs/Makefile	Mon Nov  6 15:22:17 2017	(r325484)
+++ head/sys/boot/zfs/Makefile	Mon Nov  6 15:22:24 2017	(r325485)
@@ -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>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201711061522.vA6FMOtZ036626>