mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Serialization: remove force linked symbols for static libs
This adjusts the IRGen to avoid the force load symbol for static linking. When static linking, we can elide the force load symbol as it exists to ensure that the shared library is loaded at runtime unconditionally. However, the symbol will not preserve the library and it will be DCE'd appropriately. This resolves the unresolved force load symbol when statically linking on Windows.
This commit is contained in:
@@ -1350,6 +1350,8 @@ ModuleFileSharedCore::ModuleFileSharedCore(
|
||||
bool shouldForceLink;
|
||||
input_block::LinkLibraryLayout::readRecord(scratch, rawKind,
|
||||
shouldForceLink);
|
||||
if (Bits.IsStaticLibrary)
|
||||
shouldForceLink = false;
|
||||
if (auto libKind = getActualLibraryKind(rawKind))
|
||||
LinkLibraries.push_back({blobData, *libKind, shouldForceLink});
|
||||
// else ignore the dependency...it'll show up as a linker error.
|
||||
|
||||
Reference in New Issue
Block a user