guru/dev-lang/swift/files/swift-6.1/link-with-lld.patch
Itai Ferber f0fee0b997
dev-lang/swift: add 6.1
Signed-off-by: Itai Ferber <itai@itaiferber.net>
2025-04-01 09:58:53 -04:00

45 lines
1.6 KiB
Diff

# 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
@@ -102,36 +102,7 @@ bool isAmazonLinux2023Host() {
return false;
}
-std::string toolchains::GenericUnix::getDefaultLinker() const {
- if (getTriple().isAndroid() || isAmazonLinux2023Host()
- || (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 {