[Openmp-commits] [compiler-rt] [openmp] [OpenMP] Allow libomp.so to link in Debug build with GCC 15 libstdc++ (PR #175463)

via Openmp-commits openmp-commits at lists.llvm.org
Sun Jan 11 13:38:28 PST 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: Rainer Orth (rorth)

<details>
<summary>Changes</summary>

As detailed in Issue #<!-- -->153569, a `Debug` build with the `GCC 15` `libstdc++` `FAIL`s to link `libomp.so`.

To avoid this, one needs to define `_GLIBCXX_NO_ASSERTIONS`.

Tested on `x86_64-pc-solaris2.11`.

---
Full diff: https://github.com/llvm/llvm-project/pull/175463.diff


2 Files Affected:

- (modified) compiler-rt/test/ubsan/TestCases/Misc/Posix/static-link.cpp (+1-1) 
- (modified) openmp/runtime/src/kmp.h (+6) 


``````````diff
diff --git a/compiler-rt/test/ubsan/TestCases/Misc/Posix/static-link.cpp b/compiler-rt/test/ubsan/TestCases/Misc/Posix/static-link.cpp
index 081eec049e3fc..daa76b7322669 100644
--- a/compiler-rt/test/ubsan/TestCases/Misc/Posix/static-link.cpp
+++ b/compiler-rt/test/ubsan/TestCases/Misc/Posix/static-link.cpp
@@ -6,7 +6,7 @@
 // UNSUPPORTED: i386-target-arch, internal_symbolizer
 
 // Does not link.
-// UNSUPPORTED: darwin
+// UNSUPPORTED: darwin,target={{.*solaris.*}}
 
 #include <signal.h>
 #include <stdio.h>
diff --git a/openmp/runtime/src/kmp.h b/openmp/runtime/src/kmp.h
index 36c40abaf1ef4..db6b4238d4906 100644
--- a/openmp/runtime/src/kmp.h
+++ b/openmp/runtime/src/kmp.h
@@ -48,6 +48,12 @@
 #define KMP_CANCEL_THREADS
 #define KMP_THREAD_ATTR
 
+// GCC 15 libstdc++ enables debug assertions in unoptimized builds.
+// Disable them to allow libomp.so to link without libstdc++.so.
+#if !__OPTIMIZE__
+#define GLIBCXX_NO_ASSERTIONS
+#endif
+
 // Android does not have pthread_cancel.  Undefine KMP_CANCEL_THREADS if being
 // built on Android
 #if defined(__ANDROID__)

``````````

</details>


https://github.com/llvm/llvm-project/pull/175463


More information about the Openmp-commits mailing list