Files
nixpkgs/pkgs/development/compilers/swift/compiler/patches/swift-linux-fix-linking.patch
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

18 lines
634 B
Diff

diff --git a/lib/Driver/ToolChains.cpp b/lib/Driver/ToolChains.cpp
index c0ee9217e8..bf7737d6fa 100644
--- a/lib/Driver/ToolChains.cpp
+++ b/lib/Driver/ToolChains.cpp
@@ -1489,6 +1489,12 @@
LinkerDriver = Args.MakeArgString(tool.get());
}
+ // For Nix, prefer linking using the wrapped Nixpkgs clang, instead of using
+ // the unwrapped clang packaged with swift. The latter is unable to link, but
+ // we still want to use it for other purposes (clang importer).
+ if (auto tool = llvm::sys::findProgramByName(LinkerDriver, {"@clang@/bin"}))
+ return Args.MakeArgString(tool.get());
+
return LinkerDriver;
}