[libc] Switch to using the generic `<gpuintrin.h>` implementations (#121810)
[llvm-project.git] / lld / test / MachO / arm64-objc-stubs-dyn.s
blob9358fc5b31c2ba58e37e0fa964cc731d3a488320
1 # REQUIRES: aarch64
3 # RUN: llvm-mc -filetype=obj -triple=arm64-apple-darwin %s -o %t.o
4 # RUN: %lld -arch arm64 -lSystem -U _objc_msgSend -o %t.out %t.o
5 # RUN: llvm-otool -vs __TEXT __objc_stubs %t.out | FileCheck %s
6 # RUN: %lld -arch arm64 -lSystem -U _objc_msgSend -o %t.out %t.o -dead_strip
7 # RUN: llvm-otool -vs __TEXT __objc_stubs %t.out | FileCheck %s
8 # RUN: %lld -arch arm64 -lSystem -U _objc_msgSend -o %t.out %t.o -objc_stubs_fast
9 # RUN: llvm-otool -vs __TEXT __objc_stubs %t.out | FileCheck %s
10 # RUN: %lld -arch arm64 -lSystem -U _objc_msgSend -o %t.out %t.o -objc_stubs_small
11 # RUN: llvm-otool -vs __TEXT __stubs %t.out | FileCheck %s --check-prefix=STUB
12 # RUN: llvm-otool -vs __TEXT __objc_stubs %t.out | FileCheck %s --check-prefix=SMALL
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.
19 # CHECK: Contents of (__TEXT,__objc_stubs) section
21 # CHECK-NEXT: _objc_msgSend$foo:
22 # CHECK-NEXT: adrp x1, 8 ; 0x100008000
23 # CHECK-NEXT: ldr x1, [x1, #0x10]
24 # CHECK-NEXT: adrp x16, 4 ; 0x100004000
25 # CHECK-NEXT: ldr x16, [x16]
26 # CHECK-NEXT: br x16
27 # CHECK-NEXT: brk #0x1
28 # CHECK-NEXT: brk #0x1
29 # CHECK-NEXT: brk #0x1
31 # CHECK-NEXT: _objc_msgSend$length:
32 # CHECK-NEXT: adrp x1, 8 ; 0x100008000
33 # CHECK-NEXT: ldr x1, [x1, #0x18]
34 # CHECK-NEXT: adrp x16, 4 ; 0x100004000
35 # CHECK-NEXT: ldr x16, [x16]
36 # CHECK-NEXT: br x16
37 # CHECK-NEXT: brk #0x1
38 # CHECK-NEXT: brk #0x1
39 # CHECK-NEXT: brk #0x1
41 # CHECK-EMPTY:
43 # STUB: Contents of (__TEXT,__stubs) section
44 # STUB-NEXT: adrp x16, 8 ; 0x100008000
45 # STUB-NEXT: ldr x16, [x16]
46 # STUB-NEXT: br x16
48 # SMALL: Contents of (__TEXT,__objc_stubs) section
49 # SMALL-NEXT: _objc_msgSend$foo:
50 # SMALL-NEXT: adrp x1, 8 ; 0x100008000
51 # SMALL-NEXT: ldr x1, [x1, #0x18]
52 # SMALL-NEXT: b
53 # SMALL-NEXT: _objc_msgSend$length:
54 # SMALL-NEXT: adrp x1, 8 ; 0x100008000
55 # SMALL-NEXT: ldr x1, [x1, #0x20]
56 # SMALL-NEXT: b
58 .section __TEXT,__objc_methname,cstring_literals
59 lselref1:
60 .asciz "foo"
61 lselref2:
62 .asciz "bar"
64 .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip
65 .p2align 3
66 .quad lselref1
67 .quad lselref2
69 .text
71 .globl _main
72 _main:
73 bl _objc_msgSend$length
74 bl _objc_msgSend$foo
75 bl _objc_msgSend$foo
76 ret