[clang] [Flang] Link `-lflang_rt.runtime` if available on the device (PR #132737)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 24 07:06:00 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Joseph Huber (jhuber6)
<details>
<summary>Changes</summary>
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.
---
Full diff: https://github.com/llvm/llvm-project/pull/132737.diff
1 Files Affected:
- (modified) clang/lib/Driver/ToolChains/Clang.cpp (+5)
``````````diff
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index fb3ed2db0e3c0..d7da2af321e7b 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 (HasCompilerRT)
+ CmdArgs.push_back(
+ Args.MakeArgString("--device-linker=" + TC.getTripleString() + "=" +
+ "-lflang_rt.runtime"));
});
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/132737
More information about the cfe-commits
mailing list