aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe Leroy <christophe.leroy@csgroup.eu>2023-11-15 19:36:36 +0100
committerTom Rini <trini@konsulko.com>2023-11-29 09:32:15 -0500
commit4072572b0f8aeffedcd908dc45b7e046ee0554b0 (patch)
treec01a59061bf744dbd5667023b4fe8a1fac4f1c7b
parent654580eee13bc7a0d4ed4cad2b2fead1ec88107a (diff)
downloadu-boot-4072572b0f8aeffedcd908dc45b7e046ee0554b0.zip
u-boot-4072572b0f8aeffedcd908dc45b7e046ee0554b0.tar.gz
u-boot-4072572b0f8aeffedcd908dc45b7e046ee0554b0.tar.bz2
Fix stack-protector for powerpc
On powerpc, stack protector expects a function called __stack_chk_fail_local() instead of __stack_chk_fail() And some versions of GCC for powerpc default to TLS canary instead of global canary, so always force GCC to use global canary with -mstack-protector-guard=global Cc: Joel Peshkin <joel.peshkin@broadcom.com> Fixes: 4e9bce12432 ("Add support for stack-protector") Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
-rw-r--r--Makefile1
-rw-r--r--common/stackprot.c5
2 files changed, 6 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index ffeb722..1b347f4 100644
--- a/Makefile
+++ b/Makefile
@@ -750,6 +750,7 @@ endif
ifeq ($(CONFIG_STACKPROTECTOR),y)
KBUILD_CFLAGS += $(call cc-option,-fstack-protector-strong)
+KBUILD_CFLAGS += $(call cc-option,-mstack-protector-guard=global)
CFLAGS_EFI += $(call cc-option,-fno-stack-protector)
else
KBUILD_CFLAGS += $(call cc-option,-fno-stack-protector)
diff --git a/common/stackprot.c b/common/stackprot.c
index d5b7061..6495951 100644
--- a/common/stackprot.c
+++ b/common/stackprot.c
@@ -18,3 +18,8 @@ void __stack_chk_fail(void)
panic("Stack smashing detected in function:\n%p relocated from %p",
ra, ra - gd->reloc_off);
}
+
+void __stack_chk_fail_local(void)
+{
+ __stack_chk_fail();
+}