diff --git a/include/ace/generic/main.h b/include/ace/generic/main.h index 033f4d9a..c2e0d916 100644 --- a/include/ace/generic/main.h +++ b/include/ace/generic/main.h @@ -19,6 +19,24 @@ void genericCreate(void); void genericProcess(void); void genericDestroy(void); +#if defined(__GNUC__) +#include + +#if UINT32_MAX == UINTPTR_MAX +#define STACK_CHK_GUARD 0xe2dee396 +#else +#define STACK_CHK_GUARD 0x595e9fbd94fda766 +#endif + +uintptr_t __stack_chk_guard = STACK_CHK_GUARD; + +__attribute__((noreturn)) +void __stack_chk_fail(void) { + logWrite("ERR: STACK SMASHED\n"); + while(1) {} +} +#endif + int main(void) { systemCreate(); memCreate(); diff --git a/makefile b/makefile index fe2f73c9..861e5c81 100644 --- a/makefile +++ b/makefile @@ -43,9 +43,9 @@ ifeq ($(ACE_CC), vc) AS_FLAGS = +kick13 -c OBJDUMP = else ifeq ($(ACE_CC), m68k-amigaos-gcc) - CC_FLAGS_NO_O = $(CC_FLAGS_COMMON) -std=gnu11 -DAMIGA \ - -noixemul -Wall -Wextra -fomit-frame-pointer CC_FLAGS = $(CC_FLAGS_NO_O) $(TARGET_DEFINES) -O3 + CC_FLAGS_NO_O = $(CC_FLAGS_COMMON) -std=gnu11 -noixemul -Wall -Wextra \ + -fomit-frame-pointer -fstack-protector-all #-fverbose-asm ACE_AS = vasmm68k_mot AS_FLAGS = -quiet -x -m68010 -Faout -ID:\prg\kompilatory\bebbo\m68k-amigaos\sys-include