From a0e69ffbbddff559ea0fb3dfcc13a7493d684904 Mon Sep 17 00:00:00 2001 From: goeiecool9999 <7033575+goeiecool9999@users.noreply.github.com> Date: Wed, 9 Nov 2022 07:17:50 +0100 Subject: [PATCH] Linux: Explicitly enable some flags related to security. (#446) --- src/CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e06cfeaf..6444a3d0 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -34,6 +34,13 @@ elseif(UNIX) if(CMAKE_C_COMPILER_ID STREQUAL "Clang") add_compile_options(-Wno-ambiguous-reversed-operator) endif() + # most linux environments should enable pie by default, but make sure just in case. + # the same cannot be said for no executable stack which some linkers + # and configurations thereof might enable due to the assembly in the project + if(NOT APPLE) + add_compile_options(-fpie) + add_link_options(-pie -z noexecstack) + endif() add_compile_options(-Wno-multichar -Wno-invalid-offsetof -Wno-switch -Wno-ignored-attributes -Wno-deprecated-enum-enum-conversion) endif()