1# RUN: ld64.lld.darwinold -arch x86_64 -r -print_atoms %s -o %t | FileCheck %s
2# RUN: ld64.lld.darwinold -arch x86_64 -r -print_atoms %t -o %t2 | FileCheck %s
3
4
5--- !mach-o
6arch:            x86_64
7file-type:       MH_OBJECT
8flags:           [ MH_SUBSECTIONS_VIA_SYMBOLS ]
9compat-version:  0.0
10current-version: 0.0
11has-UUID:        false
12OS:              unknown
13sections:
14  - segment:         __DATA
15    section:         __objc_catlist
16    type:            S_REGULAR
17    attributes:      [ S_ATTR_NO_DEAD_STRIP ]
18    alignment:       8
19    address:         0x00000000000003F8
20    content:         [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
21                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ]
22    relocations:
23      - offset:          0x00000008
24        type:            X86_64_RELOC_UNSIGNED
25        length:          3
26        pc-rel:          false
27        extern:          true
28        symbol:          0
29      - offset:          0x00000000
30        type:            X86_64_RELOC_UNSIGNED
31        length:          3
32        pc-rel:          false
33        extern:          true
34        symbol:          1
35undefined-symbols:
36  - name:            __category1
37    type:            N_UNDF
38    scope:           [ N_EXT ]
39    value:           0x0000000000000000
40  - name:            __category2
41    type:            N_UNDF
42    scope:           [ N_EXT ]
43    value:           0x0000000000000000
44page-size:       0x00000000
45...
46
47# Make sure we atomize the category list section by pointer sized atoms.
48
49# CHECK: path:            '<linker-internal>'
50# CHECK: defined-atoms:
51# CHECK:   - type:            objc-category-list
52# CHECK:     content:         [ 00, 00, 00, 00, 00, 00, 00, 00 ]
53# CHECK:     merge:           by-content
54# CHECK:     alignment:       8
55# CHECK:     references:
56# CHECK:       - kind:            pointer64
57# CHECK:         offset:          0
58# CHECK:         target:          __category2
59# CHECK:   - type:            objc-category-list
60# CHECK:     content:         [ 00, 00, 00, 00, 00, 00, 00, 00 ]
61# CHECK:     merge:           by-content
62# CHECK:     alignment:       8
63# CHECK:     references:
64# CHECK:       - kind:            pointer64
65# CHECK:         offset:          0
66# CHECK:         target:          __category1
67# CHECK: undefined-atoms:
68# CHECK:   - name:            __category1
69# CHECK:   - name:            __category2
70# CHECK: ...
71