summaryrefslogtreecommitdiffstats
path: root/arch/mips/lib
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2022-03-09 23:09:39 +0100
committerThomas Bogendoerfer <tsbogend@alpha.franken.de>2022-03-14 15:02:53 +0100
commitb847bd64ea9f484510e27065cb2bccc58d9b829b (patch)
tree6ee0d94d6ce3516b2047ecf0bfcab2148afcc273 /arch/mips/lib
parentMIPS: boot/compressed: Use array reference for image bounds (diff)
downloadlinux-b847bd64ea9f484510e27065cb2bccc58d9b829b.tar.xz
linux-b847bd64ea9f484510e27065cb2bccc58d9b829b.zip
MIPS: Only use current_stack_pointer on GCC
Unfortunately, Clang did not have support for "sp" as a global register definition, and was crashing after the addition of current_stack_pointer. This has been fixed in Clang 14, but earlier Clang versions need to avoid this code, so add a versioned test and revert back to the open-coded asm instances. Fixes Clang build error: fatal error: error in backend: Invalid register name global variable Fixes: 200ed341b864 ("mips: Implement "current_stack_pointer"") Reported-by: Nathan Chancellor <nathan@kernel.org> Reviewed-by: Nathan Chancellor <nathan@kernel.org> Link: https://lore.kernel.org/lkml/YikTQRql+il3HbrK@dev-arch.thelio-3990X Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de> Cc: Marc Zyngier <maz@kernel.org> Cc: Guenter Roeck <linux@roeck-us.net> Cc: Yanteng Si <siyanteng01@gmail.com> Cc: linux-mips@vger.kernel.org Signed-off-by: Kees Cook <keescook@chromium.org> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com> Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Diffstat (limited to 'arch/mips/lib')
-rw-r--r--arch/mips/lib/uncached.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/arch/mips/lib/uncached.c b/arch/mips/lib/uncached.c
index f8d4ca046c3e..f80a67c092b6 100644
--- a/arch/mips/lib/uncached.c
+++ b/arch/mips/lib/uncached.c
@@ -40,7 +40,9 @@ unsigned long run_uncached(void *func)
register long ret __asm__("$2");
long lfunc = (long)func, ufunc;
long usp;
- long sp = current_stack_pointer;
+ long sp;
+
+ __asm__("move %0, $sp" : "=r" (sp));
if (sp >= (long)CKSEG0 && sp < (long)CKSEG2)
usp = CKSEG1ADDR(sp);