77 lines · plain
1# REQUIRES: aarch642 3# RUN: llvm-mc -filetype=obj -triple=arm64-apple-darwin %s -o %t.o4# RUN: %lld -arch arm64 -lSystem -U _objc_msgSend -o %t.out %t.o5# RUN: llvm-otool -vs __TEXT __objc_stubs %t.out | FileCheck %s6# RUN: %lld -arch arm64 -lSystem -U _objc_msgSend -o %t.out %t.o -dead_strip7# RUN: llvm-otool -vs __TEXT __objc_stubs %t.out | FileCheck %s8# RUN: %lld -arch arm64 -lSystem -U _objc_msgSend -o %t.out %t.o -objc_stubs_fast9# RUN: llvm-otool -vs __TEXT __objc_stubs %t.out | FileCheck %s10# RUN: %lld -arch arm64 -lSystem -U _objc_msgSend -o %t.out %t.o -objc_stubs_small11# RUN: llvm-otool -vs __TEXT __stubs %t.out | FileCheck %s --check-prefix=STUB12# RUN: llvm-otool -vs __TEXT __objc_stubs %t.out | FileCheck %s --check-prefix=SMALL13 14# Unlike arm64-objc-stubs.s, in this test, _objc_msgSend is not defined,15# which usually binds with libobjc.dylib.16# 1. -objc_stubs_fast: No change as it uses GOT.17# 2. -objc_stubs_small: Create a (shared) stub to invoke _objc_msgSend, to minimize the size.18 19# CHECK: Contents of (__TEXT,__objc_stubs) section20 21# CHECK-NEXT: _objc_msgSend$foo:22# CHECK-NEXT: adrp x1, 8 ; 0x10000800023# CHECK-NEXT: ldr x1, [x1, #0x10]24# CHECK-NEXT: adrp x16, 4 ; 0x10000400025# CHECK-NEXT: ldr x16, [x16]26# CHECK-NEXT: br x1627# CHECK-NEXT: brk #0x128# CHECK-NEXT: brk #0x129# CHECK-NEXT: brk #0x130 31# CHECK-NEXT: _objc_msgSend$length:32# CHECK-NEXT: adrp x1, 8 ; 0x10000800033# CHECK-NEXT: ldr x1, [x1, #0x18]34# CHECK-NEXT: adrp x16, 4 ; 0x10000400035# CHECK-NEXT: ldr x16, [x16]36# CHECK-NEXT: br x1637# CHECK-NEXT: brk #0x138# CHECK-NEXT: brk #0x139# CHECK-NEXT: brk #0x140 41# CHECK-EMPTY:42 43# STUB: Contents of (__TEXT,__stubs) section44# STUB-NEXT: adrp x16, 8 ; 0x10000800045# STUB-NEXT: ldr x16, [x16]46# STUB-NEXT: br x1647 48# SMALL: Contents of (__TEXT,__objc_stubs) section49# SMALL-NEXT: _objc_msgSend$foo:50# SMALL-NEXT: adrp x1, 8 ; 0x10000800051# SMALL-NEXT: ldr x1, [x1, #0x18]52# SMALL-NEXT: b53# SMALL-NEXT: _objc_msgSend$length:54# SMALL-NEXT: adrp x1, 8 ; 0x10000800055# SMALL-NEXT: ldr x1, [x1, #0x20]56# SMALL-NEXT: b57 58.section __TEXT,__objc_methname,cstring_literals59lselref1:60 .asciz "foo"61lselref2:62 .asciz "bar"63 64.section __DATA,__objc_selrefs,literal_pointers,no_dead_strip65.p2align 366.quad lselref167.quad lselref268 69.text70 71.globl _main72_main:73 bl _objc_msgSend$length74 bl _objc_msgSend$foo75 bl _objc_msgSend$foo76 ret77