Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lld / test / MachO / arm64-objc-stubs.s
blobfeba40ac36d8405d83eac6e3f00eb8721ee14b53
1 # REQUIRES: aarch64
3 # RUN: llvm-mc -filetype=obj -triple=arm64-apple-darwin %s -o %t.o
4 # RUN: %lld -arch arm64 -lSystem -o %t.out %t.o
5 # RUN: llvm-otool -vs __TEXT __objc_stubs %t.out | FileCheck %s
6 # RUN: %lld -arch arm64 -lSystem -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 -o %t.out %t.o -objc_stubs_fast
9 # RUN: llvm-otool -vs __TEXT __objc_stubs %t.out | FileCheck %s
10 # RUN: %no-fatal-warnings-lld -arch arm64 -lSystem -o %t.out %t.o -objc_stubs_small 2>&1 | FileCheck %s --check-prefix=WARNING
11 # RUN: llvm-otool -vs __TEXT __objc_stubs %t.out | FileCheck %s
13 # WARNING: warning: -objc_stubs_small is not yet implemented, defaulting to -objc_stubs_fast
15 # CHECK: Contents of (__TEXT,__objc_stubs) section
17 # CHECK-NEXT: _objc_msgSend$foo:
18 # CHECK-NEXT: adrp x1, 8 ; 0x100008000
19 # CHECK-NEXT: ldr x1, [x1, #0x10]
20 # CHECK-NEXT: adrp x16, 4 ; 0x100004000
21 # CHECK-NEXT: ldr x16, [x16]
22 # CHECK-NEXT: br x16
23 # CHECK-NEXT: brk #0x1
24 # CHECK-NEXT: brk #0x1
25 # CHECK-NEXT: brk #0x1
27 # CHECK-NEXT: _objc_msgSend$length:
28 # CHECK-NEXT: adrp x1, 8 ; 0x100008000
29 # CHECK-NEXT: ldr x1, [x1, #0x18]
30 # CHECK-NEXT: adrp x16, 4 ; 0x100004000
31 # CHECK-NEXT: ldr x16, [x16]
32 # CHECK-NEXT: br x16
33 # CHECK-NEXT: brk #0x1
34 # CHECK-NEXT: brk #0x1
35 # CHECK-NEXT: brk #0x1
37 # CHECK-EMPTY:
39 .section __TEXT,__objc_methname,cstring_literals
40 lselref1:
41 .asciz "foo"
42 lselref2:
43 .asciz "bar"
45 .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip
46 .p2align 3
47 .quad lselref1
48 .quad lselref2
50 .text
51 .globl _objc_msgSend
52 _objc_msgSend:
53 ret
55 .globl _main
56 _main:
57 bl _objc_msgSend$length
58 bl _objc_msgSend$foo
59 bl _objc_msgSend$foo
60 ret