Add patch to link pthread library for llvm 15 (#32838)

This commit is contained in:
Mikael Simberg 2022-09-29 15:41:59 +02:00 committed by GitHub
parent a0147a1f07
commit a78462988b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 0 deletions

View file

@ -0,0 +1,23 @@
diff --git a/openmp/libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake b/openmp/libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake
index 1f2a50667c4f..d3ff232f6bd3 100644
--- a/openmp/libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake
+++ b/openmp/libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake
@@ -280,4 +280,5 @@ if (NOT LIBOMPTARGET_CUDA_TOOLKIT_ROOT_DIR_PRESET AND
endif()
endif()
-set(OPENMP_PTHREAD_LIB ${LLVM_PTHREAD_LIB})
+find_package(Threads REQUIRED)
+set(OPENMP_PTHREAD_LIB Threads::Threads)
diff --git a/openmp/libomptarget/src/CMakeLists.txt b/openmp/libomptarget/src/CMakeLists.txt
index 071ec61889a2..b782c3b07e6f 100644
--- a/openmp/libomptarget/src/CMakeLists.txt
+++ b/openmp/libomptarget/src/CMakeLists.txt
@@ -33,6 +33,7 @@ add_llvm_library(omptarget
LINK_LIBS
PRIVATE
${CMAKE_DL_LIBS}
+ ${OPENMP_PTHREAD_LIB}
"-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/exports"
NO_INSTALL_RPATH
)

View file

@ -360,6 +360,7 @@ class Llvm(CMakePackage, CudaPackage):
# add -lpthread to build OpenMP libraries # add -lpthread to build OpenMP libraries
patch("llvm13-14-thread.patch", when="@13:14") patch("llvm13-14-thread.patch", when="@13:14")
patch("llvm15-thread.patch", when="@15")
# avoid build failed with Fujitsu compiler # avoid build failed with Fujitsu compiler
patch("llvm13-fujitsu.patch", when="@13 %fj") patch("llvm13-fujitsu.patch", when="@13 %fj")