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

From: Sam Ravnborg
Date: Wed May 21 2008 - 18:38:19 EST


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/