Skip to content

Frontend: allow specifying a different target triple for internal clang instance to use #37774

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 6, 2021

Conversation

nkcsgexi
Copy link
Contributor

@nkcsgexi nkcsgexi commented Jun 3, 2021

Before this change, we always use the Swift target triple to instantiate the internal
Clang instance. When loading a Swift module from the textual interface, we may pick up
a lower target triple to use to build the Swift module because the target is hard-coded
in the textual interface file. This implies we may end up building multiple versions of the
same Clang module, one for each target triple of the loading Swift module.

This change adds a new frontend flag -clang-target to allow clients to specify a
consistent clang target to use across the Swift module boundaries. This value won't change
because it's not part of .swiftinterface files.

swift-driver should pass down -clang-target for each frontend invocation, and its value should be
identical to -target.

Related to: rdar://72480261

@nkcsgexi
Copy link
Contributor Author

nkcsgexi commented Jun 3, 2021

@swift-ci please smoke test

@nkcsgexi
Copy link
Contributor Author

nkcsgexi commented Jun 4, 2021

swiftlang/swift-driver#698
@swift-ci please smoke test

@nkcsgexi
Copy link
Contributor Author

nkcsgexi commented Jun 4, 2021

swiftlang/swift-driver#698
@swift-ci please smoke test

@nkcsgexi
Copy link
Contributor Author

nkcsgexi commented Jun 4, 2021

swiftlang/swift-driver#698
@swift-ci please smoke test

@nkcsgexi
Copy link
Contributor Author

nkcsgexi commented Jun 4, 2021

swiftlang/swift-driver#698
@swift-ci please smoke test

@nkcsgexi nkcsgexi force-pushed the 72480261 branch 2 times, most recently from c66bade to 0ddf1b0 Compare June 4, 2021 16:55
@nkcsgexi
Copy link
Contributor Author

nkcsgexi commented Jun 4, 2021

swiftlang/swift-driver#698
@swift-ci please test

@swift-ci
Copy link
Contributor

swift-ci commented Jun 4, 2021

Build failed
Swift Test Linux Platform
Git Sha - 0ddf1b0277538060c8408363cbfcf99d94302ff3

@swift-ci
Copy link
Contributor

swift-ci commented Jun 4, 2021

Build failed
Swift Test OS X Platform
Git Sha - 0ddf1b0277538060c8408363cbfcf99d94302ff3

@nkcsgexi nkcsgexi force-pushed the 72480261 branch 2 times, most recently from 55adf0c to 498b030 Compare June 4, 2021 22:14
@nkcsgexi
Copy link
Contributor Author

nkcsgexi commented Jun 4, 2021

swiftlang/swift-driver#698
@swift-ci please test

@swift-ci
Copy link
Contributor

swift-ci commented Jun 4, 2021

Build failed
Swift Test Linux Platform
Git Sha - 498b03077e34db4147b05f6e08a4ea8c8d545bcb

@nkcsgexi
Copy link
Contributor Author

nkcsgexi commented Jun 4, 2021

swiftlang/swift-driver#698
@swift-ci please test

@swift-ci
Copy link
Contributor

swift-ci commented Jun 5, 2021

Build failed
Swift Test OS X Platform
Git Sha - 498b03077e34db4147b05f6e08a4ea8c8d545bcb

@nkcsgexi
Copy link
Contributor Author

nkcsgexi commented Jun 5, 2021

swiftlang/swift-driver#698
@swift-ci Please test source compatibility

@swift-ci
Copy link
Contributor

swift-ci commented Jun 5, 2021

Build failed
Swift Test OS X Platform
Git Sha - 2522fdd998974662cc8299dd66df13bff60f573c

@nkcsgexi
Copy link
Contributor Author

nkcsgexi commented Jun 5, 2021

swiftlang/swift-driver#698
@swift-ci please test

@swift-ci
Copy link
Contributor

swift-ci commented Jun 5, 2021

Build failed
Swift Test Linux Platform
Git Sha - 891ac8bbbddb14428161ef917c1c09b280e00df5

