Here is a patch that we should have before v2.x -- It will stop people
from building buggy kernels with old gcc versions (and thus lodging bogus
bug reports) as seen below.
Paul.
------------------------------------------------------
foobar:/tmp/linux# gcc -v
Reading specs from /usr/lib/gcc-lib/i486-linux/2.5.8/specs
gcc version 2.5.8
foobar:/tmp/linux# make
gcc -D__KERNEL__ [...blah blah...] -c -o init/main.o init/main.c
init/main.c:49: #error sorry, your GCC is too old. It builds incorrect kernels.
make: *** [init/main.o] Error 1
foobar:/tmp/linux#
------------------------------------------------------
diff -ur /usr/tmp/linux/include/linux/ext2_fs.h linux/include/linux/ext2_fs.h
--- /usr/tmp/linux/include/linux/ext2_fs.h Sat May 4 17:06:18 1996
+++ linux/include/linux/ext2_fs.h Mon May 20 22:13:50 1996
@@ -428,15 +428,9 @@
* Ok, these declarations are also in <linux/kernel.h> but none of the
* ext2 source programs needs to include it so they are duplicated here.
*/
-#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
-# define NORET_TYPE __volatile__
-# define ATTRIB_NORET /**/
-# define NORET_AND /**/
-#else
# define NORET_TYPE /**/
# define ATTRIB_NORET __attribute__((noreturn))
# define NORET_AND noreturn,
-#endif
/* acl.c */
extern int ext2_permission (struct inode *, int);
diff -ur /usr/tmp/linux/include/linux/kernel.h linux/include/linux/kernel.h
--- /usr/tmp/linux/include/linux/kernel.h Mon May 6 21:50:10 1996
+++ linux/include/linux/kernel.h Mon May 20 21:56:49 1996
@@ -29,15 +29,9 @@
#define KERN_INFO "<6>" /* informational */
#define KERN_DEBUG "<7>" /* debug-level messages */
-#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
-# define NORET_TYPE __volatile__
-# define ATTRIB_NORET /**/
-# define NORET_AND /**/
-#else
# define NORET_TYPE /**/
# define ATTRIB_NORET __attribute__((noreturn))
# define NORET_AND noreturn,
-#endif
extern void math_error(void);
NORET_TYPE void panic(const char * fmt, ...)
diff -ur /usr/tmp/linux/init/main.c linux/init/main.c
--- /usr/tmp/linux/init/main.c Mon May 20 18:23:23 1996
+++ linux/init/main.c Mon May 20 22:40:49 1996
@@ -5,6 +5,7 @@
*
* GK 2/5/95 - Changed to support mounting root fs via NFS
* Added initrd & change_root: Werner Almesberger & Hans Lermen, Feb '96
+ * Moan early if gcc is old, avoiding bogus kernels - Paul Gortmaker, May '96
*/
#define __KERNEL_SYSCALLS__
@@ -37,6 +38,16 @@
#endif
#include <asm/bugs.h>
+
+/*
+ * Versions of gcc older than that listed below may actually compile
+ * and link okay, but the end product can have subtle run time bugs.
+ * To avoid associated bogus bug reports, we flatly refuse to compile
+ * with a gcc that is known to be too old from the very beginning.
+ */
+#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 6)
+#error sorry, your GCC is too old. It builds incorrect kernels.
+#endif
extern char _stext, _etext;
extern char *linux_banner;