Skip to content

[runtimes] remove workaround for old CMake when setting --unwindlib=none #93429

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

Draft
wants to merge 16 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
8c1b899
[runtimes] [CMake] Use CMAKE_REQUIRED_LINK_OPTIONS to simplify handli…
mstorsjo Apr 25, 2022
816e9e6
add comment (and CMake issue reference) about incompatible options
h-vetinari Jun 20, 2024
3f917d2
[cmake] move check for `-fno-exceptions` to "safe zone"
h-vetinari Jun 20, 2024
a8dd830
[cmake] same for `-fno-rtti`
h-vetinari Jun 26, 2024
7444457
[cmake] run _all_ flag checks in runtimes/CMakeLists.txt without linker
h-vetinari Jun 26, 2024
216799a
[cmake] also do static-vs-linker work-around for cxx_add_warning_flags
h-vetinari Jun 26, 2024
47e7688
[cmake] also do static-vs-linker work-around for target_add_compile_f…
h-vetinari Jun 26, 2024
11cbf4f
[cmake] also do static-vs-linker work-around in libcxx/cmake/config-i…
h-vetinari Jun 27, 2024
6ade702
[cmake] also do static-vs-linker work-around for add_flag_if_supported
h-vetinari Jun 27, 2024
fcd9671
[cmake] also do static-vs-linker work-around in runtimes/CMakeLists.txt
h-vetinari Jun 27, 2024
f34093a
[cmake] also do static-vs-linker work-around for libcxx{,abi}'s add_f…
h-vetinari Jun 27, 2024
37bb8e1
[cmake] also do static-vs-linker work-around in libcxxabi/cmake/confi…
h-vetinari Jun 27, 2024
74b9d3f
[cmake] also do static-vs-linker work-around in libunwind/cmake/confi…
h-vetinari Jun 27, 2024
8c2fda5
[cmake] fix up order of work-around with definition of CMAKE_REQUIRED…
h-vetinari Jun 27, 2024
bbc4a0f
Merge remote-tracking branch 'upstream/main' into unwindlib
h-vetinari Aug 12, 2024
9576869
avoid resetting context for CMake flag checks manually
h-vetinari Aug 12, 2024
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
28 changes: 26 additions & 2 deletions cmake/Modules/LLVMCheckCompilerLinkerFlag.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
include(CMakePushCheckState)
include(CheckCompilerFlag)

function(llvm_check_compiler_linker_flag lang flag out_var)
function(llvm_check_compiler_linker_flag lang reset target_type flag out_var)
# If testing a flag with check_compiler_flag, it gets added to the compile
# command only, but not to the linker command in that test. If the flag
# is vital for linking to succeed, the test would fail even if it would
Expand All @@ -10,8 +10,32 @@ function(llvm_check_compiler_linker_flag lang flag out_var)
# Therefore, try adding the flag to CMAKE_REQUIRED_FLAGS, which gets
# added to both compiling and linking commands in the tests.

cmake_push_check_state()
# In some cases, we need to disable existing linker options completely;
# e.g. due to https://gitlab.kitware.com/cmake/cmake/-/issues/23454, in the
# context of CXX_SUPPORTS_UNWINDLIB_EQ_NONE_FLAG, for example. To this end,
# we the RESET option of cmake_push_check_state, c.f.
# https://cmake.org/cmake/help/latest/module/CMakePushCheckState.html
#
# Due to the same CMake issue, we need to be able to override the targe type,
# as some checks will fail by default for shared libraries. A concrete example
# is checking for `-funwind-tables` when building libunwind (e.g. for ARM EHABI).
#
# This happens because, when performing CMake checks, adding `-funwind-tables`
# for a dynamic target causes the check to produce a false negative, because the
# compiler compiler generates calls to `__aeabi_unwind_cpp_pr0`, which is defined
# in libunwind itself, which isn't built yet, so the linker complains about
# undefined symbols. This would lead to libunwind not being built with this flag,
# which makes libunwind quite useless in this setup.
cmake_push_check_state(${reset})
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${flag}")
if (NOT target_type STREQUAL "")
set(_previous_CMAKE_TRY_COMPILE_TARGET_TYPE ${CMAKE_TRY_COMPILE_TARGET_TYPE})
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
endif()
# run the actual check
check_compiler_flag("${lang}" "" ${out_var})
if (NOT target_type STREQUAL "")
set(CMAKE_TRY_COMPILE_TARGET_TYPE ${_previous_CMAKE_TRY_COMPILE_TARGET_TYPE})
endif()
cmake_pop_check_state()
endfunction()
18 changes: 10 additions & 8 deletions compiler-rt/cmake/config-ix.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag)
include(CheckIncludeFiles)
include(CheckLibraryExists)
include(LLVMCheckCompilerLinkerFlag)
include(CheckSymbolExists)
include(LLVMCheckCompilerLinkerFlag)
include(TestBigEndian)

