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

Joseph Huber via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 9 09:14:49 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();
----------------
jhuber6 wrote:

It's not really offload in this context, since it deals with `clang --target=amdgcn-amd-amdhsa`. But I could see putting it in `CommonArgs`. 

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


More information about the cfe-commits mailing list