# RUN: ld64.lld -arch x86_64 -o %t %s -dylib %p/Inputs/x86_64/libSystem.yaml && \
# RUN:   llvm-nm -no-sort -debug-syms %t | FileCheck %s

# CHECK:      0000000000000000 - 00 0000    SO /Users/lhames/Projects/lld/lld-svn-tot/scratch/
# CHECK-NEXT: 0000000000000000 - 00 0000    SO hw.c
# CHECK-NEXT:    {{[0-9a-f]+}} - 03 0001   OSO {{.*}}{{/|\\}}test{{/|\\}}mach-o{{/|\\}}debug-syms.yaml
# CHECK-NEXT: 0000000000000fa0 - 01 0000 BNSYM
# CHECK-NEXT: 0000000000000fa0 - 01 0000   FUN _main
# CHECK-NEXT: 0000000000000016 - 00 0000   FUN
# CHECK-NEXT: 0000000000000016 - 01 0000 ENSYM
# CHECK-NEXT: 0000000000000000 - 01 0000    SO

--- !mach-o
arch:            x86_64
file-type:       MH_OBJECT
flags:           [ MH_SUBSECTIONS_VIA_SYMBOLS ]
compat-version:  0.0
current-version: 0.0
has-UUID:        false
OS:              unknown
min-os-version-kind: LC_VERSION_MIN_MACOSX
sections:
  - segment:         __TEXT
    section:         __text
    type:            S_REGULAR
    attributes:      [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ]
    alignment:       16
    address:         0x0000000000000000
    content:         [ 0x55, 0x48, 0x89, 0xE5, 0x31, 0xC0, 0xC7, 0x45,
                       0xFC, 0x00, 0x00, 0x00, 0x00, 0x89, 0x7D, 0xF8,
                       0x48, 0x89, 0x75, 0xF0, 0x5D, 0xC3 ]
  - segment:         __DWARF
    section:         __debug_str
    type:            S_REGULAR
    attributes:      [ S_ATTR_DEBUG ]
    address:         0x0000000000000016
    content:         [ 0x41, 0x70, 0x70, 0x6C, 0x65, 0x20, 0x4C, 0x4C,
                       0x56, 0x4D, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69,
                       0x6F, 0x6E, 0x20, 0x38, 0x2E, 0x30, 0x2E, 0x30,
                       0x20, 0x28, 0x63, 0x6C, 0x61, 0x6E, 0x67, 0x2D,
                       0x38, 0x30, 0x30, 0x2E, 0x30, 0x2E, 0x32, 0x34,
                       0x2E, 0x31, 0x29, 0x00, 0x68, 0x77, 0x2E, 0x63,
                       0x00, 0x2F, 0x55, 0x73, 0x65, 0x72, 0x73, 0x2F,
                       0x6C, 0x68, 0x61, 0x6D, 0x65, 0x73, 0x2F, 0x50,
                       0x72, 0x6F, 0x6A, 0x65, 0x63, 0x74, 0x73, 0x2F,
                       0x6C, 0x6C, 0x64, 0x2F, 0x6C, 0x6C, 0x64, 0x2D,
                       0x73, 0x76, 0x6E, 0x2D, 0x74, 0x6F, 0x74, 0x2F,
                       0x73, 0x63, 0x72, 0x61, 0x74, 0x63, 0x68, 0x00,
                       0x6D, 0x61, 0x69, 0x6E, 0x00, 0x69, 0x6E, 0x74,
                       0x00, 0x61, 0x72, 0x67, 0x63, 0x00, 0x61, 0x72,
                       0x67, 0x76, 0x00, 0x63, 0x68, 0x61, 0x72, 0x00 ]
  - segment:         __DWARF
    section:         __debug_loc
    type:            S_REGULAR
    attributes:      [ S_ATTR_DEBUG ]
    address:         0x000000000000008E
  - segment:         __DWARF
    section:         __debug_abbrev
    type:            S_REGULAR
    attributes:      [ S_ATTR_DEBUG ]
    address:         0x000000000000008E
    content:         [ 0x01, 0x11, 0x01, 0x25, 0x0E, 0x13, 0x05, 0x03,
                       0x0E, 0x10, 0x06, 0x1B, 0x0E, 0x11, 0x01, 0x12,
                       0x01, 0x00, 0x00, 0x02, 0x2E, 0x01, 0x11, 0x01,
                       0x12, 0x01, 0x40, 0x0A, 0x03, 0x0E, 0x3A, 0x0B,
                       0x3B, 0x0B, 0x27, 0x0C, 0x49, 0x13, 0x3F, 0x0C,
                       0x00, 0x00, 0x03, 0x05, 0x00, 0x02, 0x0A, 0x03,
                       0x0E, 0x3A, 0x0B, 0x3B, 0x0B, 0x49, 0x13, 0x00,
                       0x00, 0x04, 0x24, 0x00, 0x03, 0x0E, 0x3E, 0x0B,
                       0x0B, 0x0B, 0x00, 0x00, 0x05, 0x0F, 0x00, 0x49,
                       0x13, 0x00, 0x00, 0x00 ]
  - segment:         __DWARF
    section:         __debug_info
    type:            S_REGULAR
    attributes:      [ S_ATTR_DEBUG ]
    address:         0x00000000000000DA
    content:         [ 0x7F, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
                       0x00, 0x00, 0x08, 0x01, 0x00, 0x00, 0x00, 0x00,
                       0x0C, 0x00, 0x2C, 0x00, 0x00, 0x00, 0x00, 0x00,
                       0x00, 0x00, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00,
                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x00,
                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00,
                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16,
                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
                       0x56, 0x60, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01,
                       0x6A, 0x00, 0x00, 0x00, 0x01, 0x03, 0x02, 0x91,
                       0x78, 0x69, 0x00, 0x00, 0x00, 0x01, 0x01, 0x6A,
                       0x00, 0x00, 0x00, 0x03, 0x02, 0x91, 0x70, 0x6E,
                       0x00, 0x00, 0x00, 0x01, 0x01, 0x71, 0x00, 0x00,
                       0x00, 0x00, 0x04, 0x65, 0x00, 0x00, 0x00, 0x05,
                       0x04, 0x05, 0x76, 0x00, 0x00, 0x00, 0x05, 0x7B,
                       0x00, 0x00, 0x00, 0x04, 0x73, 0x00, 0x00, 0x00,
                       0x06, 0x01, 0x00 ]
    relocations:
      - offset:          0x00000037
        type:            X86_64_RELOC_UNSIGNED
        length:          3
        pc-rel:          false
        extern:          false
        symbol:          1
      - offset:          0x0000002F
        type:            X86_64_RELOC_UNSIGNED
        length:          3
        pc-rel:          false
        extern:          false
        symbol:          1
      - offset:          0x00000026
        type:            X86_64_RELOC_UNSIGNED
        length:          3
        pc-rel:          false
        extern:          false
        symbol:          1
      - offset:          0x0000001E
        type:            X86_64_RELOC_UNSIGNED
        length:          3
        pc-rel:          false
        extern:          false
        symbol:          1
  - segment:         __DWARF
    section:         __debug_ranges
    type:            S_REGULAR
    attributes:      [ S_ATTR_DEBUG ]
    address:         0x000000000000015D
  - segment:         __DWARF
    section:         __debug_macinfo
    type:            S_REGULAR
    attributes:      [ S_ATTR_DEBUG ]
    address:         0x000000000000015D
    content:         [ 0x00 ]
  - segment:         __DWARF
    section:         __apple_names
    type:            S_REGULAR
    attributes:      [ S_ATTR_DEBUG ]
    address:         0x000000000000015E
    content:         [ 0x48, 0x53, 0x41, 0x48, 0x01, 0x00, 0x00, 0x00,
                       0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
                       0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                       0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x06, 0x00,
                       0x00, 0x00, 0x00, 0x00, 0x6A, 0x7F, 0x9A, 0x7C,
                       0x2C, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00,
                       0x01, 0x00, 0x00, 0x00, 0x2E, 0x00, 0x00, 0x00,
                       0x00, 0x00, 0x00, 0x00 ]
  - segment:         __DWARF
    section:         __apple_objc
    type:            S_REGULAR
    attributes:      [ S_ATTR_DEBUG ]
    address:         0x000000000000019A
    content:         [ 0x48, 0x53, 0x41, 0x48, 0x01, 0x00, 0x00, 0x00,
                       0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                       0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                       0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x06, 0x00,
                       0xFF, 0xFF, 0xFF, 0xFF ]
  - segment:         __DWARF
    section:         __apple_namespac
    type:            S_REGULAR
    attributes:      [ S_ATTR_DEBUG ]
    address:         0x00000000000001BE
    content:         [ 0x48, 0x53, 0x41, 0x48, 0x01, 0x00, 0x00, 0x00,
                       0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                       0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                       0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x06, 0x00,
                       0xFF, 0xFF, 0xFF, 0xFF ]
  - segment:         __DWARF
    section:         __apple_types
    type:            S_REGULAR
    attributes:      [ S_ATTR_DEBUG ]
    address:         0x00000000000001E2
    content:         [ 0x48, 0x53, 0x41, 0x48, 0x01, 0x00, 0x00, 0x00,
                       0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
                       0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                       0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x06, 0x00,
                       0x03, 0x00, 0x05, 0x00, 0x04, 0x00, 0x0B, 0x00,
                       0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
                       0x30, 0x80, 0x88, 0x0B, 0x63, 0x20, 0x95, 0x7C,
                       0x40, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, 0x00,
                       0x65, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
                       0x6A, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00,
                       0x00, 0x00, 0x00, 0x73, 0x00, 0x00, 0x00, 0x01,
                       0x00, 0x00, 0x00, 0x7B, 0x00, 0x00, 0x00, 0x24,
                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ]
  - segment:         __DWARF
    section:         __apple_exttypes
    type:            S_REGULAR
    attributes:      [ S_ATTR_DEBUG ]
    address:         0x0000000000000248
    content:         [ 0x48, 0x53, 0x41, 0x48, 0x01, 0x00, 0x00, 0x00,
                       0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                       0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                       0x01, 0x00, 0x00, 0x00, 0x07, 0x00, 0x06, 0x00,
                       0xFF, 0xFF, 0xFF, 0xFF ]
  - segment:         __LD
    section:         __compact_unwind
    type:            S_REGULAR
    attributes:      [ S_ATTR_DEBUG ]
    alignment:       8
    address:         0x0000000000000270
    content:         [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                       0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ]
    relocations:
      - offset:          0x00000000
        type:            X86_64_RELOC_UNSIGNED
        length:          3
        pc-rel:          false
        extern:          false
        symbol:          1
  - segment:         __TEXT
    section:         __eh_frame
    type:            S_COALESCED
    attributes:      [  ]
    alignment:       8
    address:         0x0000000000000290
    content:         [ 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                       0x01, 0x7A, 0x52, 0x00, 0x01, 0x78, 0x10, 0x01,
                       0x10, 0x0C, 0x07, 0x08, 0x90, 0x01, 0x00, 0x00,
                       0x24, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00,
                       0x50, 0xFD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
                       0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                       0x00, 0x41, 0x0E, 0x10, 0x86, 0x02, 0x43, 0x0D,
                       0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ]
  - segment:         __DWARF
    section:         __debug_line
    type:            S_REGULAR
    attributes:      [ S_ATTR_DEBUG ]
    address:         0x00000000000002D0
    content:         [ 0x37, 0x00, 0x00, 0x00, 0x02, 0x00, 0x1B, 0x00,
                       0x00, 0x00, 0x01, 0x01, 0xFB, 0x0E, 0x0D, 0x00,
                       0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01,
                       0x00, 0x00, 0x01, 0x00, 0x68, 0x77, 0x2E, 0x63,
                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x02,
                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                       0x01, 0x05, 0x03, 0x0A, 0x08, 0x3D, 0x02, 0x02,
                       0x00, 0x01, 0x01 ]
    relocations:
      - offset:          0x00000028
        type:            X86_64_RELOC_UNSIGNED
        length:          3
        pc-rel:          false
        extern:          false
        symbol:          1
global-symbols:
  - name:            _main
    type:            N_SECT
    scope:           [ N_EXT ]
    sect:            1
    value:           0x0000000000000000
page-size:       0x00000000
...
