* [PATCH] MIPS: boot: compressed: Remove -fstack-protector from CFLAGS
@ 2013-07-01 10:38 ` Markos Chandras
0 siblings, 0 replies; 3+ messages in thread
From: Markos Chandras @ 2013-07-01 10:38 UTC (permalink / raw)
To: linux-mips; +Cc: Markos Chandras
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 <markos.chandras@imgtec.com>
---
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 b/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))
+
KBUILD_CFLAGS := $(LINUXINCLUDE) $(KBUILD_CFLAGS) -D__KERNEL__ \
-DBOOT_HEAP_SIZE=$(BOOT_HEAP_SIZE) -D"VMLINUX_LOAD_ADDRESS_ULL=$(VMLINUX_LOAD_ADDRESS)ull"
--
1.8.2.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH] MIPS: boot: compressed: Remove -fstack-protector from CFLAGS
@ 2013-07-01 10:38 ` Markos Chandras
0 siblings, 0 replies; 3+ messages in thread
From: Markos Chandras @ 2013-07-01 10:38 UTC (permalink / raw)
To: linux-mips; +Cc: Markos Chandras
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 <markos.chandras@imgtec.com>
---
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 b/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))
+
KBUILD_CFLAGS := $(LINUXINCLUDE) $(KBUILD_CFLAGS) -D__KERNEL__ \
-DBOOT_HEAP_SIZE=$(BOOT_HEAP_SIZE) -D"VMLINUX_LOAD_ADDRESS_ULL=$(VMLINUX_LOAD_ADDRESS)ull"
--
1.8.2.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] MIPS: boot: compressed: Remove -fstack-protector from CFLAGS
2013-07-01 10:38 ` Markos Chandras
(?)
@ 2013-07-01 13:19 ` Ralf Baechle
-1 siblings, 0 replies; 3+ messages in thread
From: Ralf Baechle @ 2013-07-01 13:19 UTC (permalink / raw)
To: Markos Chandras; +Cc: linux-mips
On Mon, Jul 01, 2013 at 11:38:30AM +0100, Markos Chandras wrote:
I've inserted this patch before the patch that actually adds the stack
protector.
Thanks,
Ralf
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-07-01 13:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-01 10:38 [PATCH] MIPS: boot: compressed: Remove -fstack-protector from CFLAGS Markos Chandras
2013-07-01 10:38 ` Markos Chandras
2013-07-01 13:19 ` Ralf Baechle
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.