# Swift defaults to building with `gold` on Linux because `bfd` can't correctly # handle Swift symbols; Gentoo no longer supports `gold`, so we have to make # sure that we build with `lld`. --- a/swift/lib/Driver/UnixToolChains.cpp +++ b/swift/lib/Driver/UnixToolChains.cpp @@ -109,36 +109,7 @@ ToolChain::InvocationInfo toolchains::GenericUnix::constructInvocation( return II; } -std::string toolchains::GenericUnix::getDefaultLinker() const { - if (getTriple().isAndroid() - || (getTriple().isMusl() - && getTriple().getVendor() == llvm::Triple::Swift)) - return "lld"; - - switch (getTriple().getArch()) { - case llvm::Triple::arm: - case llvm::Triple::aarch64: - case llvm::Triple::aarch64_32: - case llvm::Triple::armeb: - case llvm::Triple::thumb: - case llvm::Triple::thumbeb: - // BFD linker has issues wrt relocation of the protocol conformance - // section on these targets, it also generates COPY relocations for - // final executables, as such, unless specified, we default to gold - // linker. - return "gold"; - case llvm::Triple::x86: - case llvm::Triple::x86_64: - case llvm::Triple::ppc64: - case llvm::Triple::ppc64le: - case llvm::Triple::systemz: - // BFD linker has issues wrt relocations against protected symbols. - return "gold"; - default: - // Otherwise, use the default BFD linker. - return ""; - } -} +std::string toolchains::GenericUnix::getDefaultLinker() const { return "lld"; } bool toolchains::GenericUnix::addRuntimeRPath(const llvm::Triple &T, const llvm::opt::ArgList &Args) const {