diff options
Diffstat (limited to 'sys-freebsd/freebsd-sources/files/freebsd-sources-9.0-gcc-disable-optimization.patch')
-rw-r--r-- | sys-freebsd/freebsd-sources/files/freebsd-sources-9.0-gcc-disable-optimization.patch | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/sys-freebsd/freebsd-sources/files/freebsd-sources-9.0-gcc-disable-optimization.patch b/sys-freebsd/freebsd-sources/files/freebsd-sources-9.0-gcc-disable-optimization.patch new file mode 100644 index 000000000000..a72d5beee9e1 --- /dev/null +++ b/sys-freebsd/freebsd-sources/files/freebsd-sources-9.0-gcc-disable-optimization.patch @@ -0,0 +1,32 @@ +Taken from debian GNU/kFreeBSD. + +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. This is Gentoo Bug #410945. + +We restrict this to GCC so that Clang can use -O2. + +--- a/sys/conf/kern.pre.mk ++++ b/sys/conf/kern.pre.mk +@@ -41,6 +41,9 @@ + .if !empty(COPTFLAGS:M-O[23s]) && empty(COPTFLAGS:M-fno-strict-aliasing) + COPTFLAGS+= -fno-strict-aliasing + .endif ++.if ${CC:T:Mgcc} == "gcc" && !empty(COPTFLAGS:M-O[23s]) ++COPTFLAGS+= -O1 ++.endif + .if !defined(NO_CPU_COPTFLAGS) + COPTFLAGS+= ${_CPUCFLAGS} + .endif +--- a/sys/conf/kmod.mk ++++ b/sys/conf/kmod.mk +@@ -91,6 +91,9 @@ + .if !empty(CFLAGS:M-O[23s]) && empty(CFLAGS:M-fno-strict-aliasing) + CFLAGS+= -fno-strict-aliasing + .endif ++.if ${CC:T:Mgcc} == "gcc" && !empty(CFLAGS:M-O[23s]) ++CFLAGS+= -O1 ++.endif + WERROR?= -Werror + CFLAGS+= ${WERROR} + CFLAGS+= -D_KERNEL |