[flang-commits] [flang] [flang][test] Expect a single -rpath in fveclib.f90 ArmPL check (PR #220969)

Eugene Epshteyn via flang-commits flang-commits at lists.llvm.org
Thu Sep 3 08:19:51 PDT 2026


https://github.com/eugeneepshteyn created https://github.com/llvm/llvm-project/pull/220969

Fixes a `check-flang` failure on main: `Flang :: Driver/fveclib.f90`.

#220697 consolidated `tools::addArchSpecificRPath()` down to a single call site — it was removed from `ToolChain::addFlangRTLibPath()` and from the `-fveclib=ArmPL` block in `tools::AddLinkerInputs()`, and one unconditional call was hoisted to the end of `AddLinkerInputs()`. A link line can therefore emit each candidate rpath at most once, so `CHECK-RPATH-ARMPL` fails on its second `-rpath` match:

```
flang/test/Driver/fveclib.f90:59:27: error: CHECK-RPATH-ARMPL-SAME: expected string not found in input
! CHECK-RPATH-ARMPL-SAME: "-rpath"
                          ^
```

The two matches only ever passed because `addArchSpecificRPath()` is a pure function of the toolchain and the argument list, so the two former call sites emitted identical paths. The test was matching a duplicate rpath, not the separate veclib and Fortran-runtime entries that its comment described. The arch-specific runtime directory — which is where `flang_rt` lives — is still emitted once, so no rpath is actually lost:

```
$ flang -### -frtlib-add-rpath hello.f90
"-rpath" ".../lib/clang/24/lib/x86_64-unknown-linux-gnu"
```

This drops the stale comment and the extra check so that the flang test matches the equivalent `CHECK-RPATH-ARMPL` in `clang/test/Driver/fveclib.c`, which runs the same command, already expects a single `-rpath`, and passes.

`check-flang` `Driver/` is clean with this change (267 tests, 0 failures), as are `clang/test/Driver/fveclib.c`, `clang/test/Driver/arch-specific-libdir-rpath.c`, and `flang/test/Driver/arch-specific-libdir-rpath.f95`.

>From 4b2cf6d1806f296a157cb3774ec4e2cb59cc4d7c Mon Sep 17 00:00:00 2001
From: Eugene Epshteyn <eepshteyn at nvidia.com>
Date: Thu, 3 Sep 2026 11:19:06 -0400
Subject: [PATCH] [flang][test] Expect a single -rpath in fveclib.f90 ArmPL
 check

#220697 consolidated `tools::addArchSpecificRPath()` down to a single
call site: it was removed from `ToolChain::addFlangRTLibPath()` and from
the `-fveclib=ArmPL` block in `tools::AddLinkerInputs()`, and one
unconditional call was hoisted to the end of `AddLinkerInputs()`. A link
line can therefore emit each candidate rpath at most once, and
CHECK-RPATH-ARMPL in flang/test/Driver/fveclib.f90 has been failing on
its second `-rpath` match since.

The two `-rpath` matches only ever passed because `addArchSpecificRPath()`
is a pure function of the toolchain and arguments, so the two former call
sites emitted identical paths -- the test was matching a duplicate, not
the separate veclib and Fortran-runtime entries its comment described.
The arch-specific runtime directory is still emitted once, so nothing is
lost. Drop the stale comment and the extra check, matching the equivalent
CHECK-RPATH-ARMPL in clang/test/Driver/fveclib.c, which already expects a
single `-rpath` and passes.
---
 flang/test/Driver/fveclib.f90 | 2 --
 1 file changed, 2 deletions(-)

diff --git a/flang/test/Driver/fveclib.f90 b/flang/test/Driver/fveclib.f90
index d21e85e486f8d..3a02a597eb67e 100644
--- a/flang/test/Driver/fveclib.f90
+++ b/flang/test/Driver/fveclib.f90
@@ -54,6 +54,4 @@
 
 ! RUN: %flang -### --target=aarch64-linux-gnu -resource-dir=%S/../../../clang/test/Driver/Inputs/resource_dir_with_arch_subdir -frtlib-add-rpath -fveclib=ArmPL %s 2>&1 | FileCheck --check-prefix=CHECK-RPATH-ARMPL %s
 ! CHECK-RPATH-ARMPL: "--push-state" "--as-needed" "-lm" "-lamath" "-lm" "--pop-state"
-! We need to see "-rpath" at least twice, one for veclib, one for the Fortran runtime
-! CHECK-RPATH-ARMPL-SAME: "-rpath"
 ! CHECK-RPATH-ARMPL-SAME: "-rpath"



More information about the flang-commits mailing list