diff options
| author | Michael Kruse <llvm-project@meinersbur.de> | 2025-08-27 10:10:48 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-27 10:10:48 +0200 |
| commit | 88f8ab01b5855bbd7375b7a3d83d9a78d77f3fdf (patch) | |
| tree | 77196c1597336b2b8a171048314fa57fcd4c0159 | |
| parent | 6551f7f1cd623e04e30c06eb58a85ef2fd768be9 (diff) | |
[Flang-RT][OpenMP] Define _GLIBCXX_NO_ASSERTIONS (#155440)
Since GCC 15.1, libstdc++ enabled assertions/hardening by default in
non-optimized (-O0) builds [1]. That is, _GLIBCXX_ASSERTIONS is defined
in the libstdc++ headers itself so defining/undefining it on the
compiler command line no longer has an effect in non-optimized builds.
As the commit message[2] suggests, define _GLIBCXX_NO_ASSERTIONS
instead.
For libstdc++ headers before 15.1, -U_GLIBCXX_ASSERTIONS still has to be
on the command line as well.
Defining _GLIBCXX_NO_ASSERTIONS was previously proposed in #152223
[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112808
[2] https://github.com/gcc-mirror/gcc/commit/361d230fd7800a7e749aba8ed020f54f5c26d504
| -rw-r--r-- | flang-rt/cmake/modules/AddFlangRT.cmake | 1 | ||||
| -rw-r--r-- | openmp/runtime/src/CMakeLists.txt | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/flang-rt/cmake/modules/AddFlangRT.cmake b/flang-rt/cmake/modules/AddFlangRT.cmake index 58541609829c..66e54bd2103a 100644 --- a/flang-rt/cmake/modules/AddFlangRT.cmake +++ b/flang-rt/cmake/modules/AddFlangRT.cmake @@ -281,6 +281,7 @@ function (add_flangrt_library name) # Disable libstdc++/libc++ assertions, even in an LLVM_ENABLE_ASSERTIONS # build, to avoid an unwanted dependency on libstdc++/libc++.so. + target_compile_definitions(${tgtname} PUBLIC _GLIBCXX_NO_ASSERTIONS) if (FLANG_RT_SUPPORTS_UNDEFINE_FLAG) target_compile_options(${tgtname} PUBLIC -U_GLIBCXX_ASSERTIONS) target_compile_options(${tgtname} PUBLIC -U_LIBCPP_ENABLE_ASSERTIONS) diff --git a/openmp/runtime/src/CMakeLists.txt b/openmp/runtime/src/CMakeLists.txt index 08e1753b9363..b22d03d16841 100644 --- a/openmp/runtime/src/CMakeLists.txt +++ b/openmp/runtime/src/CMakeLists.txt @@ -167,6 +167,7 @@ endif() # Disable libstdc++ assertions, even in an LLVM_ENABLE_ASSERTIONS build, to # avoid an unwanted dependency on libstdc++.so. +add_compile_definitions(_GLIBCXX_NO_ASSERTIONS) if(NOT WIN32) add_definitions(-U_GLIBCXX_ASSERTIONS) endif() |
