Skip to content

Commit c4eeb98

Browse files
committed
Fix use of extraCPPFlags
Since we are using `swiftc` as the linker driver, we need to prefix any C specifc arguments with `-Xcc`. rdar://100575898
1 parent d1d2d17 commit c4eeb98

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

Sources/Build/BuildPlan.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2080,7 +2080,8 @@ public class BuildPlan {
20802080
// Note: This will come from build settings in future.
20812081
for target in dependencies.staticTargets {
20822082
if case let target as ClangTarget = target.underlyingTarget, target.isCXX {
2083-
buildProduct.additionalFlags += self.buildParameters.toolchain.extraCPPFlags
2083+
// Since we are using `swiftc` as the linker driver, we need to prefix these.
2084+
buildProduct.additionalFlags += self.buildParameters.toolchain.extraCPPFlags.flatMap({ ["-Xcc", $0] })
20842085
break
20852086
}
20862087
}

Tests/BuildTests/BuildPlanTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1906,7 +1906,7 @@ final class BuildPlanTests: XCTestCase {
19061906
#if os(macOS)
19071907
XCTAssertEqual(try result.buildProduct(for: "lib").linkArguments(), [
19081908
result.plan.buildParameters.toolchain.swiftCompilerPath.pathString,
1909-
"-lc++",
1909+
"-Xcc", "-lc++",
19101910
"-L", buildPath.pathString,
19111911
"-o", buildPath.appending(components: "liblib.dylib").pathString,
19121912
"-module-name", "lib",

0 commit comments

Comments
 (0)