mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Serialize and honor whether a particular library should be force-loaded.
When a module built with -autolink-force-load is imported, add a reference to a special symbol in the corresponding library so that ld is forced to link it. This means the library will be linked into the final binary even if no other symbols are used (which happens for some of our overlays that just add category methods to Objective-C classes). Second part of <rdar://problem/16829587> Swift SVN r17751
This commit is contained in:
@@ -586,9 +586,11 @@ ModuleFile::ModuleFile(
|
||||
}
|
||||
case input_block::LINK_LIBRARY: {
|
||||
uint8_t rawKind;
|
||||
input_block::ImportedModuleLayout::readRecord(scratch, rawKind);
|
||||
bool shouldForceLink;
|
||||
input_block::LinkLibraryLayout::readRecord(scratch, rawKind,
|
||||
shouldForceLink);
|
||||
if (auto libKind = getActualLibraryKind(rawKind))
|
||||
LinkLibraries.push_back({blobData, *libKind});
|
||||
LinkLibraries.push_back({blobData, *libKind, shouldForceLink});
|
||||
// else ignore the dependency...it'll show up as a linker error.
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user