[flang-commits] [flang] [flang][Driver] Fix compiler-rt linker test with a libgcc unwinder (PR #212419)

via flang-commits flang-commits at lists.llvm.org
Tue Jul 28 00:05:34 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-flang-driver

Author: leovance (leovancekang)

<details>
<summary>Changes</summary>

`-rtlib=compiler-rt` selects compiler-rt builtins, while the unwind library is selected independently. When Clang is configured with `CLANG_DEFAULT_UNWINDLIB=libgcc`, the driver therefore emits `-lgcc_s` alongside `libclang_rt.builtins.a`.

The existing `COMPILER-RT-NOT` check for `-lgcc_s` in `flang/test/Driver/linker-flags.f90` causes the test to fail in this configuration. This change removes that negative check while retaining the `-lgcc` check to ensure that the driver does not select libgcc builtins. This is a test-only change; driver behavior is unchanged.

### Testing

Built with `-DCLANG_DEFAULT_RTLIB=compiler-rt` and `-DCLANG_DEFAULT_UNWINDLIB=libgcc`.

- `build-release/bin/llvm-lit -sv --filter='Driver/linker-flags\.f90$' build-release/tools/flang/test`: passed
- `cmake --build build-release --target check-flang --parallel 12`: passed with no unexpected failures (4636 passed, 173 unsupported, and 11 expected failures)

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


1 Files Affected:

- (modified) flang/test/Driver/linker-flags.f90 (+2-1) 


``````````diff
diff --git a/flang/test/Driver/linker-flags.f90 b/flang/test/Driver/linker-flags.f90
index 2b56fdfb8da05..ab7182c3064a2 100644
--- a/flang/test/Driver/linker-flags.f90
+++ b/flang/test/Driver/linker-flags.f90
@@ -85,5 +85,6 @@
 ! MSVC-SAME: /subsystem:console
 ! MSVC-SAME: "[[object_file]]"
 
+! The compiler runtime and unwind library are selected independently. A
+! configured libgcc unwinder may therefore add "-lgcc_s" with compiler-rt.
 ! COMPILER-RT-NOT: "-lgcc"
-! COMPILER-RT-NOT: "-lgcc_s"

``````````

</details>


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


More information about the flang-commits mailing list