[PATCH 2/5] x86, gcc: Disallow building Linux/x86 with gcc 3.x/4.0

From: H. Peter Anvin
Date: Mon Sep 13 2010 - 16:17:09 EST


We are starting to get "straggler problems" with people compiling
current Linux kernels with now-ancient versions of gcc. All the
development is being done against gcc 4.x; this simply disallows gcc
4.0 or earlier.

We disallow 4.0 as well as 3.x because 4.0 had a fair share of bugs
especially around asm() statements; this allows us to remove those
workarounds.

Signed-off-by: H. Peter Anvin <hpa@xxxxxxxxxxxxxxx>
---
arch/x86/kernel/Makefile | 3 ++-
arch/x86/kernel/compiler.c | 5 +++++
2 files changed, 7 insertions(+), 1 deletions(-)
create mode 100644 arch/x86/kernel/compiler.c

diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
index 0925676..a6459b7 100644
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@ -29,7 +29,8 @@ GCOV_PROFILE_hpet.o := n
GCOV_PROFILE_tsc.o := n
GCOV_PROFILE_paravirt.o := n

-obj-y := process_$(BITS).o signal.o entry_$(BITS).o
+obj-y := compiler.o
+obj-y += process_$(BITS).o signal.o entry_$(BITS).o
obj-y += traps.o irq.o irq_$(BITS).o dumpstack_$(BITS).o
obj-y += time.o ioport.o ldt.o dumpstack.o
obj-y += setup.o x86_init.o i8259.o irqinit.o
diff --git a/arch/x86/kernel/compiler.c b/arch/x86/kernel/compiler.c
new file mode 100644
index 0000000..8914974
--- /dev/null
+++ b/arch/x86/kernel/compiler.c
@@ -0,0 +1,5 @@
+#if __GNUC__ < 4
+#error "Compiling Linux/x86 with gcc 3.x is no longer supported"
+#elif __GNUC__ == 4 && __GNUC_MINOR__ < 1
+#error "Compiling Linux/x86 with gcc 4.0 is not supported"
+#endif
--
1.7.2.1

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