Skip to content

Commit

Permalink
Remove <toolchain>/usr/bin/../lib/ from directories passed to linker …
Browse files Browse the repository at this point in the history
…to look up libraries for target triple (#6824)

Also, update my github username in the mailmap.

Resolves #6767
  • Loading branch information
finagolfin authored Aug 22, 2023
1 parent c708d0d commit fab4533
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 14 deletions.
4 changes: 2 additions & 2 deletions .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -101,5 +101,5 @@ Tim Gymnich <[email protected]> <[email protected]>
Tom Doron <[email protected]> <[email protected]>
Valeriy Van <[email protected]> <[email protected]>
Valeriy Van <[email protected]> <[email protected]>
buttaface <[email protected]> <[email protected]>
buttaface <[email protected]> <[email protected]>
finagolfin <[email protected]> <[email protected]>
finagolfin <[email protected]> <[email protected]>
8 changes: 0 additions & 8 deletions Sources/Build/BuildDescription/ProductBuildDescription.swift
Original file line number Diff line number Diff line change
Expand Up @@ -314,14 +314,6 @@ public final class ProductBuildDescription: SPMBuildCore.ProductBuildDescription
args += ["-L", librarySearchPath.pathString]
}

// Add toolchain's libdir at the very end (even after the user -Xlinker arguments).
//
// This will allow linking to libraries shipped in the toolchain.
let toolchainLibDir = try buildParameters.toolchain.toolchainLibDir
if self.fileSystem.isDirectory(toolchainLibDir) {
args += ["-L", toolchainLibDir.pathString]
}

// Library search path for the toolchain's copy of SwiftSyntax.
#if BUILD_MACROS_AS_DYLIBS
if product.type == .macro {
Expand Down
5 changes: 1 addition & 4 deletions Tests/BuildTests/BuildPlanTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3518,11 +3518,8 @@ final class BuildPlanTests: XCTestCase {
}

func testExtraBuildFlags() throws {
let libpath = AbsolutePath("/fake/path/lib")

let fs = InMemoryFileSystem(emptyFiles:
"/A/Sources/exe/main.swift",
libpath.appending(components: "libSomething.dylib").pathString,
"<end>"
)

Expand Down Expand Up @@ -3553,7 +3550,7 @@ final class BuildPlanTests: XCTestCase {
))

let exe = try result.buildProduct(for: "exe").linkArguments()
XCTAssertMatch(exe, [.anySequence, "-L", "/path/to/foo", "-L/path/to/foo", "-Xlinker", "-rpath=foo", "-Xlinker", "-rpath", "-Xlinker", "foo", "-L", "\(libpath)"])
XCTAssertMatch(exe, [.anySequence, "-L", "/path/to/foo", "-L/path/to/foo", "-Xlinker", "-rpath=foo", "-Xlinker", "-rpath", "-Xlinker", "foo"])
}

func testUserToolchainCompileFlags() throws {
Expand Down

0 comments on commit fab4533

Please sign in to comment.