Skip to content

Commit 3624d12

Browse files
committed
Ongoing development
- Implement ENABLE_PIE_FLAG option to allow the PIE flags to be enabled or disabled. Disabled option to work around link issue. Signed-off-by: Derek G Foster <[email protected]>
1 parent e7d0163 commit 3624d12

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ cmake_minimum_required(VERSION 3.15)
1111
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Type of build to perform")
1212

1313
# Include before the project() command.
14+
set(ENABLE_PIE_FLAG OFF)
1415
set(ENABLE_SANITIZE_CFI OFF)
1516
set(ENABLE_SPECTRE_FLAGS OFF)
1617
include(cmake/CompilerFlags.cmake)

cmake/CompilerFlags.cmake

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
include(CMakePrintHelpers)
88

99
option(ENABLE_WARNING_FLAGS "Enable compiler warnings" OFF)
10+
option(ENABLE_PIE_FLAG "Enable position independent executables" ON)
1011
option(ENABLE_SANITIZE_CFI "Enable -sanitize=cfi" ON)
1112
option(ENABLE_SPECTRE_FLAGS "Enable Spectre mitigations" ON)
1213

@@ -128,7 +129,9 @@ function(_get_security_flags_list config cflags)
128129
setFlowIntegrity(config _cflags)
129130
setFormatDefense(config _cflags)
130131
setStackDefense(config _cflags)
131-
setPIE(config _cflags)
132+
if(ENABLE_PIE_FLAG)
133+
setPIE(config _cflags)
134+
endif()
132135
setRelocation(config _cflags)
133136

134137
if(ENABLE_SPECTRE_FLAGS)

0 commit comments

Comments
 (0)