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
9 # RUN: %no-fatal-warnings-lld -arch x86_64 -lSystem -o %t.out %t.o -objc_stubs_small 2>&1 | FileCheck %s --check-prefix=WARNING
11 # WARNING: warning: -objc_stubs_small is not yet implemented, defaulting to -objc_stubs_fast
13 # RUN: %lld -arch x86_64 -lSystem -o %t-icfsafe.out --icf=safe %t.o
14 # RUN: llvm-otool -vs __DATA __objc_selrefs %t-icfsafe.out | FileCheck %s --check-prefix=ICF
15 # RUN: %lld -arch x86_64 -lSystem -o %t-icfall.out --icf=all %t.o
16 # RUN: llvm-otool -vs __DATA __objc_selrefs %t-icfall.out | FileCheck %s --check-prefix=ICF
19 # CHECK: __got {{[0-9a-f]*}} [[#%x, GOTSTART:]] DATA
20 # CHECK: __objc_selrefs {{[0-9a-f]*}} [[#%x, SELSTART:]] DATA
22 # CHECK: Contents of (__DATA,__objc_selrefs) section
24 # CHECK-NEXT: {{[0-9a-f]*}} __TEXT:__objc_methname:foo
25 # CHECK-NEXT: {{[0-9a-f]*}} __TEXT:__objc_methname:bar
26 # CHECK-NEXT: [[#%x, FOOSELREF:]] __TEXT:__objc_methname:foo
27 # CHECK-NEXT: [[#%x, LENGTHSELREF:]] __TEXT:__objc_methname:length
29 # ICF: Contents of (__DATA,__objc_selrefs) section
31 # ICF-NEXT: {{[0-9a-f]*}} __TEXT:__objc_methname:foo
32 # ICF-NEXT: {{[0-9a-f]*}} __TEXT:__objc_methname:bar
33 # ICF-NEXT: {{[0-9a-f]*}} __TEXT:__objc_methname:length
36 # CHECK: Contents of (__TEXT,__objc_stubs) section
38 # CHECK-NEXT: _objc_msgSend$foo:
39 # CHECK-NEXT: [[#%x, PC1:]]
40 # CHECK-SAME: movq 0x[[#%x, FOOSELREF - PC1 - 7]](%rip), %rsi
41 # CHECK-NEXT: [[#%x, PC2:]]
42 # CHECK-SAME: jmpq *0x[[#%x, GOTSTART - PC2 - 6]](%rip)
44 # CHECK-NEXT: _objc_msgSend$length:
45 # CHECK-NEXT: [[#%x, PC3:]]
46 # CHECK-SAME: movq 0x[[#%x, LENGTHSELREF - PC3 - 7]](%rip), %rsi
47 # CHECK-NEXT: [[#%x, PC4:]]
48 # CHECK-SAME: jmpq *0x[[#%x, GOTSTART - PC4 - 6]](%rip)
52 .section __TEXT,__objc_methname,cstring_literals
58 .section __DATA,__objc_selrefs,literal_pointers,no_dead_strip
70 callq _objc_msgSend$length
71 callq _objc_msgSend$foo
72 callq _objc_msgSend$foo