[flang-commits] [clang] [flang] [flang][Driver] Account for the default unwind library in linker test (PR #212419)

via flang-commits flang-commits at lists.llvm.org
Fri Aug 7 00:53:53 PDT 2026


leovancekang wrote:

> > Clang's clang/test/Driver/compiler-rt-unwind.c explicitly tests -rtlib=compiler-rt --unwindlib=libgcc and expects both libclang_rt.builtins.a and -lgcc_s. #144582 also adjusted Clang Driver tests to allow -lgcc_s when the configured defaults combined compiler-rt with the libgcc unwinder.
> 
> My understanding of this test is that it is explicitly checking that GCC's unwinder is not added when --rtlib is given. With this PR, you are explicitly changing what the test is checking for in order to workaround a configuration issue.
> 
> A proper fix for this would be to change the expectation of the test if a default unwind library is specified at configuration time.

@tarunprabhu Thanks. I updated the patch so that the expectation now depends on the configured default unwind library.

The patch exports `CLANG_DEFAULT_UNWINDLIB` through `ClangConfig.cmake`, propagates it to Flang's lit configuration, and requires `-lgcc_s` only when `libgcc` is the configured default. Other configurations continue to reject `-lgcc_s`, and the exact `-lgcc` linker argument remains rejected in all configurations.

I tested both `CLANG_DEFAULT_UNWINDLIB=libgcc` and an empty `CLANG_DEFAULT_UNWINDLIB` with the targeted test and the full `check-flang` suite.

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


More information about the flang-commits mailing list