Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lld / test / MachO / section-order.s
blobf575eebf96dba1c35df54ad51088424db624b3c6
1 # REQUIRES: x86
2 ## Check that section ordering follows from input file ordering.
3 # RUN: rm -rf %t; split-file %s %t
4 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/1.s -o %t/1.o
5 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/2.s -o %t/2.o
6 # RUN: %lld -dylib %t/1.o %t/2.o -o %t/12
7 # RUN: %lld -dylib %t/2.o %t/1.o -o %t/21
8 # RUN: %lld -dylib %t/2.o %t/1.o -o %t/synth-section-order \
9 # RUN: -add_empty_section __TEXT __objc_stubs \
10 # RUN: -add_empty_section __TEXT __init_offsets \
11 # RUN: -add_empty_section __TEXT __stubs \
12 # RUN: -add_empty_section __TEXT __stub_helper \
13 # RUN: -add_empty_section __TEXT __unwind_info \
14 # RUN: -add_empty_section __TEXT __eh_frame \
15 # RUN: -add_empty_section __DATA __objc_selrefs
16 # RUN: llvm-objdump --macho --section-headers %t/12 | FileCheck %s --check-prefix=CHECK-12
17 # RUN: llvm-objdump --macho --section-headers %t/21 | FileCheck %s --check-prefix=CHECK-21
18 # RUN: llvm-objdump --macho --section-headers %t/synth-section-order | FileCheck %s --check-prefix=CHECK-SYNTHETIC-ORDER
20 # CHECK-12: __text
21 # CHECK-12-NEXT: foo
22 # CHECK-12-NEXT: bar
23 # CHECK-12-NEXT: __cstring
25 # CHECK-21: __text
26 # CHECK-21-NEXT: __cstring
27 # CHECK-21-NEXT: bar
28 # CHECK-21-NEXT: foo
30 # CHECK-SYNTHETIC-ORDER: __text
31 # CHECK-SYNTHETIC-ORDER-NEXT: __stubs
32 # CHECK-SYNTHETIC-ORDER-NEXT: __stub_helper
33 # CHECK-SYNTHETIC-ORDER-NEXT: __objc_stubs
34 # CHECK-SYNTHETIC-ORDER-NEXT: __init_offsets
35 # CHECK-SYNTHETIC-ORDER-NEXT: __cstring
36 # CHECK-SYNTHETIC-ORDER-NEXT: bar
37 # CHECK-SYNTHETIC-ORDER-NEXT: foo
38 # CHECK-SYNTHETIC-ORDER-NEXT: __unwind_info
39 # CHECK-SYNTHETIC-ORDER-NEXT: __eh_frame
40 # CHECK-SYNTHETIC-ORDER-NEXT: __objc_selrefs
42 #--- 1.s
43 .section __TEXT,foo
44 .space 1
45 .section __TEXT,bar
46 .space 1
47 .cstring
48 .asciz ""
50 #--- 2.s
51 .cstring
52 .asciz ""
53 .section __TEXT,bar
54 .space 1
55 .section __TEXT,foo
56 .space 1