[llvm] [openmp] Remaining work necessary for GCC 15 (PR #157385)
Patrick Simmons via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 11 04:01:10 PDT 2025
https://github.com/linuxrocks123 updated https://github.com/llvm/llvm-project/pull/157385
>From bdb9d87ad010189650abe6dec90dcb446deab4f6 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 1/3] 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
>From 36d8c0e5ce9a85899b4bdb7f6fa3017993c4f3b3 Mon Sep 17 00:00:00 2001
From: Patrick Simmons <psimmons at pensando.io>
Date: Mon, 8 Sep 2025 21:52:12 -0500
Subject: [PATCH 2/3] Fixed
---
openmp/runtime/src/CMakeLists.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/openmp/runtime/src/CMakeLists.txt b/openmp/runtime/src/CMakeLists.txt
index 6f84a753c2788..6ac047a833fe5 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 -D_GLIBCXX_NO_ASSERTIONS)
+ add_definitions(-U_GLIBCXX_ASSERTIONS)
endif()
# Add the OpenMP library
>From 3a47b7362fa6f77e7af3b72ce21c473ebf650693 Mon Sep 17 00:00:00 2001
From: Patrick Simmons <psimmons at pensando.io>
Date: Thu, 11 Sep 2025 06:00:02 -0500
Subject: [PATCH 3/3] Make suggested change to targets loop
---
flang-rt/cmake/modules/AddFlangRT.cmake | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/flang-rt/cmake/modules/AddFlangRT.cmake b/flang-rt/cmake/modules/AddFlangRT.cmake
index 75af278fa1c28..b72bdd01cf5e4 100644
--- a/flang-rt/cmake/modules/AddFlangRT.cmake
+++ b/flang-rt/cmake/modules/AddFlangRT.cmake
@@ -190,19 +190,22 @@ function (add_flangrt_library name)
endif ()
endif ()
+ # Must use minimum optimization level of -O2 to prevent dependency on libstdc++
+ foreach (tgtname IN LISTS srctargets)
+ 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 ()
+ endforeach ()
+
foreach (tgtname IN LISTS libtargets)
if (NOT WIN32)
# 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)
More information about the llvm-commits
mailing list