Set noexecstack CXX link flags for wamrc (#1303)

Set noexecstack CXX link flags for wamrc to avoid generating binary
with exec stack.
This commit is contained in:
Xu Jun 2022-07-18 18:47:44 +08:00 committed by GitHub
parent 0ec27af9df
commit 9d689b3a22
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -226,6 +226,7 @@ if (NOT MSVC)
endif()
if (NOT (MSVC OR CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang"))
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,-z,noexecstack,-z,relro,-z,now")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-z,noexecstack,-z,relro,-z,now")
endif()
# We disable these flags by default to stay the same with wasm runtime