summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2014-03-06 01:57:34 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2014-03-06 01:57:34 +0000
commitd0bb55a1d443591e470425413bdc4212bee798b2 (patch)
tree2a64c2d8d1e3105542aef35a9165354c3d11424f /clang
parentcab4afd7c68c680a6b2f4a510e0264485ad8cd8f (diff)
downloadbcm5719-llvm-d0bb55a1d443591e470425413bdc4212bee798b2.tar.gz
bcm5719-llvm-d0bb55a1d443591e470425413bdc4212bee798b2.zip
Use private linkage for remaining GlobalVariables with private names.
This patch changes the remaining GlobalVariables using "\01L" and "\01l" prefixes to use private linkage. What is strange about them is that they currently use WeakAnyLinkage. There is no comment stating why and that is really odd since the symbols are completely hidden, so it doesn't make sense for them to be weak. Clang revisions like r63329, r63408, r63770, r65761 set the linkage to weak, but don't say why. I suspect they were just copying llvm-gcc. In llvm-gcc I found r58599 and r56322 that set DECL_WEAK, but they were just syncing from the apple gcc. I am not exactly sure what that means, since the last commit to svn://gcc.gnu.org/svn/gcc/branches/apple was in 2006, 2 years earlier. In summary, I have no idea why weak linkage was being used :-( To quote John McCall, "Let’s try without it and see" :-) llvm-svn: 203059
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/CodeGen/CGObjCMac.cpp22
-rw-r--r--clang/test/CodeGenObjC/forward-protocol-metadata-symbols.m6
-rw-r--r--clang/test/CodeGenObjC/hidden-visibility.m2
-rw-r--r--clang/test/CodeGenObjC/metadata-symbols-64.m6
4 files changed, 18 insertions, 18 deletions
diff --git a/clang/lib/CodeGen/CGObjCMac.cpp b/clang/lib/CodeGen/CGObjCMac.cpp
index 0cb38f27aa0..55bd7235112 100644
--- a/clang/lib/CodeGen/CGObjCMac.cpp
+++ b/clang/lib/CodeGen/CGObjCMac.cpp
@@ -5955,11 +5955,11 @@ llvm::Value *CGObjCNonFragileABIMac::GenerateProtocolRef(CodeGenFunction &CGF,
PTGV = new llvm::GlobalVariable(
CGM.getModule(),
Init->getType(), false,
- llvm::GlobalValue::WeakAnyLinkage,
+ llvm::GlobalValue::PrivateLinkage,
Init,
ProtocolName);
+ assertPrivateName(PTGV);
PTGV->setSection("__DATA, __objc_protorefs, coalesced, no_dead_strip");
- PTGV->setVisibility(llvm::GlobalValue::HiddenVisibility);
CGM.AddUsedGlobal(PTGV);
return CGF.Builder.CreateLoad(PTGV);
}
@@ -6243,10 +6243,11 @@ llvm::Constant *CGObjCNonFragileABIMac::GetOrEmitProtocolRef(
// contents for protocols which were referenced but never defined.
Entry =
new llvm::GlobalVariable(CGM.getModule(), ObjCTypes.ProtocolnfABITy,
- false, llvm::GlobalValue::WeakAnyLinkage, 0,
+ false, llvm::GlobalValue::PrivateLinkage, 0,
"\01l_OBJC_PROTOCOL_$_" + PD->getName());
Entry->setSection("__DATA,__datacoal_nt,coalesced");
}
+ assertPrivateName(Entry);
return Entry;
}
@@ -6358,12 +6359,11 @@ llvm::Constant *CGObjCNonFragileABIMac::GetOrEmitProtocol(
if (Entry) {
// Already created, update the initializer.
- assert(Entry->getLinkage() == llvm::GlobalValue::WeakAnyLinkage);
Entry->setInitializer(Init);
} else {
Entry =
new llvm::GlobalVariable(CGM.getModule(), ObjCTypes.ProtocolnfABITy,
- false, llvm::GlobalValue::WeakAnyLinkage, Init,
+ false, llvm::GlobalValue::PrivateLinkage, Init,
"\01l_OBJC_PROTOCOL_$_" + PD->getName());
Entry->setAlignment(
CGM.getDataLayout().getABITypeAlignment(ObjCTypes.ProtocolnfABITy));
@@ -6371,19 +6371,19 @@ llvm::Constant *CGObjCNonFragileABIMac::GetOrEmitProtocol(
Protocols[PD->getIdentifier()] = Entry;
}
- Entry->setVisibility(llvm::GlobalValue::HiddenVisibility);
+ assertPrivateName(Entry);
CGM.AddUsedGlobal(Entry);
// Use this protocol meta-data to build protocol list table in section
// __DATA, __objc_protolist
llvm::GlobalVariable *PTGV =
new llvm::GlobalVariable(CGM.getModule(), ObjCTypes.ProtocolnfABIPtrTy,
- false, llvm::GlobalValue::WeakAnyLinkage, Entry,
+ false, llvm::GlobalValue::PrivateLinkage, Entry,
"\01l_OBJC_LABEL_PROTOCOL_$_" + PD->getName());
+ assertPrivateName(PTGV);
PTGV->setAlignment(
CGM.getDataLayout().getABITypeAlignment(ObjCTypes.ProtocolnfABIPtrTy));
PTGV->setSection("__DATA, __objc_protolist, coalesced, no_dead_strip");
- PTGV->setVisibility(llvm::GlobalValue::HiddenVisibility);
CGM.AddUsedGlobal(PTGV);
return Entry;
}
@@ -6592,14 +6592,14 @@ CGObjCNonFragileABIMac::EmitVTableMessageSend(CodeGenFunction &CGF,
messageRef = new llvm::GlobalVariable(CGM.getModule(),
init->getType(),
/*constant*/ false,
- llvm::GlobalValue::WeakAnyLinkage,
+ llvm::GlobalValue::PrivateLinkage,
init,
messageRefName);
- messageRef->setVisibility(llvm::GlobalValue::HiddenVisibility);
messageRef->setAlignment(16);
messageRef->setSection("__DATA, __objc_msgrefs, coalesced");
}
-
+ assertPrivateName(messageRef);
+
bool requiresnullCheck = false;
if (CGM.getLangOpts().ObjCAutoRefCount && method)
for (ObjCMethodDecl::param_const_iterator i = method->param_begin(),
diff --git a/clang/test/CodeGenObjC/forward-protocol-metadata-symbols.m b/clang/test/CodeGenObjC/forward-protocol-metadata-symbols.m
index c28adb3f8aa..e23ae303976 100644
--- a/clang/test/CodeGenObjC/forward-protocol-metadata-symbols.m
+++ b/clang/test/CodeGenObjC/forward-protocol-metadata-symbols.m
@@ -18,7 +18,7 @@ int main() {
return 0;
}
-// CHECK: @"\01l_OBJC_PROTOCOL_$_P0" = weak hidden global
+// CHECK: @"\01l_OBJC_PROTOCOL_$_P0" = private global
// CHECK: @"\01l_OBJC_CLASS_PROTOCOLS_$_A" = private global
-// CHECK: @"\01l_OBJC_LABEL_PROTOCOL_$_P0" = weak hidden global
-// CHECK: @"\01l_OBJC_PROTOCOL_REFERENCE_$_P0" = weak hidden global
+// CHECK: @"\01l_OBJC_LABEL_PROTOCOL_$_P0" = private global
+// CHECK: @"\01l_OBJC_PROTOCOL_REFERENCE_$_P0" = private global
diff --git a/clang/test/CodeGenObjC/hidden-visibility.m b/clang/test/CodeGenObjC/hidden-visibility.m
index 9f5071d5ffa..733bf170168 100644
--- a/clang/test/CodeGenObjC/hidden-visibility.m
+++ b/clang/test/CodeGenObjC/hidden-visibility.m
@@ -2,7 +2,7 @@
// CHECK: @"OBJC_IVAR_$_I.P" = hidden
// CHECK: @"OBJC_CLASS_$_I" = hidden
// CHECK: @"OBJC_METACLASS_$_I" = hidden
-// CHECK: @"\01l_OBJC_PROTOCOL_$_Prot0" = weak hidden
+// CHECK: @"\01l_OBJC_PROTOCOL_$_Prot0" = private global
@interface I {
int P;
diff --git a/clang/test/CodeGenObjC/metadata-symbols-64.m b/clang/test/CodeGenObjC/metadata-symbols-64.m
index 7b960938690..9043eb8cfaf 100644
--- a/clang/test/CodeGenObjC/metadata-symbols-64.m
+++ b/clang/test/CodeGenObjC/metadata-symbols-64.m
@@ -11,8 +11,8 @@
// CHECK: @"\01l_OBJC_$_CLASS_METHODS_A" = private global {{.*}} section "__DATA, __objc_const", align 8
// CHECK: @"\01l_OBJC_$_PROTOCOL_INSTANCE_METHODS_P" = private global {{.*}} section "__DATA, __objc_const", align 8
// CHECK: @"\01l_OBJC_$_PROTOCOL_CLASS_METHODS_P" = private global {{.*}} section "__DATA, __objc_const", align 8
-// CHECK: @"\01l_OBJC_PROTOCOL_$_P" = weak hidden global {{.*}} section "__DATA,__datacoal_nt,coalesced", align 8
-// CHECK: @"\01l_OBJC_LABEL_PROTOCOL_$_P" = weak hidden global {{.*}} section "__DATA, __objc_protolist, coalesced, no_dead_strip", align 8
+// CHECK: @"\01l_OBJC_PROTOCOL_$_P" = private global {{.*}} section "__DATA,__datacoal_nt,coalesced", align 8
+// CHECK: @"\01l_OBJC_LABEL_PROTOCOL_$_P" = private global {{.*}} section "__DATA, __objc_protolist, coalesced, no_dead_strip", align 8
// CHECK: @"\01l_OBJC_CLASS_PROTOCOLS_$_A" = private global {{.*}} section "__DATA, __objc_const", align 8
// CHECK: @"\01l_OBJC_METACLASS_RO_$_A" = private global {{.*}} section "__DATA, __objc_const", align 8
// CHECK: @"\01l_OBJC_$_INSTANCE_METHODS_A" = private global {{.*}} section "__DATA, __objc_const", align 8
@@ -28,7 +28,7 @@
// CHECK: @"\01L_OBJC_CLASSLIST_SUP_REFS_$_{{[0-9]*}}" = private global {{.*}} section "__DATA, __objc_superrefs, regular, no_dead_strip", align 8
// CHECK: @"OBJC_CLASS_$_B" = external global
// CHECK: @"\01L_OBJC_CLASSLIST_REFERENCES_$_{{[0-9]*}}" = private global {{.*}} section "__DATA, __objc_classrefs, regular, no_dead_strip", align 8
-// CHECK: @"\01l_objc_msgSend_fixup_alloc" = weak hidden global {{.*}} section "__DATA, __objc_msgrefs, coalesced", align 16
+// CHECK: @"\01l_objc_msgSend_fixup_alloc" = private global {{.*}} section "__DATA, __objc_msgrefs, coalesced", align 16
// CHECK: @"\01L_OBJC_LABEL_CLASS_$" = private global {{.*}} section "__DATA, __objc_classlist, regular, no_dead_strip", align 8
// CHECK: @"\01L_OBJC_LABEL_CATEGORY_$" = private global {{.*}} section "__DATA, __objc_catlist, regular, no_dead_strip", align 8
// CHECK: @objc_msgSend_fpret(
OpenPOWER on IntegriCloud