diff --git a/CMakeLists.txt b/CMakeLists.txt index 6b8fc65f77..2208de5c4b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -727,6 +727,7 @@ else() OUTPUT nuttx.rel COMMAND ${CMAKE_C_COMPILER} ARGS -r $<$:-m32> + $<$:-Wl,-z,noexecstack> $ $<$>:-Wl,--start-group> ${nuttx_libs_paths} $<$>:-Wl,--end-group> -o nuttx.rel diff --git a/arch/sim/src/cmake/Toolchain.cmake b/arch/sim/src/cmake/Toolchain.cmake index bad48c36fe..0674a0b1c3 100644 --- a/arch/sim/src/cmake/Toolchain.cmake +++ b/arch/sim/src/cmake/Toolchain.cmake @@ -200,3 +200,7 @@ else() add_link_options(-Wl,--gc-sections) add_link_options(-Wl,-Ttext-segment=0x40000000) endif() + +if(CONFIG_HOST_LINUX) + add_link_options(-Wl,-z,noexecstack) +endif()