Skip to content

Commit 096f93e

Browse files
committed
[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.
1 parent fa9c12e commit 096f93e

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

openmp/runtime/cmake/LibompHandleFlags.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ function(libomp_get_ldflags ldflags)
9999
IF_DEFINED CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG)
100100
libomp_append(ldflags_local -Wl,--warn-shared-textrel LIBOMP_HAVE_WARN_SHARED_TEXTREL_FLAG)
101101
libomp_append(ldflags_local -Wl,--as-needed LIBOMP_HAVE_AS_NEEDED_FLAG)
102-
libomp_append(ldflags_local "-Wl,--version-script=${LIBOMP_SRC_DIR}/exports_so.txt" LIBOMP_HAVE_VERSION_SCRIPT_FLAG)
102+
libomp_append(ldflags_local "-Wl,--version-script=${LIBOMP_SRC_DIR}/exports_so.txt -Wl,--undefined-version" LIBOMP_HAVE_VERSION_SCRIPT_FLAG)
103103
libomp_append(ldflags_local -static-libgcc LIBOMP_HAVE_STATIC_LIBGCC_FLAG)
104104
libomp_append(ldflags_local -Wl,-z,noexecstack LIBOMP_HAVE_Z_NOEXECSTACK_FLAG)
105105
libomp_append(ldflags_local -no-intel-extensions LIBOMP_HAVE_NO_INTEL_EXTENSIONS_FLAG)

openmp/runtime/cmake/config-ix.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function(libomp_check_version_symbols retval)
3434
}")
3535
set(version_script_source "VER1 { }; VER2 { } VER1;")
3636
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/__version_script.txt "${version_script_source}")
37-
set(CMAKE_REQUIRED_FLAGS -Wl,--version-script=${CMAKE_CURRENT_BINARY_DIR}/__version_script.txt)
37+
set(CMAKE_REQUIRED_FLAGS "-Wl,--version-script=${CMAKE_CURRENT_BINARY_DIR}/__version_script.txt -Wl,--undefined-version")
3838
check_c_source_compiles("${source_code}" ${retval})
3939
set(${retval} ${${retval}} PARENT_SCOPE)
4040
file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/__version_script.txt)
@@ -132,7 +132,7 @@ elseif(NOT APPLE)
132132
libomp_check_linker_flag(-Wl,-x LIBOMP_HAVE_X_FLAG)
133133
libomp_check_linker_flag(-Wl,--warn-shared-textrel LIBOMP_HAVE_WARN_SHARED_TEXTREL_FLAG)
134134
libomp_check_linker_flag(-Wl,--as-needed LIBOMP_HAVE_AS_NEEDED_FLAG)
135-
libomp_check_linker_flag("-Wl,--version-script=${LIBOMP_SRC_DIR}/exports_so.txt" LIBOMP_HAVE_VERSION_SCRIPT_FLAG)
135+
libomp_check_linker_flag("-Wl,--version-script=${LIBOMP_SRC_DIR}/exports_so.txt -Wl,--undefined-version" LIBOMP_HAVE_VERSION_SCRIPT_FLAG)
136136
libomp_check_linker_flag(-static-libgcc LIBOMP_HAVE_STATIC_LIBGCC_FLAG)
137137
libomp_check_linker_flag(-Wl,-z,noexecstack LIBOMP_HAVE_Z_NOEXECSTACK_FLAG)
138138
endif()

0 commit comments

Comments
 (0)