diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp --- a/clang/lib/Driver/ToolChain.cpp +++ b/clang/lib/Driver/ToolChain.cpp @@ -558,7 +558,11 @@ } else if (UseLinker.empty() || UseLinker == "ld") { // If we're passed -fuse-ld= with no argument, or with the argument ld, // then use whatever the default system linker is. - return GetProgramPath(getDefaultLinker()); + const char *DefaultLinker = getDefaultLinker(); + if (llvm::sys::path::is_absolute(DefaultLinker)) + return DefaultLinker; + else + return GetProgramPath(DefaultLinker); } else { llvm::SmallString<8> LinkerName; if (Triple.isOSDarwin()) diff --git a/clang/lib/Driver/ToolChains/Solaris.h b/clang/lib/Driver/ToolChains/Solaris.h --- a/clang/lib/Driver/ToolChains/Solaris.h +++ b/clang/lib/Driver/ToolChains/Solaris.h @@ -65,6 +65,11 @@ SanitizerMask getSupportedSanitizers() const override; unsigned GetDefaultDwarfVersion() const override { return 2; } + const char *getDefaultLinker() const override { + // clang currently uses Solaris ld-only options. + return "/usr/bin/ld"; + } + protected: Tool *buildAssembler() const override; Tool *buildLinker() const override;