Skip to content
Closed
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 @@ -183,6 +183,9 @@ extension GenericUnixToolchain {
}
}

let expirementalFeatures = parsedOptions.arguments(for: .enableExperimentalFeature)
let embeddedEnabled = expirementalFeatures.map(\.argument).map(\.asSingle).contains("Embedded")

if !parsedOptions.hasArgument(.nostartfiles) {
let swiftrtPath = VirtualPath.lookup(targetInfo.runtimeResourcePath.path)
.appending(
Expand Down Expand Up @@ -251,6 +254,8 @@ extension GenericUnixToolchain {
linkFilePath = linkFilePath?.appending(component: "static-executable-args.lnk")
} else if staticStdlib {
linkFilePath = linkFilePath?.appending(component: "static-stdlib-args.lnk")
} else if embeddedEnabled {
linkFilePath = nil
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we please add a test that passes the experimental feature flag and makes sure the link command does not contain this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

finally coming back around to this: are there good examples of these types of tests already present? I did not immediately see any.

} else {
linkFilePath = nil
commandLine.appendFlag("-lswiftCore")
Expand Down
8 changes: 8 additions & 0 deletions Tests/SwiftDriverTests/SwiftDriverTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2245,6 +2245,14 @@ final class SwiftDriverTests: XCTestCase {
XCTAssertTrue(cmd.contains(.flag("-lsomelib")))
XCTAssertTrue(cmd.contains(.flag("-lotherlib")))
}

do {
// Linker flags when embedded is enabled should not contain `-lswiftCore`
var driver = try Driver(args: commonArgs + ["-target", "armv6-none-none-eabi", "-emit-executable", "-whole-module-optimization", "-enable-experimental-feature", "Embedded"], env: env)
let plannedJobs = try driver.planBuild()
let cmd = plannedJobs.last!.commandLine
XCTAssertFalse(cmd.contains(.flag("-lswiftCore")))
}

do {
// The Android NDK only uses the lld linker now
Expand Down