1# RUN: ld64.lld.darwinold -arch arm64 -r -print_atoms %s -o %t
2# RUN: ld64.lld.darwinold -arch arm64 -r -print_atoms %t -o %t2
3# RUN: llvm-objdump --section-headers %t | FileCheck %s
4# RUN: llvm-objdump --section-headers %t2 | FileCheck %s
5
6# Make sure that the sections are sorted.  Currently we want this order:
7# __text, __unwind_info
8
9# CHECK: Sections:
10# CHECK: 0 __text        {{.*}} TEXT
11# CHECK: 1 __compact_unwind {{.*}}
12
13
14--- !mach-o
15arch:            arm64
16file-type:       MH_OBJECT
17flags:           [ MH_SUBSECTIONS_VIA_SYMBOLS ]
18compat-version:  0.0
19current-version: 0.0
20has-UUID:        false
21OS:              unknown
22sections:
23  - segment:         __TEXT
24    section:         __text
25    type:            S_REGULAR
26    attributes:      [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ]
27    alignment:       8
28    address:         0x0000000000000000
29    content:         [ 0xC0, 0x03, 0x5F, 0xD6, 0xC0, 0x03, 0x5F, 0xD6 ]
30  - segment:         __LD
31    section:         __compact_unwind
32    type:            S_REGULAR
33    attributes:      [  ]
34    alignment:       8
35    address:         0x0000000000000008
36    content:         [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
37                       0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
38                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
39                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
40                       0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
41                       0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
42                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
43                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ]
44    relocations:
45      - offset:          0x00000020
46        type:            ARM64_RELOC_UNSIGNED
47        length:          3
48        pc-rel:          false
49        extern:          false
50        symbol:          1
51      - offset:          0x00000000
52        type:            ARM64_RELOC_UNSIGNED
53        length:          3
54        pc-rel:          false
55        extern:          false
56        symbol:          1
57global-symbols:
58  - name:            __Z3fooi
59    type:            N_SECT
60    scope:           [ N_EXT ]
61    sect:            1
62    value:           0x0000000000000000
63  - name:            __Z4foo2i
64    type:            N_SECT
65    scope:           [ N_EXT ]
66    sect:            1
67    value:           0x0000000000000004
68