[PATCH] D112126: [libunwind] Try to add -unwindlib=none while configuring and building libunwind

Harald van Dijk via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 25 09:03:58 PDT 2021


hvdijk added a comment.

In D112126#3084606 <https://reviews.llvm.org/D112126#3084606>, @ldionne wrote:

> Honestly, this feels a bit messy to me. At some point I had a patch to set `CMAKE_TRY_COMPILE_TARGET_TYPE` to `STATIC` for all runtimes, unconditionally. We ended up not doing it over some concerns about the correctness of the change, however perhaps we should re-consider that?

@mstorsjo wrote earlier that that approach causes tests that rely on linking to pass when they should not (checking whether libraries exist), and I fear that may be an unavoidable problem since the sole purpose of `CMAKE_TRY_COMPILE_TARGET_TYPE=STATIC` is to avoid having CMake run the linker at configure time.

> Also TBH the more I look at it, the more I think that `check_c_compiler_flag` and the similar utilities provided by CMake out of the box don't work that well for our use case, since we run without a toolchain. Maybe we should consider moving away from those in the runtimes.

compiler-rt builtins & crt do not need linker tests so `CMAKE_TRY_COMPILE_TARGET_TYPE=STATIC` is fine, and builtins already sets that. crt doesn't, and will need the same handling as builtins, but that should be possible without any issues. With `CMAKE_TRY_COMPILE_TARGET_TYPE=STATIC` set, `check_c_compiler_flag` does work.

libcxx and libcxxabi are odd in that they are built without a fully functional C++ compiler, but with a fully functional C compiler, and the C compiler is used to the relevant tests, the C++ compiler is simply not checked by CMake so everything works out. (I have not checked how that is done, I only see from my build logs that it never makes any mention of clang++.)

libunwind is the only special one, it needs to run linker tests before we have a fully functional C compiler, so having special tricks in there to make the C compiler *almost* fully functional, functional enough to pass the remaining CMake tests, should be good enough, I think.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112126/new/

https://reviews.llvm.org/D112126



More information about the llvm-commits mailing list