Skip to content

Commit 215375f

Browse files
bcolesawesomekling
authored andcommitted
Build: Enable --noexecstack
Build ELF executables with a zero length `GNU_STACK` program header flagged non-executable. The stack is never executable on SerenityOS regardless of whether the `GNU_STACK` header is specified. Specifically defining this header is more explicit, as absence of this header implies an executable stack on other systems (Linux).
1 parent 5df34f6 commit 215375f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,8 @@ endforeach()
146146

147147
set(CMAKE_INSTALL_NAME_TOOL "")
148148
set(CMAKE_SHARED_LIBRARY_SUFFIX ".so")
149-
set(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-shared -Wl,--hash-style=gnu,-z,relro,-z,now")
150-
set(CMAKE_CXX_LINK_FLAGS "-Wl,--hash-style=gnu,-z,relro,-z,now")
149+
set(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-shared -Wl,--hash-style=gnu,-z,relro,-z,now,-z,noexecstack")
150+
set(CMAKE_CXX_LINK_FLAGS "-Wl,--hash-style=gnu,-z,relro,-z,now,-z,noexecstack")
151151

152152
# We disable it completely because it makes cmake very spammy.
153153
# This will need to be revisited when the Loader supports RPATH/RUN_PATH.

0 commit comments

Comments
 (0)