Re: [PATCH] Fix Immediate Values x86_64 support old gcc (v2)



On Wed, May 21, 2008 at 05:57:56PM -0400, Mathieu Desnoyers wrote:
* Sam Ravnborg (sam@xxxxxxxxxxxx) wrote:

Same with USE_IMMEDIATE - as USE_IMMEDIATE is only used in a x86 Makefile.
Or did I miss sothing?


Given that I want to change every use of CONFIG_IMMEDIATE into
USE_IMMEDIATE, both in architecture specific and independant C files and
also in arch spec. and indep. Makefiles, I will have to define
USE_IMMEDIATE on other arch too.

Here is the updated patch. It applies on top of the sched-devel.git
tree.

Fix Immediate Values x86_64 support old gcc

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.

Changelog :
- USE_IMMEDIATE must now be used in lieue of CONFIG_IMMEDIATE in Makefiles and
in C code.
- Every architecture implementing immediate values must declare USE_IMMEDIATE
in their Makefile.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@xxxxxxxxxx>
CC: Sam Ravnborg <sam@xxxxxxxxxxxx>
CC: "H. Peter Anvin" <hpa@xxxxxxxxx>
CC: Jeremy Fitzhardinge <jeremy@xxxxxxxx>
CC: Ingo Molnar <mingo@xxxxxxx>
CC: David Miller <davem@xxxxxxxxxxxxx>
CC: Paul Mackerras paulus@xxxxxxxxx
---
Makefile | 5 +++++
arch/powerpc/Makefile | 2 ++
arch/powerpc/kernel/Makefile | 2 +-
arch/x86/Makefile | 5 +++++
arch/x86/kernel/Makefile | 2 +-
arch/x86/kernel/traps_32.c | 4 ++--
include/linux/immediate.h | 2 +-
include/linux/module.h | 4 ++--
kernel/Makefile | 2 +-
kernel/module.c | 8 ++++----
10 files changed, 24 insertions(+), 12 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 14:18:16.000000000 -0400
@@ -43,6 +43,7 @@

# temporary until string.h is fixed
KBUILD_CFLAGS += -ffreestanding
+ export USE_IMMEDIATE := $(CONFIG_IMMEDIATE)
tabs has a special sematic purpose in makefiles so do not
use tabs for indent.

else
BITS := 64
UTS_MACHINE := x86_64
@@ -78,6 +79,10 @@
"$(CC)" -fstack-protector-all )

KBUILD_CFLAGS += $(stackp-y)
+
+ # x86_64 gcc 3.x has problems with passing symbol+offset in
+ # asm "i" constraint.
+ export USE_IMMEDIATE := $(call cc-ifversion, -ge, 0400, $(CONFIG_IMMEDIATE))
tabs -> spaces again.

Other than that I like this patch much better.

Thanks,
Sam
--
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/



Relevant Pages

  • Re: [patch 3/8] Immediate Values - Kconfig menu in EMBEDDED
    ... It is actually the default on any non embedded configuration. ... create an optimized immediate value header for their architecture. ... As long as we find a way for people to disable _all_ code patching in ...
    (Linux-Kernel)
  • Re: Heap of the application
    ... "Never", modulus any weird RISC-style architecture which does, in fact, ... transfer binary constants to the heap, ... instructions is 4 bytes wide; and that includes immediate values! ...
    (comp.programming)
  • Re: [RFC patch 23/27] Immediate Values - Powerpc Optimization NMI MCE support
    ... using memcpy, which is not in any way guaranteed to be atomic. ... It makes sure the instruction modified ... My original question was in the context of the powerpc architecture, ... Sorry, I meant 4 byte instruction with 2 bytes immediate value, but we ...
    (Linux-Kernel)
  • [patch 0/8] Immediate Values (now with merged x86 support)
    ... Here is the latest version of the Immediate Values. ... architecture. ... I also removed the *_early API which could have been confusing to ...
    (Linux-Kernel)
  • Re: 32 vs. 64 bit on Leopard?
    ... richard@xxxxxxxxxxxxxxx (Richard Tobin) wrote: ... Do I need to change all my Makefiles to pass a flag to cc? ... which is a 32-bit architecture. ...
    (uk.comp.sys.mac)