aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Driver/ToolChain.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Driver/ToolChain.cpp')
-rw-r--r--clang/lib/Driver/ToolChain.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp
index 2984537..7be83ca 100644
--- a/clang/lib/Driver/ToolChain.cpp
+++ b/clang/lib/Driver/ToolChain.cpp
@@ -568,8 +568,13 @@ std::string ToolChain::GetLinkerPath() const {
}
// If we're passed -fuse-ld= with no argument, or with the argument ld,
// then use whatever the default system linker is.
- if (UseLinker.empty() || UseLinker == "ld")
- return GetProgramPath(getDefaultLinker());
+ if (UseLinker.empty() || UseLinker == "ld") {
+ const char *DefaultLinker = getDefaultLinker();
+ if (llvm::sys::path::is_absolute(DefaultLinker))
+ return std::string(DefaultLinker);
+ else
+ return GetProgramPath(DefaultLinker);
+ }
// Extending -fuse-ld= to an absolute or relative path is unexpected. Checking
// for the linker flavor is brittle. In addition, prepending "ld." or "ld64."