| 1 | // Test that we register protocol metadata. Without registration, messaging |
| 2 | // a protocol metatype object crashes. |
| 3 | // |
| 4 | // RUN: %clang -c -o %t.o %s |
| 5 | // RUN: %llvm_jitlink -preload libobjc.A.dylib %t.o |
| 6 | // |
| 7 | // REQUIRES: jit-compatible-osx-swift-runtime |
| 8 | |
| 9 | .section __TEXT,__text,regular,pure_instructions |
| 10 | .build_version macos, 15, 0 sdk_version 15, 0 |
| 11 | .globl _main ## -- Begin function main |
| 12 | .p2align 4, 0x90 |
| 13 | _main: ## @main |
| 14 | .cfi_startproc |
| 15 | ## %bb.0: |
| 16 | pushq %rbp |
| 17 | .cfi_def_cfa_offset 16 |
| 18 | .cfi_offset %rbp, -16 |
| 19 | movq %rsp, %rbp |
| 20 | .cfi_def_cfa_register %rbp |
| 21 | subq $16, %rsp |
| 22 | movl $0, -4(%rbp) |
| 23 | movq __OBJC_PROTOCOL_REFERENCE_$_P(%rip), %rdi |
| 24 | callq *_objc_retain@GOTPCREL(%rip) |
| 25 | xorl %eax, %eax |
| 26 | addq $16, %rsp |
| 27 | popq %rbp |
| 28 | retq |
| 29 | .cfi_endproc |
| 30 | ## -- End function |
| 31 | .section __TEXT,__objc_classname,cstring_literals |
| 32 | L_OBJC_CLASS_NAME_: ## @OBJC_CLASS_NAME_ |
| 33 | .asciz "P" |
| 34 | |
| 35 | .private_extern __OBJC_PROTOCOL_$_P ## @"_OBJC_PROTOCOL_$_P" |
| 36 | .section __DATA,__data |
| 37 | .globl __OBJC_PROTOCOL_$_P |
| 38 | .weak_definition __OBJC_PROTOCOL_$_P |
| 39 | .p2align 3, 0x0 |
| 40 | __OBJC_PROTOCOL_$_P: |
| 41 | .quad 0 |
| 42 | .quad L_OBJC_CLASS_NAME_ |
| 43 | .quad 0 |
| 44 | .quad 0 |
| 45 | .quad 0 |
| 46 | .quad 0 |
| 47 | .quad 0 |
| 48 | .quad 0 |
| 49 | .long 96 ## 0x60 |
| 50 | .long 0 ## 0x0 |
| 51 | .quad 0 |
| 52 | .quad 0 |
| 53 | .quad 0 |
| 54 | |
| 55 | .private_extern __OBJC_LABEL_PROTOCOL_$_P ## @"_OBJC_LABEL_PROTOCOL_$_P" |
| 56 | .section __DATA,__objc_protolist,coalesced,no_dead_strip |
| 57 | .globl __OBJC_LABEL_PROTOCOL_$_P |
| 58 | .weak_definition __OBJC_LABEL_PROTOCOL_$_P |
| 59 | .p2align 3, 0x0 |
| 60 | __OBJC_LABEL_PROTOCOL_$_P: |
| 61 | .quad __OBJC_PROTOCOL_$_P |
| 62 | |
| 63 | .private_extern __OBJC_PROTOCOL_REFERENCE_$_P ## @"_OBJC_PROTOCOL_REFERENCE_$_P" |
| 64 | .section __DATA,__objc_protorefs,coalesced,no_dead_strip |
| 65 | .globl __OBJC_PROTOCOL_REFERENCE_$_P |
| 66 | .weak_definition __OBJC_PROTOCOL_REFERENCE_$_P |
| 67 | .p2align 3, 0x0 |
| 68 | __OBJC_PROTOCOL_REFERENCE_$_P: |
| 69 | .quad __OBJC_PROTOCOL_$_P |
| 70 | |
| 71 | .no_dead_strip __OBJC_PROTOCOL_$_P |
| 72 | .no_dead_strip __OBJC_LABEL_PROTOCOL_$_P |
| 73 | .no_dead_strip __OBJC_PROTOCOL_REFERENCE_$_P |
| 74 | .section __DATA,__objc_imageinfo,regular,no_dead_strip |
| 75 | L_OBJC_IMAGE_INFO: |
| 76 | .long 0 |
| 77 | .long 64 |
| 78 | |
| 79 | .subsections_via_symbols |
| 80 | |