[clang] [Clang] Make the GPU toolchains implicitly link `-lm` and `-lc` (PR #98170)

Yaxun Liu via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 9 09:13:36 PDT 2024


================
@@ -633,6 +633,17 @@ void amdgpu::Linker::ConstructJob(Compilation &C, const JobAction &JA,
   else if (Args.hasArg(options::OPT_mcpu_EQ))
     CmdArgs.push_back(Args.MakeArgString(
         "-plugin-opt=mcpu=" + Args.getLastArgValue(options::OPT_mcpu_EQ)));
+
+  // If the user's toolchain has the 'include/amdgcn-amd-amdhsa/` path, we
+  // assume it supports the standard C libraries for the GPU and include them.
+  bool HasLibC = getToolChain().getStdlibIncludePath().has_value();
----------------
yxsamliu wrote:

maybe refactor as a member of ToolChain::addOffloadLibCArgs

https://github.com/llvm/llvm-project/pull/98170


More information about the cfe-commits mailing list