1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
Regretably, with GCC 4.4 or later this is the only flag combination
I could find that doesn't cause kernel panics CPU triple-faults or
other kind of severe breakage.
--- a/sys/conf/kern.pre.mk
+++ b/sys/conf/kern.pre.mk
@@ -38,6 +38,9 @@
COPTFLAGS+= -fno-strict-aliasing
. endif
.endif
+.if !empty(COPTFLAGS:M-O[23s])
+COPTFLAGS+= -O1
+.endif
.if !defined(NO_CPU_COPTFLAGS)
. if ${CC} == "icc"
COPTFLAGS+= ${_ICC_CPUCFLAGS:C/(-x[^M^K^W]+)[MKW]+|-x[MKW]+/\1/}
--- a/sys/conf/kmod.mk
+++ b/sys/conf/kmod.mk
@@ -79,6 +79,9 @@
. if !empty(CFLAGS:M-O[23s]) && empty(CFLAGS:M-fno-strict-aliasing)
CFLAGS+= -fno-strict-aliasing
. endif
+. if !empty(CFLAGS:M-O[23s])
+CFLAGS+= -O1
+. endif
WERROR?= -Werror
.endif
CFLAGS+= ${WERROR}
|