Skip to content

[embedded] Add a frontend flag to drop all code from a module and emit an empty object file #72669

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 5 commits into from
Mar 29, 2024

Conversation

kubamracek
Copy link
Contributor

Motivation: In Embedded Swift, we don't want to emit actual code for libraries, we only serialize them and clients only need the serialized .swiftmodule. But sometimes it's useful to still have some .o file for a library, because it simplifies the build system story significantly, and various build systems can still operate on a "normal" dependency graph. For that, let's add a flag that makes the compiler emit an empty object file, to be used in situations where a build system really needs some .o output.

I don't expect this flag to be useful when running manual compile commands (e.g. in a Makefile) -- users should simply avoid asking the compiler to generate a .o file in the first place.

Also note we should consider this to be a stop-gap, until we flesh out the story of how libraries/modules are supposed to build in Embedded Swift.

@kubamracek
Copy link
Contributor Author

@swift-ci please test

Copy link
Contributor

@eeckstein eeckstein left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link
Member

@etcwilde etcwilde left a comment

Choose a reason for hiding this comment

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

LGTM. Once the embedded stuff is stable and I have a minute, I can probably teach CMake how to model a build graph that doesn't have object files for Swift.

@kubamracek kubamracek merged commit 4fd6adb into swiftlang:main Mar 29, 2024
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.

3 participants