building kernel with lang/gcc41 (or lang/gcc42)

Yuriy Tsibizov Yuriy.Tsibizov at gfk.ru
Thu Dec 21 06:42:24 PST 2006


Are there any ways to build kernel with GCC from ports without patching
FreeBSD sources?
I'm mostly interested in syntax checks, not a working kernel / modules.

I have to use patch below, because
 - it does not like -fformat-extentions and -mno-align-long-strings
 - it does not define __FreeBSD_cc_version.

Index: sys/conf/kern.mk
===================================================================
RCS file: /home/ncvs/src/sys/conf/kern.mk,v
retrieving revision 1.50
diff -u -r1.50 kern.mk
--- sys/conf/kern.mk	26 Nov 2006 23:16:46 -0000	1.50
+++ sys/conf/kern.mk	20 Dec 2006 05:20:15 -0000
@@ -12,7 +12,7 @@
  .else
  CWARNFLAGS?=	-Wall -Wredundant-decls -Wnested-externs
-Wstrict-prototypes \
  		-Wmissing-prototypes -Wpointer-arith -Winline
-Wcast-qual \
-		${_wundef} -fformat-extensions
+		${_wundef}
  .if !defined(NO_UNDEF)
  _wundef=	-Wundef
  .endif
@@ -33,7 +33,7 @@
  # reserved for user applications.
  #
  .if ${MACHINE_ARCH} == "i386" && ${CC} != "icc"
-CFLAGS+=	-mno-align-long-strings -mpreferred-stack-boundary=2 \
+CFLAGS+=	-mpreferred-stack-boundary=2 \
  		-mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3
  INLINE_LIMIT?=	8000
  .endif
Index: sys/sys/cdefs.h
===================================================================
RCS file: /home/ncvs/src/sys/sys/cdefs.h,v
retrieving revision 1.93
diff -u -r1.93 cdefs.h
--- sys/sys/cdefs.h	21 Sep 2006 01:38:58 -0000	1.93
+++ sys/sys/cdefs.h	20 Dec 2006 17:29:42 -0000
@@ -338,6 +338,10 @@
  #endif

  /* Compiler-dependent macros that rely on FreeBSD-specific extensions.
*/
+#ifndef __FreeBSD_cc_version
+#define __FreeBSD_cc_version 0
+#endif
+
  #if __FreeBSD_cc_version >= 300001 && defined(__GNUC__) &&
!defined(__INTEL_COMPILER)
  #define	__printf0like(fmtarg, firstvararg) \
  	    __attribute__((__format__ (__printf0__, fmtarg,
firstvararg)))


Yuriy



More information about the freebsd-current mailing list