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 @@ -253,9 +253,11 @@ extension GenericUnixToolchain {
linkFilePath = linkFilePath?.appending(component: "static-executable-args.lnk")
} else if staticStdlib {
linkFilePath = linkFilePath?.appending(component: "static-stdlib-args.lnk")
} else if !isEmbeddedEnabled {
} else {
linkFilePath = nil
commandLine.appendFlag("-lswiftCore")
if !isEmbeddedEnabled {
commandLine.appendFlag("-lswiftCore")
}
}

if let linkFile = linkFilePath {
Expand Down
34 changes: 34 additions & 0 deletions Tests/SwiftDriverTests/SwiftDriverTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6494,6 +6494,40 @@ final class SwiftDriverTests: XCTestCase {
XCTAssertTrue(compileJob.commandLine.contains(.flag("-disable-objc-interop")))
XCTAssertFalse(linkJob.commandLine.contains(.flag("-force_load")))
}

do {
var driver = try Driver(args: [
"swiftc",
"-v",
"-L",
"/TestApp/.build/aarch64-none-none-elf/release",
"-o",
"/TestApp/.build/aarch64-none-none-elf/release/TestApp",
"-module-name",
"TestApp",
"-emit-executable",
"-Xlinker",
"--gc-sections",
"@/TestApp/.build/aarch64-none-none-elf/release/TestApp.product/Objects.LinkFileList",
"-target",
"aarch64-none-none-elf",
"-enable-experimental-feature", "Embedded",
"-Xfrontend",
"-function-sections",
"-Xfrontend",
"-disable-stack-protector",
"-use-ld=lld",
"-tools-directory",
"/Tools/swift.xctoolchain/usr/bin",
], env: env)

let jobs = try driver.planBuild()
let linkJob = try jobs.findJob(.link)
let invalidPath = try VirtualPath(path: "/Tools/swift.xctoolchain/usr/lib/swift")
let invalid = linkJob.commandLine.contains(.responseFilePath(invalidPath))
XCTAssertFalse(invalid) // ensure the driver does not emit invalid responseFilePaths to the clang invocation
}

do {
var driver = try Driver(args: ["swiftc", "-target", "wasm32-none-none-wasm", "test.swift", "-enable-experimental-feature", "Embedded", "-wmo", "-o", "a.wasm"], env: env)
let plannedJobs = try driver.planBuild()
Expand Down