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
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)
37 .section __TEXT,__objc_methname,cstring_literals
43 .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip
55 callq _objc_msgSend$length
56 callq _objc_msgSend$foo
57 callq _objc_msgSend$foo