[Skiboot] [PATCH] core: Fix backtrace for gcc 6

Joel Stanley joel at jms.id.au
Mon Feb 29 11:51:11 AEDT 2016


GCC 6 warns when we look at any stack frame other than our own, ie any
argument to __builtin_frame_address other than zero.

Signed-off-by: Joel Stanley <joel at jms.id.au>
---
 core/stack.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/core/stack.c b/core/stack.c
index 17f89d491ba2..8b8842fc9d45 100644
--- a/core/stack.c
+++ b/core/stack.c
@@ -31,10 +31,11 @@ extern uint32_t _stext, _etext;
 void __nomcount __backtrace(struct bt_entry *entries, unsigned int *count)
 {
 	unsigned int room = *count;
-	unsigned long *fp = __builtin_frame_address(1);
+	unsigned long *fp = __builtin_frame_address(0);
 
 	*count = 0;
 	while(room) {
+		fp = (unsigned long *)fp[0];
 		if (!fp || (unsigned long)fp > top_of_ram)
 			break;
 		entries->sp = (unsigned long)fp;
@@ -42,7 +43,6 @@ void __nomcount __backtrace(struct bt_entry *entries, unsigned int *count)
 		entries++;
 		*count = (*count) + 1;
 		room--;
-		fp = (unsigned long *)fp[0];
 	}
 }
 
-- 
2.7.0



More information about the Skiboot mailing list