# The compiler driver may be implicitly trying to link against libunwind.
Expand All @@ -15,7 +15,7 @@ include(TestBigEndian)
# libunwind (and the compiler implicit -lunwind wouldn't succeed as the newly
# built libunwind isn't installed yet). For those cases, it'd be good to
# link with --unwindlib=none. Check if that option works.
llvm_check_compiler_linker_flag(C "--unwindlib=none" CXX_SUPPORTS_UNWINDLIB_NONE_FLAG)
llvm_check_compiler_linker_flag(C "--unwindlib=none" "" "" CXX_SUPPORTS_UNWINDLIB_NONE_FLAG)

check_library_exists(c fopen "" COMPILER_RT_HAS_LIBC)
if (COMPILER_RT_USE_BUILTINS_LIBRARY)
Expand Down Expand Up @@ -190,12 +190,13 @@ check_library_exists(c++ __cxa_throw "" COMPILER_RT_HAS_LIBCXX)
check_library_exists(stdc++ __cxa_throw "" COMPILER_RT_HAS_LIBSTDCXX)

# Linker flags.
llvm_check_compiler_linker_flag(C "-Wl,-z,text" COMPILER_RT_HAS_Z_TEXT)
llvm_check_compiler_linker_flag(C "-fuse-ld=lld" COMPILER_RT_HAS_FUSE_LD_LLD_FLAG)
llvm_check_compiler_linker_flag(C "-Wl,-z,text" "" "" COMPILER_RT_HAS_Z_TEXT)
llvm_check_compiler_linker_flag(C "-fuse-ld=lld" "" "" COMPILER_RT_HAS_FUSE_LD_LLD_FLAG)

if(${CMAKE_SYSTEM_NAME} MATCHES "SunOS" AND LLVM_LINKER_IS_SOLARISLD)
set(VERS_COMPAT_OPTION "-Wl,-z,gnu-version-script-compat")
llvm_check_compiler_linker_flag(C "${VERS_COMPAT_OPTION}" COMPILER_RT_HAS_GNU_VERSION_SCRIPT_COMPAT)
llvm_check_compiler_linker_flag(
C "${VERS_COMPAT_OPTION}" "" "" COMPILER_RT_HAS_GNU_VERSION_SCRIPT_COMPAT)
endif()

set(DUMMY_VERS ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/dummy.vers)
Expand All @@ -206,10 +207,10 @@ if(COMPILER_RT_HAS_GNU_VERSION_SCRIPT_COMPAT)
# -z gnu-version-script-compat.
string(APPEND VERS_OPTION " ${VERS_COMPAT_OPTION}")
endif()
llvm_check_compiler_linker_flag(C "${VERS_OPTION}" COMPILER_RT_HAS_VERSION_SCRIPT)
llvm_check_compiler_linker_flag(C "${VERS_OPTION}" "" "" COMPILER_RT_HAS_VERSION_SCRIPT)

if(ANDROID)
llvm_check_compiler_linker_flag(C "-Wl,-z,global" COMPILER_RT_HAS_Z_GLOBAL)
llvm_check_compiler_linker_flag(C "-Wl,-z,global" "" "" COMPILER_RT_HAS_Z_GLOBAL)
check_library_exists(log __android_log_write "" COMPILER_RT_HAS_LIBLOG)
endif()

Expand Down Expand Up @@ -494,7 +495,8 @@ if(APPLE)
-lc++
-lc++abi)

