-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[Clang] Automatically link the compiler-rt
for GPUs if present
#109152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Summary: This automically links `copmiler-rt` for offloading languages if it exists in the resource directory.
@llvm/pr-subscribers-clang-driver @llvm/pr-subscribers-clang Author: Joseph Huber (jhuber6) ChangesSummary: Full diff: https://github.com/llvm/llvm-project/pull/109152.diff 1 Files Affected:
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index c00df5f5bc729c..1e615214580134 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -9239,6 +9239,12 @@ void LinkerWrapper::ConstructJob(Compilation &C, const JobAction &JA,
CmdArgs.push_back(Args.MakeArgString(
"--device-linker=" + TC.getTripleString() + "=" + "-lm"));
}
+ auto HasCompilerRT = getToolChain().getVFS().exists(
+ TC.getCompilerRT(Args, "builtins", ToolChain::FT_Static));
+ if (HasCompilerRT)
+ CmdArgs.push_back(
+ Args.MakeArgString("--device-linker=" + TC.getTripleString() + "=" +
+ "-lclang_rt.builtins"));
});
}
|
I guess that makes sense. |
I'm not sure about this. What does |
It's |
I like this direction and I think it should be the right way. However, IMHO, I think it needs discussion (and potentially an RFC). |
Moving from the header to the definition in |
I ran this through a buildbot config and found no errors. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a reasonable change.
Summary:
This automically links
copmiler-rt
for offloading languages if itexists in the resource directory.