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. Signed-off-by: Daniel Sanders <daniel.sanders@xxxxxxxxxx> Cc: Ralf Baechle <ralf@xxxxxxxxxxxxxx> Cc: Paul Burton <paul.burton@xxxxxxxxxx> Cc: Markos Chandras <markos.chandras@xxxxxxxxxx> Cc: James Hogan <james.hogan@xxxxxxxxxx> Cc: linux-mips@xxxxxxxxxxxxxx Cc: Behan Webster <behanw@xxxxxxxxxxxxxxxxxx> Cc: Sergei Shtylyov <sergei.shtylyov@xxxxxxxxxxxxxxxxxx> Cc: David Daney <ddaney.cavm@xxxxxxxxx> --- This version of the patch preserves the name of the original named register local following David Daney's request. For reference, a similar patch for ARM's stack pointer has already been merged: 0abc08b ARM: 8170/1: Add global named register current_stack_pointer for ARM This is part of a patch series to get Linux for Mips working when compiled with clang. I've chosen to submit this patch individually since it's my first kernel patch and I'd like to be sure I'm following your processes correctly before I submit all of them. Please CC me on replies since I'm not subscribed to the mailing list. arch/mips/include/asm/thread_info.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/mips/include/asm/thread_info.h b/arch/mips/include/asm/thread_info.h index 99eea59..0f239cf 100644 --- a/arch/mips/include/asm/thread_info.h +++ b/arch/mips/include/asm/thread_info.h @@ -58,10 +58,10 @@ struct thread_info { #define init_stack (init_thread_union.stack) /* How to get the thread information struct from C. */ +register struct thread_info *__current_thread_info __asm__("$28"); + static inline struct thread_info *current_thread_info(void) { - register struct thread_info *__current_thread_info __asm__("$28"); - return __current_thread_info; } -- 2.1.4