llvm_check_compiler_linker_flag(C "-fapplication-extension" COMPILER_RT_HAS_APP_EXTENSION)
llvm_check_compiler_linker_flag(
C "-fapplication-extension" "" "" COMPILER_RT_HAS_APP_EXTENSION)
if(COMPILER_RT_HAS_APP_EXTENSION)
list(APPEND DARWIN_COMMON_LINK_FLAGS "-fapplication-extension")
endif()
Expand Down
4 changes: 3 additions & 1 deletion libcxx/cmake/Modules/HandleLibcxxFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

include(CheckCXXCompilerFlag)
include(HandleFlags)
include(LLVMCheckCompilerLinkerFlag)

unset(add_flag_if_supported)

Expand All @@ -31,7 +32,8 @@ endmacro()
macro(add_flags_if_supported)
foreach(flag ${ARGN})
mangle_name("${flag}" flagname)
check_cxx_compiler_flag("${flag}" "CXX_SUPPORTS_${flagname}_FLAG")
llvm_check_compiler_linker_flag(
CXX "${flag}" RESET STATIC_LIBRARY "CXX_SUPPORTS_${flagname}_FLAG")
add_flags_if(CXX_SUPPORTS_${flagname}_FLAG ${flag})
endforeach()
endmacro()
Expand Down
17 changes: 11 additions & 6 deletions libcxx/cmake/config-ix.cmake
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
include(CMakePushCheckState)
include(CheckLibraryExists)
include(CheckSymbolExists)
include(LLVMCheckCompilerLinkerFlag)
include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag)
include(CheckCSourceCompiles)
include(LLVMCheckCompilerLinkerFlag)

# The compiler driver may be implicitly trying to link against libunwind.
# This is normally ok (libcxx relies on an unwinder), but if libunwind is
Expand All @@ -13,7 +13,8 @@ include(CheckCSourceCompiles)
# libunwind (and the compiler implicit -lunwind wouldn't succeed as the newly
# built libunwind isn't installed yet). For those cases, it'd be good to
# link with --unwindlib=none. Check if that option works.
llvm_check_compiler_linker_flag(C "--unwindlib=none" CXX_SUPPORTS_UNWINDLIB_EQ_NONE_FLAG)
llvm_check_compiler_linker_flag(
C "--unwindlib=none" RESET STATIC_LIBRARY CXX_SUPPORTS_UNWINDLIB_EQ_NONE_FLAG)

if (NOT LIBCXX_USE_COMPILER_RT)
if(WIN32 AND NOT MINGW)
Expand All @@ -27,8 +28,10 @@ if (NOT LIBCXX_USE_COMPILER_RT)
endif()
endif()

check_cxx_compiler_flag(-nostdlibinc CXX_SUPPORTS_NOSTDLIBINC_FLAG)
check_cxx_compiler_flag(-nolibc CXX_SUPPORTS_NOLIBC_FLAG)
llvm_check_compiler_linker_flag(
CXX "-nostdlibinc" RESET STATIC_LIBRARY CXX_SUPPORTS_NOSTDLIBINC_FLAG)
llvm_check_compiler_linker_flag(
CXX "-nolibc" RESET STATIC_LIBRARY CXX_SUPPORTS_NOLIBC_FLAG)

# libc++ is using -nostdlib++ at the link step when available,
# otherwise -nodefaultlibs is used. We want all our checks to also
Expand All @@ -39,11 +42,13 @@ check_cxx_compiler_flag(-nolibc CXX_SUPPORTS_NOLIBC_FLAG)
# required for the link to go through. We remove sanitizers from the
# configuration checks to avoid spurious link errors.

check_cxx_compiler_flag(-nostdlib++ CXX_SUPPORTS_NOSTDLIBXX_FLAG)
llvm_check_compiler_linker_flag(
CXX "-nostdlib++" RESET STATIC_LIBRARY CXX_SUPPORTS_NOSTDLIBXX_FLAG)
if (CXX_SUPPORTS_NOSTDLIBXX_FLAG)
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -nostdlib++")
else()
check_c_compiler_flag(-nodefaultlibs C_SUPPORTS_NODEFAULTLIBS_FLAG)
llvm_check_compiler_linker_flag(
C "-nodefaultlibs" RESET STATIC_LIBRARY C_SUPPORTS_NODEFAULTLIBS_FLAG)
if (C_SUPPORTS_NODEFAULTLIBS_FLAG)
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -nodefaultlibs")
endif()
Expand Down
4 changes: 3 additions & 1 deletion libcxxabi/cmake/Modules/HandleLibcxxabiFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

