1# RUN: ld64.lld.darwinold -arch x86_64 -macosx_version_min 10.8 %s -dylib \
2# RUN:    -sectalign __DATA __custom 0x800 -sectalign __TEXT __text 0x400 \
3# RUN:    %p/Inputs/x86_64/libSystem.yaml -o %t \
4# RUN: && llvm-readobj --sections %t | FileCheck %s
5#
6# Test -sectalign option on __text and a custom section.
7#
8
9--- !mach-o
10arch:            x86_64
11file-type:       MH_OBJECT
12flags:           [ MH_SUBSECTIONS_VIA_SYMBOLS ]
13sections:
14  - segment:         __TEXT
15    section:         __text
16    type:            S_REGULAR
17    attributes:      [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ]
18    address:         0x0000000000000000
19    content:         [ 0x55, 0x48, 0x89, 0xE5, 0x8B, 0x05, 0x00, 0x00,
20                       0x00, 0x00, 0x03, 0x05, 0x00, 0x00, 0x00, 0x00,
21                       0x5D, 0xC3 ]
22    relocations:
23      - offset:          0x0000000C
24        type:            X86_64_RELOC_SIGNED
25        length:          2
26        pc-rel:          true
27        extern:          true
28        symbol:          1
29      - offset:          0x00000006
30        type:            X86_64_RELOC_SIGNED
31        length:          2
32        pc-rel:          true
33        extern:          true
34        symbol:          2
35  - segment:         __DATA
36    section:         __data
37    type:            S_REGULAR
38    attributes:      [  ]
39    alignment:       2
40    address:         0x0000000000000014
41    content:         [ 0x0A, 0x00, 0x00, 0x00 ]
42  - segment:         __DATA
43    section:         __custom
44    type:            S_REGULAR
45    attributes:      [  ]
46    alignment:       2
47    address:         0x0000000000000018
48    content:         [ 0x0A, 0x00, 0x00, 0x00 ]
49global-symbols:
50  - name:            _a
51    type:            N_SECT
52    scope:           [ N_EXT ]
53    sect:            2
54    value:           0x0000000000000014
55  - name:            _b
56    type:            N_SECT
57    scope:           [ N_EXT ]
58    sect:            3
59    value:           0x0000000000000018
60  - name:            _get
61    type:            N_SECT
62    scope:           [ N_EXT ]
63    sect:            1
64    value:           0x0000000000000000
65
66...
67
68
69# CHECK:  Name: __text (5F 5F 74 65 78 74 00 00 00 00 00 00 00 00 00 00)
70# CHECK:  Segment: __TEXT (5F 5F 54 45 58 54 00 00 00 00 00 00 00 00 00 00)
71# CHECK:  Address: 0xC00
72
73# CHECK:  Name: __data (5F 5F 64 61 74 61 00 00 00 00 00 00 00 00 00 00)
74# CHECK:  Segment: __DATA (5F 5F 44 41 54 41 00 00 00 00 00 00 00 00 00 00)
75# CHECK:  Address: 0x1000
76
77# CHECK:  Name: __custom (5F 5F 63 75 73 74 6F 6D 00 00 00 00 00 00 00 00)
78# CHECK:  Segment: __DATA (5F 5F 44 41 54 41 00 00 00 00 00 00 00 00 00 00)
79# CHECK:  Address: 0x1800
80
81