[all-commits] [llvm/llvm-project] ce6b9b: [flang][runtime] Avoid dependency on libc++ for `s...

Markus Mützel via All-commits all-commits at lists.llvm.org
Thu Oct 26 05:30:39 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ce6b9b3b58b6c9e51d87084c916fa7aef81401f1
      https://github.com/llvm/llvm-project/commit/ce6b9b3b58b6c9e51d87084c916fa7aef81401f1
  Author: Markus Mützel <markus.muetzel at gmx.de>
  Date:   2023-10-26 (Thu, 26 Oct 2023)

  Changed paths:
    M flang/runtime/io-api.cpp

  Log Message:
  -----------
  [flang][runtime] Avoid dependency on libc++ for `std::__libcpp_verbose_abort`

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

Differential Revision: https://reviews.llvm.org/D158957




More information about the All-commits mailing list