Changes in libc++ during the development cycle for LLVM 17 lead to the FortranRuntime library depending on libc++.
Trying to build with Flang 17 that was built with clang++ 17 and libc++ 17 (on MinGW) leads to the following linker error:
ld.lld: error: undefined symbol: std::__1::__libcpp_verbose_abort(char const*, ...) >>> referenced by libFortranRuntime.a(io-api.cpp.obj):(std::__1::__throw_bad_variant_access[abi:v170000]()) >>> referenced by libFortranRuntime.a(io-stmt.cpp.obj) >>> referenced by libFortranRuntime.a(unit.cpp.obj)
That might be caused by std::get being called on a std::variant in common::visit.
std::__libcpp_verbose_abort is a weak symbol in libc++ that can be optionally replaced by an
alternative definition in user code (see: [1])
Do that to avoid a dependency of the FortranRuntime on libc++.
[1]: https://libcxx.llvm.org/UsingLibcxx.html#overriding-the-default-termination-handler
See also: https://github.com/msys2/MINGW-packages/pull/18002#issuecomment-1694412640