Index: lib/CodeGen/CGObjCMac.cpp =================================================================== --- lib/CodeGen/CGObjCMac.cpp +++ lib/CodeGen/CGObjCMac.cpp @@ -1020,11 +1020,13 @@ llvm::GlobalVariable *CreateMetadataVar(Twine Name, ConstantStructBuilder &Init, StringRef Section, CharUnits Align, - bool AddToUsed); + bool AddToUsed, + bool ExplicitDataSegment); llvm::GlobalVariable *CreateMetadataVar(Twine Name, llvm::Constant *Init, StringRef Section, CharUnits Align, - bool AddToUsed); + bool AddToUsed, + bool ExplicitDataSegment); llvm::GlobalVariable *CreateCStringLiteral(StringRef Name, ObjCLabelType LabelType, @@ -1968,16 +1970,18 @@ // The struct. CharUnits Alignment = CGM.getPointerAlign(); + bool ExplicitDataSegment = CGM.getLangOpts().ObjCRuntime.isNonFragile(); GV = Fields.finishAndCreateGlobal("_unnamed_nsstring_", Alignment, /*constant*/ true, - llvm::GlobalVariable::PrivateLinkage); - const char *NSStringSection = "__OBJC,__cstring_object,regular,no_dead_strip"; - const char *NSStringNonFragileABISection = - "__DATA,__objc_stringobj,regular,no_dead_strip"; + ExplicitDataSegment + ? llvm::GlobalVariable::InternalLinkage + : llvm::GlobalValue::PrivateLinkage); // FIXME. Fix section. - GV->setSection(CGM.getLangOpts().ObjCRuntime.isNonFragile() - ? NSStringNonFragileABISection - : NSStringSection); + if (ExplicitDataSegment) + GV->setSection("__DATA,__objc_stringobj,regular,no_dead_strip"); + else + GV->setSection("__OBJC,__cstring_object,regular,no_dead_strip"); + Entry.second = GV; return ConstantAddress(GV, Alignment); @@ -3105,8 +3109,8 @@ values.add(classProperties); // No special section, but goes in llvm.used - return CreateMetadataVar("\01l_OBJC_PROTOCOLEXT_" + PD->getName(), values, - StringRef(), CGM.getPointerAlign(), true); + return CreateMetadataVar("_OBJC_PROTOCOLEXT_" + PD->getName(), values, + StringRef(), CGM.getPointerAlign(), true, false); } /* @@ -3149,8 +3153,8 @@ if (CGM.getTriple().isOSBinFormatMachO()) section = "__OBJC,__cat_cls_meth,regular,no_dead_strip"; - llvm::GlobalVariable *GV = - CreateMetadataVar(name, values, section, CGM.getPointerAlign(), false); + llvm::GlobalVariable *GV = CreateMetadataVar( + name, values, section, CGM.getPointerAlign(), false, false); return llvm::ConstantExpr::getBitCast(GV, ObjCTypes.ProtocolListPtrTy); } @@ -3249,12 +3253,18 @@ propertiesArray.finishAndAddTo(values); StringRef Section; - if (CGM.getTriple().isOSBinFormatMachO()) - Section = (ObjCABI == 2) ? "__DATA, __objc_const" - : "__OBJC,__property,regular,no_dead_strip"; + bool ExplicitDataSegment = false; + if (CGM.getTriple().isOSBinFormatMachO()) { + if (ObjCABI == 2) { + Section = "__DATA, __objc_const"; + ExplicitDataSegment = true; + } else { + Section = "__OBJC,__property,regular,no_dead_strip"; + } + } - llvm::GlobalVariable *GV = - CreateMetadataVar(Name, values, Section, CGM.getPointerAlign(), true); + llvm::GlobalVariable *GV = CreateMetadataVar( + Name, values, Section, CGM.getPointerAlign(), true, ExplicitDataSegment); return llvm::ConstantExpr::getBitCast(GV, ObjCTypes.PropertyListPtrTy); } @@ -3271,11 +3281,13 @@ llvm::Constant *Init = llvm::ConstantArray::get(AT, MethodTypes); StringRef Section; - if (CGM.getTriple().isOSBinFormatMachO() && ObjCABI == 2) + bool ExplicitDataSegment = + CGM.getTriple().isOSBinFormatMachO() && ObjCABI == 2; + if (ExplicitDataSegment) Section = "__DATA, __objc_const"; - llvm::GlobalVariable *GV = - CreateMetadataVar(Name, Init, Section, CGM.getPointerAlign(), true); + llvm::GlobalVariable *GV = CreateMetadataVar( + Name, Init, Section, CGM.getPointerAlign(), true, ExplicitDataSegment); return llvm::ConstantExpr::getBitCast(GV, ObjCTypes.Int8PtrPtrTy); } @@ -3338,9 +3350,9 @@ // If there is no category @interface then there can be no properties. if (Category) { - Values.add(EmitPropertyList("\01l_OBJC_$_PROP_LIST_" + ExtName.str(), + Values.add(EmitPropertyList("_OBJC_$_PROP_LIST_" + ExtName.str(), OCD, Category, ObjCTypes, false)); - Values.add(EmitPropertyList("\01l_OBJC_$_CLASS_PROP_LIST_" + ExtName.str(), + Values.add(EmitPropertyList("_OBJC_$_CLASS_PROP_LIST_" + ExtName.str(), OCD, Category, ObjCTypes, true)); } else { Values.addNullPointer(ObjCTypes.PropertyListPtrTy); @@ -3350,7 +3362,7 @@ llvm::GlobalVariable *GV = CreateMetadataVar("OBJC_CATEGORY_" + ExtName.str(), Values, "__OBJC,__category,regular,no_dead_strip", - CGM.getPointerAlign(), true); + CGM.getPointerAlign(), true, false); DefinedCategories.push_back(GV); DefinedCategoryNames.insert(llvm::CachedHashString(ExtName)); // method definition entries must be clear for next implementation. @@ -3554,7 +3566,8 @@ GV->setAlignment(CGM.getPointerAlign().getQuantity()); CGM.addCompilerUsedGlobal(GV); } else - GV = CreateMetadataVar(Name, values, Section, CGM.getPointerAlign(), true); + GV = CreateMetadataVar( + Name, values, Section, CGM.getPointerAlign(), true, false); DefinedClasses.push_back(GV); ImplementedClasses.push_back(Interface); // method definition entries must be clear for next implementation. @@ -3686,8 +3699,8 @@ // Properties. llvm::Constant *propertyList = - EmitPropertyList((isMetaclass ? Twine("\01l_OBJC_$_CLASS_PROP_LIST_") - : Twine("\01l_OBJC_$_PROP_LIST_")) + EmitPropertyList((isMetaclass ? Twine("_OBJC_$_CLASS_PROP_LIST_") + : Twine("_OBJC_$_PROP_LIST_")) + ID->getName(), ID, ID->getClassInterface(), ObjCTypes, isMetaclass); @@ -3707,7 +3720,7 @@ return CreateMetadataVar("OBJC_CLASSEXT_" + ID->getName(), values, "__OBJC,__class_ext,regular,no_dead_strip", - CGM.getPointerAlign(), true); + CGM.getPointerAlign(), true, false); } /* @@ -3768,11 +3781,11 @@ GV = CreateMetadataVar("OBJC_CLASS_VARIABLES_" + ID->getName(), ivarList, "__OBJC,__class_vars,regular,no_dead_strip", - CGM.getPointerAlign(), true); + CGM.getPointerAlign(), true, false); else GV = CreateMetadataVar("OBJC_INSTANCE_VARIABLES_" + ID->getName(), ivarList, "__OBJC,__instance_vars,regular,no_dead_strip", - CGM.getPointerAlign(), true); + CGM.getPointerAlign(), true, false); return llvm::ConstantExpr::getBitCast(GV, ObjCTypes.IvarListPtrTy); } @@ -3890,8 +3903,8 @@ } methodArray.finishAndAddTo(values); - llvm::GlobalVariable *GV = CreateMetadataVar(prefix + name, values, section, - CGM.getPointerAlign(), true); + llvm::GlobalVariable *GV = CreateMetadataVar( + prefix + name, values, section, CGM.getPointerAlign(), true, false); return llvm::ConstantExpr::getBitCast(GV, ObjCTypes.MethodDescriptionListPtrTy); } @@ -3907,8 +3920,8 @@ } methodArray.finishAndAddTo(values); - llvm::GlobalVariable *GV = CreateMetadataVar(prefix + name, values, section, - CGM.getPointerAlign(), true); + llvm::GlobalVariable *GV = CreateMetadataVar( + prefix + name, values, section, CGM.getPointerAlign(), true, false); return llvm::ConstantExpr::getBitCast(GV, ObjCTypes.MethodListPtrTy); } @@ -3930,14 +3943,15 @@ return Method; } -llvm::GlobalVariable *CGObjCCommonMac::CreateMetadataVar(Twine Name, - ConstantStructBuilder &Init, - StringRef Section, - CharUnits Align, - bool AddToUsed) { +llvm::GlobalVariable * +CGObjCCommonMac::CreateMetadataVar(Twine Name, ConstantStructBuilder &Init, + StringRef Section, CharUnits Align, + bool AddToUsed, bool ExplicitDataSegment) { + llvm::GlobalValue::LinkageTypes LT = ExplicitDataSegment || Section.empty() + ? llvm::GlobalValue::InternalLinkage + : llvm::GlobalValue::PrivateLinkage; llvm::GlobalVariable *GV = - Init.finishAndCreateGlobal(Name, Align, /*constant*/ false, - llvm::GlobalValue::PrivateLinkage); + Init.finishAndCreateGlobal(Name, Align, /*constant*/ false, LT); if (!Section.empty()) GV->setSection(Section); if (AddToUsed) @@ -3945,15 +3959,16 @@ return GV; } -llvm::GlobalVariable *CGObjCCommonMac::CreateMetadataVar(Twine Name, - llvm::Constant *Init, - StringRef Section, - CharUnits Align, - bool AddToUsed) { +llvm::GlobalVariable * +CGObjCCommonMac::CreateMetadataVar(Twine Name, llvm::Constant *Init, + StringRef Section, CharUnits Align, + bool AddToUsed, bool ExplicitDataSegment) { llvm::Type *Ty = Init->getType(); + llvm::GlobalValue::LinkageTypes LT = ExplicitDataSegment || Section.empty() + ? llvm::GlobalValue::InternalLinkage + : llvm::GlobalValue::PrivateLinkage; llvm::GlobalVariable *GV = - new llvm::GlobalVariable(CGM.getModule(), Ty, false, - llvm::GlobalValue::PrivateLinkage, Init, Name); + new llvm::GlobalVariable(CGM.getModule(), Ty, false, LT, Init, Name); if (!Section.empty()) GV->setSection(Section); GV->setAlignment(Align.getQuantity()); @@ -4975,7 +4990,7 @@ values.add(EmitModuleSymbols()); CreateMetadataVar("OBJC_MODULES", values, "__OBJC,__module_info,regular,no_dead_strip", - CGM.getPointerAlign(), true); + CGM.getPointerAlign(), true, false); } llvm::Constant *CGObjCMac::EmitModuleSymbols() { @@ -5013,7 +5028,7 @@ llvm::GlobalVariable *GV = CreateMetadataVar( "OBJC_SYMBOLS", values, "__OBJC,__symbols,regular,no_dead_strip", - CGM.getPointerAlign(), true); + CGM.getPointerAlign(), true, false); return llvm::ConstantExpr::getBitCast(GV, ObjCTypes.SymtabPtrTy); } @@ -5030,7 +5045,7 @@ Entry = CreateMetadataVar( "OBJC_CLASS_REFERENCES_", Casted, "__OBJC,__cls_refs,literal_pointers,no_dead_strip", - CGM.getPointerAlign(), true); + CGM.getPointerAlign(), true, false); } return CGF.Builder.CreateAlignedLoad(Entry, CGF.getPointerAlign()); @@ -5067,7 +5082,8 @@ ObjCTypes.SelectorPtrTy); Entry = CreateMetadataVar( "OBJC_SELECTOR_REFERENCES_", Casted, - "__OBJC,__message_refs,literal_pointers,no_dead_strip", Align, true); + "__OBJC,__message_refs,literal_pointers,no_dead_strip", Align, true, + false); Entry->setExternallyInitialized(true); } @@ -6000,10 +6016,18 @@ Symbols.size()), Symbols); + llvm::GlobalValue::LinkageTypes LT; + if (CGM.getTriple().isOSBinFormatMachO()) { + // Section name is obtained by calling GetSectionName, which returns + // sections in the __DATA segment on MachO. + assert(SectionName.startswith("__DATA") && "Section not in __DATA"); + LT = llvm::GlobalValue::InternalLinkage; + } else { + LT = llvm::GlobalValue::PrivateLinkage; + } + llvm::GlobalVariable *GV = - new llvm::GlobalVariable(CGM.getModule(), Init->getType(), false, - llvm::GlobalValue::PrivateLinkage, - Init, + new llvm::GlobalVariable(CGM.getModule(), Init->getType(), false, LT, Init, SymbolName); GV->setAlignment(CGM.getDataLayout().getABITypeAlignment(Init->getType())); GV->setSection(SectionName); @@ -6182,7 +6206,7 @@ const ObjCInterfaceDecl *OID = ID->getClassInterface(); assert(OID && "CGObjCNonFragileABIMac::BuildClassRoTInitializer"); - values.add(EmitProtocolList("\01l_OBJC_CLASS_PROTOCOLS_$_" + values.add(EmitProtocolList("_OBJC_CLASS_PROTOCOLS_$_" + OID->getObjCRuntimeNameAsString(), OID->all_referenced_protocol_begin(), OID->all_referenced_protocol_end())); @@ -6191,26 +6215,25 @@ values.addNullPointer(ObjCTypes.IvarListnfABIPtrTy); values.add(GetIvarLayoutName(nullptr, ObjCTypes)); values.add(EmitPropertyList( - "\01l_OBJC_$_CLASS_PROP_LIST_" + ID->getObjCRuntimeNameAsString(), + "_OBJC_$_CLASS_PROP_LIST_" + ID->getObjCRuntimeNameAsString(), ID, ID->getClassInterface(), ObjCTypes, true)); } else { values.add(EmitIvarList(ID)); values.add(BuildWeakIvarLayout(ID, beginInstance, endInstance, hasMRCWeak)); values.add(EmitPropertyList( - "\01l_OBJC_$_PROP_LIST_" + ID->getObjCRuntimeNameAsString(), + "_OBJC_$_PROP_LIST_" + ID->getObjCRuntimeNameAsString(), ID, ID->getClassInterface(), ObjCTypes, false)); } llvm::SmallString<64> roLabel; llvm::raw_svector_ostream(roLabel) - << ((flags & NonFragileABI_Class_Meta) ? "\01l_OBJC_METACLASS_RO_$_" - : "\01l_OBJC_CLASS_RO_$_") + << ((flags & NonFragileABI_Class_Meta) ? "_OBJC_METACLASS_RO_$_" + : "_OBJC_CLASS_RO_$_") << ClassName; - llvm::GlobalVariable *CLASS_RO_GV = - values.finishAndCreateGlobal(roLabel, CGM.getPointerAlign(), - /*constant*/ false, - llvm::GlobalValue::PrivateLinkage); + llvm::GlobalVariable *CLASS_RO_GV = values.finishAndCreateGlobal( + roLabel, CGM.getPointerAlign(), /*constant*/ false, + llvm::GlobalValue::InternalLinkage); if (CGM.getTriple().isOSBinFormatMachO()) CLASS_RO_GV->setSection("__DATA, __objc_const"); return CLASS_RO_GV; @@ -6251,6 +6274,7 @@ if (CGM.getTriple().isOSBinFormatMachO()) GV->setSection("__DATA, __objc_data"); + GV->setAlignment( CGM.getDataLayout().getABITypeAlignment(ObjCTypes.ClassnfABITy)); if (!CGM.getTriple().isOSBinFormatCOFF()) @@ -6445,7 +6469,7 @@ llvm::ConstantExpr::getBitCast(GetOrEmitProtocol(PD), ObjCTypes.getExternalProtocolPtrTy()); - std::string ProtocolName("\01l_OBJC_PROTOCOL_REFERENCE_$_"); + std::string ProtocolName("_OBJC_PROTOCOL_REFERENCE_$_"); ProtocolName += PD->getObjCRuntimeNameAsString(); CharUnits Align = CGF.getPointerAlign(); @@ -6480,7 +6504,7 @@ /// void CGObjCNonFragileABIMac::GenerateCategory(const ObjCCategoryImplDecl *OCD) { const ObjCInterfaceDecl *Interface = OCD->getClassInterface(); - const char *Prefix = "\01l_OBJC_$_CATEGORY_"; + const char *Prefix = "_OBJC_$_CATEGORY_"; llvm::SmallString<64> ExtCatName(Prefix); ExtCatName += Interface->getObjCRuntimeNameAsString(); @@ -6516,14 +6540,14 @@ SmallString<256> ExtName; llvm::raw_svector_ostream(ExtName) << Interface->getObjCRuntimeNameAsString() << "_$_" << OCD->getName(); - values.add(EmitProtocolList("\01l_OBJC_CATEGORY_PROTOCOLS_$_" + values.add(EmitProtocolList("_OBJC_CATEGORY_PROTOCOLS_$_" + Interface->getObjCRuntimeNameAsString() + "_$_" + Category->getName(), Category->protocol_begin(), Category->protocol_end())); - values.add(EmitPropertyList("\01l_OBJC_$_PROP_LIST_" + ExtName.str(), + values.add(EmitPropertyList("_OBJC_$_PROP_LIST_" + ExtName.str(), OCD, Category, ObjCTypes, false)); - values.add(EmitPropertyList("\01l_OBJC_$_CLASS_PROP_LIST_" + ExtName.str(), + values.add(EmitPropertyList("_OBJC_$_CLASS_PROP_LIST_" + ExtName.str(), OCD, Category, ObjCTypes, true)); } else { values.addNullPointer(ObjCTypes.ProtocolListnfABIPtrTy); @@ -6534,12 +6558,12 @@ unsigned Size = CGM.getDataLayout().getTypeAllocSize(ObjCTypes.CategorynfABITy); values.addInt(ObjCTypes.IntTy, Size); - llvm::GlobalVariable *GCATV = - values.finishAndCreateGlobal(ExtCatName.str(), CGM.getPointerAlign(), - /*constant*/ false, - llvm::GlobalValue::PrivateLinkage); + llvm::GlobalVariable *GCATV = values.finishAndCreateGlobal( + ExtCatName.str(), CGM.getPointerAlign(), /*constant*/ false, + llvm::GlobalValue::InternalLinkage); if (CGM.getTriple().isOSBinFormatMachO()) GCATV->setSection("__DATA, __objc_const"); + CGM.addCompilerUsedGlobal(GCATV); DefinedCategories.push_back(GCATV); @@ -6598,36 +6622,36 @@ bool forProtocol; switch (kind) { case MethodListType::CategoryInstanceMethods: - prefix = "\01l_OBJC_$_CATEGORY_INSTANCE_METHODS_"; + prefix = "_OBJC_$_CATEGORY_INSTANCE_METHODS_"; forProtocol = false; break; case MethodListType::CategoryClassMethods: - prefix = "\01l_OBJC_$_CATEGORY_CLASS_METHODS_"; + prefix = "_OBJC_$_CATEGORY_CLASS_METHODS_"; forProtocol = false; break; case MethodListType::InstanceMethods: - prefix = "\01l_OBJC_$_INSTANCE_METHODS_"; + prefix = "_OBJC_$_INSTANCE_METHODS_"; forProtocol = false; break; case MethodListType::ClassMethods: - prefix = "\01l_OBJC_$_CLASS_METHODS_"; + prefix = "_OBJC_$_CLASS_METHODS_"; forProtocol = false; break; case MethodListType::ProtocolInstanceMethods: - prefix = "\01l_OBJC_$_PROTOCOL_INSTANCE_METHODS_"; + prefix = "_OBJC_$_PROTOCOL_INSTANCE_METHODS_"; forProtocol = true; break; case MethodListType::ProtocolClassMethods: - prefix = "\01l_OBJC_$_PROTOCOL_CLASS_METHODS_"; + prefix = "_OBJC_$_PROTOCOL_CLASS_METHODS_"; forProtocol = true; break; case MethodListType::OptionalProtocolInstanceMethods: - prefix = "\01l_OBJC_$_PROTOCOL_INSTANCE_METHODS_OPT_"; + prefix = "_OBJC_$_PROTOCOL_INSTANCE_METHODS_OPT_"; forProtocol = true; break; case MethodListType::OptionalProtocolClassMethods: - prefix = "\01l_OBJC_$_PROTOCOL_CLASS_METHODS_OPT_"; + prefix = "_OBJC_$_PROTOCOL_CLASS_METHODS_OPT_"; forProtocol = true; break; } @@ -6646,11 +6670,12 @@ } methodArray.finishAndAddTo(values); - auto *GV = values.finishAndCreateGlobal(prefix + name, CGM.getPointerAlign(), - /*constant*/ false, - llvm::GlobalValue::PrivateLinkage); + auto *GV = values.finishAndCreateGlobal( + prefix + name, CGM.getPointerAlign(), /*constant*/ false, + llvm::GlobalValue::InternalLinkage); if (CGM.getTriple().isOSBinFormatMachO()) GV->setSection("__DATA, __objc_const"); + CGM.addCompilerUsedGlobal(GV); return llvm::ConstantExpr::getBitCast(GV, ObjCTypes.MethodListnfABIPtrTy); } @@ -6790,11 +6815,10 @@ ivars.finishAndAddTo(ivarList); ivarList.fillPlaceholderWithInt(ivarCountSlot, ObjCTypes.IntTy, ivarCount); - const char *Prefix = "\01l_OBJC_$_INSTANCE_VARIABLES_"; - llvm::GlobalVariable *GV = - ivarList.finishAndCreateGlobal(Prefix + OID->getObjCRuntimeNameAsString(), - CGM.getPointerAlign(), /*constant*/ false, - llvm::GlobalValue::PrivateLinkage); + const char *Prefix = "_OBJC_$_INSTANCE_VARIABLES_"; + llvm::GlobalVariable *GV = ivarList.finishAndCreateGlobal( + Prefix + OID->getObjCRuntimeNameAsString(), CGM.getPointerAlign(), + /*constant*/ false, llvm::GlobalValue::InternalLinkage); if (CGM.getTriple().isOSBinFormatMachO()) GV->setSection("__DATA, __objc_const"); CGM.addCompilerUsedGlobal(GV); @@ -6864,7 +6888,7 @@ // isa is NULL values.addNullPointer(ObjCTypes.ObjectPtrTy); values.add(GetClassName(PD->getObjCRuntimeNameAsString())); - values.add(EmitProtocolList("\01l_OBJC_$_PROTOCOL_REFS_" + values.add(EmitProtocolList("_OBJC_$_PROTOCOL_REFS_" + PD->getObjCRuntimeNameAsString(), PD->protocol_begin(), PD->protocol_end())); @@ -6877,13 +6901,13 @@ values.add(methodLists.emitMethodList(this, PD, ProtocolMethodLists::OptionalClassMethods)); values.add(EmitPropertyList( - "\01l_OBJC_$_PROP_LIST_" + PD->getObjCRuntimeNameAsString(), + "_OBJC_$_PROP_LIST_" + PD->getObjCRuntimeNameAsString(), nullptr, PD, ObjCTypes, false)); uint32_t Size = CGM.getDataLayout().getTypeAllocSize(ObjCTypes.ProtocolnfABITy); values.addInt(ObjCTypes.IntTy, Size); values.addInt(ObjCTypes.IntTy, 0); - values.add(EmitProtocolMethodTypes("\01l_OBJC_$_PROTOCOL_METHOD_TYPES_" + values.add(EmitProtocolMethodTypes("_OBJC_$_PROTOCOL_METHOD_TYPES_" + PD->getObjCRuntimeNameAsString(), methodLists.emitExtendedTypesArray(this), ObjCTypes)); @@ -6892,7 +6916,7 @@ values.addNullPointer(ObjCTypes.Int8PtrTy); values.add(EmitPropertyList( - "\01l_OBJC_$_CLASS_PROP_LIST_" + PD->getObjCRuntimeNameAsString(), + "_OBJC_$_CLASS_PROP_LIST_" + PD->getObjCRuntimeNameAsString(), nullptr, PD, ObjCTypes, true)); if (Entry) { @@ -6978,7 +7002,7 @@ GV = values.finishAndCreateGlobal(Name, CGM.getPointerAlign(), /*constant*/ false, - llvm::GlobalValue::PrivateLinkage); + llvm::GlobalValue::InternalLinkage); if (CGM.getTriple().isOSBinFormatMachO()) GV->setSection("__DATA, __objc_const"); CGM.addCompilerUsedGlobal(GV); @@ -7091,7 +7115,7 @@ // except normal, non-super message-sends. // FIXME: don't use this for that. llvm::FunctionCallee fn = nullptr; - std::string messageRefName("\01l_"); + std::string messageRefName("_"); if (CGM.ReturnSlotInterferesWithArgs(MSI.CallInfo)) { if (isSuper) { fn = ObjCTypes.getMessageSendSuper2StretFixupFn(); @@ -7246,7 +7270,10 @@ } Entry = new llvm::GlobalVariable(CGM.getModule(), ObjCTypes.ClassnfABIPtrTy, - false, llvm::GlobalValue::PrivateLinkage, + false, + CGM.getTriple().isOSBinFormatMachO() + ? llvm::GlobalValue::InternalLinkage + : llvm::GlobalValue::PrivateLinkage, ClassGV, "OBJC_CLASSLIST_REFERENCES_$_"); Entry->setAlignment(Align.getQuantity()); Entry->setSection(GetSectionName("__objc_classrefs", @@ -7281,7 +7308,10 @@ if (!Entry) { auto ClassGV = GetClassGlobal(ID, /*metaclass*/ false, NotForDefinition); Entry = new llvm::GlobalVariable(CGM.getModule(), ObjCTypes.ClassnfABIPtrTy, - false, llvm::GlobalValue::PrivateLinkage, + false, + CGM.getTriple().isOSBinFormatMachO() + ? llvm::GlobalValue::InternalLinkage + : llvm::GlobalValue::PrivateLinkage, ClassGV, "OBJC_CLASSLIST_SUP_REFS_$_"); Entry->setAlignment(Align.getQuantity()); Entry->setSection(GetSectionName("__objc_superrefs", @@ -7303,7 +7333,10 @@ auto MetaClassGV = GetClassGlobal(ID, /*metaclass*/ true, NotForDefinition); Entry = new llvm::GlobalVariable(CGM.getModule(), ObjCTypes.ClassnfABIPtrTy, - false, llvm::GlobalValue::PrivateLinkage, + false, + CGM.getTriple().isOSBinFormatMachO() + ? llvm::GlobalValue::InternalLinkage + : llvm::GlobalValue::PrivateLinkage, MetaClassGV, "OBJC_CLASSLIST_SUP_REFS_$_"); Entry->setAlignment(Align.getQuantity()); @@ -7399,7 +7432,10 @@ llvm::ConstantExpr::getBitCast(GetMethodVarName(Sel), ObjCTypes.SelectorPtrTy); Entry = new llvm::GlobalVariable(CGM.getModule(), ObjCTypes.SelectorPtrTy, - false, llvm::GlobalValue::PrivateLinkage, + false, + CGM.getTriple().isOSBinFormatMachO() + ? llvm::GlobalValue::InternalLinkage + : llvm::GlobalValue::PrivateLinkage, Casted, "OBJC_SELECTOR_REFERENCES_"); Entry->setExternallyInitialized(true); Entry->setSection(GetSectionName("__objc_selrefs", Index: test/CodeGenObjC/arc.m =================================================================== --- test/CodeGenObjC/arc.m +++ test/CodeGenObjC/arc.m @@ -634,11 +634,11 @@ // rdar://problem/12492434 // Note that we set the flag saying that we need destruction *and* // the flag saying that we don't also need construction. -// CHECK-GLOBALS: @"\01l_OBJC_CLASS_RO_$_Test23" = private global [[RO_T:%.*]] { i32 390, +// CHECK-GLOBALS: @"_OBJC_CLASS_RO_$_Test23" = internal global [[RO_T:%.*]] { i32 390, @interface Test23 { id x; } @end @implementation Test23 @end -// CHECK-GLOBALS: @"\01l_OBJC_CLASS_RO_$_Test24" = private global [[RO_T:%.*]] { i32 130, +// CHECK-GLOBALS: @"_OBJC_CLASS_RO_$_Test24" = internal global [[RO_T:%.*]] { i32 130, @interface Test24 {} @end @implementation Test24 @end Index: test/CodeGenObjC/boxing.m =================================================================== --- test/CodeGenObjC/boxing.m +++ test/CodeGenObjC/boxing.m @@ -57,17 +57,17 @@ // CHECK: [[STRUCT_NSCONSTANT_STRING_TAG:%.*]] = type { i32*, i32, i8*, i64 } // CHECK: [[WithIntMeth:@.*]] = private unnamed_addr constant [15 x i8] c"numberWithInt:\00" -// CHECK: [[WithIntSEL:@.*]] = private externally_initialized global i8* getelementptr inbounds ([15 x i8], [15 x i8]* [[WithIntMeth]] +// CHECK: [[WithIntSEL:@.*]] = internal externally_initialized global i8* getelementptr inbounds ([15 x i8], [15 x i8]* [[WithIntMeth]] // CHECK: [[WithCharMeth:@.*]] = private unnamed_addr constant [16 x i8] c"numberWithChar:\00" -// CHECK: [[WithCharSEL:@.*]] = private externally_initialized global i8* getelementptr inbounds ([16 x i8], [16 x i8]* [[WithCharMeth]] +// CHECK: [[WithCharSEL:@.*]] = internal externally_initialized global i8* getelementptr inbounds ([16 x i8], [16 x i8]* [[WithCharMeth]] // CHECK: [[WithBoolMeth:@.*]] = private unnamed_addr constant [16 x i8] c"numberWithBool:\00" -// CHECK: [[WithBoolSEL:@.*]] = private externally_initialized global i8* getelementptr inbounds ([16 x i8], [16 x i8]* [[WithBoolMeth]] +// CHECK: [[WithBoolSEL:@.*]] = internal externally_initialized global i8* getelementptr inbounds ([16 x i8], [16 x i8]* [[WithBoolMeth]] // CHECK: [[WithIntegerMeth:@.*]] = private unnamed_addr constant [19 x i8] c"numberWithInteger:\00" -// CHECK: [[WithIntegerSEL:@.*]] = private externally_initialized global i8* getelementptr inbounds ([19 x i8], [19 x i8]* [[WithIntegerMeth]] +// CHECK: [[WithIntegerSEL:@.*]] = internal externally_initialized global i8* getelementptr inbounds ([19 x i8], [19 x i8]* [[WithIntegerMeth]] // CHECK: [[WithUnsignedIntegerMeth:@.*]] = private unnamed_addr constant [27 x i8] c"numberWithUnsignedInteger:\00" -// CHECK: [[WithUnsignedIntegerSEL:@.*]] = private externally_initialized global i8* getelementptr inbounds ([27 x i8], [27 x i8]* [[WithUnsignedIntegerMeth]] +// CHECK: [[WithUnsignedIntegerSEL:@.*]] = internal externally_initialized global i8* getelementptr inbounds ([27 x i8], [27 x i8]* [[WithUnsignedIntegerMeth]] // CHECK: [[stringWithUTF8StringMeth:@.*]] = private unnamed_addr constant [22 x i8] c"stringWithUTF8String:\00" -// CHECK: [[stringWithUTF8StringSEL:@.*]] = private externally_initialized global i8* getelementptr inbounds ([22 x i8], [22 x i8]* [[stringWithUTF8StringMeth]] +// CHECK: [[stringWithUTF8StringSEL:@.*]] = internal externally_initialized global i8* getelementptr inbounds ([22 x i8], [22 x i8]* [[stringWithUTF8StringMeth]] // CHECK: [[STR0:.*]] = private unnamed_addr constant [4 x i8] c"abc\00", section "__TEXT,__cstring,cstring_literals", align 1 // CHECK: [[UNNAMED_CFSTRING:.*]] = private global [[STRUCT_NSCONSTANT_STRING_TAG]] { i32* getelementptr inbounds ([0 x i32], [0 x i32]* @__CFConstantStringClassReference, i32 0, i32 0), i32 1992, i8* getelementptr inbounds ([4 x i8], [4 x i8]* [[STR0]], i32 0, i32 0), i64 3 }, section "__DATA,__cfstring", align 8 Index: test/CodeGenObjC/exceptions-asm-attribute.m =================================================================== --- test/CodeGenObjC/exceptions-asm-attribute.m +++ test/CodeGenObjC/exceptions-asm-attribute.m @@ -15,7 +15,7 @@ // CHECK-X86_64: @"OBJC_EHTYPE_$_MySecretNamespace.EH1" = weak global {{.*}}, align 8 // CHECK-X86_64: @"OBJC_EHTYPE_$_MySecretNamespace.EH2" = external global // CHECK-X86_64: @"OBJC_EHTYPE_$_MySecretNamespace.EH3" = global {{.*}}, section "__DATA,__objc_const", align 8 -// CHECK-X86_64: @"OBJC_LABEL_CLASS_$" = private global {{.*}}, section "__DATA,__objc_classlist,regular,no_dead_strip", align 8 +// CHECK-X86_64: @"OBJC_LABEL_CLASS_$" = internal global {{.*}}, section "__DATA,__objc_classlist,regular,no_dead_strip", align 8 // CHECK-X86_64: define internal void @"\01-[A im0]" // CHECK-X86_64: define internal void @"\01-[A(Cat) im1]" @@ -39,7 +39,7 @@ // CHECK-ARMV6: @"OBJC_EHTYPE_$_MySecretNamespace.EH1" = weak global {{.*}}, align 4 // CHECK-ARMV6: @"OBJC_EHTYPE_$_MySecretNamespace.EH2" = external global // CHECK-ARMV6: @"OBJC_EHTYPE_$_MySecretNamespace.EH3" = global {{.*}}, section "__DATA,__objc_const", align 4 -// CHECK-ARMV6: @"OBJC_LABEL_CLASS_$" = private global {{.*}}, section "__DATA,__objc_classlist,regular,no_dead_strip", align 4 +// CHECK-ARMV6: @"OBJC_LABEL_CLASS_$" = internal global {{.*}}, section "__DATA,__objc_classlist,regular,no_dead_strip", align 4 // CHECK-ARMV6: define internal void @"\01-[A im0]" // CHECK-ARMV6: define internal void @"\01-[A(Cat) im1]" Index: test/CodeGenObjC/externally-initialized-selectors.m =================================================================== --- test/CodeGenObjC/externally-initialized-selectors.m +++ test/CodeGenObjC/externally-initialized-selectors.m @@ -1,7 +1,8 @@ -// RUN: %clang_cc1 -fobjc-runtime=macosx-fragile-10.5 -o - -emit-llvm %s | FileCheck %s -// RUN: %clang_cc1 -o - -emit-llvm %s | FileCheck %s +// RUN: %clang_cc1 -fobjc-runtime=macosx-fragile-10.5 -o - -emit-llvm %s | FileCheck -check-prefix=FRAGILE %s +// RUN: %clang_cc1 -o - -emit-llvm %s | FileCheck -check-prefix=NONFRAGILE %s -// CHECK: @OBJC_SELECTOR_REFERENCES_ = private externally_initialized global +// NONFRAGILE: @OBJC_SELECTOR_REFERENCES_ = internal externally_initialized global +// FRAGILE: @OBJC_SELECTOR_REFERENCES_ = private externally_initialized global void test(id x) { [x doSomething]; Index: test/CodeGenObjC/forward-protocol-metadata-symbols.m =================================================================== --- test/CodeGenObjC/forward-protocol-metadata-symbols.m +++ test/CodeGenObjC/forward-protocol-metadata-symbols.m @@ -20,20 +20,20 @@ // CHECK: @"_OBJC_PROTOCOL_$_P0" = weak hidden global // CHECK: @"_OBJC_LABEL_PROTOCOL_$_P0" = weak hidden global -// CHECK: @"\01l_OBJC_CLASS_PROTOCOLS_$_A" = private global -// CHECK: @"\01l_OBJC_PROTOCOL_REFERENCE_$_P0" = weak hidden global +// CHECK: @"_OBJC_CLASS_PROTOCOLS_$_A" = internal global +// CHECK: @"_OBJC_PROTOCOL_REFERENCE_$_P0" = weak hidden global // CHECK: llvm.used = appending global [3 x i8*] // CHECK-SAME: "_OBJC_PROTOCOL_$_P0" // CHECK-SAME: "_OBJC_LABEL_PROTOCOL_$_P0" -// CHECK-SAME: "\01l_OBJC_PROTOCOL_REFERENCE_$_P0" +// CHECK-SAME: "_OBJC_PROTOCOL_REFERENCE_$_P0" // CHECK: llvm.compiler.used = appending global [7 x i8*] // CHECK-SAME: OBJC_CLASS_NAME_ // CHECK-SAME: OBJC_METH_VAR_NAME_ // CHECK-SAME: OBJC_METH_VAR_TYPE_ -// CHECK-SAME: "\01l_OBJC_$_CLASS_METHODS_A" +// CHECK-SAME: "_OBJC_$_CLASS_METHODS_A" // CHECK-SAME: OBJC_CLASS_NAME_.1 -// CHECK-SAME: "\01l_OBJC_CLASS_PROTOCOLS_$_A" +// CHECK-SAME: "_OBJC_CLASS_PROTOCOLS_$_A" // CHECK-SAME: "OBJC_LABEL_CLASS_$" // CHECK-SAME: section "llvm.metadata" Index: test/CodeGenObjC/instance-method-metadata.m =================================================================== --- test/CodeGenObjC/instance-method-metadata.m +++ test/CodeGenObjC/instance-method-metadata.m @@ -27,7 +27,7 @@ @synthesize prop; @end -// CHECK: l_OBJC_$_INSTANCE_METHODS_Bar: +// CHECK: _OBJC_$_INSTANCE_METHODS_Bar: // CHECK-NEXT: .long 24 // CHECK-NEXT: .long 2 // CHECK-NEXT: .quad L_OBJC_METH_VAR_NAME_ Index: test/CodeGenObjC/interface-layout-64.m =================================================================== --- test/CodeGenObjC/interface-layout-64.m +++ test/CodeGenObjC/interface-layout-64.m @@ -2,24 +2,24 @@ // CHECK: @"OBJC_IVAR_$_I3._iv2" = global i64 8, section "__DATA, __objc_ivar", align 8 // CHECK: @"OBJC_IVAR_$_I3._iv3" = global i64 12, section "__DATA, __objc_ivar", align 8 -// CHECK: _OBJC_CLASS_RO_$_I3" = private global {{.*}} { i32 0, i32 8, i32 13 +// CHECK: _OBJC_CLASS_RO_$_I3" = internal global {{.*}} { i32 0, i32 8, i32 13 // CHECK: @"OBJC_IVAR_$_I4._iv4" = global i64 13, section "__DATA, __objc_ivar", align 8 -// CHECK: _OBJC_CLASS_RO_$_I4" = private global {{.*}} { i32 0, i32 13, i32 14, {{.*}} +// CHECK: _OBJC_CLASS_RO_$_I4" = internal global {{.*}} { i32 0, i32 13, i32 14, {{.*}} // CHECK: @"OBJC_IVAR_$_I5._iv6_synth" = hidden global i64 16, section "__DATA, __objc_ivar", align 8 // CHECK: @"OBJC_IVAR_$_I5._iv7_synth" = hidden global i64 20, section "__DATA, __objc_ivar", align 8 // CHECK: @"OBJC_IVAR_$_I5._iv5" = global i64 14, section "__DATA, __objc_ivar", align 8 -// CHECK: _OBJC_CLASS_RO_$_I5" = private global {{.*}} { i32 0, i32 14, i32 24, {{.*}} +// CHECK: _OBJC_CLASS_RO_$_I5" = internal global {{.*}} { i32 0, i32 14, i32 24, {{.*}} // CHECK: @"OBJC_IVAR_$_I6.iv0" = global i64 0, section "__DATA, __objc_ivar", align 8 -// CHECK: _OBJC_CLASS_RO_$_I6" = private global {{.*}} { i32 2, i32 0, i32 1, {{.*}} +// CHECK: _OBJC_CLASS_RO_$_I6" = internal global {{.*}} { i32 2, i32 0, i32 1, {{.*}} // CHECK: @"OBJC_IVAR_$_I8.b" = global i64 8, section "__DATA, __objc_ivar", align 8 -// CHECK: _OBJC_CLASS_RO_$_I8" = private global {{.*}} { i32 0, i32 8, i32 16, {{.*}} +// CHECK: _OBJC_CLASS_RO_$_I8" = internal global {{.*}} { i32 0, i32 8, i32 16, {{.*}} // CHECK: @"OBJC_IVAR_$_I9.iv0" = global i64 0, section "__DATA, __objc_ivar", align 8 -// CHECK: _OBJC_CLASS_RO_$_I9" = private global {{.*}} { i32 2, i32 0, i32 4, {{.*}} +// CHECK: _OBJC_CLASS_RO_$_I9" = internal global {{.*}} { i32 2, i32 0, i32 4, {{.*}} // CHECK: @"OBJC_IVAR_$_I10.iv1" = global i64 4, section "__DATA, __objc_ivar", align 8 -// CHECK: _OBJC_CLASS_RO_$_I10" = private global {{.*}} { i32 0, i32 4, i32 5, {{.*}} -// CHECK: _OBJC_CLASS_RO_$_I11" = private global {{.*}} { i32 0, i32 5, i32 5, {{.*}} +// CHECK: _OBJC_CLASS_RO_$_I10" = internal global {{.*}} { i32 0, i32 4, i32 5, {{.*}} +// CHECK: _OBJC_CLASS_RO_$_I11" = internal global {{.*}} { i32 0, i32 5, i32 5, {{.*}} // CHECK: @"OBJC_IVAR_$_I12.iv2" = global i64 8, section "__DATA, __objc_ivar", align 8 -// CHECK: _OBJC_CLASS_RO_$_I12" = private global {{.*}} { i32 0, i32 8, i32 12, {{.*}} +// CHECK: _OBJC_CLASS_RO_$_I12" = internal global {{.*}} { i32 0, i32 8, i32 12, {{.*}} /* Compare to: Index: test/CodeGenObjC/metadata-class-properties.m =================================================================== --- test/CodeGenObjC/metadata-class-properties.m +++ test/CodeGenObjC/metadata-class-properties.m @@ -2,33 +2,33 @@ // RUN: %clang_cc1 -triple x86_64-apple-macosx10.10 -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-NULL %s // RUN: %clang_cc1 -triple x86_64-apple-macosx10.11 -emit-llvm -o - -fobjc-runtime=macosx-fragile-10.5 %s | FileCheck -check-prefix=CHECK-FRAGILE %s -// CHECK: @"\01l_OBJC_$_CLASS_PROP_LIST_Proto" = private global {{.*}} section "__DATA, __objc_const", align 8 -// CHECK: @"_OBJC_PROTOCOL_$_Proto" = {{.*}} global %struct._protocol_t { {{.*}} i32 96, i32 {{.*}} @"\01l_OBJC_$_CLASS_PROP_LIST_Proto" {{.*}} } -// CHECK: @"\01l_OBJC_$_CLASS_PROP_LIST_Foo_$_Category" = private global {{.*}} section "__DATA, __objc_const", align 8 -// CHECK: @"\01l_OBJC_$_CATEGORY_Foo_$_Category" = private global %struct._category_t { {{.*}} @"\01l_OBJC_$_CLASS_PROP_LIST_Foo_$_Category" {{.*}}, i32 64 }, section "__DATA, __objc_const", align 8 +// CHECK: @"_OBJC_$_CLASS_PROP_LIST_Proto" = internal global {{.*}} section "__DATA, __objc_const", align 8 +// CHECK: @"_OBJC_PROTOCOL_$_Proto" = {{.*}} global %struct._protocol_t { {{.*}} i32 96, i32 {{.*}} @"_OBJC_$_CLASS_PROP_LIST_Proto" {{.*}} } +// CHECK: @"_OBJC_$_CLASS_PROP_LIST_Foo_$_Category" = internal global {{.*}} section "__DATA, __objc_const", align 8 +// CHECK: @"_OBJC_$_CATEGORY_Foo_$_Category" = internal global %struct._category_t { {{.*}} @"_OBJC_$_CLASS_PROP_LIST_Foo_$_Category" {{.*}}, i32 64 }, section "__DATA, __objc_const", align 8 -// CHECK: @"\01l_OBJC_$_CLASS_PROP_LIST_C" = private global {{.*}} section "__DATA, __objc_const", align 8 -// CHECK: @"\01l_OBJC_METACLASS_RO_$_C" = private global %struct._class_ro_t { {{.*}} @"\01l_OBJC_$_CLASS_PROP_LIST_C" {{.*}} }, section "__DATA, __objc_const", align 8 +// CHECK: @"_OBJC_$_CLASS_PROP_LIST_C" = internal global {{.*}} section "__DATA, __objc_const", align 8 +// CHECK: @"_OBJC_METACLASS_RO_$_C" = internal global %struct._class_ro_t { {{.*}} @"_OBJC_$_CLASS_PROP_LIST_C" {{.*}} }, section "__DATA, __objc_const", align 8 // CHECK: !{i32 1, !"Objective-C Class Properties", i32 64} -// CHECK-NULL-NOT: @"\01l_OBJC_$_CLASS_PROP_LIST_Proto" +// CHECK-NULL-NOT: @"_OBJC_$_CLASS_PROP_LIST_Proto" // CHECK-NULL: @"_OBJC_PROTOCOL_$_Proto" = {{.*}} global %struct._protocol_t { {{.*}} %struct._prop_list_t* null, i32 96, i32 {{.*}} %struct._prop_list_t* null } -// CHECK-NULL-NOT: @"\01l_OBJC_$_CLASS_PROP_LIST_Foo_$_Category" = private global {{.*}} section "__DATA, __objc_const", align 8 -// CHECK-NULL: @"\01l_OBJC_$_CATEGORY_Foo_$_Category" = private global %struct._category_t { {{.*}} %struct._prop_list_t* null, %struct._prop_list_t* null, {{.*}} }, section "__DATA, __objc_const", align 8 +// CHECK-NULL-NOT: @"_OBJC_$_CLASS_PROP_LIST_Foo_$_Category" = internal global {{.*}} section "__DATA, __objc_const", align 8 +// CHECK-NULL: @"_OBJC_$_CATEGORY_Foo_$_Category" = internal global %struct._category_t { {{.*}} %struct._prop_list_t* null, %struct._prop_list_t* null, {{.*}} }, section "__DATA, __objc_const", align 8 -// CHECK-NULL-NOT: @"\01l_OBJC_$_CLASS_PROP_LIST_C" = private global {{.*}} section "__DATA, __objc_const", align 8 -// CHECK-NULL: @"\01l_OBJC_METACLASS_RO_$_C" = private global %struct._class_ro_t { {{.*}} %struct._prop_list_t* null }, section "__DATA, __objc_const", align 8 +// CHECK-NULL-NOT: @"_OBJC_$_CLASS_PROP_LIST_C" = internal global {{.*}} section "__DATA, __objc_const", align 8 +// CHECK-NULL: @"_OBJC_METACLASS_RO_$_C" = internal global %struct._class_ro_t { {{.*}} %struct._prop_list_t* null }, section "__DATA, __objc_const", align 8 // CHECK-NULL: !{i32 1, !"Objective-C Class Properties", i32 64} // CHECK-FRAGILE: @"OBJC_$_CLASS_PROP_PROTO_LIST_Proto" = private global {{.*}} section "__OBJC,__property,regular,no_dead_strip", align 8 -// CHECK-FRAGILE: @"\01l_OBJC_PROTOCOLEXT_Proto" = private global %struct._objc_protocol_extension { i32 48, {{.*}} @"OBJC_$_CLASS_PROP_PROTO_LIST_Proto" {{.*}} }, align 8 -// CHECK-FRAGILE: @"\01l_OBJC_$_CLASS_PROP_LIST_Foo_Category" = private global {{.*}} section "__OBJC,__property,regular,no_dead_strip", align 8 -// CHECK-FRAGILE: @OBJC_CATEGORY_Foo_Category = private global %struct._objc_category { {{.*}}, i32 64, {{.*}} @"\01l_OBJC_$_CLASS_PROP_LIST_Foo_Category" {{.*}} }, section "__OBJC,__category,regular,no_dead_strip", align 8 +// CHECK-FRAGILE: @_OBJC_PROTOCOLEXT_Proto = internal global %struct._objc_protocol_extension { i32 48, {{.*}} @"OBJC_$_CLASS_PROP_PROTO_LIST_Proto" {{.*}} }, align 8 +// CHECK-FRAGILE: @"_OBJC_$_CLASS_PROP_LIST_Foo_Category" = private global {{.*}} section "__OBJC,__property,regular,no_dead_strip", align 8 +// CHECK-FRAGILE: @OBJC_CATEGORY_Foo_Category = private global %struct._objc_category { {{.*}}, i32 64, {{.*}} @"_OBJC_$_CLASS_PROP_LIST_Foo_Category" {{.*}} }, section "__OBJC,__category,regular,no_dead_strip", align 8 -// CHECK-FRAGILE: @"\01l_OBJC_$_CLASS_PROP_LIST_C" = private global {{.*}} section "__OBJC,__property,regular,no_dead_strip", align 8 -// CHECK-FRAGILE: @OBJC_CLASSEXT_C = private global %struct._objc_class_extension { {{.*}} @"\01l_OBJC_$_CLASS_PROP_LIST_C" {{.*}} }, section "__OBJC,__class_ext,regular,no_dead_strip", align 8 +// CHECK-FRAGILE: @"_OBJC_$_CLASS_PROP_LIST_C" = private global {{.*}} section "__OBJC,__property,regular,no_dead_strip", align 8 +// CHECK-FRAGILE: @OBJC_CLASSEXT_C = private global %struct._objc_class_extension { {{.*}} @"_OBJC_$_CLASS_PROP_LIST_C" {{.*}} }, section "__OBJC,__class_ext,regular,no_dead_strip", align 8 // CHECK-FRAGILE: !{i32 1, !"Objective-C Class Properties", i32 64} Index: test/CodeGenObjC/metadata-symbols-32.m =================================================================== --- test/CodeGenObjC/metadata-symbols-32.m +++ test/CodeGenObjC/metadata-symbols-32.m @@ -3,7 +3,7 @@ // CHECK: .lazy_reference .objc_class_name_J0 // CHECK: @OBJC_METH_VAR_TYPE_{{.*}} = private unnamed_addr constant {{.*}}section "__TEXT,__cstring,cstring_literals", align 1 -// CHECK: @"\01l_OBJC_PROTOCOLEXT_P" = private global {{.*}}}, align +// CHECK: @_OBJC_PROTOCOLEXT_P = internal global {{.*}}}, align // CHECK: @OBJC_CLASS_NAME_{{[0-9]*}} = private unnamed_addr constant {{.*}}section "__TEXT,__cstring,cstring_literals", align 1 // CHECK: @OBJC_METH_VAR_NAME_{{.*}} = private unnamed_addr constant {{.*}}section "__TEXT,__cstring,cstring_literals", align 1 // CHECK: @OBJC_PROTOCOL_INSTANCE_METHODS_P = private global {{.*}}section "__OBJC,__cat_inst_meth,regular,no_dead_strip", align 4 @@ -15,7 +15,7 @@ // CHECK: @OBJC_INSTANCE_VARIABLES_A = private global {{.*}}section "__OBJC,__instance_vars,regular,no_dead_strip", align 4 // CHECK: @OBJC_INSTANCE_METHODS_A = private global {{.*}}section "__OBJC,__inst_meth,regular,no_dead_strip", align 4 // CHECK: @OBJC_PROP_NAME_ATTR_{{[0-9]*}} = private unnamed_addr constant {{.*}}section "__TEXT,__cstring,cstring_literals", align 1 -// CHECK: @"\01l_OBJC_$_PROP_LIST_A" = private global {{.*}}section "__OBJC,__property,regular,no_dead_strip", align 4 +// CHECK: @"_OBJC_$_PROP_LIST_A" = private global {{.*}}section "__OBJC,__property,regular,no_dead_strip", align 4 // CHECK: @OBJC_CLASSEXT_A = private global {{.*}}section "__OBJC,__class_ext,regular,no_dead_strip", align 4 // CHECK: @OBJC_CLASS_A = private global {{.*}}section "__OBJC,__class,regular,no_dead_strip", align 4 // CHECK: @OBJC_CATEGORY_INSTANCE_METHODS_A_Cat = private global {{.*}}section "__OBJC,__cat_inst_meth,regular,no_dead_strip", align 4 Index: test/CodeGenObjC/metadata-symbols-64.m =================================================================== --- test/CodeGenObjC/metadata-symbols-64.m +++ test/CodeGenObjC/metadata-symbols-64.m @@ -8,29 +8,29 @@ // CHECK: @OBJC_CLASS_NAME_{{[0-9]*}} = private unnamed_addr constant {{.*}} section "__TEXT,__objc_classname,cstring_literals", align 1 // CHECK: @OBJC_METH_VAR_NAME_{{[0-9]*}} = private unnamed_addr constant {{.*}} section "__TEXT,__objc_methname,cstring_literals", align 1 // CHECK: @OBJC_METH_VAR_TYPE_{{[0-9]*}} = private unnamed_addr constant {{.*}} section "__TEXT,__objc_methtype,cstring_literals", align 1 -// 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: @"_OBJC_$_CLASS_METHODS_A" = internal global {{.*}} section "__DATA, __objc_const", align 8 +// CHECK: @"_OBJC_$_PROTOCOL_INSTANCE_METHODS_P" = internal global {{.*}} section "__DATA, __objc_const", align 8 +// CHECK: @"_OBJC_$_PROTOCOL_CLASS_METHODS_P" = internal global {{.*}} section "__DATA, __objc_const", align 8 // CHECK: @"_OBJC_PROTOCOL_$_P" = weak hidden global {{.*}}, align 8 // CHECK: @"_OBJC_LABEL_PROTOCOL_$_P" = weak hidden 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 -// CHECK: @"\01l_OBJC_$_INSTANCE_VARIABLES_A" = private global {{.*}} section "__DATA, __objc_const", align 8 +// CHECK: @"_OBJC_CLASS_PROTOCOLS_$_A" = internal global {{.*}} section "__DATA, __objc_const", align 8 +// CHECK: @"_OBJC_METACLASS_RO_$_A" = internal global {{.*}} section "__DATA, __objc_const", align 8 +// CHECK: @"_OBJC_$_INSTANCE_METHODS_A" = internal global {{.*}} section "__DATA, __objc_const", align 8 +// CHECK: @"_OBJC_$_INSTANCE_VARIABLES_A" = internal global {{.*}} section "__DATA, __objc_const", align 8 // CHECK: @OBJC_PROP_NAME_ATTR_{{[0-9]*}} = private unnamed_addr constant {{.*}} section "__TEXT,__cstring,cstring_literals", align 1 -// CHECK: @"\01l_OBJC_$_PROP_LIST_A" = private global {{.*}} section "__DATA, __objc_const", align 8 -// CHECK: @"\01l_OBJC_CLASS_RO_$_A" = private global {{.*}} section "__DATA, __objc_const", align 8 -// CHECK: @"\01l_OBJC_$_CATEGORY_INSTANCE_METHODS_A_$_Cat" = private global {{.*}} section "__DATA, __objc_const", align 8 -// CHECK: @"\01l_OBJC_$_CATEGORY_CLASS_METHODS_A_$_Cat" = private global {{.*}} section "__DATA, __objc_const", align 8 -// CHECK: @"\01l_OBJC_$_CATEGORY_A_$_Cat" = private global {{.*}} section "__DATA, __objc_const", align 8 -// CHECK: @"OBJC_CLASSLIST_SUP_REFS_$_{{[0-9]*}}" = private global {{.*}} section "__DATA,__objc_superrefs,regular,no_dead_strip", align 8 -// CHECK: @OBJC_SELECTOR_REFERENCES_ = private externally_initialized global {{.*}} section "__DATA,__objc_selrefs,literal_pointers,no_dead_strip" -// CHECK: @"OBJC_CLASSLIST_SUP_REFS_$_{{[\.0-9]*}}" = private global {{.*}} section "__DATA,__objc_superrefs,regular,no_dead_strip", align 8 +// CHECK: @"_OBJC_$_PROP_LIST_A" = internal global {{.*}} section "__DATA, __objc_const", align 8 +// CHECK: @"_OBJC_CLASS_RO_$_A" = internal global {{.*}} section "__DATA, __objc_const", align 8 +// CHECK: @"_OBJC_$_CATEGORY_INSTANCE_METHODS_A_$_Cat" = internal global {{.*}} section "__DATA, __objc_const", align 8 +// CHECK: @"_OBJC_$_CATEGORY_CLASS_METHODS_A_$_Cat" = internal global {{.*}} section "__DATA, __objc_const", align 8 +// CHECK: @"_OBJC_$_CATEGORY_A_$_Cat" = internal global {{.*}} section "__DATA, __objc_const", align 8 +// CHECK: @"OBJC_CLASSLIST_SUP_REFS_$_{{[0-9]*}}" = internal global {{.*}} section "__DATA,__objc_superrefs,regular,no_dead_strip", align 8 +// CHECK: @OBJC_SELECTOR_REFERENCES_ = internal externally_initialized global {{.*}} section "__DATA,__objc_selrefs,literal_pointers,no_dead_strip" +// CHECK: @"OBJC_CLASSLIST_SUP_REFS_$_{{[\.0-9]*}}" = internal global {{.*}} section "__DATA,__objc_superrefs,regular,no_dead_strip", align 8 // CHECK: @"OBJC_CLASS_$_B" = external global -// CHECK: @"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: @"OBJC_LABEL_CLASS_$" = private global {{.*}} section "__DATA,__objc_classlist,regular,no_dead_strip", align 8 -// CHECK: @"OBJC_LABEL_CATEGORY_$" = private global {{.*}} section "__DATA,__objc_catlist,regular,no_dead_strip", align 8 +// CHECK: @"OBJC_CLASSLIST_REFERENCES_$_{{[0-9]*}}" = internal global {{.*}} section "__DATA,__objc_classrefs,regular,no_dead_strip", align 8 +// CHECK: @_objc_msgSend_fixup_alloc = weak hidden global {{.*}} section "__DATA,__objc_msgrefs,coalesced", align 16 +// CHECK: @"OBJC_LABEL_CLASS_$" = internal global {{.*}} section "__DATA,__objc_classlist,regular,no_dead_strip", align 8 +// CHECK: @"OBJC_LABEL_CATEGORY_$" = internal global {{.*}} section "__DATA,__objc_catlist,regular,no_dead_strip", align 8 // CHECK: @objc_msgSend_fpret( // CHECK: @objc_msgSend_fixup( Index: test/CodeGenObjC/metadata_symbols.m =================================================================== --- test/CodeGenObjC/metadata_symbols.m +++ test/CodeGenObjC/metadata_symbols.m @@ -14,7 +14,7 @@ // CHECK-X86_64: @"OBJC_EHTYPE_$_EH1" = weak global {{.*}}, align 8 // CHECK-X86_64: @"OBJC_EHTYPE_$_EH2" = external global // CHECK-X86_64: @"OBJC_EHTYPE_$_EH3" = global {{.*}}, section "__DATA,__objc_const", align 8 -// CHECK-X86_64: @"OBJC_LABEL_CLASS_$" = private global {{.*}}, section "__DATA,__objc_classlist,regular,no_dead_strip", align 8 +// CHECK-X86_64: @"OBJC_LABEL_CLASS_$" = internal global {{.*}}, section "__DATA,__objc_classlist,regular,no_dead_strip", align 8 // CHECK-X86_64: define internal void @"\01-[A im0]" // CHECK-X86_64: define internal void @"\01-[A(Cat) im1]" @@ -38,7 +38,7 @@ // CHECK-ARMV6: @"OBJC_EHTYPE_$_EH1" = weak global {{.*}}, align 4 // CHECK-ARMV6: @"OBJC_EHTYPE_$_EH2" = external global // CHECK-ARMV6: @"OBJC_EHTYPE_$_EH3" = global {{.*}}, section "__DATA,__objc_const", align 4 -// CHECK-ARMV6: @"OBJC_LABEL_CLASS_$" = private global {{.*}}, section "__DATA,__objc_classlist,regular,no_dead_strip", align 4 +// CHECK-ARMV6: @"OBJC_LABEL_CLASS_$" = internal global {{.*}}, section "__DATA,__objc_classlist,regular,no_dead_strip", align 4 // CHECK-ARMV6: define internal void @"\01-[A im0]" // CHECK-ARMV6: define internal void @"\01-[A(Cat) im1]" Index: test/CodeGenObjC/mrc-weak.m =================================================================== --- test/CodeGenObjC/mrc-weak.m +++ test/CodeGenObjC/mrc-weak.m @@ -15,7 +15,7 @@ // CHECK-MODERN: @"OBJC_IVAR_$_HighlyAlignedSubclass.ivar2" = global i64 24, // CHECK-MODERN: @"OBJC_IVAR_$_HighlyAlignedSubclass.ivar" = global i64 16, // CHECK-MODERN: @OBJC_CLASS_NAME_{{.*}} = {{.*}} c"\02\00" -// CHECK-MODERN: @"\01l_OBJC_CLASS_RO_$_HighlyAlignedSubclass" = {{.*}} { +// CHECK-MODERN: @"_OBJC_CLASS_RO_$_HighlyAlignedSubclass" = {{.*}} { // CHECK-FRAGILE: @OBJC_INSTANCE_VARIABLES_HighlyAlignedSubclass = {{.*}}, i32 8 }, {{.*}}, i32 12 }] // CHECK-FRAGILE: @OBJC_CLASS_NAME_{{.*}} = {{.*}} c"\02\00" // CHECK-FRAGILE: @OBJC_CLASS_HighlyAlignedSubclass @@ -27,7 +27,7 @@ @implementation HighlyAlignedSubclass @end // CHECK-MODERN: @OBJC_CLASS_NAME_{{.*}} = {{.*}} c"\01\00" -// CHECK-MODERN: @"\01l_OBJC_CLASS_RO_$_Foo" = {{.*}} { i32 772 +// CHECK-MODERN: @"_OBJC_CLASS_RO_$_Foo" = {{.*}} { i32 772 // 772 == 0x304 // ^ HasMRCWeakIvars // ^ HasCXXDestructorOnly Index: test/CodeGenObjC/non-lazy-classes.m =================================================================== --- test/CodeGenObjC/non-lazy-classes.m +++ test/CodeGenObjC/non-lazy-classes.m @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -Wno-objc-root-class -emit-llvm -o - %s | FileCheck %s -// CHECK: @"OBJC_LABEL_NONLAZY_CLASS_$" = private global [3 x {{.*}}]{{.*}}@"OBJC_CLASS_$_A"{{.*}},{{.*}}@"OBJC_CLASS_$_D"{{.*}},{{.*}}"OBJC_CLASS_$_E"{{.*}} section "__DATA,__objc_nlclslist,regular,no_dead_strip", align 8 -// CHECK: @"OBJC_LABEL_NONLAZY_CATEGORY_$" = private global [2 x {{.*}}] {{.*}}@"\01l_OBJC_$_CATEGORY_A_$_Cat"{{.*}},{{.*}}@"\01l_OBJC_$_CATEGORY_E_$_MyCat"{{.*}}, section "__DATA,__objc_nlcatlist,regular,no_dead_strip", align 8 +// CHECK: @"OBJC_LABEL_NONLAZY_CLASS_$" = internal global [3 x {{.*}}]{{.*}}@"OBJC_CLASS_$_A"{{.*}},{{.*}}@"OBJC_CLASS_$_D"{{.*}},{{.*}}"OBJC_CLASS_$_E"{{.*}} section "__DATA,__objc_nlclslist,regular,no_dead_strip", align 8 +// CHECK: @"OBJC_LABEL_NONLAZY_CATEGORY_$" = internal global [2 x {{.*}}] {{.*}}@"_OBJC_$_CATEGORY_A_$_Cat"{{.*}},{{.*}}@"_OBJC_$_CATEGORY_E_$_MyCat"{{.*}}, section "__DATA,__objc_nlcatlist,regular,no_dead_strip", align 8 @interface A @end @implementation A Index: test/CodeGenObjC/ns-constant-strings.m =================================================================== --- test/CodeGenObjC/ns-constant-strings.m +++ test/CodeGenObjC/ns-constant-strings.m @@ -33,7 +33,11 @@ // CHECK-NONFRAGILE: @"OBJC_CLASS_$_NSConstantString" = external global // CHECK-FRAGILE: @.str = private unnamed_addr constant [6 x i8] c"MyApp\00" +// CHECK-FRAGILE: @_unnamed_nsstring_ = private constant // CHECK-FRAGILE: @.str.1 = private unnamed_addr constant [7 x i8] c"MyApp1\00" +// CHECK-FRAGILE: @_unnamed_nsstring_{{.*}} = private constant // CHECK-NONFRAGILE: @.str = private unnamed_addr constant [6 x i8] c"MyApp\00" +// CHECK-NONFRAGILE: @_unnamed_nsstring_ = internal constant // CHECK-NONFRAGILE: @.str.1 = private unnamed_addr constant [7 x i8] c"MyApp1\00" +// CHECK-NONFRAGILE: @_unnamed_nsstring_{{.*}} = internal constant Index: test/CodeGenObjC/private-extern-selector-reference.m =================================================================== --- test/CodeGenObjC/private-extern-selector-reference.m +++ test/CodeGenObjC/private-extern-selector-reference.m @@ -15,4 +15,4 @@ @end // CHECK: @"OBJC_METACLASS_$_ObserverQuery" = global %struct._class_t -// CHECK: @OBJC_SELECTOR_REFERENCES_ = private externally_initialized global +// CHECK: @OBJC_SELECTOR_REFERENCES_ = internal externally_initialized global Index: test/CodeGenObjC/property-category-impl.m =================================================================== --- test/CodeGenObjC/property-category-impl.m +++ test/CodeGenObjC/property-category-impl.m @@ -15,6 +15,6 @@ @end -// CHECK: l_OBJC_$_PROP_LIST_Foo_$_Category" = private global -// CHECK: l_OBJC_$_CATEGORY_Foo_$_Category" = private global -// CHECK: l_OBJC_$_PROP_LIST_Foo_$_Category +// CHECK: _OBJC_$_PROP_LIST_Foo_$_Category" = internal global +// CHECK: _OBJC_$_CATEGORY_Foo_$_Category" = internal global +// CHECK: _OBJC_$_PROP_LIST_Foo_$_Category Index: test/CodeGenObjC/property-list-in-class.m =================================================================== --- test/CodeGenObjC/property-list-in-class.m +++ test/CodeGenObjC/property-list-in-class.m @@ -1,5 +1,5 @@ // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm %s -o - | FileCheck %s -// CHECK: l_OBJC_$_PROP_LIST_C2" = private global { i32, i32, [3 x %struct._prop_t] } { i32 16, i32 3 +// CHECK: _OBJC_$_PROP_LIST_C2" = internal global { i32, i32, [3 x %struct._prop_t] } { i32 16, i32 3 @protocol P @property int i; Index: test/CodeGenObjC/property-list-in-extension.m =================================================================== --- test/CodeGenObjC/property-list-in-extension.m +++ test/CodeGenObjC/property-list-in-extension.m @@ -18,7 +18,7 @@ // Metadata for _myprop should be present, and PROP_LIST for Foo should have // only one entry. // CHECK: = private unnamed_addr constant [12 x i8] c"Ti,V_myprop\00", -// CHECK: @"\01l_OBJC_$_PROP_LIST_Foo" = private global { i32, i32, [1 x %struct._prop_t] } +// CHECK: @"_OBJC_$_PROP_LIST_Foo" = internal global { i32, i32, [1 x %struct._prop_t] } // Readonly property in interface made readwrite in a category: __attribute__((objc_root_class)) @@ -44,4 +44,4 @@ // CHECK: [[evolvingsetter:@OBJC_PROP_NAME_ATTR[^ ]+]] = private unnamed_addr constant [18 x i8] c"Ti,V_evolvingprop\00", // CHECK: [[booleanmetadata:@OBJC_PROP_NAME_ATTR[^ ]+]] = private unnamed_addr constant [34 x i8] c"Ti,N,GisBooleanProp,V_booleanProp\00" // CHECK: [[weakmetadata:@OBJC_PROP_NAME_ATTR[^ ]+]] = private unnamed_addr constant [23 x i8] c"T@\22Foo\22,W,N,V_weakProp\00" -// CHECK: @"\01l_OBJC_$_PROP_LIST_FooRO" = private global { i32, i32, [3 x %struct._prop_t] }{{.*}}[[evolvinggetter]]{{.*}}[[evolvingsetter]]{{.*}}[[booleanmetadata]] +// CHECK: @"_OBJC_$_PROP_LIST_FooRO" = internal global { i32, i32, [3 x %struct._prop_t] }{{.*}}[[evolvinggetter]]{{.*}}[[evolvingsetter]]{{.*}}[[booleanmetadata]] Index: test/CodeGenObjC/protocol-comdat.m =================================================================== --- test/CodeGenObjC/protocol-comdat.m +++ test/CodeGenObjC/protocol-comdat.m @@ -20,8 +20,8 @@ // CHECK: $"_OBJC_PROTOCOL_$_P" = comdat any // CHECK: $"_OBJC_LABEL_PROTOCOL_$_P" = comdat any -// CHECK: $"\01l_OBJC_PROTOCOL_REFERENCE_$_Q" = comdat any -// CHECK: $"\01l_OBJC_PROTOCOL_REFERENCE_$_R" = comdat any +// CHECK: $"_OBJC_PROTOCOL_REFERENCE_$_Q" = comdat any +// CHECK: $"_OBJC_PROTOCOL_REFERENCE_$_R" = comdat any // CHECK: @"_OBJC_PROTOCOL_$_P" = {{.*}}, comdat // CHECK: @"_OBJC_LABEL_PROTOCOL_$_P" = {{.*}}, comdat Index: test/CodeGenObjC/protocols.m =================================================================== --- test/CodeGenObjC/protocols.m +++ test/CodeGenObjC/protocols.m @@ -1,19 +1,20 @@ // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s -// HECK: @[[PROTO_P1:"_OBJC_PROTOCOL_$_P1"]] = weak hidden +// CHECK: @"_OBJC_\$_PROTOCOL_METHOD_TYPES_P1" = internal global +// CHECK: @[[PROTO_P1:"_OBJC_PROTOCOL_$_P1"]] = weak hidden // CHECK: @[[PROTO_P1:"_OBJC_PROTOCOL_\$_P1"]] = weak hidden // CHECK: @[[LABEL_PROTO_P1:"_OBJC_LABEL_PROTOCOL_\$_P1"]] = weak hidden global %{{.*}}* @[[PROTO_P1]] // CHECK: @[[PROTO_P2:"_OBJC_PROTOCOL_\$_P2"]] = weak hidden // CHECK: @[[LABEL_PROTO_P2:"_OBJC_LABEL_PROTOCOL_\$_P2"]] = weak hidden global %{{.*}}* @[[PROTO_P2]] -// CHECK: @"\01l_OBJC_$_PROTOCOL_REFS_P3" = private global { i64, [3 x %{{.*}}] } { i64 2, [3 x %{{.*}}*] [%{{.*}}* @[[PROTO_P1]], %{{.*}}* @[[PROTO_P2]], %{{.*}}* null] } +// CHECK: @"_OBJC_$_PROTOCOL_REFS_P3" = internal global { i64, [3 x %{{.*}}] } { i64 2, [3 x %{{.*}}*] [%{{.*}}* @[[PROTO_P1]], %{{.*}}* @[[PROTO_P2]], %{{.*}}* null] } // CHECK: @[[PROTO_P3:"_OBJC_PROTOCOL_\$_P3"]] = weak hidden // CHECK: @[[LABEL_PROTO_P3:"_OBJC_LABEL_PROTOCOL_\$_P3"]] = weak hidden global %{{.*}}* @[[PROTO_P3]] -// CHECK: "\01l_OBJC_PROTOCOL_REFERENCE_$_P3" = weak hidden global %{{.*}}* bitcast (%{{.*}}* @[[PROTO_P3]] to %{{.*}}*) +// CHECK: "_OBJC_PROTOCOL_REFERENCE_$_P3" = weak hidden global %{{.*}}* bitcast (%{{.*}}* @[[PROTO_P3]] to %{{.*}}*) // CHECK: @[[PROTO_P0:"_OBJC_PROTOCOL_\$_P0"]] = weak hidden // CHECK: @[[LABEL_PROTO_P0:"_OBJC_LABEL_PROTOCOL_\$_P0"]] = weak hidden global %{{.*}}* @[[PROTO_P0]] -// CHECK: "\01l_OBJC_PROTOCOL_REFERENCE_$_P0" = weak hidden global %0* bitcast (%{{.*}}* @[[PROTO_P0]] to %{{.*}}*) -// CHECK: "\01l_OBJC_PROTOCOL_REFERENCE_$_P1" = weak hidden global %0* bitcast (%{{.*}}* @[[PROTO_P1]] to %{{.*}}*) -// CHECK: "\01l_OBJC_PROTOCOL_REFERENCE_$_P2" = weak hidden global %0* bitcast (%{{.*}}* @[[PROTO_P2]] to %{{.*}}*) +// CHECK: "_OBJC_PROTOCOL_REFERENCE_$_P0" = weak hidden global %0* bitcast (%{{.*}}* @[[PROTO_P0]] to %{{.*}}*) +// CHECK: "_OBJC_PROTOCOL_REFERENCE_$_P1" = weak hidden global %0* bitcast (%{{.*}}* @[[PROTO_P1]] to %{{.*}}*) +// CHECK: "_OBJC_PROTOCOL_REFERENCE_$_P2" = weak hidden global %0* bitcast (%{{.*}}* @[[PROTO_P2]] to %{{.*}}*) void p(const char*, ...); Index: test/CodeGenObjC/section-name.m =================================================================== --- test/CodeGenObjC/section-name.m +++ test/CodeGenObjC/section-name.m @@ -31,15 +31,15 @@ // CHECK-NOT: @"OBJC_IVAR_$_Interface._property" = {{.*}} section "__DATA, __objc_ivar" // CHECK-NOT: @"OBJC_CLASS_$_Interface" = {{.*}} section "__DATA, __objc_data" // CHECK-NOT: @"OBJC_METACLASS_$_Interface" = {{.*}} section "__DATA, __objc_data" -// CHECK-NOT: @"\01l_OBJC_$_CLASS_METHODS_Interface" = {{.*}} section "__DATA, __objc_const" -// CHECK-NOT: @"\01l_OBJC_$_PROTOCOL_INSTANCE_METHODS_Protocol" = {{.*}} section "__DATA, __objc_const" -// CHECK-NOT: @"\01l_OBJC_$_PROTOCOL_METHOD_TYPES_Protocol" = {{.*}} section "__DATA, __objc_const" -// CHECK-NOT: @"\01l_OBJC_CLASS_PROTOCOLS_$_Interface" = {{.*}} section "__DATA, __objc_const" -// CHECK-NOT: @"\01l_OBJC_METACLASS_RO_$_" = {{.*}} section "__DATA, __objc_const" -// CHECK-NOT: @"\01l_OBJC_$_INSTANCE_METHODS_Interface" = {{.*}} section "__DATA, __objc_const" -// CHECK-NOT: @"\01l_OBJC_$_INSTANCE_VARIABLES_Interface" = {{.*}} section "__DATA, __objc_const" -// CHECK-NOT: @"\01l_OBJC_$_PROP_LIST_Interface" = {{.*}} section "__DATA, __objc_const" -// CHECK-NOT: @"\01l_OBJC_CLASS_RO_$_Interface" = {{.*}} section "__DATA, __objc_const" -// CHECK-NOT: @"\01l_OBJC_$_CATEGORY_INSTANCE_METHODS_Interface_$_Category" = {{.*}} section "__DATA, __objc_const" -// CHECK-NOT: @"\01l_OBJC_$_CATEGORY_Interface_$_Category" = {{.*}} section "__DATA, __objc_const" +// CHECK-NOT: @"_OBJC_$_CLASS_METHODS_Interface" = {{.*}} section "__DATA, __objc_const" +// CHECK-NOT: @"_OBJC_$_PROTOCOL_INSTANCE_METHODS_Protocol" = {{.*}} section "__DATA, __objc_const" +// CHECK-NOT: @"_OBJC_$_PROTOCOL_METHOD_TYPES_Protocol" = {{.*}} section "__DATA, __objc_const" +// CHECK-NOT: @"_OBJC_CLASS_PROTOCOLS_$_Interface" = {{.*}} section "__DATA, __objc_const" +// CHECK-NOT: @"_OBJC_METACLASS_RO_$_" = {{.*}} section "__DATA, __objc_const" +// CHECK-NOT: @"_OBJC_$_INSTANCE_METHODS_Interface" = {{.*}} section "__DATA, __objc_const" +// CHECK-NOT: @"_OBJC_$_INSTANCE_VARIABLES_Interface" = {{.*}} section "__DATA, __objc_const" +// CHECK-NOT: @"_OBJC_$_PROP_LIST_Interface" = {{.*}} section "__DATA, __objc_const" +// CHECK-NOT: @"_OBJC_CLASS_RO_$_Interface" = {{.*}} section "__DATA, __objc_const" +// CHECK-NOT: @"_OBJC_$_CATEGORY_INSTANCE_METHODS_Interface_$_Category" = {{.*}} section "__DATA, __objc_const" +// CHECK-NOT: @"_OBJC_$_CATEGORY_Interface_$_Category" = {{.*}} section "__DATA, __objc_const" Index: test/CodeGenObjC/sections.m =================================================================== --- test/CodeGenObjC/sections.m +++ test/CodeGenObjC/sections.m @@ -37,9 +37,9 @@ // CHECK-COFF: @"OBJC_CLASSLIST_SUP_REFS_$_" = {{.*}}, section ".objc_superrefs$B" // CHECK-COFF: @OBJC_SELECTOR_REFERENCES_ = {{.*}}, section ".objc_selrefs$B" // CHECK-COFF: @"OBJC_CLASSLIST_REFERENCES_$_" = {{.*}}, section ".objc_classrefs$B" -// CHECK-COFF: @"\01l_objc_msgSend_fixup_class" = {{.*}}, section ".objc_msgrefs$B" +// CHECK-COFF: @_objc_msgSend_fixup_class = {{.*}}, section ".objc_msgrefs$B" // CHECK-COFF: @"_OBJC_LABEL_PROTOCOL_$_P" = {{.*}}, section ".objc_protolist$B" -// CHECK-COFF: @"\01l_OBJC_PROTOCOL_REFERENCE_$_P" = {{.*}}, section ".objc_protorefs$B" +// CHECK-COFF: @"_OBJC_PROTOCOL_REFERENCE_$_P" = {{.*}}, section ".objc_protorefs$B" // CHECK-COFF: @"OBJC_LABEL_CLASS_$" = {{.*}}, section ".objc_classlist$B" // CHECK-COFF: @"OBJC_LABEL_NONLAZY_CLASS_$" = {{.*}}, section ".objc_nlclslist$B" // CHECK-COFF: @"OBJC_LABEL_CATEGORY_$" = {{.*}}, section ".objc_catlist$B" @@ -49,9 +49,9 @@ // CHECK-ELF: @"OBJC_CLASSLIST_SUP_REFS_$_" = {{.*}}, section "objc_superrefs" // CHECK-ELF: @OBJC_SELECTOR_REFERENCES_ = {{.*}}, section "objc_selrefs" // CHECK-ELF: @"OBJC_CLASSLIST_REFERENCES_$_" = {{.*}}, section "objc_classrefs" -// CHECK-ELF: @"\01l_objc_msgSend_fixup_class" = {{.*}}, section "objc_msgrefs" +// CHECK-ELF: @_objc_msgSend_fixup_class = {{.*}}, section "objc_msgrefs" // CHECK-ELF: @"_OBJC_LABEL_PROTOCOL_$_P" = {{.*}}, section "objc_protolist" -// CHECK-ELF: @"\01l_OBJC_PROTOCOL_REFERENCE_$_P" = {{.*}}, section "objc_protorefs" +// CHECK-ELF: @"_OBJC_PROTOCOL_REFERENCE_$_P" = {{.*}}, section "objc_protorefs" // CHECK-ELF: @"OBJC_LABEL_CLASS_$" = {{.*}}, section "objc_classlist" // CHECK-ELF: @"OBJC_LABEL_NONLAZY_CLASS_$" = {{.*}}, section "objc_nlclslist" // CHECK-ELF: @"OBJC_LABEL_CATEGORY_$" = {{.*}}, section "objc_catlist" @@ -61,9 +61,9 @@ // CHECK-MACHO: @"OBJC_CLASSLIST_SUP_REFS_$_" = {{.*}}, section "__DATA,__objc_superrefs,regular,no_dead_strip" // CHECK-MACHO: @OBJC_SELECTOR_REFERENCES_ = {{.*}}, section "__DATA,__objc_selrefs,literal_pointers,no_dead_strip" // CHECK-MACHO: @"OBJC_CLASSLIST_REFERENCES_$_" = {{.*}}, section "__DATA,__objc_classrefs,regular,no_dead_strip" -// CHECK-MACHO: @"\01l_objc_msgSend_fixup_class" = {{.*}}, section "__DATA,__objc_msgrefs,coalesced" +// CHECK-MACHO: @_objc_msgSend_fixup_class = {{.*}}, section "__DATA,__objc_msgrefs,coalesced" // CHECK-MACHO: @"_OBJC_LABEL_PROTOCOL_$_P" = {{.*}}, section "__DATA,__objc_protolist,coalesced,no_dead_strip" -// CHECK-MACHO: @"\01l_OBJC_PROTOCOL_REFERENCE_$_P" = {{.*}}, section "__DATA,__objc_protorefs,coalesced,no_dead_strip" +// CHECK-MACHO: @"_OBJC_PROTOCOL_REFERENCE_$_P" = {{.*}}, section "__DATA,__objc_protorefs,coalesced,no_dead_strip" // CHECK-MACHO: @"OBJC_LABEL_CLASS_$" = {{.*}}, section "__DATA,__objc_classlist,regular,no_dead_strip" // CHECK-MACHO: @"OBJC_LABEL_NONLAZY_CLASS_$" = {{.*}}, section "__DATA,__objc_nlclslist,regular,no_dead_strip" // CHECK-MACHO: @"OBJC_LABEL_CATEGORY_$" = {{.*}}, section "__DATA,__objc_catlist,regular,no_dead_strip" Index: test/CodeGenObjCXX/externally-initialized-selectors.mm =================================================================== --- test/CodeGenObjCXX/externally-initialized-selectors.mm +++ test/CodeGenObjCXX/externally-initialized-selectors.mm @@ -1,7 +1,8 @@ -// RUN: %clang_cc1 -fobjc-runtime=macosx-fragile-10.5 -o - -emit-llvm %s | FileCheck %s -// RUN: %clang_cc1 -o - -emit-llvm %s | FileCheck %s +// RUN: %clang_cc1 -fobjc-runtime=macosx-fragile-10.5 -o - -emit-llvm %s | FileCheck -check-prefix=FRAGILE %s +// RUN: %clang_cc1 -o - -emit-llvm %s | FileCheck -check-prefix=NONFRAGILE %s -// CHECK: @OBJC_SELECTOR_REFERENCES_ = private externally_initialized global +// NONFRAGILE: @OBJC_SELECTOR_REFERENCES_ = internal externally_initialized global +// FRAGILE: @OBJC_SELECTOR_REFERENCES_ = private externally_initialized global void test(id x) { [x doSomething]; Index: test/CodeGenObjCXX/mrc-weak.mm =================================================================== --- test/CodeGenObjCXX/mrc-weak.mm +++ test/CodeGenObjCXX/mrc-weak.mm @@ -7,7 +7,7 @@ @end // CHECK-MODERN: @OBJC_CLASS_NAME_{{.*}} = {{.*}} c"\01\00" -// CHECK-MODERN: @"\01l_OBJC_CLASS_RO_$_Foo" = {{.*}} { i32 772 +// CHECK-MODERN: @"_OBJC_CLASS_RO_$_Foo" = {{.*}} { i32 772 // 772 == 0x304 // ^ HasMRCWeakIvars // ^ HasCXXDestructorOnly