MINGW-packages: Clang's LLD is broken, again!

After the last update of the llvm packages (9.0.0-3), LDD no longer works. ld.lld.exe hangs indefinitely. (It miraculously worked once for me, but no luck since then.)

You can reproduce it simply by running

echo -e '#include <iostream>\nint main() {std::cout << "Hello!\\n";}' >a.cpp
clang++ -fuse-ld=lld a.cpp

This closely resembles bug https://github.com/msys2/MINGW-packages/issues/5231 that was already fixed.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 1
  • Comments: 19 (9 by maintainers)

Commits related to this issue

Most upvoted comments

On Linux, if a process calls exit() or returns from main(), the other threads are still running. The process will eventually exit despite them. It is not necessary to join with them, but it is cructial that they do not access destroyed (static) objects.

On Windows, if a process calls exit() or returns from main(), the other threads are terminated at unpredictable locations before TLS callbacks. This places significant limits on what DllMain() and TLS callbacks can do and what they must not do.

Your suggestion to bypass destructors upon process exit doesn’t seem correct to me, as such behavior is required by Itanium ABI. My opinion is that LLD should wait for worker threads explicitly before returning from main(), or if really those threads are out of question, call ::Terminate(::GetCurrentProcess()) instead.