svn commit: r334432 - in head/stand: . common i386/gptboot i386/gptzfsboot i386/isoboot i386/zfsboot

Dimitry Andric dim at FreeBSD.org
Thu May 31 14:38:15 UTC 2018


Author: dim
Date: Thu May 31 14:38:13 2018
New Revision: 334432
URL: https://svnweb.freebsd.org/changeset/base/334432

Log:
  Fix build of stand with base gcc
  
  * Make autoboot() a static function in stand/common/boot.c, so it does
    not shadow local variables in gptboot.c and zfsboot.c.
  * Remove -Winline from the Makefiles for gptboot, gptzfsboot and
    zfsboot, as gcc will always fail to inline some functions, and there
    is nothing we can do about it.
  * For gcc <= 4.2.1, silence -Wuninitialized for isoboot, as it produces
    a false positive warning.
  * Remove deprecated and unnecessary -mcpu=i386 flag from stand/defs.mk,
    as there is already a -march=i386 flag further in the file.
  
  Reviewed by:	imp
  MFC after:	3 days
  Differential Revision: https://reviews.freebsd.org/D15628

Modified:
  head/stand/common/boot.c
  head/stand/common/bootstrap.h
  head/stand/defs.mk
  head/stand/i386/gptboot/Makefile
  head/stand/i386/gptzfsboot/Makefile
  head/stand/i386/isoboot/Makefile
  head/stand/i386/zfsboot/Makefile

Modified: head/stand/common/boot.c
==============================================================================
--- head/stand/common/boot.c	Thu May 31 14:23:33 2018	(r334431)
+++ head/stand/common/boot.c	Thu May 31 14:38:13 2018	(r334432)
@@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$");
 
 #include "bootstrap.h"
 
+static int	autoboot(int timeout, char *prompt);
 static char	*getbootfile(int try);
 static int	loadakernel(int try, int argc, char* argv[]);
 
@@ -157,7 +158,7 @@ autoboot_maybe()
 		autoboot(-1, NULL);		/* try to boot automatically */
 }
 
-int
+static int
 autoboot(int timeout, char *prompt)
 {
 	time_t	when, otime, ntime;

Modified: head/stand/common/bootstrap.h
==============================================================================
--- head/stand/common/bootstrap.h	Thu May 31 14:23:33 2018	(r334431)
+++ head/stand/common/bootstrap.h	Thu May 31 14:38:13 2018	(r334432)
@@ -61,7 +61,6 @@ char	*backslash(const char *str);
 int	parse(int *argc, char ***argv, const char *str);
 
 /* boot.c */
-int	autoboot(int timeout, char *prompt);
 void	autoboot_maybe(void);
 int	getrootmount(char *rootdev);
 

Modified: head/stand/defs.mk
==============================================================================
--- head/stand/defs.mk	Thu May 31 14:23:33 2018	(r334431)
+++ head/stand/defs.mk	Thu May 31 14:38:13 2018	(r334432)
@@ -91,7 +91,7 @@ CFLAGS+=	-m32 -mcpu=powerpc
 # 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
+CFLAGS+=	-m32
 # LD_FLAGS is passed directly to ${LD}, not via ${CC}:
 LD_FLAGS+=	-m elf_i386_fbsd
 AFLAGS+=	--32

Modified: head/stand/i386/gptboot/Makefile
==============================================================================
--- head/stand/i386/gptboot/Makefile	Thu May 31 14:23:33 2018	(r334431)
+++ head/stand/i386/gptboot/Makefile	Thu May 31 14:38:13 2018	(r334432)
@@ -37,7 +37,7 @@ CFLAGS+=-DBOOTPROG=\"gptboot\" \
 	-Wall -Waggregate-return -Wbad-function-cast -Wno-cast-align \
 	-Wmissing-declarations -Wmissing-prototypes -Wnested-externs \
 	-Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \
-	-Winline -Wno-pointer-sign
+	-Wno-pointer-sign
 
 CFLAGS.gcc+=	--param max-inline-insns-single=100
 

Modified: head/stand/i386/gptzfsboot/Makefile
==============================================================================
--- head/stand/i386/gptzfsboot/Makefile	Thu May 31 14:23:33 2018	(r334431)
+++ head/stand/i386/gptzfsboot/Makefile	Thu May 31 14:38:13 2018	(r334432)
@@ -37,7 +37,7 @@ CFLAGS+=-DBOOTPROG=\"gptzfsboot\" \
 	-Wall -Waggregate-return -Wbad-function-cast \
 	-Wmissing-declarations -Wmissing-prototypes -Wnested-externs \
 	-Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \
-	-Winline -Wno-pointer-sign
+	-Wno-pointer-sign
 
 CFLAGS.clang+=	-Wno-tentative-definition-incomplete-type
 

Modified: head/stand/i386/isoboot/Makefile
==============================================================================
--- head/stand/i386/isoboot/Makefile	Thu May 31 14:23:33 2018	(r334431)
+++ head/stand/i386/isoboot/Makefile	Thu May 31 14:38:13 2018	(r334432)
@@ -36,6 +36,9 @@ CFLAGS+=-DBOOTPROG=\"isoboot\" \
 	-Winline -Wno-pointer-sign
 
 CFLAGS.gcc+=	--param max-inline-insns-single=100
+.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} <= 40201
+CFLAGS.gcc+=	-Wno-uninitialized
+.endif
 CFLAGS.clang+=  -Oz ${CLANG_OPT_SMALL}
 
 LD_FLAGS+=${LD_FLAGS_BIN}

Modified: head/stand/i386/zfsboot/Makefile
==============================================================================
--- head/stand/i386/zfsboot/Makefile	Thu May 31 14:23:33 2018	(r334431)
+++ head/stand/i386/zfsboot/Makefile	Thu May 31 14:38:13 2018	(r334432)
@@ -34,8 +34,7 @@ CFLAGS+=-DBOOTPROG=\"zfsboot\" \
 	-I${BOOTSRC}/i386/boot2 \
 	-Wall -Waggregate-return -Wbad-function-cast -Wno-cast-align \
 	-Wmissing-declarations -Wmissing-prototypes -Wnested-externs \
-	-Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \
-	-Winline
+	-Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings
 
 CFLAGS.gcc+=	--param max-inline-insns-single=100
 .if ${MACHINE} == "amd64"


More information about the svn-src-all mailing list