2 # RUN: rm -rf %t; split-file %s %t
3 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/defs.s -o %t/defs.o
4 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/refs1.s -o %t/refs1.o
5 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/refs2.s -o %t/refs2.o
6 # RUN: %lld -lSystem -dylib %t/defs.o -o %t/libdefs.dylib
7 # RUN: %lld -lSystem -dylib --icf=all %t/refs1.o %t/refs2.o %t/libdefs.dylib -o %t/out
8 # RUN: llvm-otool -o %t/out | FileCheck %s
10 ## Check that we only have 3 (unique) entries, of which two are bound at runtime
11 ## (i.e. they are entries that have a static value of 0x0).
12 # CHECK: Contents of (__DATA,__objc_classrefs) section
13 # CHECK-NEXT: 0000000000001008 0x0 _OBJC_CLASS_$_Foo
14 # CHECK-NEXT: 0000000000001010 0x0 _OBJC_CLASS_$_Bar
15 # CHECK-NEXT: 0000000000001018 0x1000 _OBJC_CLASS_$_Baz
19 .globl _OBJC_CLASS_$_Foo, _OBJC_CLASS_$_Bar
20 .section __DATA,__objc_data
27 .subsections_via_symbols
30 .globl _OBJC_CLASS_$_Baz
32 .section __DATA,__objc_data
36 .section __DATA,__objc_classrefs
37 .quad _OBJC_CLASS_$_Foo
38 .quad _OBJC_CLASS_$_Bar
39 .quad _OBJC_CLASS_$_Baz
40 .quad _OBJC_CLASS_$_Baz
42 .subsections_via_symbols
45 .section __DATA,__objc_classrefs
46 .quad _OBJC_CLASS_$_Foo
47 .quad _OBJC_CLASS_$_Bar
49 .subsections_via_symbols