0
0
mirror of https://github.com/termux/termux-packages.git synced 2024-12-12 13:03:31 +00:00
termux-packages/packages/swift/swift-change-library-lookup.patch
2024-11-12 13:08:55 +05:30

45 lines
2.1 KiB
Diff

diff --git a/swift/lib/Driver/ToolChains.cpp b/swift/lib/Driver/ToolChains.cpp
index c0ee9217e86..47b667187c6 100644
--- a/swift/lib/Driver/ToolChains.cpp
+++ b/swift/lib/Driver/ToolChains.cpp
@@ -1448,6 +1448,9 @@ void ToolChain::getRuntimeLibraryPaths(SmallVectorImpl<std::string> &runtimeLibP
StringRef SDKPath, bool shared) const {
SmallString<128> scratchPath;
getResourceDirPath(scratchPath, args, shared);
+ if (getTriple().isAndroid())
+ llvm::sys::path::append(scratchPath,
+ swift::getMajorArchitectureName(getTriple()));
runtimeLibPaths.push_back(std::string(scratchPath.str()));
// If there's a secondary resource dir, add it too.
diff --git a/swift/lib/Frontend/CompilerInvocation.cpp b/swift/lib/Frontend/CompilerInvocation.cpp
index 0a57134a410..71b7f36a634 100644
--- a/swift/lib/Frontend/CompilerInvocation.cpp
+++ b/swift/lib/Frontend/CompilerInvocation.cpp
@@ -169,7 +169,7 @@ static void updateRuntimeLibraryPaths(SearchPathOptions &SearchPathOpts,
#endif
llvm::sys::path::append(LibPath, LibSubDir);
- SearchPathOpts.RuntimeLibraryPaths.push_back(std::string(LibPath.str()));
+ SearchPathOpts.RuntimeLibraryPaths.push_back("@TERMUX_PREFIX@/lib");
if (Triple.isOSDarwin())
SearchPathOpts.RuntimeLibraryPaths.push_back(DARWIN_OS_LIBRARY_PATH);
diff --git a/swift-driver/Sources/SwiftDriver/Jobs/GenericUnixToolchain+LinkerSupport.swift b/swift-driver/Sources/SwiftDriver/Jobs/GenericUnixToolchain+LinkerSupport.swift
index a4a735f4..dcd3f55a 100644
--- a/swift-driver/Sources/SwiftDriver/Jobs/GenericUnixToolchain+LinkerSupport.swift
+++ b/swift-driver/Sources/SwiftDriver/Jobs/GenericUnixToolchain+LinkerSupport.swift
@@ -226,8 +226,11 @@ extension GenericUnixToolchain {
}
// Add the runtime library link paths.
- for path in runtimePaths {
+ for var path in runtimePaths {
commandLine.appendFlag(.L)
+ if targetTriple.environment == .android {
+ path = path.appending(component: majorArchitectureName(for: targetTriple))
+ }
commandLine.appendPath(path)
}