Skip to content

[SYCL][CMAKE] Refactor -fPIE handling #19235

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions llvm/cmake/modules/AddSecurityFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,13 @@ macro(append_common_extra_security_flags)
endif()

# Position Independent Execution
if(is_gcc
OR is_clang
OR (is_icpx AND MSVC))
# The project should be configured with -DCMAKE_POSITION_INDEPENDENT_CODE=ON
add_compile_option_ext("-fPIE" FPIE)
add_link_option_ext("-pie" PIE CMAKE_EXE_LINKER_FLAGS
CMAKE_MODULE_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS)
elseif(is_msvc)
# We rely on CMake to set the right -fPIE flags for us, but it must be
# explicitly requested
if (NOT CMAKE_POSITION_INDEPENDENT_CODE)
message(FATAL_ERROR "To enable all necessary security flags, CMAKE_POSITION_INDEPENDENT_CODE must be set to ON")
endif()

if(is_msvc)
add_link_option_ext("/DYNAMICBASE" DYNAMICBASE CMAKE_EXE_LINKER_FLAGS
CMAKE_MODULE_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS)
endif()
Expand Down
Loading