From: Sam Ravnborg <sam@ravnborg.org>
To: Mathieu Desnoyers <compudj@krystal.dyndns.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>,
linux-kernel@vger.kernel.org,
Jeremy Fitzhardinge <jeremy@goop.org>,
Ingo Molnar <mingo@elte.hu>
Subject: Re: [PATCH] Fix Immediate Values x86_64 support old gcc
Date: Wed, 21 May 2008 22:37:43 +0200 [thread overview]
Message-ID: <20080521203743.GA12982@uranus.ravnborg.org> (raw)
In-Reply-To: <20080521170150.GA29428@Krystal>
Hi Mathieu
> 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@polymtl.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)
So here we introduce a global environment variable that tells
us that gcc has "BROKEN_IMMEDIATE".
I have absolutely no clue what "BROKEN_IMMEDIATE" is so I guess others
are in the same boat. Comment please!
Consider something like this (note: no negative logic involved):
export USE_IMMEDIATE := $(call cc-ifversion, -ge, 0400, $(CONFIG_IMMEDIATE))
Then the MAkefile fragment can be simplified as:
> -obj-$(CONFIG_IMMEDIATE) += immediate.o
> +obj-$(USE_IMMEDIATE) += immediate.o
(Or find a better name than "USE_IMMEDIATE".
> 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
And now in the source we use a direct check of the GNUC version. So this is a duplicate
of GCC_BROKEN_IMMEDIATE and not sensible comments.
"I ask myself in what way is gcc broken?"
And you DO NOT fiddle with the CONFIG_* variables - this is just plain wrong.
> --- 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
So you need to find a better way for this.
>
> -#include <asm/immediate.h>
> +#ifdef CONFIG_IMMEDIATE
>
> /**
> * imv_set - set immediate variable (with locking)
next prev parent reply other threads:[~2008-05-21 20:37 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-14 9:54 x86-64 build problem with tip Jeremy Fitzhardinge
2008-05-16 12:48 ` [PATCH] Fix immediate asm constraint for gcc 3 x86_64 Mathieu Desnoyers
2008-05-16 21:32 ` H. Peter Anvin
2008-05-21 13:31 ` Mathieu Desnoyers
[not found] ` <48344239.9070003@zytor.com>
[not found] ` <20080521160217.GA26974@Krystal>
2008-05-21 17:01 ` [PATCH] Fix Immediate Values x86_64 support old gcc Mathieu Desnoyers
2008-05-21 20:37 ` Sam Ravnborg [this message]
2008-05-21 21:28 ` Mathieu Desnoyers
2008-05-21 21:46 ` Sam Ravnborg
2008-05-21 21:57 ` [PATCH] Fix Immediate Values x86_64 support old gcc (v2) Mathieu Desnoyers
2008-05-21 22:38 ` Sam Ravnborg
2008-05-21 23:24 ` [PATCH] Fix Immediate Values x86_64 support old gcc (v3) Mathieu Desnoyers
2008-05-22 2:03 ` Mathieu Desnoyers
2008-05-25 7:21 ` Sam Ravnborg
2008-05-27 13:12 ` [PATCH ftrace.git sched-fixes.git] " Mathieu Desnoyers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080521203743.GA12982@uranus.ravnborg.org \
--to=sam@ravnborg.org \
--cc=compudj@krystal.dyndns.org \
--cc=hpa@zytor.com \
--cc=jeremy@goop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®