Re: [PATCH] mips: define _MIPS_ARCH_LOONGSON3A for Loongson3
From: Chen Jie <hidden>
Date: 2014-08-26 01:13:04
Hi Ralf, 2014-08-26 3:41 GMT+08:00 Ralf Baechle [off-list ref]:
On Mon, Aug 25, 2014 at 08:35:17PM +0100, Maciej W. Rozycki wrote:quoted
On Mon, 25 Aug 2014, Ralf Baechle wrote:quoted
quoted
quoted
quoted
+cflags-$(CONFIG_CPU_LOONGSON3) += -D_MIPS_ARCH_LOONGSON3AThe _MIPS_ARCH_* namespace belongs to GCC. While it seems current GCC does not define this symbol _MIPS_ARCH_LOONGSON3A runs into the danger of causing a conflict when GCC eventually will define the symbol.When this symbol will be defined? With option '-march=loongson3a'?Well, not currently (at least not in my gcc 4.9.0) - but it might. In fact, I'm wondering why it doesn't. Maciej?No idea, a _MIPS_ARCH_foo macro gets defined automagically by GCC whenever `-march=foo' is in effect (be it implicitly or with the use of a command-line option), so there should be one. Has support for "loongson3a" been present in 4.9.x (it is in trunk)? If so, then what _MIPS_ARCH_* macro gets defined for `-march=loongson3a'?Hmm - I must have fatfingered something. Now I'm getting: $ mips-linux-gcc < /dev/null -E -C -dM -march=loongson3a - | grep _MIPS_ARCH #define _MIPS_ARCH_LOONGSON3A 1 #define _MIPS_ARCH "loongson3a" $ So that would conflict with a manual definition, thus the patch would not be acceptable as it because: $ cat > c.c << EOF foo(){} EOF $ mips-linux-gcc -D_MIPS_ARCH_LOONGSON3A -march=loongson3a -Wall -c c.c c.c:1:1: warning: return type defaults to ‘int’ [-Wreturn-type] foo(){} ^ c.c: In function ‘foo’: c.c:1:1: warning: control reaches end of non-void function [-Wreturn-type] foo(){} ^ $
Thanks for the explanation. We will enable "-march=loongson3a" and do some test internally to make sure doing so wouldn't cause any problems. To James:
Any reason not to just refer directly to CONFIG_CPU_LOONGSON3 from the source rather than adding an intermediate definition? Cheers James
I guess it's because "arch/mips/include/uapi/asm/swab.h" is in "uapi/" directory(http://lwn.net/Articles/507794/), that means it contains "user-space API-related definitions", hence using CONFIG_CPU_LOONGSON3 is not suitable there.