include(CheckCXXCompilerFlag)
include(HandleFlags)
include(LLVMCheckCompilerLinkerFlag)

unset(add_flag_if_supported)

Expand All @@ -31,7 +32,8 @@ endmacro()
macro(add_flags_if_supported)
foreach(flag ${ARGN})
mangle_name("${flag}" flagname)
check_cxx_compiler_flag("${flag}" "CXX_SUPPORTS_${flagname}_FLAG")
llvm_check_compiler_linker_flag(
CXX "${flag}" RESET STATIC_LIBRARY "CXX_SUPPORTS_${flagname}_FLAG")
add_flags_if(CXX_SUPPORTS_${flagname}_FLAG ${flag})
endforeach()
endmacro()
Expand Down
10 changes: 7 additions & 3 deletions libcxxabi/cmake/config-ix.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ include(CheckLibraryExists)
include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag)
include(CheckCSourceCompiles)
include(LLVMCheckCompilerLinkerFlag)

check_library_exists(c fopen "" LIBCXXABI_HAS_C_LIB)
if (NOT LIBCXXABI_USE_COMPILER_RT)
Expand All @@ -23,11 +24,13 @@ endif ()
# required for the link to go through. We remove sanitizers from the
# configuration checks to avoid spurious link errors.

check_cxx_compiler_flag(-nostdlib++ CXX_SUPPORTS_NOSTDLIBXX_FLAG)
llvm_check_compiler_linker_flag(
CXX "-nostdlib++" RESET STATIC_LIBRARY CXX_SUPPORTS_NOSTDLIBXX_FLAG)
if (CXX_SUPPORTS_NOSTDLIBXX_FLAG)
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -nostdlib++")
else()
check_c_compiler_flag(-nodefaultlibs C_SUPPORTS_NODEFAULTLIBS_FLAG)
llvm_check_compiler_linker_flag(
C "-nodefaultlibs" RESET STATIC_LIBRARY C_SUPPORTS_NODEFAULTLIBS_FLAG)
if (C_SUPPORTS_NODEFAULTLIBS_FLAG)
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -nodefaultlibs")
endif()
Expand Down Expand Up @@ -92,7 +95,8 @@ int main(void) { return 0; }
endif()

# Check compiler flags
check_cxx_compiler_flag(-nostdinc++ CXX_SUPPORTS_NOSTDINCXX_FLAG)
llvm_check_compiler_linker_flag(
CXX "-nostdinc++" RESET STATIC_LIBRARY CXX_SUPPORTS_NOSTDINCXX_FLAG)

# Check libraries
if(FUCHSIA)
Expand Down
16 changes: 0 additions & 16 deletions libunwind/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -215,23 +215,7 @@ endif()
add_cxx_compile_flags_if_supported(-fstrict-aliasing)
add_cxx_compile_flags_if_supported(-EHsc)

# Don't run the linker in this CMake check.
#
# The reason why this was added is that when building libunwind for
# ARM Linux, we need to pass the -funwind-tables flag in order for it to
# work properly with ARM EHABI.
#
# However, when performing CMake checks, adding this flag causes the check
# to produce a false negative, because the compiler generates calls
# to __aeabi_unwind_cpp_pr0, which is defined in libunwind itself,
# which isn't built yet, so the linker complains about undefined symbols.
#
# This leads to libunwind not being built with this flag, which makes
# libunwind quite useless in this setup.
set(_previous_CMAKE_TRY_COMPILE_TARGET_TYPE ${CMAKE_TRY_COMPILE_TARGET_TYPE})
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
add_compile_flags_if_supported(-funwind-tables)
set(CMAKE_TRY_COMPILE_TARGET_TYPE ${_previous_CMAKE_TRY_COMPILE_TARGET_TYPE})

if (LIBUNWIND_USES_ARM_EHABI AND NOT CXX_SUPPORTS_FUNWIND_TABLES_FLAG)
message(SEND_ERROR "The -funwind-tables flag must be supported "
Expand Down
4 changes: 3 additions & 1 deletion libunwind/cmake/Modules/HandleLibunwindFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag)
include(HandleFlags)
include(LLVMCheckCompilerLinkerFlag)

