r304661 - CodeGen: fix section names for different file formats
Steven Wu via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 13 13:41:38 PDT 2017
Hi Saleem
I just realize there can be an issue with this commit. This breaks the bitcode compatibility when LTO linking bitcode file produced by llvm-5.0 vs the older versions. Because the objc related module flag has the behavior Module::Error, simple whitespace changes will cause libLTO to error upon seeing different values.
I wish I caught this earlier so we can fix the issue before 5.0 released. Maybe we need another bitcode upgrade path to strip away all the whitespaces in "Objective-C Image Info Section" module flag?
Steven
> On Jun 3, 2017, at 9:18 AM, Saleem Abdulrasool via cfe-commits <cfe-commits at lists.llvm.org> wrote:
>
> Author: compnerd
> Date: Sat Jun 3 11:18:09 2017
> New Revision: 304661
>
> URL: http://llvm.org/viewvc/llvm-project?rev=304661&view=rev
> Log:
> CodeGen: fix section names for different file formats
>
> This changes the codegen to match the section names according to the
> ObjC rewriter as well as the runtime. The changes to the test are
> simply whitespace changes to the section attributes and names and are
> functionally equivalent (the whitespace is ignored by the linker).
>
> Added:
> cfe/trunk/test/CodeGenObjC/sections.m
> Modified:
> cfe/trunk/lib/CodeGen/CGObjCMac.cpp
> cfe/trunk/test/CodeGenObjC/exceptions-asm-attribute.m
> cfe/trunk/test/CodeGenObjC/image-info.m
> cfe/trunk/test/CodeGenObjC/metadata-symbols-64.m
> cfe/trunk/test/CodeGenObjC/metadata_symbols.m
> cfe/trunk/test/CodeGenObjC/non-lazy-classes.m
>
> Modified: cfe/trunk/lib/CodeGen/CGObjCMac.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCMac.cpp?rev=304661&r1=304660&r2=304661&view=diff
> ==============================================================================
> --- cfe/trunk/lib/CodeGen/CGObjCMac.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGObjCMac.cpp Sat Jun 3 11:18:09 2017
> @@ -1004,6 +1004,8 @@ protected:
> const ObjCInterfaceDecl *ID,
> ObjCCommonTypesHelper &ObjCTypes);
>
> + std::string GetSectionName(StringRef Section, StringRef MachOAttributes);
> +
> public:
> /// CreateMetadataVar - Create a global variable with internal
> /// linkage for use by the Objective-C runtime.
> @@ -4786,6 +4788,27 @@ llvm::Value *CGObjCMac::EmitIvarOffset(C
>
> /* *** Private Interface *** */
>
> +std::string CGObjCCommonMac::GetSectionName(StringRef Section,
> + StringRef MachOAttributes) {
> + switch (CGM.getTriple().getObjectFormat()) {
> + default:
> + llvm_unreachable("unexpected object file format");
> + case llvm::Triple::MachO: {
> + if (MachOAttributes.empty())
> + return ("__DATA," + Section).str();
> + return ("__DATA," + Section + "," + MachOAttributes).str();
> + }
> + case llvm::Triple::ELF:
> + assert(Section.substr(0, 2) == "__" &&
> + "expected the name to begin with __");
> + return Section.substr(2).str();
> + case llvm::Triple::COFF:
> + assert(Section.substr(0, 2) == "__" &&
> + "expected the name to begin with __");
> + return ("." + Section.substr(2) + "$B").str();
> + }
> +}
> +
> /// EmitImageInfo - Emit the image info marker used to encode some module
> /// level information.
> ///
> @@ -4809,9 +4832,10 @@ enum ImageInfoFlags {
>
> void CGObjCCommonMac::EmitImageInfo() {
> unsigned version = 0; // Version is unused?
> - const char *Section = (ObjCABI == 1) ?
> - "__OBJC, __image_info,regular" :
> - "__DATA, __objc_imageinfo, regular, no_dead_strip";
> + std::string Section =
> + (ObjCABI == 1)
> + ? "__OBJC,__image_info,regular"
> + : GetSectionName("__objc_imageinfo", "regular,no_dead_strip");
>
> // Generate module-level named metadata to convey this information to the
> // linker and code-gen.
> @@ -4822,7 +4846,7 @@ void CGObjCCommonMac::EmitImageInfo() {
> Mod.addModuleFlag(llvm::Module::Error, "Objective-C Image Info Version",
> version);
> Mod.addModuleFlag(llvm::Module::Error, "Objective-C Image Info Section",
> - llvm::MDString::get(VMContext,Section));
> + llvm::MDString::get(VMContext, Section));
>
> if (CGM.getLangOpts().getGC() == LangOptions::NonGC) {
> // Non-GC overrides those files which specify GC.
> @@ -5930,17 +5954,21 @@ void CGObjCNonFragileABIMac::FinishNonFr
> }
>
> AddModuleClassList(DefinedClasses, "OBJC_LABEL_CLASS_$",
> - "__DATA, __objc_classlist, regular, no_dead_strip");
> + GetSectionName("__objc_classlist",
> + "regular,no_dead_strip"));
>
> AddModuleClassList(DefinedNonLazyClasses, "OBJC_LABEL_NONLAZY_CLASS_$",
> - "__DATA, __objc_nlclslist, regular, no_dead_strip");
> + GetSectionName("__objc_nlclslist",
> + "regular,no_dead_strip"));
>
> // Build list of all implemented category addresses in array
> // L_OBJC_LABEL_CATEGORY_$.
> AddModuleClassList(DefinedCategories, "OBJC_LABEL_CATEGORY_$",
> - "__DATA, __objc_catlist, regular, no_dead_strip");
> + GetSectionName("__objc_catlist",
> + "regular,no_dead_strip"));
> AddModuleClassList(DefinedNonLazyCategories, "OBJC_LABEL_NONLAZY_CATEGORY_$",
> - "__DATA, __objc_nlcatlist, regular, no_dead_strip");
> + GetSectionName("__objc_nlcatlist",
> + "regular,no_dead_strip"));
>
> EmitImageInfo();
> }
> @@ -6359,7 +6387,8 @@ llvm::Value *CGObjCNonFragileABIMac::Gen
> llvm::GlobalValue::WeakAnyLinkage,
> Init,
> ProtocolName);
> - PTGV->setSection("__DATA, __objc_protorefs, coalesced, no_dead_strip");
> + PTGV->setSection(GetSectionName("__objc_protorefs",
> + "coalesced,no_dead_strip"));
> PTGV->setVisibility(llvm::GlobalValue::HiddenVisibility);
> PTGV->setAlignment(Align.getQuantity());
> CGM.addCompilerUsedGlobal(PTGV);
> @@ -6818,8 +6847,8 @@ llvm::Constant *CGObjCNonFragileABIMac::
> PTGV->setComdat(CGM.getModule().getOrInsertComdat(ProtocolRef));
> PTGV->setAlignment(
> CGM.getDataLayout().getABITypeAlignment(ObjCTypes.ProtocolnfABIPtrTy));
> - if (CGM.getTriple().isOSBinFormatMachO())
> - PTGV->setSection("__DATA, __objc_protolist, coalesced, no_dead_strip");
> + PTGV->setSection(GetSectionName("__objc_protolist",
> + "coalesced,no_dead_strip"));
> PTGV->setVisibility(llvm::GlobalValue::HiddenVisibility);
> CGM.addCompilerUsedGlobal(PTGV);
> return Entry;
> @@ -7015,7 +7044,7 @@ CGObjCNonFragileABIMac::EmitVTableMessag
> /*constant*/ false,
> llvm::GlobalValue::WeakAnyLinkage);
> messageRef->setVisibility(llvm::GlobalValue::HiddenVisibility);
> - messageRef->setSection("__DATA, __objc_msgrefs, coalesced");
> + messageRef->setSection(GetSectionName("__objc_msgrefs", "coalesced"));
> }
>
> bool requiresnullCheck = false;
> @@ -7126,7 +7155,8 @@ CGObjCNonFragileABIMac::EmitClassRefFrom
> false, llvm::GlobalValue::PrivateLinkage,
> ClassGV, "OBJC_CLASSLIST_REFERENCES_$_");
> Entry->setAlignment(Align.getQuantity());
> - Entry->setSection("__DATA, __objc_classrefs, regular, no_dead_strip");
> + Entry->setSection(GetSectionName("__objc_classrefs",
> + "regular,no_dead_strip"));
> CGM.addCompilerUsedGlobal(Entry);
> }
> return CGF.Builder.CreateAlignedLoad(Entry, Align);
> @@ -7160,7 +7190,8 @@ CGObjCNonFragileABIMac::EmitSuperClassRe
> false, llvm::GlobalValue::PrivateLinkage,
> ClassGV, "OBJC_CLASSLIST_SUP_REFS_$_");
> Entry->setAlignment(Align.getQuantity());
> - Entry->setSection("__DATA, __objc_superrefs, regular, no_dead_strip");
> + Entry->setSection(GetSectionName("__objc_superrefs",
> + "regular,no_dead_strip"));
> CGM.addCompilerUsedGlobal(Entry);
> }
> return CGF.Builder.CreateAlignedLoad(Entry, Align);
> @@ -7182,7 +7213,8 @@ llvm::Value *CGObjCNonFragileABIMac::Emi
> MetaClassGV, "OBJC_CLASSLIST_SUP_REFS_$_");
> Entry->setAlignment(Align.getQuantity());
>
> - Entry->setSection("__DATA, __objc_superrefs, regular, no_dead_strip");
> + Entry->setSection(GetSectionName("__objc_superrefs",
> + "regular,no_dead_strip"));
> CGM.addCompilerUsedGlobal(Entry);
> }
>
> @@ -7278,7 +7310,8 @@ Address CGObjCNonFragileABIMac::EmitSele
> false, llvm::GlobalValue::PrivateLinkage,
> Casted, "OBJC_SELECTOR_REFERENCES_");
> Entry->setExternallyInitialized(true);
> - Entry->setSection("__DATA, __objc_selrefs, literal_pointers, no_dead_strip");
> + Entry->setSection(GetSectionName("__objc_selrefs",
> + "literal_pointers,no_dead_strip"));
> Entry->setAlignment(Align.getQuantity());
> CGM.addCompilerUsedGlobal(Entry);
> }
>
> Modified: cfe/trunk/test/CodeGenObjC/exceptions-asm-attribute.m
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/exceptions-asm-attribute.m?rev=304661&r1=304660&r2=304661&view=diff
> ==============================================================================
> --- cfe/trunk/test/CodeGenObjC/exceptions-asm-attribute.m (original)
> +++ cfe/trunk/test/CodeGenObjC/exceptions-asm-attribute.m Sat Jun 3 11:18:09 2017
> @@ -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_$" = private 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_$" = private 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]"
>
>
> Modified: cfe/trunk/test/CodeGenObjC/image-info.m
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/image-info.m?rev=304661&r1=304660&r2=304661&view=diff
> ==============================================================================
> --- cfe/trunk/test/CodeGenObjC/image-info.m (original)
> +++ cfe/trunk/test/CodeGenObjC/image-info.m Sat Jun 3 11:18:09 2017
> @@ -7,11 +7,11 @@
> // CHECK-FRAGILE: !llvm.module.flags = !{{{.*}}}
> // CHECK-FRAGILE: !{{[0-9]+}} = !{i32 1, !"Objective-C Version", i32 1}
> // CHECK-FRAGILE-NEXT: !{{[0-9]+}} = !{i32 1, !"Objective-C Image Info Version", i32 0}
> -// CHECK-FRAGILE-NEXT: !{{[0-9]+}} = !{i32 1, !"Objective-C Image Info Section", !"__OBJC, __image_info,regular"}
> +// CHECK-FRAGILE-NEXT: !{{[0-9]+}} = !{i32 1, !"Objective-C Image Info Section", !"__OBJC,__image_info,regular"}
> // CHECK-FRAGILE-NEXT: !{{[0-9]+}} = !{i32 4, !"Objective-C Garbage Collection", i32 0}
>
> // CHECK-NONFRAGILE: !llvm.module.flags = !{{{.*}}}
> // CHECK-NONFRAGILE: !{{[0-9]+}} = !{i32 1, !"Objective-C Version", i32 2}
> // CHECK-NONFRAGILE-NEXT: !{{[0-9]+}} = !{i32 1, !"Objective-C Image Info Version", i32 0}
> -// CHECK-NONFRAGILE-NEXT: !{{[0-9]+}} = !{i32 1, !"Objective-C Image Info Section", !"__DATA, __objc_imageinfo, regular, no_dead_strip"}
> +// CHECK-NONFRAGILE-NEXT: !{{[0-9]+}} = !{i32 1, !"Objective-C Image Info Section", !"__DATA,__objc_imageinfo,regular,no_dead_strip"}
> // CHECK-NONFRAGILE-NEXT: !{{[0-9]+}} = !{i32 4, !"Objective-C Garbage Collection", i32 0}
>
> Modified: cfe/trunk/test/CodeGenObjC/metadata-symbols-64.m
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/metadata-symbols-64.m?rev=304661&r1=304660&r2=304661&view=diff
> ==============================================================================
> --- cfe/trunk/test/CodeGenObjC/metadata-symbols-64.m (original)
> +++ cfe/trunk/test/CodeGenObjC/metadata-symbols-64.m Sat Jun 3 11:18:09 2017
> @@ -12,7 +12,7 @@
> // 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 {{.*}}, align 8
> -// CHECK: @"\01l_OBJC_LABEL_PROTOCOL_$_P" = weak hidden global {{.*}} section "__DATA, __objc_protolist, coalesced, no_dead_strip", align 8
> +// CHECK: @"\01l_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
> @@ -23,14 +23,14 @@
> // 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_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_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]*}}" = 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_msgSend_fpret(
> // CHECK: @objc_msgSend_fixup(
>
>
> Modified: cfe/trunk/test/CodeGenObjC/metadata_symbols.m
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/metadata_symbols.m?rev=304661&r1=304660&r2=304661&view=diff
> ==============================================================================
> --- cfe/trunk/test/CodeGenObjC/metadata_symbols.m (original)
> +++ cfe/trunk/test/CodeGenObjC/metadata_symbols.m Sat Jun 3 11:18:09 2017
> @@ -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_$" = private 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_$" = private 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]"
>
>
> Modified: cfe/trunk/test/CodeGenObjC/non-lazy-classes.m
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/non-lazy-classes.m?rev=304661&r1=304660&r2=304661&view=diff
> ==============================================================================
> --- cfe/trunk/test/CodeGenObjC/non-lazy-classes.m (original)
> +++ cfe/trunk/test/CodeGenObjC/non-lazy-classes.m Sat Jun 3 11:18:09 2017
> @@ -1,7 +1,7 @@
> // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s | \
> // RUN: FileCheck %s
> -// CHECK: @"OBJC_LABEL_NONLAZY_CLASS_$" = private global [1 x {{.*}}] {{.*}}@"OBJC_CLASS_$_A"{{.*}}, section "__DATA, __objc_nlclslist, regular, no_dead_strip", align 8
> -// CHECK: @"OBJC_LABEL_NONLAZY_CATEGORY_$" = private global [1 x {{.*}}] {{.*}}@"\01l_OBJC_$_CATEGORY_A_$_Cat"{{.*}}, section "__DATA, __objc_nlcatlist, regular, no_dead_strip", align 8
> +// CHECK: @"OBJC_LABEL_NONLAZY_CLASS_$" = private global [1 x {{.*}}] {{.*}}@"OBJC_CLASS_$_A"{{.*}}, section "__DATA,__objc_nlclslist,regular,no_dead_strip", align 8
> +// CHECK: @"OBJC_LABEL_NONLAZY_CATEGORY_$" = private global [1 x {{.*}}] {{.*}}@"\01l_OBJC_$_CATEGORY_A_$_Cat"{{.*}}, section "__DATA,__objc_nlcatlist,regular,no_dead_strip", align 8
>
> @interface A @end
> @implementation A
>
> Added: cfe/trunk/test/CodeGenObjC/sections.m
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/sections.m?rev=304661&view=auto
> ==============================================================================
> --- cfe/trunk/test/CodeGenObjC/sections.m (added)
> +++ cfe/trunk/test/CodeGenObjC/sections.m Sat Jun 3 11:18:09 2017
> @@ -0,0 +1,72 @@
> +// RUN: %clang_cc1 -triple x86_64-unknown-windows -fobjc-dispatch-method=mixed -fobjc-runtime=ios -emit-llvm -o - %s | FileCheck %s -check-prefix CHECK-COFF
> +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fobjc-dispatch-method=mixed -fobjc-runtime=ios -emit-llvm -o - %s | FileCheck %s -check-prefix CHECK-ELF
> +// RUN: %clang_cc1 -triple x86_64-apple-ios -fobjc-dispatch-method=mixed -fobjc-runtime=ios -emit-llvm -o - %s | FileCheck %s -check-prefix CHECK-MACHO
> +
> +__attribute__((__objc_root_class__))
> + at interface NSObject
> ++ (void)load;
> ++ (id)class;
> + at end
> +
> + at protocol P
> + at end
> +
> + at interface I<P> : NSObject
> ++ (void)load;
> + at end
> +
> + at implementation I
> ++ (void)load; { }
> + at end
> +
> + at implementation I(C)
> ++ (void)load; {
> + [super load];
> +}
> + at end
> +
> + at interface J : NSObject
> +- (void)m;
> + at end
> +
> +_Bool f(J *j) {
> + [j m];
> + return [I class] == @protocol(P);
> +}
> +
> +// 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: @"\01l_OBJC_LABEL_PROTOCOL_$_P" = {{.*}}, section ".objc_protolist$B"
> +// CHECK-COFF: @"\01l_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"
> +// CHECK-COFF: @"OBJC_LABEL_NONLAZY_CATEGORY_$" = {{.*}}, section ".objc_nlcatlist$B"
> +// CHECK-COFF: !{{[0-9]+}} = !{i32 1, !"Objective-C Image Info Section", !".objc_imageinfo$B"}
> +
> +// 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: @"\01l_OBJC_LABEL_PROTOCOL_$_P" = {{.*}}, section "objc_protolist"
> +// CHECK-ELF: @"\01l_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"
> +// CHECK-ELF: @"OBJC_LABEL_NONLAZY_CATEGORY_$" = {{.*}}, section "objc_nlcatlist"
> +// CHECK-ELF: !{{[0-9]+}} = !{i32 1, !"Objective-C Image Info Section", !"objc_imageinfo"}
> +
> +// 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: @"\01l_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_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"
> +// CHECK-MACHO: @"OBJC_LABEL_NONLAZY_CATEGORY_$" = {{.*}}, section "__DATA,__objc_nlcatlist,regular,no_dead_strip"
> +// CHECK-MACHO: !{{[0-9]+}} = !{i32 1, !"Objective-C Image Info Section", !"__DATA,__objc_imageinfo,regular,no_dead_strip"}
> +
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
More information about the cfe-commits
mailing list