File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -83,6 +83,14 @@ if (MSVC)
8383 add_compile_options (/MT)
8484else ()
8585 set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall" )
86+ if (CMAKE_SYSTEM_NAME STREQUAL "Linux" )
87+ # Prevent the toolchain from emitting an executable stack on Linux targets,
88+ # which triggers kernel warnings (e.g. "started with executable stack") and
89+ # weakens security hardening. The linker flag is not supported on macOS.
90+ add_compile_options (-Wa,--noexecstack)
91+ set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-z,noexecstack" )
92+ set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,noexecstack" )
93+ endif ()
8694 # The following flags are to enhance security, but it may impact performance,
8795 # we disable them by default.
8896 if (FLB_WASM_STACK_PROTECT)
You can’t perform that action at this time.
0 commit comments