mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
IRGen: apply IR linkage to trivial property descriptors
This ensures that the trivial property descriptors is externally accessible on targets like Windows which does not export symbols by default. Thanks to Joe Groff for the pointer about the global aliases for trivial property descriptors!
This commit is contained in:
@@ -1269,14 +1269,18 @@ void IRGenModule::emitSILProperty(SILProperty *prop) {
|
||||
var->setConstant(true);
|
||||
var->setUnnamedAddr(llvm::GlobalValue::UnnamedAddr::Global);
|
||||
var->setAlignment(4);
|
||||
|
||||
|
||||
TheTrivialPropertyDescriptor = var;
|
||||
} else {
|
||||
auto entity = LinkEntity::forPropertyDescriptor(prop->getDecl());
|
||||
auto linkInfo = LinkInfo::get(*this, entity, ForDefinition);
|
||||
llvm::GlobalAlias::create(linkInfo.getLinkage(),
|
||||
linkInfo.getName(),
|
||||
TheTrivialPropertyDescriptor);
|
||||
auto *GA = llvm::GlobalAlias::create(linkInfo.getLinkage(),
|
||||
linkInfo.getName(),
|
||||
TheTrivialPropertyDescriptor);
|
||||
ApplyIRLinkage({linkInfo.getLinkage(),
|
||||
linkInfo.getVisibility(),
|
||||
llvm::GlobalValue::DLLExportStorageClass})
|
||||
.to(GA);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user