[embedded] Add basics of module serialization, importing and validation in embedded Swift.

- Add a flag to the serialized module (IsEmbeddedSwiftModule)
- Check on import that the mode matches (don't allow importing non-embedded module in embedded mode and vice versa)
- Drop TBD support, it's not expected to work in embedded Swift for now
- Drop auto-linking backdeploy libraries, it's not expected to backdeploy embedded Swift for now
- Drop prespecializations, not expected to work in embedded Swift for now
- Use CMO to serialize everything when emitting an embedded Swift module
- Change SILLinker to deserialize/import everything when importing an embedded Swift module
- Add an IR test for importing modules
- Add a deserialization validation test
This commit is contained in:
Kuba Mracek
2023-09-02 11:55:17 -07:00
parent 74e22dc450
commit 25eb997a28
25 changed files with 188 additions and 21 deletions

View File

@@ -58,7 +58,7 @@ const uint16_t SWIFTMODULE_VERSION_MAJOR = 0;
/// describe what change you made. The content of this comment isn't important;
/// it just ensures a conflict if two people change the module format.
/// Don't worry about adhering to the 80-column limit for this line.
const uint16_t SWIFTMODULE_VERSION_MINOR = 803; // removed initializes and accesses attributes
const uint16_t SWIFTMODULE_VERSION_MINOR = 804; // embedded swift modules
/// A standard hash seed used for all string hashes in a serialized module.
///
@@ -885,6 +885,7 @@ namespace options_block {
IS_SIB,
IS_STATIC_LIBRARY,
HAS_HERMETIC_SEAL_AT_LINK,
IS_EMBEDDED_SWIFT_MODULE,
IS_TESTABLE,
RESILIENCE_STRATEGY,
ARE_PRIVATE_IMPORTS_ENABLED,
@@ -928,6 +929,10 @@ namespace options_block {
HAS_HERMETIC_SEAL_AT_LINK
>;
using IsEmbeddedSwiftModuleLayout = BCRecordLayout<
IS_EMBEDDED_SWIFT_MODULE
>;
using IsTestableLayout = BCRecordLayout<
IS_TESTABLE
>;