Skip to content

Commit eb48aac

Browse files
authored
[Clang] Automatically link the compiler-rt for GPUs if present (llvm#109152)
Summary: This automically links `copmiler-rt` for offloading languages if it exists in the resource directory.
1 parent 8588c6e commit eb48aac

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9242,6 +9242,12 @@ void LinkerWrapper::ConstructJob(Compilation &C, const JobAction &JA,
92429242
CmdArgs.push_back(Args.MakeArgString(
92439243
"--device-linker=" + TC.getTripleString() + "=" + "-lm"));
92449244
}
9245+
auto HasCompilerRT = getToolChain().getVFS().exists(
9246+
TC.getCompilerRT(Args, "builtins", ToolChain::FT_Static));
9247+
if (HasCompilerRT)
9248+
CmdArgs.push_back(
9249+
Args.MakeArgString("--device-linker=" + TC.getTripleString() + "=" +
9250+
"-lclang_rt.builtins"));
92459251
});
92469252
}
92479253

0 commit comments

Comments
 (0)