unset(add_flag_if_supported)

Expand All @@ -30,7 +31,8 @@ endmacro()
macro(add_compile_flags_if_supported)
foreach(flag ${ARGN})
mangle_name("${flag}" flagname)
check_cxx_compiler_flag("${flag}" "CXX_SUPPORTS_${flagname}_FLAG")
llvm_check_compiler_linker_flag(
CXX "${flag}" RESET STATIC_LIBRARY "CXX_SUPPORTS_${flagname}_FLAG")
add_compile_flags_if(CXX_SUPPORTS_${flagname}_FLAG ${flag})
endforeach()
endmacro()
Expand Down
9 changes: 6 additions & 3 deletions libunwind/cmake/config-ix.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ include(CheckCSourceCompiles)
# The compiler driver may be implicitly trying to link against libunwind, which
# might not work if libunwind doesn't exist yet. Try to check if
# --unwindlib=none is supported, and use that if possible.
llvm_check_compiler_linker_flag(C "--unwindlib=none" CXX_SUPPORTS_UNWINDLIB_EQ_NONE_FLAG)
llvm_check_compiler_linker_flag(
C "--unwindlib=none" RESET STATIC_LIBRARY CXX_SUPPORTS_UNWINDLIB_EQ_NONE_FLAG)

if (HAIKU)
check_library_exists(root fopen "" LIBUNWIND_HAS_ROOT_LIB)
Expand All @@ -35,11 +36,13 @@ endif()
# required for the link to go through. We remove sanitizers from the
# configuration checks to avoid spurious link errors.

llvm_check_compiler_linker_flag(CXX "-nostdlib++" CXX_SUPPORTS_NOSTDLIBXX_FLAG)
llvm_check_compiler_linker_flag(
CXX "-nostdlib++" RESET STATIC_LIBRARY CXX_SUPPORTS_NOSTDLIBXX_FLAG)
if (CXX_SUPPORTS_NOSTDLIBXX_FLAG)
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -nostdlib++")
else()
llvm_check_compiler_linker_flag(C "-nodefaultlibs" C_SUPPORTS_NODEFAULTLIBS_FLAG)
llvm_check_compiler_linker_flag(
C "-nodefaultlibs" RESET STATIC_LIBRARY C_SUPPORTS_NODEFAULTLIBS_FLAG)
if (C_SUPPORTS_NODEFAULTLIBS_FLAG)
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -nodefaultlibs")
endif()
Expand Down
7 changes: 5 additions & 2 deletions llvm/cmake/modules/HandleLLVMOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ include(CheckCXXCompilerFlag)
include(CheckCXXSourceCompiles)
include(CheckSymbolExists)
include(CMakeDependentOption)
include(LLVMCheckCompilerLinkerFlag)
include(LLVMProcessSources)

if(CMAKE_LINKER MATCHES ".*lld" OR (LLVM_USE_LINKER STREQUAL "lld" OR LLVM_ENABLE_LLD))
Expand Down Expand Up @@ -333,9 +334,11 @@ function(append_if condition value)
endfunction()

macro(add_flag_if_supported flag name)
check_c_compiler_flag("-Werror ${flag}" "C_SUPPORTS_${name}")
llvm_check_compiler_linker_flag(
C "-Werror ${flag}" RESET STATIC_LIBRARY "C_SUPPORTS_${name}")
append_if("C_SUPPORTS_${name}" "${flag}" CMAKE_C_FLAGS)
check_cxx_compiler_flag("-Werror ${flag}" "CXX_SUPPORTS_${name}")
llvm_check_compiler_linker_flag(
CXX "-Werror ${flag}" RESET STATIC_LIBRARY "CXX_SUPPORTS_${name}")
append_if("CXX_SUPPORTS_${name}" "${flag}" CMAKE_CXX_FLAGS)
endmacro()

