Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions lib/IRGen/GenDecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3963,16 +3963,21 @@ IRGenModule::getAddrOfLLVMVariable(LinkEntity entity,
// inside the standard library with the definition being in the runtime
// preventing the normal detection from identifying that this is module
// local.
if (getSwiftModule()->isStdlibModule())
//
// If we are statically linking the standard library, we need to internalise
// the symbols.
if (getSwiftModule()->isStdlibModule() ||
(Context.getStdlibModule() &&
Context.getStdlibModule()->isStaticLibrary()))
if (entity.isTypeKind() &&
(IsWellKnownBuiltinOrStructralType(entity.getType()) ||
entity.getType() == kAnyFunctionType))
if (auto *GV = dyn_cast<llvm::GlobalValue>(var))
if (GV->hasDLLImportStorageClass())
ApplyIRLinkage({llvm::GlobalValue::ExternalLinkage,
llvm::GlobalValue::DefaultVisibility,
llvm::GlobalValue::DefaultStorageClass})
.to(GV);
if (GV->hasDLLImportStorageClass())
ApplyIRLinkage({llvm::GlobalValue::ExternalLinkage,
llvm::GlobalValue::DefaultVisibility,
llvm::GlobalValue::DefaultStorageClass})
.to(GV);

// Install the concrete definition if we have one.
if (definition && definition.hasInit()) {
Expand Down