Diff Detail
Event Timeline
lib/Driver/Tools.cpp | ||
---|---|---|
277–279 | Style nit -- no need for curly braces. |
I'm sorry I sat on this for so long; I failed at email somehow, and only came back to ping this patch. :)
lib/Driver/ToolChains.cpp | ||
---|---|---|
4125 | Hm...I don't want to over-complicated the UI. Is there prior art for what we're doing here that we could crib off? |
lib/Driver/ToolChains.cpp | ||
---|---|---|
4125 | 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. |
lib/Driver/ToolChains.cpp | ||
---|---|---|
4125 | Sounds like a plan. I'll send separate patches for each of these. |
Now also pass -lcudart_static -lcuda -ldl -lrt -pthread for CUDA compiles.
Depends on D15933.
include/clang/Driver/Options.td | ||
---|---|---|
1636 ↗ | (On Diff #44145) | include -> link with Perhaps less implementation details would be more appropriate for a help string. |
lib/Driver/ToolChains.cpp | ||
4129–4137 | Does this kick in before user's arguments have been added or after? Skipping -lFOO will also have problems if any of the libraries are static and one of preceding libraries needs extra symbols that were not linked in by this point yet. Link with required libraries unconditionally. Make sure to add these libraries after user arguments have been added. | |
4139 | -lcuda is not needed. As far as I can tell, cudart_static will open and use it via dlopen. It would be needed only if user uses any of API calls from libcuda directly, but then it would be up to user to add -lcuda. | |
4142 | -lpthread |
Updated code; please have a look.
include/clang/Driver/Options.td | ||
---|---|---|
1636 ↗ | (On Diff #44145) |
Done.
I'm not sure about that? Maybe if we were just including -lcudart_static, but given that we're pulling in other libraries and adding a library search path, I feel like we should tell users what we're doing? I mean, we should document it somewhere, and here's where people are actually going to find it... |
lib/Driver/ToolChains.cpp | ||
4129–4137 |
After; I wrote tests. :)
Done. | |
4142 | Oh, I see, -pthread is a compile-time flag, not a link-time flag. Thanks. |
lib/Driver/ToolChains.cpp | ||
---|---|---|
4129–4137 | Although then I deleted the relevant tests... I just added new ones. :) |
Minor nit, but looks good otherwise.
include/clang/Driver/Options.td | ||
---|---|---|
1636 ↗ | (On Diff #44160) | Implementation details may be different on different platforms. I.e. you may need to link with different set of libraries if/when we add missing bits for windows and your help string will make no sense there. Specifics should be in the documentation, IMO. |
lib/Driver/ToolChains.cpp | ||
4130 | {}, again. |
Address tra's review comments.
include/clang/Driver/Options.td | ||
---|---|---|
1636 ↗ | (On Diff #44160) | OK, that's a good reason not to do it in the command-line help. |
lib/Driver/Tools.cpp | ||
---|---|---|
276 | It just struck me that this patch may not be as useful as we'd like it to be. For typical compilation source-to-object and object-to-executable are separate phases. |
It just struck me that this patch may not be as useful as we'd like it to be.
Oh. Yes.
I guess I'll drop this and D15939. :(
We may need a new option as -nocudalib is currently used to disable linking with libdevice bitcode library.