Skip to content

Commit 4c5bd04

Browse files
committed
[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 a34584e commit 4c5bd04

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
@@ -107,7 +107,10 @@ macro(append_common_extra_security_flags)
107107
# Position Independent Execution
108108
# We rely on CMake to set the right -fPIE flags for us, but it must be
109109
# explicitly requested
110-
if (NOT CMAKE_POSITION_INDEPENDENT_CODE)
110+
if (CMAKE_POSITION_INDEPENDENT_CODE)
111+
include(CheckPIESupported)
112+
check_pie_supported()
113+
else()
111114
message(FATAL_ERROR "To enable all necessary security flags, CMAKE_POSITION_INDEPENDENT_CODE must be set to ON")
112115
endif()
113116

0 commit comments

Comments
 (0)