mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Enforce consistent usage of -experimental-hermetic-seat-at-link flag (#39986)
We've recently added the -experimental-hermetic-seal-at-link compiler flag, which turns on aggressive dead-stripping optimizations and assumes that library code can be optimized against client code because all users of the library code/types are present at link/LTO time. This means that any module that's built with -experimental-hermetic-seal-at-link requires all clients of this module to also use -experimental-hermetic-seal-at-link. This PR enforces that by storing a bit in the serialized module, and checking the bit when importing modules.
This commit is contained in:
committed by
GitHub
parent
775c632d03
commit
c89eca6c34
@@ -132,6 +132,9 @@ static bool readOptionsBlock(llvm::BitstreamCursor &cursor,
|
||||
case options_block::IS_STATIC_LIBRARY:
|
||||
extendedInfo.setIsStaticLibrary(true);
|
||||
break;
|
||||
case options_block::HAS_HERMETIC_SEAL_AT_LINK:
|
||||
extendedInfo.setHasHermeticSealAtLink(true);
|
||||
break;
|
||||
case options_block::IS_TESTABLE:
|
||||
extendedInfo.setIsTestable(true);
|
||||
break;
|
||||
@@ -1257,6 +1260,7 @@ ModuleFileSharedCore::ModuleFileSharedCore(
|
||||
Bits.ArePrivateImportsEnabled = extInfo.arePrivateImportsEnabled();
|
||||
Bits.IsSIB = extInfo.isSIB();
|
||||
Bits.IsStaticLibrary = extInfo.isStaticLibrary();
|
||||
Bits.HasHermeticSealAtLink = extInfo.hasHermeticSealAtLink();
|
||||
Bits.IsTestable = extInfo.isTestable();
|
||||
Bits.ResilienceStrategy = unsigned(extInfo.getResilienceStrategy());
|
||||
Bits.IsImplicitDynamicEnabled = extInfo.isImplicitDynamicEnabled();
|
||||
|
||||
Reference in New Issue
Block a user