Skip to content

Commit c6e6231

Browse files
jhuber6Joseph Huber
authored and
Joseph Huber
committed
[OpenMP][libomp] Fix version scripts after undefined version script changes
Summary: Building with `lld` now errors on undefined symbols by default now. This was causing `libomp` to think that the compiler didn't support version scripts when checking linker features. This patch adds a new script that exports all symbols to be used for testing. We also remove the old workarounds for undefined versions now that it's no longer necessary.
1 parent b4028fb commit c6e6231

File tree

3 files changed

+61
-3
lines changed

3 files changed

+61
-3
lines changed

openmp/runtime/cmake/LibompHandleFlags.cmake

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ function(libomp_get_ldflags ldflags)
101101
IF_DEFINED CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG)
102102
libomp_append(ldflags_local -Wl,--as-needed LIBOMP_HAVE_AS_NEEDED_FLAG)
103103
libomp_append(ldflags_local "-Wl,--version-script=${LIBOMP_SRC_DIR}/exports_so.txt" LIBOMP_HAVE_VERSION_SCRIPT_FLAG)
104-
libomp_append(ldflags_local "-Wl,--undefined-version" LIBOMP_HAVE_UNDEFINED_VERSION_FLAG) # FIXME issue #58858
105104
libomp_append(ldflags_local -static-libgcc LIBOMP_HAVE_STATIC_LIBGCC_FLAG)
106105
libomp_append(ldflags_local -Wl,-z,noexecstack LIBOMP_HAVE_Z_NOEXECSTACK_FLAG)
107106
libomp_append(ldflags_local -no-intel-extensions LIBOMP_HAVE_NO_INTEL_EXTENSIONS_FLAG)

openmp/runtime/cmake/config-ix.cmake

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,7 @@ if(WIN32)
131131
elseif(NOT APPLE)
132132
libomp_check_linker_flag(-Wl,-x LIBOMP_HAVE_X_FLAG)
133133
libomp_check_linker_flag(-Wl,--as-needed LIBOMP_HAVE_AS_NEEDED_FLAG)
134-
libomp_check_linker_flag("-Wl,--version-script=${LIBOMP_SRC_DIR}/exports_so.txt" LIBOMP_HAVE_VERSION_SCRIPT_FLAG)
135-
libomp_check_linker_flag("-Wl,--undefined-version" LIBOMP_HAVE_UNDEFINED_VERSION_FLAG) # FIXME issue #58858
134+
libomp_check_linker_flag("-Wl,--version-script=${LIBOMP_SRC_DIR}/exports_test_so.txt" LIBOMP_HAVE_VERSION_SCRIPT_FLAG)
136135
libomp_check_linker_flag(-static-libgcc LIBOMP_HAVE_STATIC_LIBGCC_FLAG)
137136
libomp_check_linker_flag(-Wl,-z,noexecstack LIBOMP_HAVE_Z_NOEXECSTACK_FLAG)
138137
endif()
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# exports_test_so.txt #
2+
3+
#
4+
#//===----------------------------------------------------------------------===//
5+
#//
6+
#// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
7+
#// See https://llvm.org/LICENSE.txt for license information.
8+
#// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
9+
#//
10+
#//===----------------------------------------------------------------------===//
11+
#
12+
13+
# This is used only to test if the linker supports version scripts. If the full
14+
# version script it used we may error on undefined symbols and erroneously fail.
15+
16+
VERSION {
17+
18+
global: # Exported symbols.
19+
20+
*; # All symbols as exported for testing.
21+
22+
local: # Non-exported symbols.
23+
24+
*; # All other symbols are not exported.
25+
26+
}; # VERSION
27+
28+
# sets up GCC OMP_ version dependency chain
29+
OMP_1.0 {
30+
};
31+
OMP_2.0 {
32+
} OMP_1.0;
33+
OMP_3.0 {
34+
} OMP_2.0;
35+
OMP_3.1 {
36+
} OMP_3.0;
37+
OMP_4.0 {
38+
} OMP_3.1;
39+
OMP_4.5 {
40+
} OMP_4.0;
41+
OMP_5.0 {
42+
} OMP_4.5;
43+
44+
# sets up GCC GOMP_ version dependency chain
45+
GOMP_1.0 {
46+
};
47+
GOMP_2.0 {
48+
} GOMP_1.0;
49+
GOMP_3.0 {
50+
} GOMP_2.0;
51+
GOMP_4.0 {
52+
} GOMP_3.0;
53+
GOMP_4.5 {
54+
} GOMP_4.0;
55+
GOMP_5.0 {
56+
} GOMP_4.5;
57+
GOMP_5.0.1 {
58+
} GOMP_5.0;
59+
60+
# end of file #

0 commit comments

Comments
 (0)