Expand Down
4 changes: 3 additions & 1 deletion offload/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,9 @@ if(OPENMP_STANDALONE_BUILD OR TARGET omp)
# Check LIBOMP_HAVE_VERSION_SCRIPT_FLAG
include(LLVMCheckCompilerLinkerFlag)
if(NOT APPLE)
llvm_check_compiler_linker_flag(C "-Wl,--version-script=${CMAKE_CURRENT_LIST_DIR}/../openmp/runtime/src/exports_test_so.txt" LIBOMP_HAVE_VERSION_SCRIPT_FLAG)
llvm_check_compiler_linker_flag(C
"-Wl,--version-script=${CMAKE_CURRENT_LIST_DIR}/../openmp/runtime/src/exports_test_so.txt"
"" "" LIBOMP_HAVE_VERSION_SCRIPT_FLAG)
endif()
endif()

Expand Down
18 changes: 10 additions & 8 deletions openmp/runtime/cmake/config-ix.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,15 @@ check_symbol_exists(_aligned_malloc "malloc.h" LIBOMP_HAVE__ALIGNED_MALLOC)

# Check linker flags
if(WIN32)
llvm_check_compiler_linker_flag(C /SAFESEH LIBOMP_HAVE_SAFESEH_FLAG)
llvm_check_compiler_linker_flag(C "/SAFESEH" "" "" LIBOMP_HAVE_SAFESEH_FLAG)
elseif(NOT APPLE)
llvm_check_compiler_linker_flag(C -Wl,-x LIBOMP_HAVE_X_FLAG)
llvm_check_compiler_linker_flag(C -Wl,--as-needed LIBOMP_HAVE_AS_NEEDED_FLAG)
llvm_check_compiler_linker_flag(C "-Wl,--version-script=${LIBOMP_SRC_DIR}/exports_test_so.txt" LIBOMP_HAVE_VERSION_SCRIPT_FLAG)
llvm_check_compiler_linker_flag(C -static-libgcc LIBOMP_HAVE_STATIC_LIBGCC_FLAG)
llvm_check_compiler_linker_flag(C -Wl,-z,noexecstack LIBOMP_HAVE_Z_NOEXECSTACK_FLAG)
llvm_check_compiler_linker_flag(C "-Wl,-x" "" "" LIBOMP_HAVE_X_FLAG)
llvm_check_compiler_linker_flag(C "-Wl,--as-needed" "" "" LIBOMP_HAVE_AS_NEEDED_FLAG)
llvm_check_compiler_linker_flag(C
"-Wl,--version-script=${LIBOMP_SRC_DIR}/exports_test_so.txt"
"" "" LIBOMP_HAVE_VERSION_SCRIPT_FLAG)
llvm_check_compiler_linker_flag(C "-static-libgcc" "" "" LIBOMP_HAVE_STATIC_LIBGCC_FLAG)
llvm_check_compiler_linker_flag(C "-Wl,-z,noexecstack" "" "" LIBOMP_HAVE_Z_NOEXECSTACK_FLAG)
endif()

# Check Intel(R) C Compiler specific flags
Expand All @@ -145,8 +147,8 @@ if(CMAKE_C_COMPILER_ID STREQUAL "Intel" OR CMAKE_C_COMPILER_ID STREQUAL "IntelLL
check_cxx_compiler_flag(-Qoption,cpp,--extended_float_types LIBOMP_HAVE_EXTENDED_FLOAT_TYPES_FLAG)
check_cxx_compiler_flag(-falign-stack=maintain-16-byte LIBOMP_HAVE_FALIGN_STACK_FLAG)
check_cxx_compiler_flag("-opt-streaming-stores never" LIBOMP_HAVE_OPT_STREAMING_STORES_FLAG)
llvm_check_compiler_linker_flag(C -static-intel LIBOMP_HAVE_STATIC_INTEL_FLAG)
llvm_check_compiler_linker_flag(C -no-intel-extensions LIBOMP_HAVE_NO_INTEL_EXTENSIONS_FLAG)
llvm_check_compiler_linker_flag(C "-static-intel" "" "" LIBOMP_HAVE_STATIC_INTEL_FLAG)
llvm_check_compiler_linker_flag(C "-no-intel-extensions" "" "" LIBOMP_HAVE_NO_INTEL_EXTENSIONS_FLAG)
check_library_exists(irc_pic _intel_fast_memcpy "" LIBOMP_HAVE_IRC_PIC_LIBRARY)
endif()

Expand Down
Loading
Loading