On 01/09/2015 05:23 AM, Daniel Sanders wrote:
Hi,
Thanks for the quick reply.
-----Original Message-----
From: Sergei Shtylyov [mailto:sergei.shtylyov@xxxxxxxxxxxxxxxxxx]
Sent: 09 January 2015 12:18
To: Daniel Sanders; linux-mips@xxxxxxxxxxxxxx; Ralf Baechle
Cc: Paul Burton; Markos Chandras; James Hogan; Behan Webster
Subject: Re: [PATCH] MIPS: Changed current_thread_info() to an equivalent
supported by both clang and GCC
Hello.
On 1/9/2015 3:06 PM, Daniel Sanders wrote:
Without this, a 'break' instruction is executed very early in the boot and
the boot hangs.
The problem is that clang doesn't honour named registers on local variables
and silently treats them as normal uninitialized variables. However, it
does honour them on global variables.
Why not fix clang instead?
Signed-off-by: Daniel Sanders <daniel.sanders@xxxxxxxxxx>
[...]
diff --git a/arch/mips/include/asm/thread_info.h
b/arch/mips/include/asm/thread_info.h
index 99eea59..2a2f3c4 100644
--- a/arch/mips/include/asm/thread_info.h
+++ b/arch/mips/include/asm/thread_info.h
@@ -58,11 +58,11 @@ struct thread_info {
#define init_stack (init_thread_union.stack)
/* How to get the thread information struct from C. */
+register struct thread_info *current_gp_register asm("$28");
*static* missing?
WBR, Sergei
Combining 'register' and 'static' is invalid.
Defining global variables in header files is also invalid.
gcc gives:
arch/mips/include/asm/thread_info.h:61:1: error: multiple storage classes in declaration specifiers
static register struct thread_info *current_gp_register asm("$28");
^
and clang gives:
arch/mips/include/asm/thread_info.h:61:8: error: cannot combine with previous 'static' declaration specifier
static register struct thread_info *current_gp_register asm("$28");
^