@nkcsgexi
Copy link
Contributor Author

nkcsgexi commented Jun 5, 2021

swiftlang/swift-driver#698
@swift-ci please test

1 similar comment
@nkcsgexi
Copy link
Contributor Author

nkcsgexi commented Jun 5, 2021

swiftlang/swift-driver#698
@swift-ci please test

@swift-ci
Copy link
Contributor

swift-ci commented Jun 5, 2021

Build failed
Swift Test Linux Platform
Git Sha - 891ac8bbbddb14428161ef917c1c09b280e00df5

@swift-ci
Copy link
Contributor

swift-ci commented Jun 6, 2021

Build failed
Swift Test OS X Platform
Git Sha - 891ac8bbbddb14428161ef917c1c09b280e00df5

@nkcsgexi
Copy link
Contributor Author

nkcsgexi commented Jun 6, 2021

@swift-ci please test

@swift-ci
Copy link
Contributor

swift-ci commented Jun 6, 2021

Build failed
Swift Test Linux Platform
Git Sha - ae9508a58ead3a209ccfd9c31bff64b01304010d

…ng instance to use

Before this change, we always use the Swift target triple to instantiate the internal
Clang instance. When loading a Swift module from the textual interface, we may pick up
a lower target triple to use to build the Swift module because the target is hard-coded
in the textual interface file. This implies we may end up building multiple versions of the
same Clang module, one for each target triple of the loading Swift module.

This change adds a new frontend flag -clang-target to allow clients to specify a
consistent clang target to use across the Swift module boundaries. This value won't change
because it's not part of .swiftinterface files.

swift-driver should pass down -clang-target for each frontend invocation, and its value should be
identical to -target.

Related to: rdar://72480261
@nkcsgexi
Copy link
Contributor Author

nkcsgexi commented Jun 6, 2021

@swift-ci please test

@swift-ci
Copy link
Contributor

swift-ci commented Jun 6, 2021

Build failed
Swift Test OS X Platform
Git Sha - 2dcb33b

@nkcsgexi
Copy link
Contributor Author

nkcsgexi commented Jun 6, 2021

@swift-ci Please smoke test OS X platform

1 similar comment
@nkcsgexi
Copy link
Contributor Author

nkcsgexi commented Jun 6, 2021

@swift-ci Please smoke test OS X platform

@nkcsgexi nkcsgexi merged commit 4bd7a2f into swiftlang:main Jun 6, 2021
@nkcsgexi nkcsgexi deleted the 72480261 branch June 6, 2021 20:44
artemcm added a commit to artemcm/swift that referenced this pull request Jul 15, 2021
… scanning an interface

swiftlang#37774 (related to rdar://72480261) has made it so that the target of built clang modules (even downstream from Swift interface dependencies) can be consistent with that of the main module. This means that when building transitive Clang dependencies of the main module, they will always have a matching triple to the main module itself (ensured with `-clang-target`). This means we no longer have to report the target triple in the set of `extraPCMArgs` which encode an interface-specific requirement for building its dependencies.
nkcsgexi pushed a commit to nkcsgexi/swift that referenced this pull request Jul 16, 2021
… scanning an interface

swiftlang#37774 (related to rdar://72480261) has made it so that the target of built clang modules (even downstream from Swift interface dependencies) can be consistent with that of the main module. This means that when building transitive Clang dependencies of the main module, they will always have a matching triple to the main module itself (ensured with `-clang-target`). This means we no longer have to report the target triple in the set of `extraPCMArgs` which encode an interface-specific requirement for building its dependencies.
artemcm added a commit to artemcm/swift that referenced this pull request Mar 11, 2025
swiftlang#37774 added '-clang-target' which allows us to specify a target triple that only differs from '-target' by the OS version, when we want to provide a different OS version for API availability and type-checking, in order to set a common/unified target triple for the entire Clang module dependency graph, for presenting a unified API surface to the Swift client, serving as a maximum type-checking epoch.

This change adds an equivalent flag for the '-target-variant' configuration, as a mechanism to ensure that the entire module dependency graph presents a consistent os version.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants