linux-mips
[Top] [All Lists]

Re: [loongson-PATCH-v2 20/23] add gcc 4.4 support for MIPS and loongson

To: wuzhangjin@gmail.com
Subject: Re: [loongson-PATCH-v2 20/23] add gcc 4.4 support for MIPS and loongson
From: Arnaud Patard <apatard@mandriva.com>
Date: Wed, 27 May 2009 11:22:35 +0200
Cc: linux-mips@linux-mips.org, Ralf Baechle <ralf@linux-mips.org>, Wu Zhangjin <wuzj@lemote.com>, Yan Hua <yanh@lemote.com>, Philippe Vachon <philippe@cowpig.ca>, Zhang Le <r0bertz@gentoo.org>, Zhang Fuxin <zhangfx@lemote.com>, loongson-dev <loongson-dev@googlegroups.com>, Nicholas Mc Guire <der.herr@hofr.at>, Liu Junliang <liujl@lemote.com>, Erwan Lerale <erwan@thiscow.com>
In-reply-to: <afda033feccfe0946c308eddc86b2049f4919be2.1243362545.git.wuzj@lemote.com> (wuzhangjin@gmail.com's message of "Wed, 27 May 2009 03:09:13 +0800")
Organization: Mandriva
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <cover.1243362545.git.wuzj@lemote.com> <afda033feccfe0946c308eddc86b2049f4919be2.1243362545.git.wuzj@lemote.com>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/22.1 (gnu/linux)
wuzhangjin@gmail.com writes:
Hi,

> From: Wu Zhangjin <wuzj@lemote.com>
>
> the gcc 4.4 support for MIPS mostly refer to this PATCH:
> http://www.nabble.com/-PATCH--MIPS:-Handle-removal-of-%27h%27-constraint-in-GCC-4.4-td22192768.html
> but have been tuned a little.
>
> because only gcc 4.4 have loongson-specific support, so, we need to
> choose the suitable -march argument for gcc <= 4.3 and gcc >= 4.4, and
> we also need to consider use -march=loongson2e and -march=loongson2f for
> loongson2e and loongson2f respectively. this is handled by adding two
> new kernel options: CPU_LOONGSON2E and CPU_LOONGSON2F(thanks for the
> solutin provided by ZhangLe).
>
> I have tested it on FuLoong(2f) in 32bit and 64bit with gcc-4.4 and
> gcc-4.3. so, basically, it works.
>
> Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
> ---
>  arch/mips/Makefile               |    9 +++++-
>  arch/mips/include/asm/compiler.h |   10 ++++++
>  arch/mips/include/asm/delay.h    |   58 +++++++++++++++++++++++++------------
>  3 files changed, 57 insertions(+), 20 deletions(-)
>
> diff --git a/arch/mips/Makefile b/arch/mips/Makefile
> index a25c2e5..1ee5504 100644
> --- a/arch/mips/Makefile
> +++ b/arch/mips/Makefile
> @@ -120,7 +120,14 @@ cflags-$(CONFIG_CPU_R4300)       += -march=r4300 
> -Wa,--trap
>  cflags-$(CONFIG_CPU_VR41XX)  += -march=r4100 -Wa,--trap
>  cflags-$(CONFIG_CPU_R4X00)   += -march=r4600 -Wa,--trap
>  cflags-$(CONFIG_CPU_TX49XX)  += -march=r4600 -Wa,--trap
> -cflags-$(CONFIG_CPU_LOONGSON2)       += -march=r4600 -Wa,--trap
> +
> +# only gcc >= 4.4 have the loongson-specific support
> +cflags-$(CONFIG_CPU_LOONGSON2)       += -Wa,--trap
> +cflags-$(CONFIG_CPU_LOONGSON2E)      += $(shell if [ $(call cc-version) -lt 
> 0440 ] ; then \
> +     echo $(call cc-option,-march=r4600); else echo $(call 
> cc-option,-march=loongson2e); fi ;)
> +cflags-$(CONFIG_CPU_LOONGSON2F)      += $(shell if [ $(call cc-version) -lt 
> 0440 ] ; then \
> +     echo $(call cc-option,-march=r4600); else echo $(call 
> cc-option,-march=loongson2f); fi ;)
> +

why not using something like that ? :
        cflags-$(CONFIG_LOONGSON2E) += \
                $(call cc-option,-march=loongson2e,$(call 
cc-option,-march=r4600))
        cflags-$(CONFIG_LOONGSON2F) += \
                $(call cc-option,-march=loongson2f,$(call 
cc-option,-march=r4600))

Arnaud

<Prev in Thread] Current Thread [Next in Thread>