From: Joseph Huber Date: Thu, 13 Oct 2022 13:08:46 +0000 (-0500) Subject: [Libomptarget] Make the plugins ingore undefined exported symbols X-Git-Tag: upstream/17.0.6~30692 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3f62314c235bd2475c8e2b5b874b2932a444e823;p=platform%2Fupstream%2Fllvm.git [Libomptarget] Make the plugins ingore undefined exported symbols Summary: Recent changes made the default behaviour to error when given an undefined symbol in a version script. A previous patch fixed this for `libomptarget` by removing the single undefined symbol. However, the plguins are expected to only define a subset of the availible functions so we shouldn't treat it as an error. This patch updates the build flags to work appropriately. --- diff --git a/openmp/libomptarget/plugins/CMakeLists.txt b/openmp/libomptarget/plugins/CMakeLists.txt index 8ec24b5..de0f41f 100644 --- a/openmp/libomptarget/plugins/CMakeLists.txt +++ b/openmp/libomptarget/plugins/CMakeLists.txt @@ -38,12 +38,13 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "${tmachine}$") ${LIBOMPTARGET_INCLUDE_DIR} ${LIBOMPTARGET_DEP_LIBFFI_INCLUDE_DIR} - LINK_LIBS - PRIVATE - elf_common - ${LIBOMPTARGET_DEP_LIBFFI_LIBRARIES} - ${OPENMP_PTHREAD_LIB} - "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/../exports" + LINK_LIBS + PRIVATE + elf_common + ${LIBOMPTARGET_DEP_LIBFFI_LIBRARIES} + ${OPENMP_PTHREAD_LIB} + "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/../exports" + "-Wl,--undefined-version" NO_INSTALL_RPATH ) diff --git a/openmp/libomptarget/plugins/amdgpu/CMakeLists.txt b/openmp/libomptarget/plugins/amdgpu/CMakeLists.txt index dfd3671..60d5139 100644 --- a/openmp/libomptarget/plugins/amdgpu/CMakeLists.txt +++ b/openmp/libomptarget/plugins/amdgpu/CMakeLists.txt @@ -85,6 +85,7 @@ add_llvm_library(omptarget.rtl.amdgpu SHARED ${LIBOMPTARGET_DEP_LIBRARIES} ${OPENMP_PTHREAD_LIB} "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/../exports" + "-Wl,--undefined-version" ${LDFLAGS_UNDEFINED} NO_INSTALL_RPATH diff --git a/openmp/libomptarget/plugins/cuda/CMakeLists.txt b/openmp/libomptarget/plugins/cuda/CMakeLists.txt index 244060e..4077480 100644 --- a/openmp/libomptarget/plugins/cuda/CMakeLists.txt +++ b/openmp/libomptarget/plugins/cuda/CMakeLists.txt @@ -55,6 +55,7 @@ if (LIBOMPTARGET_CAN_LINK_LIBCUDA AND NOT LIBOMPTARGET_FORCE_DLOPEN_LIBCUDA) ${LIBOMPTARGET_DEP_CUDA_DRIVER_LIBRARIES} ${OPENMP_PTHREAD_LIB} "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/../exports" + "-Wl,--undefined-version" "-Wl,-z,defs" NO_INSTALL_RPATH @@ -77,6 +78,7 @@ else() MemoryManager ${OPENMP_PTHREAD_LIB} "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/../exports" + "-Wl,--undefined-version" "-Wl,-z,defs" NO_INSTALL_RPATH diff --git a/openmp/libomptarget/plugins/remote/server/CMakeLists.txt b/openmp/libomptarget/plugins/remote/server/CMakeLists.txt index 9712642..ca3905a 100644 --- a/openmp/libomptarget/plugins/remote/server/CMakeLists.txt +++ b/openmp/libomptarget/plugins/remote/server/CMakeLists.txt @@ -29,4 +29,5 @@ target_link_libraries(openmp-offloading-server absl::synchronization ${OPENMP_PTHREAD_LIB} omp - "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/../../exports") + "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/../../exports" + "-Wl,--undefined-version") diff --git a/openmp/libomptarget/plugins/remote/src/CMakeLists.txt b/openmp/libomptarget/plugins/remote/src/CMakeLists.txt index 6299fb3..fbad626 100644 --- a/openmp/libomptarget/plugins/remote/src/CMakeLists.txt +++ b/openmp/libomptarget/plugins/remote/src/CMakeLists.txt @@ -37,7 +37,8 @@ target_link_libraries(omptarget.rtl.rpc absl::synchronization ${OPENMP_PTHREAD_LIB} omp - "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/../../exports") + "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/../../exports" + "-Wl,--undefined-version") # Report to the parent scope that we are building a plugin for RPC. set(LIBOMPTARGET_SYSTEM_TARGETS "${LIBOMPTARGET_SYSTEM_TARGETS} rpc" PARENT_SCOPE) diff --git a/openmp/libomptarget/plugins/ve/CMakeLists.txt b/openmp/libomptarget/plugins/ve/CMakeLists.txt index ef2906f..4d6144a 100644 --- a/openmp/libomptarget/plugins/ve/CMakeLists.txt +++ b/openmp/libomptarget/plugins/ve/CMakeLists.txt @@ -37,6 +37,7 @@ if(${LIBOMPTARGET_DEP_VEO_FOUND}) ${LIBOMPTARGET_DEP_LIBFFI_LIBRARIES} ${additional_libs} "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/../exports -Wl,-z,defs" + "-Wl,--undefined-version" NO_INSTALL_RPATH ) @@ -55,7 +56,8 @@ if(${LIBOMPTARGET_DEP_VEO_FOUND}) elf_common ${LIBOMPTARGET_DEP_LIBFFI_LIBRARIES} ${additional_libs} - "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/../exports -Wl,-z,defs") + "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/../exports -Wl,-z,defs" + "-Wl,--undefined-version") # Report to the parent scope that we are building a plugin. set(LIBOMPTARGET_SYSTEM_TARGETS