[PATCH] D119841: [OpenMP] Pass AMDGPU math libraries into the linker wrapper

Johannes Doerfert via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 15 13:34:10 PST 2022


jdoerfert added inline comments.


================
Comment at: clang/lib/Driver/ToolChains/Clang.cpp:8205
+    if (llvm::find(LibraryArgs, "m") == LibraryArgs.end() && !D.CCCIsCXX())
+      continue;
+
----------------
JonChesterfield wrote:
> jhuber6 wrote:
> > jdoerfert wrote:
> > > I'd switch the conditions.
> > > 
> > > More importantly, does this require that the user passes -lm to the linker invocation? I'm not convinced we should not always link these in.
> > Yes, would save some time assuming most codes are C++
> > 
> > So I figured I'd copy the same semantics of how `-lm` works where you need to specify it for C but not C++. We could just pass this in all the time, but since linking it in currently required `-lm` I copied that.
> re: always linking these libraries in, regardless of -lm, it's probably better to link them by default and effectively ignore -lm.
> 
> I'd like to keep it guarded by -nogpulib or similar so that people can still opt out of the rocm device library stack entirely.
Opting out of "optional" gpu libraries is fine. I want to avoid that one needs to add linking flags etc. for OpenMP. We link libdevice by default too, so this is no different (as both contain math function impl etc.)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D119841/new/

https://reviews.llvm.org/D119841



More information about the cfe-commits mailing list