[PATCH] D15596: Add -L/path/to/cuda/lib if any of our inputs are CUDA files.

Artem Belevich via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 5 17:03:09 PST 2016


tra added inline comments.

================
Comment at: lib/Driver/ToolChains.cpp:4125
@@ +4124,3 @@
+                              ArgStringList &LDArgs) const {
+  if (DriverArgs.hasArg(options::OPT_nocudalib) || !CudaInstallation.isValid())
+    return;
----------------
I'd rename -nocudalib to -nocudalibdevice (or -nocudabclib) to better reflect what it currently does -- disables linking with CUDA's libdevice bitcode.

Then you could use -nocudalib to control automatic addition of CUDA library-related options which would be closer to what '-nostdlib' does.

While you're at it, you may consider adding linker flags to link with static libcudart. nvcc always adds "-lcudart_static  -lrt -lpthread  -ldl" at the end. If user explicitly requests linking with dynamic version of libcudart, then it gets linked first, and linker then ignores all the symbols from static lib.



http://reviews.llvm.org/D15596





More information about the cfe-commits mailing list