Skip to content

Commit ab96c02

Browse files
committed
On ELF platforms, look for the runtime libraries in an architecture-specific directory.
This is needed for swiftlang/swift#63782, which changes the Unix toolchain to look for libraries in architecture-specific directories.
1 parent d968485 commit ab96c02

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

Sources/Commands/Utilities/TestingSupport.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,10 @@ enum TestingSupport {
134134
env.prependPath("Path", value: location.pathString)
135135
}
136136
#elseif os(Linux)
137-
var libraryPaths = ["/usr/lib/swift/linux"]
137+
let arch = buildParameters.triple.arch.rawValue
138+
var libraryPaths = ["/usr/lib/swift/linux/\(arch)"]
138139
if let path = env["PATH"], let firstPathEntry = path.components(separatedBy: ":").first {
139-
libraryPaths.append("\(firstPathEntry)/../lib/swift/linux")
140+
libraryPaths.append("\(firstPathEntry)/../lib/swift/linux/\(arch)")
140141
}
141142
if let originalLibraryPaths = env["LD_LIBRARY_PATH"] {
142143
libraryPaths.append(originalLibraryPaths)

Tests/PackageModelTests/DestinationTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ private let extraFlags = BuildFlags(
2727
cCompilerFlags: ["-fintegrated-as"],
2828
cxxCompilerFlags: ["-fno-exceptions"],
2929
swiftCompilerFlags: ["-enable-experimental-cxx-interop", "-use-ld=lld"],
30-
linkerFlags: ["-R/usr/lib/swift/linux/"]
30+
linkerFlags: ["-R/usr/lib/swift/linux/x86_64"]
3131
)
3232

3333
private let destinationV1JSON =

Utilities/bootstrap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,7 @@ def get_swiftpm_flags(args):
784784

785785
platform_path = None
786786
for path in args.target_info["paths"]["runtimeLibraryPaths"]:
787-
platform_path = re.search(r"(lib/swift/([^/]+))$", path)
787+
platform_path = re.search(r"(lib/swift/([\w/]+))$", path)
788788
if platform_path:
789789
build_flags.extend(
790790
[

0 commit comments

Comments
 (0)