[PATCH] arch/blackfin/kernel/stacktrace.c: Use __builtin_frame_address instead of asm("FP")
From: Chen Gang
Date: Tue Oct 13 2015 - 11:46:28 EST
>From 97df54f9625dae3c61f65e1f0da794718262cd69 Mon Sep 17 00:00:00 2001
From: Chen Gang <gang.chen.5i5j@xxxxxxxxx>
Date: Tue, 13 Oct 2015 23:24:02 +0800
Subject: [PATCH] arch/blackfin/kernel/stacktrace.c: Use __builtin_frame_address instead of asm("FP")
When latest gcc build kernel with "-fno-omit-frame-pointer -pg", it will
cause building break. For getting address on the stack, kernel need to
use __builtin_frame_address instead of. The related error:
CC arch/blackfin/kernel/stacktrace.o
arch/blackfin/kernel/stacktrace.c: In function 'save_stack_trace':
arch/blackfin/kernel/stacktrace.c:23:6: error: frame pointer required, but reserved
void save_stack_trace(struct stack_trace *trace)
^
arch/blackfin/kernel/stacktrace.c:13:24: note: for 'current_frame_pointer'
register unsigned long current_frame_pointer asm("FP");
^
Signed-off-by: Chen Gang <gang.chen.5i5j@xxxxxxxxx>
---
arch/blackfin/kernel/stacktrace.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/arch/blackfin/kernel/stacktrace.c b/arch/blackfin/kernel/stacktrace.c
index 30301e1..1d48aee 100644
--- a/arch/blackfin/kernel/stacktrace.c
+++ b/arch/blackfin/kernel/stacktrace.c
@@ -10,8 +10,6 @@
#include <linux/thread_info.h>
#include <linux/module.h>
-register unsigned long current_frame_pointer asm("FP");
-
struct stackframe {
unsigned long fp;
unsigned long rets;
@@ -29,7 +27,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;
--
1.9.3
Attachment:
0001-arch-blackfin-kernel-stacktrace.c-Use-__builtin_fram.patch
Description: Binary data