Skip to content

Commit d0b34c2

Browse files
authored
Merge pull request #82170 from compnerd/internalise
IRGen: internalise well known types with static linking
2 parents dbf7fe6 + 7fa316c commit d0b34c2

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

lib/IRGen/GenDecl.cpp

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3965,16 +3965,21 @@ IRGenModule::getAddrOfLLVMVariable(LinkEntity entity,
39653965
// inside the standard library with the definition being in the runtime
39663966
// preventing the normal detection from identifying that this is module
39673967
// local.
3968-
if (getSwiftModule()->isStdlibModule())
3968+
//
3969+
// If we are statically linking the standard library, we need to internalise
3970+
// the symbols.
3971+
if (getSwiftModule()->isStdlibModule() ||
3972+
(Context.getStdlibModule() &&
3973+
Context.getStdlibModule()->isStaticLibrary()))
39693974
if (entity.isTypeKind() &&
39703975
(IsWellKnownBuiltinOrStructralType(entity.getType()) ||
39713976
entity.getType() == kAnyFunctionType))
39723977
if (auto *GV = dyn_cast<llvm::GlobalValue>(var))
3973-
if (GV->hasDLLImportStorageClass())
3974-
ApplyIRLinkage({llvm::GlobalValue::ExternalLinkage,
3975-
llvm::GlobalValue::DefaultVisibility,
3976-
llvm::GlobalValue::DefaultStorageClass})
3977-
.to(GV);
3978+
if (GV->hasDLLImportStorageClass())
3979+
ApplyIRLinkage({llvm::GlobalValue::ExternalLinkage,
3980+
llvm::GlobalValue::DefaultVisibility,
3981+
llvm::GlobalValue::DefaultStorageClass})
3982+
.to(GV);
39783983

39793984
// Install the concrete definition if we have one.
39803985
if (definition && definition.hasInit()) {

0 commit comments

Comments
 (0)