Skip to content

Commit fdece9c

Browse files
[SYCL][CMake] Properly enable -pie hardening flag (#19447)
We rely on CMake to set the right set of compliation and link flags to enable positition independent code and position independent execution. Before this commit, necessary compliation flags were applied just fine, but link flags were missing. To get link flags, some extra CMake functions should be called.
1 parent 5f79ab3 commit fdece9c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

llvm/cmake/modules/AddSecurityFlags.cmake

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,10 @@ macro(append_common_extra_security_flags)
133133
# Position Independent Execution
134134
# We rely on CMake to set the right -fPIE flags for us, but it must be
135135
# explicitly requested
136-
if (NOT CMAKE_POSITION_INDEPENDENT_CODE)
136+
if (CMAKE_POSITION_INDEPENDENT_CODE)
137+
include(CheckPIESupported)
138+
check_pie_supported()
139+
else()
137140
message(FATAL_ERROR "To enable all necessary security flags, CMAKE_POSITION_INDEPENDENT_CODE must be set to ON")
138141
endif()
139142

0 commit comments

Comments
 (0)