1# RUN: ld64.lld.darwinold -arch i386 %s %p/Inputs/hello-world-x86.yaml -o %t
2# RUN: llvm-nm -m %t | FileCheck %s
3#
4# Test that i386 hello-world can be linked into a mach-o executable
5#
6
7--- !mach-o
8arch:            x86
9file-type:       MH_OBJECT
10flags:           [ MH_SUBSECTIONS_VIA_SYMBOLS ]
11sections:
12  - segment:         __TEXT
13    section:         __text
14    type:            S_REGULAR
15    attributes:      [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ]
16    address:         0x0000000000000000
17    content:         [ 0x55, 0x89, 0xE5, 0x83, 0xEC, 0x08, 0xE8, 0x00,
18                       0x00, 0x00, 0x00, 0x58, 0x8D, 0x80, 0x16, 0x00,
19                       0x00, 0x00, 0x89, 0x04, 0x24, 0xE8, 0xE6, 0xFF,
20                       0xFF, 0xFF, 0x31, 0xC0, 0x83, 0xC4, 0x08, 0x5D,
21                       0xC3 ]
22    relocations:
23      - offset:          0x00000016
24        type:            GENERIC_RELOC_VANILLA
25        length:          2
26        pc-rel:          true
27        extern:          true
28        symbol:          1
29      - offset:          0x0000000E
30        scattered:       true
31        type:            GENERIC_RELOC_LOCAL_SECTDIFF
32        length:          2
33        pc-rel:          false
34        value:           0x00000021
35      - offset:          0x00000000
36        scattered:       true
37        type:            GENERIC_RELOC_PAIR
38        length:          2
39        pc-rel:          false
40        value:           0x0000000B
41  - segment:         __TEXT
42    section:         __cstring
43    type:            S_CSTRING_LITERALS
44    attributes:      [  ]
45    address:         0x0000000000000021
46    content:         [ 0x68, 0x65, 0x6C, 0x6C, 0x6F, 0x0A, 0x00 ]
47global-symbols:
48  - name:            _main
49    type:            N_SECT
50    scope:           [ N_EXT ]
51    sect:            1
52    value:           0x0000000000000000
53undefined-symbols:
54  - name:            _printf
55    type:            N_UNDF
56    scope:           [ N_EXT ]
57    value:           0x0000000000000000
58...
59
60# CHECK:	{{[0-9a-f]+}} (__TEXT,__text) external _main
61# CHECK:	(undefined) external _printf (from libSystem)
62# CHECK:	(undefined) external dyld_stub_binder (from libSystem)
63