[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080521170150.GA29428@Krystal>
Date: Wed, 21 May 2008 13:01:50 -0400
From: Mathieu Desnoyers <compudj@...stal.dyndns.org>
To: "H. Peter Anvin" <hpa@...or.com>, Sam Ravnborg <sam@...nborg.org>
Cc: linux-kernel@...r.kernel.org,
Jeremy Fitzhardinge <jeremy@...p.org>,
Ingo Molnar <mingo@...e.hu>
Subject: [PATCH] Fix Immediate Values x86_64 support old gcc
Does this fix make more sense ?
GCC < 4, on x86_64, does not accept symbol+offset operands for "i" constraints
asm statements. Fallback on generic immediate values if this compiler is
detected.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@...ymtl.ca>
---
arch/x86/Makefile | 3 +++
arch/x86/kernel/Makefile | 4 +++-
include/asm-x86/immediate.h | 5 +++++
include/linux/immediate.h | 4 +++-
kernel/Makefile | 4 +++-
5 files changed, 17 insertions(+), 3 deletions(-)
Index: linux-2.6-sched-devel/arch/x86/Makefile
===================================================================
--- linux-2.6-sched-devel.orig/arch/x86/Makefile 2008-05-21 09:04:52.000000000 -0400
+++ linux-2.6-sched-devel/arch/x86/Makefile 2008-05-21 09:22:05.000000000 -0400
@@ -78,6 +78,9 @@
"$(CC)" -fstack-protector-all )
KBUILD_CFLAGS += $(stackp-y)
+
+ export GCC_BROKEN_IMMEDIATE
+ GCC_BROKEN_IMMEDIATE := $(shell if [ $(call cc-version) -lt 0400 ] ; then echo "y"; fi)
endif
# Stackpointer is addressed different for 32 bit and 64 bit x86
Index: linux-2.6-sched-devel/include/asm-x86/immediate.h
===================================================================
--- linux-2.6-sched-devel.orig/include/asm-x86/immediate.h 2008-05-21 09:10:59.000000000 -0400
+++ linux-2.6-sched-devel/include/asm-x86/immediate.h 2008-05-21 09:15:43.000000000 -0400
@@ -12,6 +12,10 @@
#include <asm/asm.h>
+#if (defined(CONFIG_X86_64) && __GNUC__ < 4) /* Detect broken x86_64 gcc */
+#undef CONFIG_IMMEDIATE
+#else
+
struct __imv {
unsigned long var; /* Pointer to the identifier variable of the
* immediate value
@@ -166,4 +170,5 @@
extern int arch_imv_update(struct __imv *imv, int early);
+#endif
#endif /* _ASM_X86_IMMEDIATE_H */
Index: linux-2.6-sched-devel/include/linux/immediate.h
===================================================================
--- linux-2.6-sched-devel.orig/include/linux/immediate.h 2008-05-21 09:12:22.000000000 -0400
+++ linux-2.6-sched-devel/include/linux/immediate.h 2008-05-21 09:12:59.000000000 -0400
@@ -11,8 +11,10 @@
*/
#ifdef CONFIG_IMMEDIATE
+#include <asm/immediate.h> /* May undef CONFIG_IMMEDIATE */
+#endif
-#include <asm/immediate.h>
+#ifdef CONFIG_IMMEDIATE
/**
* imv_set - set immediate variable (with locking)
Index: linux-2.6-sched-devel/arch/x86/kernel/Makefile
===================================================================
--- linux-2.6-sched-devel.orig/arch/x86/kernel/Makefile 2008-05-21 09:20:49.000000000 -0400
+++ linux-2.6-sched-devel/arch/x86/kernel/Makefile 2008-05-21 09:21:22.000000000 -0400
@@ -75,7 +75,9 @@
obj-$(CONFIG_KPROBES) += kprobes.o
obj-$(CONFIG_MODULES) += module_$(BITS).o
obj-$(CONFIG_ACPI_SRAT) += srat_32.o
-obj-$(CONFIG_IMMEDIATE) += immediate.o
+ifneq ($(GCC_BROKEN_IMMEDIATE),y)
+ obj-$(CONFIG_IMMEDIATE) += immediate.o
+endif
obj-$(CONFIG_EFI) += efi.o efi_$(BITS).o efi_stub_$(BITS).o
obj-$(CONFIG_DOUBLEFAULT) += doublefault_32.o
obj-$(CONFIG_KGDB) += kgdb.o
Index: linux-2.6-sched-devel/kernel/Makefile
===================================================================
--- linux-2.6-sched-devel.orig/kernel/Makefile 2008-05-21 09:21:28.000000000 -0400
+++ linux-2.6-sched-devel/kernel/Makefile 2008-05-21 09:21:44.000000000 -0400
@@ -75,7 +75,9 @@
obj-$(CONFIG_SYSCTL) += utsname_sysctl.o
obj-$(CONFIG_TASK_DELAY_ACCT) += delayacct.o
obj-$(CONFIG_TASKSTATS) += taskstats.o tsacct.o
-obj-$(CONFIG_IMMEDIATE) += immediate.o
+ifneq ($(GCC_BROKEN_IMMEDIATE),y)
+ obj-$(CONFIG_IMMEDIATE) += immediate.o
+endif
obj-$(CONFIG_MARKERS) += marker.o
obj-$(CONFIG_LATENCYTOP) += latencytop.o
obj-$(CONFIG_FTRACE) += trace/
--
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists