Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lld / test / MachO / subsections-symbol-relocs.s
blob72401ff3aa3ce8543dd303f035d7deb3e69b9188
1 # REQUIRES: x86
2 # RUN: rm -rf %t; split-file %s %t
3 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/test.s -o %t/test.o
5 # RUN: %lld -o %t/test-1 %t/test.o -order_file %t/order-file-1
6 # RUN: llvm-objdump --no-print-imm-hex -d --no-show-raw-insn %t/test-1 | FileCheck %s
7 # RUN: %lld -o %t/test-2 %t/test.o -order_file %t/order-file-2
8 # RUN: llvm-objdump --no-print-imm-hex -d --no-show-raw-insn %t/test-2 | FileCheck %s
9 # CHECK-LABEL: Disassembly of section __TEXT,__text:
10 # CHECK: <_ba{{r|z}}>:
11 # CHECK-NEXT: callq {{.*}} <_foo>
12 # CHECK-EMPTY:
13 # CHECK-NEXT: <_qux>:
14 # CHECK-NEXT: retq
15 # CHECK: <_foo>:
16 # CHECK-NEXT: retq
17 # CHECK: <_main>:
18 # CHECK-NEXT: callq {{.*}} <_ba{{r|z}}>
19 # CHECK-NEXT: movq $0, %rax
20 # CHECK-NEXT: retq
22 #--- order-file-1
23 _bar
24 _foo
25 _main
26 ## _qux is marked as .alt_entry, so it should not create a new subsection and
27 ## its contents should move with _bar to the start of the output despite the
28 ## order file listing it at the end.
29 _qux
31 #--- order-file-2
32 ## _bar and _baz point to the same address, so both order files should achieve
33 ## the same result.
34 _baz
35 _foo
36 _main
37 _qux
39 #--- test.s
40 .text
41 .globl _main, _foo, _bar, _qux
42 .alt_entry _qux
44 _foo:
45 retq
47 _main:
48 callq _bar
49 movq $0, %rax
50 retq
52 _bar:
53 _baz:
54 callq _foo
55 _qux:
56 retq
58 .subsections_via_symbols