This change allows setting the default linker used by the Clang driver when configuring the build.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
CMakeLists.txt | ||
---|---|---|
198 | Is there a reason not to allow using the absolute path here, like for the command-line option? |
CMakeLists.txt | ||
---|---|---|
198 | 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...
CMakeLists.txt | ||
---|---|---|
198 | I agree with both points here. | |
lib/Driver/ToolChain.cpp | ||
352 | 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?
lib/Driver/ToolChain.cpp | ||
---|---|---|
367 | You can leave this return because Clang will exit anyway after emitting the error (as I had to learn...) | |
710–713 | I think this could go into the header |
lib/Driver/ToolChain.cpp | ||
---|---|---|
710–713 | The CLANG_DEFAULT_LINKER macro is getting defined in "clang/Config/config.h" which isn't meant to be included in other headers. |
lib/Driver/ToolChain.cpp | ||
---|---|---|
710–713 | Right, that does not work for the current version of the patch. It was meant in conjunction with this comment:
|
lib/Driver/ToolChain.cpp | ||
---|---|---|
352 | I'm wandering whether we shouldn't use "platform" instead of "ld" here to match what we do for -rtlib= and -stdlib=? |
Is there a reason not to allow using the absolute path here, like for the command-line option?