Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lld / test / MachO / objc-classrefs-dedup.s
blob1df482d4d890a3696a9c537e7277496b106ded81
1 # REQUIRES: x86
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
16 # CHECK-EMPTY:
18 #--- defs.s
19 .globl _OBJC_CLASS_$_Foo, _OBJC_CLASS_$_Bar
20 .section __DATA,__objc_data
21 _OBJC_CLASS_$_Foo:
22 .quad 123
24 _OBJC_CLASS_$_Bar:
25 .quad 456
27 .subsections_via_symbols
29 #--- refs1.s
30 .globl _OBJC_CLASS_$_Baz
32 .section __DATA,__objc_data
33 _OBJC_CLASS_$_Baz:
34 .quad 789
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
44 #--- refs2.s
45 .section __DATA,__objc_classrefs
46 .quad _OBJC_CLASS_$_Foo
47 .quad _OBJC_CLASS_$_Bar
49 .subsections_via_symbols