Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
lib/Driver/Tools.cpp | ||
---|---|---|
7987 ↗ | (On Diff #16667) | Why don't you just pass "lld-link" (not "lld") to -fuse-ld option? |
lib/Driver/Tools.cpp | ||
---|---|---|
7987 ↗ | (On Diff #16667) | Because there should be a consistent syntax for specifying "link with lld" regardless of which platform you're on. I don't want it to be -fuse-ld=lld on Linux, and -fuse-ld=lld-link on Windows, for example. |
lib/Driver/Tools.cpp | ||
---|---|---|
7990 ↗ | (On Diff #16667) | Somewhat tangential: It would be nice if clang could default to lld-link if link.exe isn't found. If I'm using clang-cl targeting Windows on non-Windows, and lld-link is in the same directory as clang-cl, it'd be great if clang-cl would then transparently use lld-link to link my PE binary instead of telling me "unable to execute command: Executable "link.exe" doesn't exist!" (Not sure if this should be part of this change, but it's in the same code at least.) |
lib/Driver/Tools.cpp | ||
---|---|---|
7987 ↗ | (On Diff #16667) | Got it. |
7990 ↗ | (On Diff #16667) | Besides the issue how to find libraries in the environment where link.exe doesn't exist, lld currently depends on a few external command. rc.exe (resource compiler) and lib.exe (ar command) are needed. In order to make such silent fallback work, we need to eliminate that dependency. |
I'm kind of bummed that we have to special case lld, but I guess that's the spirit of the gcc flag anyway. This seems like the right direction.
lib/Driver/Tools.cpp | ||
---|---|---|
7982 ↗ | (On Diff #16667) | Clang code uses StudlyCaps for variable names. (Yaaay!) |
7983 ↗ | (On Diff #16667) | There are some idioms that can make this code more concise. getLastArgValue() exists and takes a default value, and const char * converts implicitly to StringRef. This can probably be: StringRef Linker = Args.getLastArgValue(options::OPT_fuse_ld_EQ, "link"); if (Linker.equals_lower("lld")) Linker = "lld-link"; if (Linker.equals_lower("link")) { ... |
Cleaned up the special casing code a little bit. Thanks for the suggestion, this is much cleaner.