@@ -3965,16 +3965,21 @@ IRGenModule::getAddrOfLLVMVariable(LinkEntity entity,
3965
3965
// inside the standard library with the definition being in the runtime
3966
3966
// preventing the normal detection from identifying that this is module
3967
3967
// 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 ()))
3969
3974
if (entity.isTypeKind () &&
3970
3975
(IsWellKnownBuiltinOrStructralType (entity.getType ()) ||
3971
3976
entity.getType () == kAnyFunctionType ))
3972
3977
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);
3978
3983
3979
3984
// Install the concrete definition if we have one.
3980
3985
if (definition && definition.hasInit ()) {
0 commit comments