Skip to content

Commit 3c4e6c1

Browse files
authored
[flang][Driver] When linking with the Fortran runtime, the addArchSpecificRPath() should be called too (#114837)
When linking with other runtimes (OpenMP, sanitizers), the addArchSpecificRPath() is being called. The same thing should happen when linking with the Fortran runtime, this will improve user experience massively.
1 parent 2bbb6c0 commit 3c4e6c1

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

clang/lib/Driver/ToolChains/CommonArgs.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1293,6 +1293,7 @@ void tools::addFortranRuntimeLibs(const ToolChain &TC, const ArgList &Args,
12931293
}
12941294
CmdArgs.push_back("-lFortranRuntime");
12951295
CmdArgs.push_back("-lFortranDecimal");
1296+
addArchSpecificRPath(TC, Args, CmdArgs);
12961297
}
12971298

12981299
// libomp needs libatomic for atomic operations if using libgcc

flang/test/Driver/arch-specific-libdir-rpath.f95

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@
1616
!
1717
! Test that -rpath is added
1818
!
19+
! Add LIBPATH, RPATH
20+
!
21+
! RUN: %flang %s -### --target=x86_64-linux \
22+
! RUN: -resource-dir=%S/../../../clang/test/Driver/Inputs/resource_dir_with_arch_subdir \
23+
! RUN: -frtlib-add-rpath 2>&1 \
24+
! RUN: | FileCheck --check-prefixes=RESDIR,LIBPATH-X86_64,RPATH-X86_64 %s
25+
!
1926
! Add LIBPATH, RPATH for OpenMP
2027
!
2128
! RUN: %flang %s -### --target=x86_64-linux -fopenmp \

0 commit comments

Comments
 (0)