[Openmp-commits] [llvm] [openmp] Remaining work necessary for GCC 15 (PR #157385)
Patrick Simmons via Openmp-commits
openmp-commits at lists.llvm.org
Sun Sep 7 22:13:51 PDT 2025
https://github.com/linuxrocks123 created https://github.com/llvm/llvm-project/pull/157385
- Use at least -O2 on Flang runtime to prevent linking in libstdc++.
- Fully disable glibc assertions for OpenMP runtime.
>From 8a9062855192544c1a75d3a3270c2c117a197689 Mon Sep 17 00:00:00 2001
From: Patrick Simmons <psimmons at pensando.io>
Date: Sun, 7 Sep 2025 23:44:02 -0500
Subject: [PATCH] Remaining work necessary for GCC 15
---
flang-rt/cmake/modules/AddFlangRT.cmake | 8 ++++++++
openmp/runtime/src/CMakeLists.txt | 2 +-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/flang-rt/cmake/modules/AddFlangRT.cmake b/flang-rt/cmake/modules/AddFlangRT.cmake
index 66e54bd2103a3..75af278fa1c28 100644
--- a/flang-rt/cmake/modules/AddFlangRT.cmake
+++ b/flang-rt/cmake/modules/AddFlangRT.cmake
@@ -195,6 +195,14 @@ function (add_flangrt_library name)
# Use same stem name for .a and .so. Common in UNIX environments.
# Not possible in Windows environments.
set_target_properties(${tgtname} PROPERTIES OUTPUT_NAME "${name}")
+
+ # Must use minimum optimization level of -O2 to prevent dependency on libstdc++
+ string(REPLACE "-O0" "-O2" CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS)
+ string(REPLACE "-O1" "-O2" CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS)
+ string(FIND "-O" CMAKE_CXX_FLAGS opt_idx)
+ if (opt_idx EQUAL -1)
+ target_compile_options(${tgtname} PRIVATE -O2)
+ endif ()
endif ()
if (ARG_INSTALL_WITH_TOOLCHAIN)
diff --git a/openmp/runtime/src/CMakeLists.txt b/openmp/runtime/src/CMakeLists.txt
index 6ac047a833fe5..6f84a753c2788 100644
--- a/openmp/runtime/src/CMakeLists.txt
+++ b/openmp/runtime/src/CMakeLists.txt
@@ -170,7 +170,7 @@ endif()
# avoid an unwanted dependency on libstdc++.so.
add_compile_definitions(_GLIBCXX_NO_ASSERTIONS)
if(NOT WIN32)
- add_definitions(-U_GLIBCXX_ASSERTIONS)
+ add_definitions(-U_GLIBCXX_ASSERTIONS -D_GLIBCXX_NO_ASSERTIONS)
endif()
# Add the OpenMP library
More information about the Openmp-commits
mailing list