[cfe-commits] r63329 - /cfe/trunk/lib/CodeGen/CGObjCMac.cpp
Fariborz Jahanian
fjahanian at apple.com
Thu Jan 29 12:11:00 PST 2009
Author: fjahanian
Date: Thu Jan 29 14:10:59 2009
New Revision: 63329
URL: http://llvm.org/viewvc/llvm-project?rev=63329&view=rev
Log:
Set protocol linkage and visibility correctly and
build protocol translation table meta-data (objc2
non-fragile abi).
Modified:
cfe/trunk/lib/CodeGen/CGObjCMac.cpp
Modified: cfe/trunk/lib/CodeGen/CGObjCMac.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCMac.cpp?rev=63329&r1=63328&r2=63329&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCMac.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCMac.cpp Thu Jan 29 14:10:59 2009
@@ -3843,12 +3843,12 @@
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 @@
// 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;
}
More information about the cfe-commits
mailing list