Re: post-halloween 0.2

Martin J. Bligh (mbligh@aracnet.com)
Wed, 30 Oct 2002 11:57:58 -0800


>> > Can you also mention not using gcc 3.0.x (stack pointer handling bug)
>>
>> Any chance of putting this sort of thing as #error detection
>> in the compile so it auto-breaks? I seem to recall that's done
>> for some versions of GCC already ...
>
> And what arch is that for? Adding a nice facility for per-arch (and
> maybe global) compiler / binutils testing would be nice, if we're going
> to go down that road..

Alan, would you consider something like (TOTALLY untested):

diff -purN -X /home/mbligh/.diff.exclude virgin/init/main.c gcc/init/main.c
--- virgin/init/main.c Fri Oct 18 21:01:16 2002
+++ gcc/init/main.c Wed Oct 30 11:54:54 2002
@@ -50,7 +50,7 @@
* 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__ < 91)
+#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 91) || (__GNUC__ == 3 && __GNUC_MINOR__ == 0)
#error Sorry, your GCC is too old. It builds incorrect kernels.
#endif

If you like it, I'll get it tested.

Probably some things are per-arch and some are global, at a guess.
Currently we have:

init/main.c:
/*
* 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__ < 91)
#error Sorry, your GCC is too old. It builds incorrect kernels.
#endif

arch/arm/kernel/asm-offsets.c

/*
* Make sure that the compiler and target are compatible.
*/
#if defined(__APCS_32__) && defined(CONFIG_CPU_26)
#error Sorry, your compiler targets APCS-32 but this kernel requires APCS-26
#endif
#if defined(__APCS_26__) && defined(CONFIG_CPU_32)
#error Sorry, your compiler targets APCS-26 but this kernel requires APCS-32
#endif
#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 95)
#error Sorry, your compiler is known to miscompile kernels. Only use gcc 2.95.3
and later.
#endif
#if __GNUC__ == 2 && __GNUC_MINOR__ == 95
/* shame we can't detect the .1 or .2 releases */
#warning GCC 2.95.2 and earlier miscompiles kernels.
#endif

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/