Commit ed6c0d89 authored by Thomas Weißschuh's avatar Thomas Weißschuh Committed by Paul E. McKenney
Browse files

tools/nolibc: arm: add stackprotector support

parent c1e30f7d
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -199,10 +199,15 @@ struct sys_stat_struct {
char **environ __attribute__((weak));
const unsigned long *_auxv __attribute__((weak));

#define __ARCH_SUPPORTS_STACK_PROTECTOR

/* startup code */
void __attribute__((weak,noreturn,optimize("omit-frame-pointer"))) _start(void)
void __attribute__((weak,noreturn,optimize("omit-frame-pointer"),no_stack_protector)) _start(void)
{
	__asm__ volatile (
#ifdef NOLIBC_STACKPROTECTOR
		"bl __stack_chk_init\n"       /* initialize stack protector                          */
#endif
		"pop {%r0}\n"                 /* argc was in the stack                               */
		"mov %r1, %sp\n"              /* argv = sp                                           */

+1 −0
Original line number Diff line number Diff line
@@ -83,6 +83,7 @@ CFLAGS_STKP_i386 = $(CFLAGS_STACKPROTECTOR)
CFLAGS_STKP_x86_64 = $(CFLAGS_STACKPROTECTOR)
CFLAGS_STKP_x86 = $(CFLAGS_STACKPROTECTOR)
CFLAGS_STKP_arm64 = $(CFLAGS_STACKPROTECTOR)
CFLAGS_STKP_arm = $(CFLAGS_STACKPROTECTOR)
CFLAGS_s390 = -m64
CFLAGS  ?= -Os -fno-ident -fno-asynchronous-unwind-tables -std=c89 \
		$(call cc-option,-fno-stack-protector) \