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
This commit is contained in:
parent
dab0468c87
commit
85867a4f6c
@ -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} \
|
||||
|
@ -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} \
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user