Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 14 Sep 2011 20:57:11 +0000
From:      Alexander Best <arundel@freebsd.org>
To:        Andriy Gapon <avg@FreeBSD.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r225530 - in head/sys/boot/i386: gptboot gptzfsboot zfsboot
Message-ID:  <20110914205711.GA74613@freebsd.org>
In-Reply-To: <201109131403.p8DE3u2t083203@svn.freebsd.org>
References:  <201109131403.p8DE3u2t083203@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--lrZ03NoBR/3+SXJZ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Tue Sep 13 11, Andriy Gapon wrote:
> Author: avg
> Date: Tue Sep 13 14:03:55 2011
> New Revision: 225530
> URL: http://svn.freebsd.org/changeset/base/225530
> 
> Log:
>   gpt/zfs boot blocks: reduce optimizing CFLAGS to -O1
>   
>   gpt and zfs boot blocks are not nearly as size-constrained as boot2
>   from which they inherited their current optimization and anti-optimization
>   options.  As such the current options do not provide any benefit, but
>   make debugging of the code much harder.
>   Also, it has been demonstrated that combination of -mrtd and
>   -fno-unit-at-a-time may result in mis-compilation of the boot code
>   with the current base gcc.
>   
>   Additionally, intermediate assembly file filtering is removed for
>   zfsboot.
>   
>   The new boot blocks are all compile- and boot- tested using qemu.
>   gptzfsboot is tested with real hardware.
>   
>   Reported by:	Peter Jeremy <peterjeremy@acm.org> [miscompilation]
>   Discussed with:	bde, jhb
>   Tested by:	Sebastian Chmielewski <chmielsster@gmail.com> [gptzfsboot]
>   Approved by:	re (kib)
>   MFC after:	3 weeks

i also found the following patches sitting in my /usr/src dir. they should get
rid of some -mno-* flags, which are already implied by other flags.

please see r221879 for a more detailed explanation.

cheers.
alex

> 
> Modified:
>   head/sys/boot/i386/gptboot/Makefile
>   head/sys/boot/i386/gptzfsboot/Makefile
>   head/sys/boot/i386/zfsboot/Makefile
> 
> Modified: head/sys/boot/i386/gptboot/Makefile
> ==============================================================================
> --- head/sys/boot/i386/gptboot/Makefile	Tue Sep 13 14:01:35 2011	(r225529)
> +++ head/sys/boot/i386/gptboot/Makefile	Tue Sep 13 14:03:55 2011	(r225530)
> @@ -20,12 +20,7 @@ GPTBOOT_UFS?=	UFS1_AND_UFS2
>  #GPTBOOT_UFS?=	UFS1_ONLY
>  
>  CFLAGS=	-DBOOTPROG=\"gptboot\" \
> -	-Os \
> -	-fno-guess-branch-probability \
> -	-fomit-frame-pointer \
> -	-fno-unit-at-a-time \
> -	-mno-align-long-strings \
> -	-mrtd \
> +	-O1 \
>  	-DGPT \
>  	-D${GPTBOOT_UFS} \
>  	-DSIOPRT=${BOOT_COMCONSOLE_PORT} \
> 
> Modified: head/sys/boot/i386/gptzfsboot/Makefile
> ==============================================================================
> --- head/sys/boot/i386/gptzfsboot/Makefile	Tue Sep 13 14:01:35 2011	(r225529)
> +++ head/sys/boot/i386/gptzfsboot/Makefile	Tue Sep 13 14:03:55 2011	(r225530)
> @@ -17,12 +17,7 @@ ORG1=	0x7c00
>  ORG2=	0x0
>  
>  CFLAGS=	-DBOOTPROG=\"gptzfsboot\" \
> -	-Os \
> -	-fno-guess-branch-probability \
> -	-fomit-frame-pointer \
> -	-fno-unit-at-a-time \
> -	-mno-align-long-strings \
> -	-mrtd \
> +	-O1 \
>  	-DGPT -DBOOT2 \
>  	-DSIOPRT=${BOOT_COMCONSOLE_PORT} \
>  	-DSIOFMT=${B2SIOFMT} \
> 
> Modified: head/sys/boot/i386/zfsboot/Makefile
> ==============================================================================
> --- head/sys/boot/i386/zfsboot/Makefile	Tue Sep 13 14:01:35 2011	(r225529)
> +++ head/sys/boot/i386/zfsboot/Makefile	Tue Sep 13 14:03:55 2011	(r225530)
> @@ -15,12 +15,7 @@ ORG1=	0x7c00
>  ORG2=	0x2000
>  
>  CFLAGS=	-DBOOTPROG=\"zfsboot\" \
> -	-Os \
> -	-fno-guess-branch-probability \
> -	-fomit-frame-pointer \
> -	-fno-unit-at-a-time \
> -	-mno-align-long-strings \
> -	-mrtd \
> +	-O1 \
>  	-DBOOT2 \
>  	-DSIOPRT=${BOOT_COMCONSOLE_PORT} \
>  	-DSIOFMT=${B2SIOFMT} \
> @@ -85,20 +80,10 @@ zfsboot.bin: zfsboot.out
>  zfsboot.out: ${BTXCRT} zfsboot.o sio.o drv.o cons.o util.o
>  	${LD} ${LDFLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} ${LIBSTAND}
>  
> -zfsboot.o: zfsboot.s
> -.if ${CC:T:Mclang} == "clang"
> -	${CC} ${ACFLAGS} -c zfsboot.s
> -.endif
> -
>  SRCS=	zfsboot.c
>  
> -zfsboot.s: zfsboot.c ${.CURDIR}/../../zfs/zfsimpl.c
> -	${CC} ${CFLAGS} -S -o zfsboot.s.tmp ${.CURDIR}/zfsboot.c
> -	sed -e '/align/d' -e '/nop/d' < zfsboot.s.tmp > zfsboot.s
> -	rm -f zfsboot.s.tmp
> -
>  .if ${MACHINE_CPUARCH} == "amd64"
> -beforedepend zfsboot.s: machine
> +beforedepend zfsboot.o: machine
>  CLEANFILES+=	machine
>  machine:
>  	ln -sf ${.CURDIR}/../../../i386/include machine

