]> granicus.if.org Git - clang/commitdiff
Fixup our uses of various linkages to match how llvm now works. I think they are all
authorMike Stump <mrs@apple.com>
Sat, 7 Mar 2009 16:33:28 +0000 (16:33 +0000)
committerMike Stump <mrs@apple.com>
Sat, 7 Mar 2009 16:33:28 +0000 (16:33 +0000)
correct, but an extra set of ObjC eyes would be good.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66342 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGObjCMac.cpp
lib/CodeGen/CodeGenModule.cpp

index 11836adf5663e322e2001ce2ce1c432739b06648..e48b6c09142cbfd290169922f700e92d8cf95ae2 100644 (file)
@@ -3885,7 +3885,9 @@ llvm::Value *CGObjCNonFragileABIMac::GenerateProtocolRef(CGBuilderTy &Builder,
     return Builder.CreateLoad(PTGV, false, "tmp");
   PTGV = new llvm::GlobalVariable(
                                 Init->getType(), false,
-                                llvm::GlobalValue::WeakLinkage,
+                                // FIXME: review, was WeakLinkage,
+                                // also review all other WeakLinkage changes
+                                llvm::GlobalValue::WeakAnyLinkage,
                                 Init,
                                 ProtocolName,
                                 &CGM.getModule());
@@ -4308,12 +4310,12 @@ llvm::Constant *CGObjCNonFragileABIMac::GetOrEmitProtocol(
   
   if (Entry) {
     // Already created, fix the linkage and update the initializer.
-    Entry->setLinkage(llvm::GlobalValue::WeakLinkage);
+    Entry->setLinkage(llvm::GlobalValue::WeakAnyLinkage);
     Entry->setInitializer(Init);
   } else {
     Entry = 
     new llvm::GlobalVariable(ObjCTypes.ProtocolnfABITy, false,
-                             llvm::GlobalValue::WeakLinkage,
+                             llvm::GlobalValue::WeakAnyLinkage,
                              Init, 
                              std::string("\01l_OBJC_PROTOCOL_$_")+ProtocolName,
                              &CGM.getModule());
@@ -4327,7 +4329,7 @@ llvm::Constant *CGObjCNonFragileABIMac::GetOrEmitProtocol(
   // __DATA, __objc_protolist
   llvm::GlobalVariable *PTGV = new llvm::GlobalVariable(
                                       ObjCTypes.ProtocolnfABIPtrTy, false,
-                                      llvm::GlobalValue::WeakLinkage,
+                                      llvm::GlobalValue::WeakAnyLinkage,
                                       Entry, 
                                       std::string("\01l_OBJC_LABEL_PROTOCOL_$_")
                                                   +ProtocolName,
@@ -4547,7 +4549,7 @@ CodeGen::RValue CGObjCNonFragileABIMac::EmitMessageSend(
     Values[1] = GetMethodVarName(Sel);
     llvm::Constant *Init = llvm::ConstantStruct::get(Values);
     GV =  new llvm::GlobalVariable(Init->getType(), false,
-                                   llvm::GlobalValue::WeakLinkage,
+                                   llvm::GlobalValue::WeakAnyLinkage,
                                    Init,
                                    Name,
                                    &CGM.getModule());
@@ -5108,7 +5110,7 @@ CGObjCNonFragileABIMac::GetInterfaceEHType(const ObjCInterfaceType *IT) {
 
   Entry = 
     new llvm::GlobalVariable(ObjCTypes.EHTypeTy, false,
-                             llvm::GlobalValue::WeakLinkage,
+                             llvm::GlobalValue::WeakAnyLinkage,
                              Init, 
                              (std::string("OBJC_EHTYPE_$_") + 
                               ID->getIdentifier()->getName()),
index 85d5208d49a2c37973ee73edfdad8f14f678a944..95d881bc49a3e2e7e15c1bed1f3e53e8cf5242e8 100644 (file)
@@ -270,7 +270,7 @@ void CodeGenModule::SetGlobalValueAttributes(const Decl *D,
                D->getAttr<WeakImportAttr>()) {
       // "extern_weak" is overloaded in LLVM; we probably should have
       // separate linkage types for this. 
-      GV->setLinkage(llvm::Function::ExternalWeakLinkage);
+      GV->setLinkage(llvm::Function::ExternalWeakAnyLinkage);
    }
   } else {
     if (IsInternal) {
@@ -285,7 +285,7 @@ void CodeGenModule::SetGlobalValueAttributes(const Decl *D,
           GV->setLinkage(llvm::Function::DLLExportLinkage);
       } else if (D->getAttr<WeakAttr>() || D->getAttr<WeakImportAttr>() || 
                  IsInline)
-        GV->setLinkage(llvm::Function::WeakLinkage);
+        GV->setLinkage(llvm::Function::WeakAnyLinkage);
     }
   }
 
@@ -611,7 +611,7 @@ void CodeGenModule::EmitGlobalDefinition(const ValueDecl *D) {
       setGlobalVisibility(GV, VisibilityAttr::HiddenVisibility);
 
     if (D->getAttr<WeakAttr>() || D->getAttr<WeakImportAttr>())
-      GV->setLinkage(llvm::GlobalValue::ExternalWeakLinkage);
+      GV->setLinkage(llvm::GlobalValue::ExternalWeakAnyLinkage);
 
     if (const AsmLabelAttr *ALA = D->getAttr<AsmLabelAttr>()) {
       // Prefaced with special LLVM marker to indicate that the name
@@ -746,7 +746,7 @@ void CodeGenModule::EmitGlobalVarDefinition(const VarDecl *D) {
   else if (D->getAttr<DLLExportAttr>())
     GV->setLinkage(llvm::Function::DLLExportLinkage);
   else if (D->getAttr<WeakAttr>() || D->getAttr<WeakImportAttr>())
-    GV->setLinkage(llvm::GlobalVariable::WeakLinkage);
+    GV->setLinkage(llvm::GlobalVariable::WeakAnyLinkage);
   else {
     // FIXME: This isn't right.  This should handle common linkage and other
     // stuff.
@@ -757,7 +757,7 @@ void CodeGenModule::EmitGlobalVarDefinition(const VarDecl *D) {
       assert(0 && "Can't have auto or register globals");
     case VarDecl::None:
       if (!D->getInit())
-        GV->setLinkage(llvm::GlobalVariable::CommonLinkage);
+        GV->setLinkage(llvm::GlobalVariable::CommonAnyLinkage);
       else
         GV->setLinkage(llvm::GlobalVariable::ExternalLinkage);
       break;