File skiboot_gcc6_backtrace.patch of Package skiboot

From 793f6f5b32c96f2774bd955b6062c74a672317ca Mon Sep 17 00:00:00 2001
From: Joel Stanley <joel@jms.id.au>
Date: Mon, 29 Feb 2016 11:21:11 +1030
Subject: [PATCH] core: Fix backtrace for gcc 6

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@jms.id.au>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>

diff --git a/core/stack.c b/core/stack.c
index 5fba6c7..3b92a14 100644
--- a/core/stack.c
+++ b/core/stack.c
@@ -31,7 +31,7 @@ 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);
 	unsigned long top_adj = top_of_ram;
 
 	/* Assume one stack for early backtraces */
@@ -40,6 +40,7 @@ void __nomcount __backtrace(struct bt_entry *entries, unsigned int *count)
 
 	*count = 0;
 	while(room) {
+		fp = (unsigned long *)fp[0];
 		if (!fp || (unsigned long)fp > top_adj)
 			break;
 		entries->sp = (unsigned long)fp;
@@ -47,7 +48,6 @@ void __nomcount __backtrace(struct bt_entry *entries, unsigned int *count)
 		entries++;
 		*count = (*count) + 1;
 		room--;
-		fp = (unsigned long *)fp[0];
 	}
 }
 
openSUSE Build Service is sponsored by