We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 200ad59 commit f2dd991Copy full SHA for f2dd991
1 file changed
CMakeLists.txt
@@ -83,6 +83,14 @@ if (MSVC)
83
add_compile_options(/MT)
84
else()
85
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()
94
# The following flags are to enhance security, but it may impact performance,
95
# we disable them by default.
96
if (FLB_WASM_STACK_PROTECT)
0 commit comments