[Openmp-commits] [openmp] 096f93e - [Libomp] Do not error on undefined version script symbols

Joseph Huber via Openmp-commits openmp-commits at lists.llvm.org
Thu Oct 13 06:45:39 PDT 2022


Author: Joseph Huber
Date: 2022-10-13T08:45:23-05:00
New Revision: 096f93e73dc3f88636cdcb57515e3732385b452d

URL: https://github.com/llvm/llvm-project/commit/096f93e73dc3f88636cdcb57515e3732385b452d
DIFF: https://github.com/llvm/llvm-project/commit/096f93e73dc3f88636cdcb57515e3732385b452d.diff

LOG: [Libomp] Do not error on undefined version script symbols

Summary:
A recent patch made all of the places we used version scripts in OpenMP
start throwing errors when linking with LLD. This is hopefully the last
one required to get the build bots to pass. This patch simply adds the
`--undefined-version` flag to the places where the version scripts are
used.

Added: 
    

Modified: 
    openmp/runtime/cmake/LibompHandleFlags.cmake
    openmp/runtime/cmake/config-ix.cmake

Removed: 
    


################################################################################
diff  --git a/openmp/runtime/cmake/LibompHandleFlags.cmake b/openmp/runtime/cmake/LibompHandleFlags.cmake
index 74643291737ea..c24a60e2391a3 100644
--- a/openmp/runtime/cmake/LibompHandleFlags.cmake
+++ b/openmp/runtime/cmake/LibompHandleFlags.cmake
@@ -99,7 +99,7 @@ function(libomp_get_ldflags ldflags)
     IF_DEFINED CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG)
   libomp_append(ldflags_local -Wl,--warn-shared-textrel LIBOMP_HAVE_WARN_SHARED_TEXTREL_FLAG)
   libomp_append(ldflags_local -Wl,--as-needed LIBOMP_HAVE_AS_NEEDED_FLAG)
-  libomp_append(ldflags_local "-Wl,--version-script=${LIBOMP_SRC_DIR}/exports_so.txt" LIBOMP_HAVE_VERSION_SCRIPT_FLAG)
+  libomp_append(ldflags_local "-Wl,--version-script=${LIBOMP_SRC_DIR}/exports_so.txt -Wl,--undefined-version" LIBOMP_HAVE_VERSION_SCRIPT_FLAG)
   libomp_append(ldflags_local -static-libgcc LIBOMP_HAVE_STATIC_LIBGCC_FLAG)
   libomp_append(ldflags_local -Wl,-z,noexecstack LIBOMP_HAVE_Z_NOEXECSTACK_FLAG)
   libomp_append(ldflags_local -no-intel-extensions LIBOMP_HAVE_NO_INTEL_EXTENSIONS_FLAG)

diff  --git a/openmp/runtime/cmake/config-ix.cmake b/openmp/runtime/cmake/config-ix.cmake
index a57cbf9d2ef59..0458c2ac9a96d 100644
--- a/openmp/runtime/cmake/config-ix.cmake
+++ b/openmp/runtime/cmake/config-ix.cmake
@@ -34,7 +34,7 @@ function(libomp_check_version_symbols retval)
     }")
   set(version_script_source "VER1 { }; VER2 { } VER1;")
   file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/__version_script.txt "${version_script_source}")
-  set(CMAKE_REQUIRED_FLAGS -Wl,--version-script=${CMAKE_CURRENT_BINARY_DIR}/__version_script.txt)
+  set(CMAKE_REQUIRED_FLAGS "-Wl,--version-script=${CMAKE_CURRENT_BINARY_DIR}/__version_script.txt -Wl,--undefined-version")
   check_c_source_compiles("${source_code}" ${retval})
   set(${retval} ${${retval}} PARENT_SCOPE)
   file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/__version_script.txt)
@@ -132,7 +132,7 @@ elseif(NOT APPLE)
   libomp_check_linker_flag(-Wl,-x LIBOMP_HAVE_X_FLAG)
   libomp_check_linker_flag(-Wl,--warn-shared-textrel LIBOMP_HAVE_WARN_SHARED_TEXTREL_FLAG)
   libomp_check_linker_flag(-Wl,--as-needed LIBOMP_HAVE_AS_NEEDED_FLAG)
-  libomp_check_linker_flag("-Wl,--version-script=${LIBOMP_SRC_DIR}/exports_so.txt" LIBOMP_HAVE_VERSION_SCRIPT_FLAG)
+  libomp_check_linker_flag("-Wl,--version-script=${LIBOMP_SRC_DIR}/exports_so.txt -Wl,--undefined-version" LIBOMP_HAVE_VERSION_SCRIPT_FLAG)
   libomp_check_linker_flag(-static-libgcc LIBOMP_HAVE_STATIC_LIBGCC_FLAG)
   libomp_check_linker_flag(-Wl,-z,noexecstack LIBOMP_HAVE_Z_NOEXECSTACK_FLAG)
 endif()


        


More information about the Openmp-commits mailing list