aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGObjCMac.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2009-01-29 20:10:59 +0000
committerFariborz Jahanian <fjahanian@apple.com>2009-01-29 20:10:59 +0000
commit8448c2cdab6e3d4b15725921735243c77b06623d (patch)
tree86ddd9dbcbb41dd7f2947846c5594ea74a4d6a4e /lib/CodeGen/CGObjCMac.cpp
parenta9c878086036de36482cc21e35a33cabe9699b0a (diff)
Set protocol linkage and visibility correctly and
build protocol translation table meta-data (objc2 non-fragile abi). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63329 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGObjCMac.cpp')
-rw-r--r--lib/CodeGen/CGObjCMac.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/lib/CodeGen/CGObjCMac.cpp b/lib/CodeGen/CGObjCMac.cpp
index 67db5fa7e6..09987a291e 100644
--- a/lib/CodeGen/CGObjCMac.cpp
+++ b/lib/CodeGen/CGObjCMac.cpp
@@ -3843,12 +3843,12 @@ llvm::Constant *CGObjCNonFragileABIMac::GetOrEmitProtocol(
if (Entry) {
// Already created, fix the linkage and update the initializer.
- Entry->setLinkage(llvm::GlobalValue::InternalLinkage);
+ Entry->setLinkage(llvm::GlobalValue::WeakLinkage);
Entry->setInitializer(Init);
} else {
Entry =
new llvm::GlobalVariable(ObjCTypes.ProtocolnfABITy, false,
- llvm::GlobalValue::InternalLinkage,
+ llvm::GlobalValue::WeakLinkage,
Init,
std::string("\01l_OBJC_PROTOCOL_$_")+ProtocolName,
&CGM.getModule());
@@ -3856,6 +3856,21 @@ llvm::Constant *CGObjCNonFragileABIMac::GetOrEmitProtocol(
// FIXME: Is this necessary? Why only for protocol?
Entry->setAlignment(4);
}
+ Entry->setVisibility(llvm::GlobalValue::HiddenVisibility);
+
+ // Use this protocol meta-data to build protocol list table in section
+ // __DATA, __objc_protolist
+ llvm::Type *ptype = llvm::PointerType::getUnqual(ObjCTypes.ProtocolnfABITy);
+ llvm::GlobalVariable *PTGV = new llvm::GlobalVariable(
+ ptype, false,
+ llvm::GlobalValue::WeakLinkage,
+ Entry,
+ std::string("\01l_OBJC_LABEL_PROTOCOL_$_")
+ +ProtocolName,
+ &CGM.getModule());
+ PTGV->setSection("__DATA, __objc_protolist");
+ PTGV->setVisibility(llvm::GlobalValue::HiddenVisibility);
+ UsedGlobals.push_back(PTGV);
return Entry;
}