[clang] b1a8e6e - [Flang] Link `-lflang_rt.runtime` if available on the device (#132737)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 24 08:02:44 PDT 2025
Author: Joseph Huber
Date: 2025-03-24T10:02:39-05:00
New Revision: b1a8e6e3ae1d7d8c8dbb5e3b9c5df03283fca279
URL: https://github.com/llvm/llvm-project/commit/b1a8e6e3ae1d7d8c8dbb5e3b9c5df03283fca279
DIFF: https://github.com/llvm/llvm-project/commit/b1a8e6e3ae1d7d8c8dbb5e3b9c5df03283fca279.diff
LOG: [Flang] Link `-lflang_rt.runtime` if available on the device (#132737)
Summary:
Now that we can build the Fortran runtime on the GPU (mostly) we should
be able to implicitly link it if it exists. This matches the normal
behavior where it is included implicity. No tests because it
would require a full VFS and is fairly trivial.
---------
Co-authored-by: Michael Kruse <github at meinersbur.de>
Added:
Modified:
clang/lib/Driver/ToolChains/Clang.cpp
Removed:
################################################################################
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index fb3ed2db0e3c0..7aa2b32acc235 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -9337,6 +9337,11 @@ void LinkerWrapper::ConstructJob(Compilation &C, const JobAction &JA,
CmdArgs.push_back(
Args.MakeArgString("--device-linker=" + TC.getTripleString() + "=" +
"-lclang_rt.builtins"));
+ bool HasFlangRT = HasCompilerRT && C.getDriver().IsFlangMode();
+ if (HasFlangRT)
+ CmdArgs.push_back(
+ Args.MakeArgString("--device-linker=" + TC.getTripleString() + "=" +
+ "-lflang_rt.runtime"));
});
}
More information about the cfe-commits
mailing list