blob: a01a6a5425ed2e0ce004c899549c44b77a09a5ce [file] [log] [blame] [raw]
Allow the kernel source be compiled with original gcc(1).
diff -ru --exclude-from freebsd-src-diff-exclude-names /usr/src/sys/conf/kern.mk freebsd-11.1/usr/src/sys/conf/kern.mk
--- /usr/src/sys/conf/kern.mk 2017-07-21 07:41:43.000000000 +0800
+++ freebsd-11.1/usr/src/sys/conf/kern.mk 2019-03-22 21:55:02.418380000 +0800
@@ -45,29 +45,33 @@
.endif
.if ${COMPILER_TYPE} == "gcc"
-.if ${COMPILER_VERSION} >= 40800
+.if ${COMPILER_VERSION} >= 40300
# Catch-all for all the things that are in our tree, but for which we're
# not yet ready for this compiler.
-CWARNEXTRA?= -Wno-error=inline -Wno-error=enum-compare -Wno-error=unused-but-set-variable \
- -Wno-error=aggressive-loop-optimizations -Wno-error=maybe-uninitialized \
- -Wno-error=array-bounds -Wno-error=address \
- -Wno-error=cast-qual -Wno-error=sequence-point -Wno-error=attributes \
+.if ${COMPILER_VERSION} >= 40800
+GCC_CWARNEXTRA := -Wno-error=aggressive-loop-optimizations
+.endif
+GCC_CWARNEXTRA += -Wno-error=inline -Wno-unused-but-set-variable \
+ -Wno-error=maybe-uninitialized \
+ -Wno-int-to-pointer-cast -Wno-error=address \
+ -Wno-error=cast-qual -Wno-error=attributes \
-Wno-error=strict-overflow -Wno-error=overflow
.else
# For gcc 4.2, eliminate the too-often-wrong warnings about uninitialized vars.
-CWARNEXTRA?= -Wno-uninitialized
+GCC_CWARNEXTRA := -Wno-uninitialized
.endif
+CWARNEXTRA?= ${GCC_CWARNEXTRA}
.endif
# External compilers may not support our format extensions. Allow them
# to be disabled. WARNING: format checking is disabled in this case.
-.if ${MK_FORMAT_EXTENSIONS} == "no"
+#.if ${MK_FORMAT_EXTENSIONS} == "no"
FORMAT_EXTENSIONS= -Wno-format
-.elif ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} >= 30600
-FORMAT_EXTENSIONS= -D__printf__=__freebsd_kprintf__
-.else
-FORMAT_EXTENSIONS= -fformat-extensions
-.endif
+#.elif ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} >= 30600
+#FORMAT_EXTENSIONS= -D__printf__=__freebsd_kprintf__
+#.else
+#FORMAT_EXTENSIONS= -fformat-extensions
+#.endif
#
# On i386, do not align the stack to 16-byte boundaries. Otherwise GCC 2.95
@@ -89,7 +93,8 @@
# Setting -mno-sse implies -mno-sse2, -mno-sse3, -mno-ssse3, -mno-sse41 and -mno-sse42
#
.if ${MACHINE_CPUARCH} == "i386"
-CFLAGS.gcc+= -mno-align-long-strings -mpreferred-stack-boundary=2
+#CFLAGS.gcc+= -mno-align-long-strings
+CFLAGS.gcc+= -mpreferred-stack-boundary=2
CFLAGS.clang+= -mno-aes -mno-avx
CFLAGS+= -mno-mmx -mno-sse -msoft-float
INLINE_LIMIT?= 8000
diff -ru --exclude-from freebsd-src-diff-exclude-names /usr/src/sys/conf/kmod.mk freebsd-11.1/usr/src/sys/conf/kmod.mk
--- /usr/src/sys/conf/kmod.mk 2017-07-21 07:41:43.000000000 +0800
+++ freebsd-11.1/usr/src/sys/conf/kmod.mk 2019-03-22 13:00:52.690920000 +0800
@@ -98,7 +98,7 @@
.if !empty(CFLAGS:M-O[23s]) && empty(CFLAGS:M-fno-strict-aliasing)
CFLAGS+= -fno-strict-aliasing
.endif
-WERROR?= -Werror
+#WERROR?= -Werror
CFLAGS+= ${WERROR}
CFLAGS+= -D_KERNEL
CFLAGS+= -DKLD_MODULE