94 lines · plain
1// Test that we register protocol reference metadata. Without registration,2// protocol pointers will not be uniqued correctly and @protocol(NSObject) will3// not match the runtime's pointer.4//5// RUN: %clang -c -o %t.o %s6// RUN: %llvm_jitlink -preload libobjc.A.dylib %t.o7//8// REQUIRES: jit-compatible-osx-swift-runtime9 10 .section __TEXT,__text,regular,pure_instructions11 .build_version macos, 15, 0 sdk_version 15, 012 .globl _main ; -- Begin function main13 .p2align 214_main: ; @main15 .cfi_startproc16; %bb.0:17 sub sp, sp, #3218 stp x29, x30, [sp, #16] ; 16-byte Folded Spill19 add x29, sp, #1620 .cfi_def_cfa w29, 1621 .cfi_offset w30, -822 .cfi_offset w29, -1623 stur wzr, [x29, #-4]24 adrp x8, __OBJC_PROTOCOL_REFERENCE_$_NSObject@PAGE25 ldr x8, [x8, __OBJC_PROTOCOL_REFERENCE_$_NSObject@PAGEOFF]26 str x8, [sp] ; 8-byte Folded Spill27 adrp x0, l_.str@PAGE28 add x0, x0, l_.str@PAGEOFF29 bl _objc_getProtocol30 ldr x8, [sp] ; 8-byte Folded Reload31 subs x8, x8, x032 cset w8, eq33 and w8, w8, #0x134 ands w8, w8, #0x135 cset w0, eq36 ldp x29, x30, [sp, #16] ; 16-byte Folded Reload37 add sp, sp, #3238 ret39 .cfi_endproc40 ; -- End function41 .section __TEXT,__objc_classname,cstring_literals42l_OBJC_CLASS_NAME_: ; @OBJC_CLASS_NAME_43 .asciz "NSObject"44 45 .private_extern __OBJC_PROTOCOL_$_NSObject ; @"_OBJC_PROTOCOL_$_NSObject"46 .section __DATA,__data47 .globl __OBJC_PROTOCOL_$_NSObject48 .weak_definition __OBJC_PROTOCOL_$_NSObject49 .p2align 3, 0x050__OBJC_PROTOCOL_$_NSObject:51 .quad 052 .quad l_OBJC_CLASS_NAME_53 .quad 054 .quad 055 .quad 056 .quad 057 .quad 058 .quad 059 .long 96 ; 0x6060 .long 0 ; 0x061 .quad 062 .quad 063 .quad 064 65 .private_extern __OBJC_LABEL_PROTOCOL_$_NSObject ; @"_OBJC_LABEL_PROTOCOL_$_NSObject"66 .section __DATA,__objc_protolist,coalesced,no_dead_strip67 .globl __OBJC_LABEL_PROTOCOL_$_NSObject68 .weak_definition __OBJC_LABEL_PROTOCOL_$_NSObject69 .p2align 3, 0x070__OBJC_LABEL_PROTOCOL_$_NSObject:71 .quad __OBJC_PROTOCOL_$_NSObject72 73 .private_extern __OBJC_PROTOCOL_REFERENCE_$_NSObject ; @"_OBJC_PROTOCOL_REFERENCE_$_NSObject"74 .section __DATA,__objc_protorefs,coalesced,no_dead_strip75 .globl __OBJC_PROTOCOL_REFERENCE_$_NSObject76 .weak_definition __OBJC_PROTOCOL_REFERENCE_$_NSObject77 .p2align 3, 0x078__OBJC_PROTOCOL_REFERENCE_$_NSObject:79 .quad __OBJC_PROTOCOL_$_NSObject80 81 .section __TEXT,__cstring,cstring_literals82l_.str: ; @.str83 .asciz "NSObject"84 85 .no_dead_strip __OBJC_PROTOCOL_$_NSObject86 .no_dead_strip __OBJC_LABEL_PROTOCOL_$_NSObject87 .no_dead_strip __OBJC_PROTOCOL_REFERENCE_$_NSObject88 .section __DATA,__objc_imageinfo,regular,no_dead_strip89L_OBJC_IMAGE_INFO:90 .long 091 .long 6492 93.subsections_via_symbols94