[PATCH AUTOSEL 4.4 2/3] hexagon: work around compiler crash

From: Sasha Levin
Date: Fri Jan 10 2020 - 17:07:53 EST


From: Nick Desaulniers <ndesaulniers@xxxxxxxxxx>

[ Upstream commit 63e80314ab7cf4783526d2e44ee57a90514911c9 ]

Clang cannot translate the string "r30" into a valid register yet.

Link: https://github.com/ClangBuiltLinux/linux/issues/755
Link: http://lkml.kernel.org/r/20191028155722.23419-1-ndesaulniers@xxxxxxxxxx
Signed-off-by: Nick Desaulniers <ndesaulniers@xxxxxxxxxx>
Suggested-by: Sid Manning <sidneym@xxxxxxxxxxx>
Reviewed-by: Brian Cain <bcain@xxxxxxxxxxxxxx>
Cc: Allison Randal <allison@xxxxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
Cc: Richard Fontana <rfontana@xxxxxxxxxx>
Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
---
arch/hexagon/kernel/stacktrace.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/arch/hexagon/kernel/stacktrace.c b/arch/hexagon/kernel/stacktrace.c
index f94918b449a8..03a0e10ecdcc 100644
--- a/arch/hexagon/kernel/stacktrace.c
+++ b/arch/hexagon/kernel/stacktrace.c
@@ -23,8 +23,6 @@
#include <linux/thread_info.h>
#include <linux/module.h>

-register unsigned long current_frame_pointer asm("r30");
-
struct stackframe {
unsigned long fp;
unsigned long rets;
@@ -42,7 +40,7 @@ void save_stack_trace(struct stack_trace *trace)

low = (unsigned long)task_stack_page(current);
high = low + THREAD_SIZE;
- fp = current_frame_pointer;
+ fp = (unsigned long)__builtin_frame_address(0);

while (fp >= low && fp <= (high - sizeof(*frame))) {
frame = (struct stackframe *)fp;
--
2.20.1