Skip to contentSkip to conversation

RISC-V: gp_in_global needs register keyword

PATCH New Palmer Dabbelt 1 participant 1 message May 21, 2020 RISC-V

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 RISC-V: gp_in_global needs register keyword

The Intel kernel build robot recently pointed out that I missed the register keyword on this one when I refactored the code to remove local register variables (which aren't supported by LLVM). GCC's manual indicates that global register variables must have the register keyword, As far as I can tell lacking the register keyword causes GCC to ignore the __asm__ and treat this as a regular variable, but I'm not sure how that didn't show up as some sort of failure.

Fixes 52e7c52d2ded ("RISC-V: Stop relying on GCC's register allocator's hueristics")
---
 arch/riscv/kernel/process.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/riscv/kernel/process.c +1 -1
index 610c11e91606..824d117cf202 100644
@@ -22,7 +22,7 @@
 #include <asm/switch_to.h>
 #include <asm/thread_info.h>
 
-unsigned long gp_in_global __asm__("gp");
+register unsigned long gp_in_global __asm__("gp");
 
 extern asmlinkage void ret_from_fork(void);
 extern asmlinkage void ret_from_kernel_thread(void);
Signature · 1 line
2.27.0.rc0.183.gde8f92d652-goog