This change allows setting the default linker used by the Clang driver when configuring the build.
I agree here, if we're adding a cmake options for this, it should accept full paths to the linker to be used (without any need for its type like gold, bfd, etc) as well.
Additionally, if "" maps to "ld", plain CLANG_DEFAULT_LINKER="ld" should also work here.
Have you run all tests with CLANG_DEFAULT_LINKER not being the platform default? I imagine there might be some tests that expect ld to be used...
I agree with both points here.
I wonder whether this is really correct: If DefaultLinker is not ld (it is lld for some ToolChains), -fuse-ld= with an empty argument should probably not use ld but rather whatever DefaultLinker says...
I have two high level remarks here:
- CLANG_DEFAULT_LINKER should override whatever the platform default is. So ToolChain::getDefaultLinker() should return ld as the variable DefaultLinker currently says and the logic should be in ToolChain::GetLinkerPath().
- The CMake variable is documented to be empty for the platform default. I think this will currently not work when used by GetProgramPath(getDefaultLinker()), will it?
You can leave this return because Clang will exit anyway after emitting the error (as I had to learn...)
I think this could go into the header
Right, that does not work for the current version of the patch.
It was meant in conjunction with this comment: