Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lld / test / MachO / x86-64-objc-stubs.s
blob5e8b9fb165f25a1e59c381a819155a2245fee9e2
1 # REQUIRES: x86
3 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %s -o %t.o
4 # RUN: %lld -arch x86_64 -lSystem -o %t.out %t.o
5 # RUN: llvm-objdump --macho --section-headers %t.out > %t.txt
6 # RUN: llvm-otool -vs __DATA __objc_selrefs %t.out >> %t.txt
7 # RUN: llvm-otool -vs __TEXT __objc_stubs %t.out >> %t.txt
8 # RUN: FileCheck %s < %t.txt
10 # CHECK: Sections:
11 # CHECK: __got {{[0-9a-f]*}} [[#%x, GOTSTART:]] DATA
12 # CHECK: __objc_selrefs {{[0-9a-f]*}} [[#%x, SELSTART:]] DATA
14 # CHECK: Contents of (__DATA,__objc_selrefs) section
16 # CHECK-NEXT: {{[0-9a-f]*}} __TEXT:__objc_methname:foo
17 # CHECK-NEXT: {{[0-9a-f]*}} __TEXT:__objc_methname:bar
18 # CHECK-NEXT: [[#%x, FOOSELREF:]] __TEXT:__objc_methname:foo
19 # CHECK-NEXT: [[#%x, LENGTHSELREF:]] __TEXT:__objc_methname:length
21 # CHECK: Contents of (__TEXT,__objc_stubs) section
23 # CHECK-NEXT: _objc_msgSend$foo:
24 # CHECK-NEXT: [[#%x, PC1:]]
25 # CHECK-SAME: movq 0x[[#%x, FOOSELREF - PC1 - 7]](%rip), %rsi
26 # CHECK-NEXT: [[#%x, PC2:]]
27 # CHECK-SAME: jmpq *0x[[#%x, GOTSTART - PC2 - 6]](%rip)
29 # CHECK-NEXT: _objc_msgSend$length:
30 # CHECK-NEXT: [[#%x, PC3:]]
31 # CHECK-SAME: movq 0x[[#%x, LENGTHSELREF - PC3 - 7]](%rip), %rsi
32 # CHECK-NEXT: [[#%x, PC4:]]
33 # CHECK-SAME: jmpq *0x[[#%x, GOTSTART - PC4 - 6]](%rip)
35 # CHECK-EMPTY:
37 .section __TEXT,__objc_methname,cstring_literals
38 lselref1:
39 .asciz "foo"
40 lselref2:
41 .asciz "bar"
43 .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip
44 .p2align 3
45 .quad lselref1
46 .quad lselref2
48 .text
49 .globl _objc_msgSend
50 _objc_msgSend:
51 ret
53 .globl _main
54 _main:
55 callq _objc_msgSend$length
56 callq _objc_msgSend$foo
57 callq _objc_msgSend$foo
58 ret