[compiler-rt] Reapply [compiler-rt] Check for and use -lunwind when linking with -nodefaultlibs (PR #66584)

Martin Storsjö via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 21 01:33:43 PDT 2023


mstorsjo wrote:

> I'm surprised that CMake is trying to use targets defined in the same build in `try_compile`. What would happen if this a `LIBRARY` target like `unwind_shared` or `unwind_static`? That target hasn't been built yet (it's built by the build we're configuring). Is this a CMake issue or is there a well defined behavior for this case?

I tested replacing this with a check for `unwind_shared`, and that proceeded just fine (and it tested linking right away even if the target `unwind_shared` wasn't found).

Thus, if the `unwind` target wouldn't be of the type `UTILITY`, this might work - but would that cause other cmake confusion at some point? If the target/library entity `unwind` both means a preexisting library (link by passing `-lunwind`) and a library that gets built during the build (where it instead adds dependencies on it, builds that before using it, and links against the newly generated file instead of necessarily using literally `-lunwind`).

https://github.com/llvm/llvm-project/pull/66584


More information about the llvm-commits mailing list