Sophie

Sophie

distrib > Mageia > 9 > x86_64 > by-pkgid > e3a4a6713f26889224e4a3a80f220f1e > files > 1

libomp-15.0.6-2.mga9.src.rpm

From c6e6231e2f467528e727bf9287c42975e778b8ed Mon Sep 17 00:00:00 2001
From: Joseph Huber <jhuber6@vols.utk.edu>
Date: Thu, 8 Dec 2022 13:34:38 -0500
Subject: [PATCH] [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.
---
(daviddavid) cherry picked from https://github.com/llvm/llvm-project/commit/c6e6231
---
 openmp/runtime/cmake/LibompHandleFlags.cmake |  1 -
 openmp/runtime/cmake/config-ix.cmake         |  3 +-
 openmp/runtime/src/exports_test_so.txt       | 60 ++++++++++++++++++++
 3 files changed, 61 insertions(+), 3 deletions(-)
 create mode 100644 openmp/runtime/src/exports_test_so.txt

diff --git a/openmp/runtime/cmake/config-ix.cmake b/openmp/runtime/cmake/config-ix.cmake
index 1e02d5a8b5cf1..1c688522a00a3 100644
--- a/openmp/runtime/cmake/config-ix.cmake
+++ b/openmp/runtime/cmake/config-ix.cmake
@@ -133,7 +133,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_test_so.txt" 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()
diff --git a/openmp/runtime/src/exports_test_so.txt b/openmp/runtime/src/exports_test_so.txt
new file mode 100644
index 0000000000000..912d160e7c068
--- /dev/null
+++ b/openmp/runtime/src/exports_test_so.txt
@@ -0,0 +1,60 @@
+# exports_test_so.txt #
+
+#
+#//===----------------------------------------------------------------------===//
+#//
+#// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+#// See https://llvm.org/LICENSE.txt for license information.
+#// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+#//
+#//===----------------------------------------------------------------------===//
+#
+
+# This is used only to test if the linker supports version scripts. If the full
+# version script it used we may error on undefined symbols and erroneously fail.
+
+VERSION {
+
+    global: # Exported symbols.
+
+        *;         # All symbols as exported for testing.
+
+    local: # Non-exported symbols.
+
+        *;         # All other symbols are not exported.
+
+}; # VERSION
+
+# sets up GCC OMP_ version dependency chain
+OMP_1.0 {
+};
+OMP_2.0 {
+} OMP_1.0;
+OMP_3.0 {
+} OMP_2.0;
+OMP_3.1 {
+} OMP_3.0;
+OMP_4.0 {
+} OMP_3.1;
+OMP_4.5 {
+} OMP_4.0;
+OMP_5.0 {
+} OMP_4.5;
+
+# sets up GCC GOMP_ version dependency chain
+GOMP_1.0 {
+};
+GOMP_2.0 {
+} GOMP_1.0;
+GOMP_3.0 {
+} GOMP_2.0;
+GOMP_4.0 {
+} GOMP_3.0;
+GOMP_4.5 {
+} GOMP_4.0;
+GOMP_5.0 {
+} GOMP_4.5;
+GOMP_5.0.1 {
+} GOMP_5.0;
+
+# end of file #