From 63c8de5f03b13270ea520421a87886e3bf0906b5 Mon Sep 17 00:00:00 2001 From: Leo Chung Date: Sun, 12 Jan 2025 13:13:27 +0800 Subject: [PATCH] sim: Fixes the linker 'noexecstack' warning Signed-off-by: Leo Chung --- CMakeLists.txt | 1 + arch/sim/src/cmake/Toolchain.cmake | 4 ++++ 2 files changed, 5 insertions(+) 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()