1# RUN: ld64.lld -arch x86_64 -r -print_atoms %s -o %t  | FileCheck %s
2#
3# Test parsing of literal sections.
4#
5
6--- !mach-o
7arch:            x86_64
8file-type:       MH_OBJECT
9flags:           [ MH_SUBSECTIONS_VIA_SYMBOLS ]
10has-UUID:        false
11OS:              unknown
12sections:
13  - segment:         __TEXT
14    section:         __cstring
15    type:            S_CSTRING_LITERALS
16    attributes:      [  ]
17    alignment:       1
18    address:         0x0000000000000100
19    content:         [ 0x68, 0x65, 0x6C, 0x6C, 0x6F, 0x00, 0x74, 0x68,
20                       0x65, 0x72, 0x65, 0x00, 0x77, 0x6F, 0x72, 0x6C,
21                       0x00 ]
22  - segment:         __TEXT
23    section:         __literal4
24    type:            S_4BYTE_LITERALS
25    attributes:      [  ]
26    alignment:       1
27    address:         0x0000000000000114
28    content:         [ 0x01, 0x02, 0x03, 0x04, 0x11, 0x12, 0x13, 0x14,
29                       0x28, 0x29, 0x2A, 0x2B ]
30  - segment:         __TEXT
31    section:         __literal8
32    type:            S_8BYTE_LITERALS
33    attributes:      [  ]
34    alignment:       1
35    address:         0x0000000000000120
36    content:         [ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
37                       0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F ]
38  - segment:         __TEXT
39    section:         __literal16
40    type:            S_16BYTE_LITERALS
41    attributes:      [  ]
42    alignment:       1
43    address:         0x0000000000000130
44    content:         [ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
45                       0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x00 ]
46  - segment:         __TEXT
47    section:         __ustring
48    type:            S_REGULAR
49    attributes:      [  ]
50    alignment:       1
51    address:         0x0000000000000100
52    content:         [ 0x68, 0x00, 0x65, 0x00, 0x6C, 0x00, 0x6C, 0x00,
53                       0x6F, 0x00, 0x00, 0x00, 0x74, 0x00, 0x68, 0x00,
54                       0x65, 0x00, 0x72, 0x00, 0x00, 0x00 ]
55...
56
57
58# CHECK:defined-atoms:
59# CHECK:  - scope:           hidden
60# CHECK:    type:            c-string
61# CHECK:    content:         [ 68, 65, 6C, 6C, 6F, 00 ]
62# CHECK:  - scope:           hidden
63# CHECK:    type:            c-string
64# CHECK:    content:         [ 74, 68, 65, 72, 65, 00 ]
65# CHECK:  - scope:           hidden
66# CHECK:    type:            c-string
67# CHECK:    content:         [ 77, 6F, 72, 6C, 00 ]
68# CHECK:  - scope:           hidden
69# CHECK:    type:            utf16-string
70# CHECK:    content:         [ 68, 00, 65, 00, 6C, 00, 6C, 00, 6F, 00, 00, 00 ]
71# CHECK:  - scope:           hidden
72# CHECK:    type:            utf16-string
73# CHECK:    content:         [ 74, 00, 68, 00, 65, 00, 72, 00, 00, 00 ]
74# CHECK:  - scope:           hidden
75# CHECK:    type:            const-4-byte
76# CHECK:    content:         [ 01, 02, 03, 04 ]
77# CHECK:  - scope:           hidden
78# CHECK:    type:            const-4-byte
79# CHECK:    content:         [ 11, 12, 13, 14 ]
80# CHECK:  - scope:           hidden
81# CHECK:    type:            const-4-byte
82# CHECK:    content:         [ 28, 29, 2A, 2B ]
83# CHECK:  - scope:           hidden
84# CHECK:    type:            const-8-byte
85# CHECK:    content:         [ 01, 02, 03, 04, 05, 06, 07, 08 ]
86# CHECK:  - scope:           hidden
87# CHECK:    type:            const-8-byte
88# CHECK:    content:         [ 28, 29, 2A, 2B, 2C, 2D, 2E, 2F ]
89# CHECK:  - scope:           hidden
90# CHECK:    type:            const-16-byte
91# CHECK:    content:         [ 01, 02, 03, 04, 05, 06, 07, 08, 09, 0A, 0B, 0C,
92# CHECK:                       0D, 0E, 0F, 00 ]
93
94