[Openmp-commits] [openmp] [OpenMP] Disable unwanted dependency on libstdc++ for libomp (PR #73249)

Tim Gymnich via Openmp-commits openmp-commits at lists.llvm.org
Thu Nov 23 07:22:06 PST 2023


https://github.com/tgymnich created https://github.com/llvm/llvm-project/pull/73249

Disable libstdc++/libc++ assertions, in an LLVM_ENABLE_ASSERTIONS build, to avoid an unwanted dependency on libstdc++/libc++.so.

fixes #73248

>From 79d0d90084ac97b9b94dbc2097ec5af5a3175caa Mon Sep 17 00:00:00 2001
From: Tim Gymnich <tgymnich at icloud.com>
Date: Thu, 23 Nov 2023 12:00:32 +0000
Subject: [PATCH] [OpenMP] Remove unwanted dependency on libstdc++ for libomp

Disable libstdc++/libc++ assertions, even in an LLVM_ENABLE_ASSERTIONS build, to avoid an unwanted dependency on libstdc++/libc++.so.
---
 openmp/runtime/src/CMakeLists.txt | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/openmp/runtime/src/CMakeLists.txt b/openmp/runtime/src/CMakeLists.txt
index 8b2445ac58bf0ca..cc9f38488926e94 100644
--- a/openmp/runtime/src/CMakeLists.txt
+++ b/openmp/runtime/src/CMakeLists.txt
@@ -135,6 +135,11 @@ libomp_get_asmflags(LIBOMP_CONFIGURED_ASMFLAGS)
 set_source_files_properties(${LIBOMP_CXXFILES} PROPERTIES COMPILE_FLAGS "${LIBOMP_CONFIGURED_CXXFLAGS}")
 set_source_files_properties(${LIBOMP_ASMFILES} ${LIBOMP_GNUASMFILES} PROPERTIES COMPILE_FLAGS "${LIBOMP_CONFIGURED_ASMFLAGS}")
 
+# Disable libstdc++/libc++ assertions, even in an LLVM_ENABLE_ASSERTIONS build,
+# to avoid an unwanted dependency on libstdc++/libc++.so.
+add_definitions(-U_GLIBCXX_ASSERTIONS)
+add_definitions(-U_LIBCPP_ENABLE_ASSERTIONS)
+
 # Remove any cmake-automatic linking of the standard C++ library.
 # We neither need (nor want) the standard C++ library dependency even though we compile c++ files.
 if(NOT ${LIBOMP_USE_STDCPPLIB})



More information about the Openmp-commits mailing list