[Openmp-commits] [flang] [llvm] [openmp] [Flang-RT] Fix GCC 15.1 Fortran Runtime libstdc++ Undefined Symbols (PR #157385)
Michael Kruse via Openmp-commits
openmp-commits at lists.llvm.org
Tue Oct 7 06:20:18 PDT 2025
================
@@ -231,6 +231,12 @@ function (add_flangrt_library name)
target_compile_options(${tgtname} PRIVATE
$<$<COMPILE_LANGUAGE:CXX>:-fno-exceptions -fno-rtti -funwind-tables -fno-asynchronous-unwind-tables>
)
+
+ # Define our own _GLIBCXX_THROW_OR_ABORT because libstdc++ headers
+ # reference std::exception in its definition, and we do not want
+ # to link against std::exception since doing that would link us to
+ # the C++ runtime.
----------------
Meinersbur wrote:
The comment is somewhat incorrect: libstdc++ does NOT use `std::exception` in its definition, (in the sense of `#define _GLIBCXX_THROW_OR_ABORT(...) std::exception`), but uses the `_EXC` argument which is typically is an exception and thus must not be used.
Please also add the following details:
* libstdc++ uses `(void)_EXC` to silence a warning
* Some compilers may not always optimize away that unreachable code (unreachable because it occurs after `__builtin_abort()`)
* The intention is to only remove that `(void)_EXC`, and nothing else
* Redefining _GLIBCXX_THROW_OR_ABORT is not officially supported by libstdc++
Since this use of _GLIBCXX_THROW_OR_ABORT is unsupported/undocumented, describing (correctly) what and why we are doing this is REALLY important.
https://github.com/llvm/llvm-project/pull/157385
More information about the Openmp-commits
mailing list