Skip to content

Commit 726ce35

Browse files
committed
IRGen: repair the windows build of Foundation
Foundation imports `free`, importing it as `dllimport dso_local` which is not permitted. Clean up the IRGen to ensure that the two are not emitted together.
1 parent c269d00 commit 726ce35

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lib/IRGen/IRGenModule.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1570,6 +1570,16 @@ bool IRGenModule::finalize() {
15701570
DebugInfo->finalize();
15711571
cleanupClangCodeGenMetadata();
15721572

1573+
// Clean up DSOLocal & DLLImport attributes, they cannot be applied together.
1574+
// The imported declarations are marked as DSO local by default.
1575+
for (auto &GV : Module.globals())
1576+
if (GV.hasDLLImportStorageClass())
1577+
GV.setDSOLocal(false);
1578+
1579+
for (auto &F : Module.functions())
1580+
if (F.hasDLLImportStorageClass())
1581+
F.setDSOLocal(false);
1582+
15731583
return true;
15741584
}
15751585

0 commit comments

Comments
 (0)