--lrZ03NoBR/3+SXJZ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="boot.diff"

diff --git a/sys/boot/ficl/Makefile b/sys/boot/ficl/Makefile
index e441573..7769bd2 100644
--- a/sys/boot/ficl/Makefile
+++ b/sys/boot/ficl/Makefile
@@ -8,8 +8,13 @@ SRCS=		${BASE_SRCS} sysdep.c softcore.c
 CLEANFILES=	softcore.c testmain testmain.o
 CFLAGS+=	-ffreestanding
 .if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
-CFLAGS+=	-mpreferred-stack-boundary=2
-CFLAGS+=	-mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 -msoft-float
+# See sys/conf/kern.mk for -m* implications
+.if ${CC:T:Mclang} != "clang"
+CFLAGS+=	-mpreferred-stack-boundary=2 -mno-sse
+.else
+CFLAGS+=	-mno-aes -mno-avx
+.endif
+CFLAGS+=	-mno-mmx -msoft-float
 .endif
 .if ${MACHINE_CPUARCH} == "powerpc" || ${MACHINE_CPUARCH} == "arm"
 CFLAGS+=	-msoft-float
diff --git a/sys/boot/pc98/Makefile.inc b/sys/boot/pc98/Makefile.inc
index 62cfc1d..f9e0348 100644
--- a/sys/boot/pc98/Makefile.inc
+++ b/sys/boot/pc98/Makefile.inc
@@ -5,9 +5,14 @@
 BINDIR?=	/boot
 
 LOADER_ADDRESS?=0x200000
-CFLAGS+=	-ffreestanding -mpreferred-stack-boundary=2 \
-		-mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 -msoft-float \
-		-Os -DPC98
+
+# See sys/conf/kern.mk for -m* implications
+.if ${CC:T:Mclang} != "clang"
+CFLAGS+=	-mpreferred-stack-boundary=2 -mno-sse
+.else
+CFLAGS+=	-mno-aes -mno-avx
+.endif
+CFLAGS+=	-ffreestanding -mno-mmx -msoft-float -Os -DPC98
 LDFLAGS+=	-nostdlib
 
 # BTX components
diff --git a/sys/boot/zfs/Makefile b/sys/boot/zfs/Makefile
index a6fba3a..3a23691 100644
--- a/sys/boot/zfs/Makefile
+++ b/sys/boot/zfs/Makefile
@@ -12,8 +12,13 @@ CFLAGS+=	-I${.CURDIR}/../../cddl/boot/zfs
 
 CFLAGS+=	-ffreestanding
 .if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
-CFLAGS+=	-mpreferred-stack-boundary=2
-CFLAGS+=	-mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 -msoft-float
+# See sys/conf/kern.mk for -m* implications
+.if ${CC:T:Mclang} != "clang"
+CFLAGS+=	-mpreferred-stack-boundary=2 -mno-sse
+.else
+CFLAGS+=	-mno-aes -mno-avx
+.endif
+CFLAGS+=	-mno-mmx -msoft-float
 .endif
 .if ${MACHINE_CPUARCH} == "powerpc" || ${MACHINE_CPUARCH} == "arm"
 CFLAGS+=	-msoft-float

--lrZ03NoBR/3+SXJZ--



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