Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ extension WebAssemblyToolchain {
if let tool = lookupExecutablePath(filename: "clang", searchPaths: [toolsDir]) {
clangPath = tool
}

// Look for binutils in the toolchain folder.
commandLine.appendFlag("-B")
commandLine.appendPath(toolsDir)
}

guard !parsedOptions.hasArgument(.noStaticStdlib, .noStaticExecutable) else {
Expand Down
20 changes: 20 additions & 0 deletions Tests/SwiftDriverTests/SwiftDriverTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4367,6 +4367,26 @@ final class SwiftDriverTests: XCTestCase {
XCTAssertEqual(frontendJobs.count, 2)
XCTAssertEqual(frontendJobs[1].kind, .link)
XCTAssertEqual(frontendJobs[1].tool.absolutePath!.pathString, ld.pathString)

// WASI toolchain
do {
try withTemporaryDirectory { resourceDir in
try localFileSystem.writeFileContents(resourceDir.appending(components: "wasi", "static-executable-args.lnk")) {
$0.send("garbage")
}
var driver = try Driver(args: ["swiftc",
"-target", "wasm32-unknown-wasi",
"-resource-dir", resourceDir.pathString,
"-tools-directory", tmpDir.pathString,
"foo.swift"],
env: env)
let frontendJobs = try driver.planBuild().removingAutolinkExtractJobs()
XCTAssertEqual(frontendJobs.count, 2)
XCTAssertTrue(frontendJobs[1].commandLine.contains(subsequence: [
.flag("-B"), .path(.absolute(tmpDir))
]))
}
}
}
}

Expand Down