From 028d0c0d15019be49b79719f1476ca029840eb3c Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Wed, 1 Jul 2020 13:44:42 +0900 Subject: [PATCH] sim: Disable stack protector for CMODULEFLAGS On Linux, we (ab)use the host compiler to compile binaries for NuttX. Explicitly disable features which might be default on the host while not available on NuttX. On macOS, this is not necessary because we use a cross compiler, which has safer defaults for our purpose, to build binaries to run on NuttX. But this doesn't hurt either. --- boards/sim/sim/sim/configs/cxxtest/Make.defs | 4 ++++ boards/sim/sim/sim/scripts/Make.defs | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/boards/sim/sim/sim/configs/cxxtest/Make.defs b/boards/sim/sim/sim/configs/cxxtest/Make.defs index b8b216a8cea..f4f0fe34cd9 100644 --- a/boards/sim/sim/sim/configs/cxxtest/Make.defs +++ b/boards/sim/sim/sim/configs/cxxtest/Make.defs @@ -88,6 +88,10 @@ CMODULEFLAGS += -fno-pic # Even on Linux, NuttX modules are loaded into the NuttX heap, which # can be out of range with -mcmodel=small. CMODULEFLAGS += -mcmodel=large +# On Linux, we (ab)use the host compiler to compile binaries for NuttX. +# Explicitly disable features which might be default on the host while +# not available on NuttX. +CMODULEFLAGS += -fno-stack-protector LDMODULEFLAGS = -r -e module_initialize ifeq ($(CONFIG_CYGWIN_WINTOOL),y) diff --git a/boards/sim/sim/sim/scripts/Make.defs b/boards/sim/sim/sim/scripts/Make.defs index 431fe244272..859ddf10c6b 100644 --- a/boards/sim/sim/sim/scripts/Make.defs +++ b/boards/sim/sim/sim/scripts/Make.defs @@ -83,6 +83,10 @@ CMODULEFLAGS += -fno-pic # Even on Linux, NuttX modules are loaded into the NuttX heap, which # can be out of range with -mcmodel=small. CMODULEFLAGS += -mcmodel=large +# On Linux, we (ab)use the host compiler to compile binaries for NuttX. +# Explicitly disable features which might be default on the host while +# not available on NuttX. +CMODULEFLAGS += -fno-stack-protector LDMODULEFLAGS = -r -e module_initialize ifeq ($(CONFIG_CYGWIN_WINTOOL),y)