[Top] [All Lists]

[PATCH] MIPS: boot: compressed: Remove -fstack-protector from CFLAGS

To: <>
Subject: [PATCH] MIPS: boot: compressed: Remove -fstack-protector from CFLAGS
From: Markos Chandras <>
Date: Mon, 1 Jul 2013 11:38:30 +0100
Cc: Markos Chandras <>
List-archive: <>
List-help: <>
List-id: linux-mips <>
List-owner: <>
List-post: <>
List-software: Ecartis version 1.0.0
List-subscribe: <>
List-unsubscribe: <>
Original-recipient: rfc822;
When building with -fstack-protector, gcc emits the
__stack_chk_guard and __stack_chk_fail symbols to check for
stack stability. These symbols are defined in vmlinux but
the generated vmlinux.bin that is used to create the
compressed vmlinuz image has no symbol table so the linker
can't find these symbols during the final linking phase.
As a result of which, we need either to redefine these symbols
just for the compressed image or drop the -fstack-protector
option when building the compressed image. This patch implements
the latter of two options.

Fixes the following linking problem:

dbg.c:(.text+0x7c): undefined reference to `__stack_chk_guard'
dbg.c:(.text+0x80): undefined reference to `__stack_chk_guard'
dbg.c:(.text+0xd4): undefined reference to `__stack_chk_guard'
dbg.c:(.text+0xec): undefined reference to `__stack_chk_fail'

Signed-off-by: Markos Chandras <>
This patch is for the upstream-sfr/mips-for-linux-next tree
 arch/mips/boot/compressed/Makefile | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/mips/boot/compressed/Makefile 
index bbaa1d4..bb1dbf4 100644
--- a/arch/mips/boot/compressed/Makefile
+++ b/arch/mips/boot/compressed/Makefile
@@ -18,6 +18,8 @@ BOOT_HEAP_SIZE := 0x400000
 # Disable Function Tracer
 KBUILD_CFLAGS := $(shell echo $(KBUILD_CFLAGS) | sed -e "s/-pg//")
+KBUILD_CFLAGS := $(filter-out -fstack-protector, $(KBUILD_CFLAGS))

<Prev in Thread] Current Thread [Next in Thread>