library-order.yaml 1.44 KB
# RUN: ld64.lld -arch x86_64 %p/Inputs/libfoo.a %s -o %t \
# RUN:    %p/Inputs/x86_64/libSystem.yaml
# RUN: llvm-nm -m -n %t | FileCheck %s
#
# Test that if library is before object file on command line, it still is used.
#

--- !mach-o
arch:            x86_64
file-type:       MH_OBJECT
flags:           [ MH_SUBSECTIONS_VIA_SYMBOLS ]
sections:
  - segment:         __TEXT
    section:         __text
    type:            S_REGULAR
    attributes:      [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ]
    alignment:       4
    address:         0x0000000000000000
    content:         [ 0x55, 0x48, 0x89, 0xE5, 0x48, 0x83, 0xEC, 0x10,
                       0xC7, 0x45, 0xFC, 0x00, 0x00, 0x00, 0x00, 0xB0,
                       0x00, 0xE8, 0x00, 0x00, 0x00, 0x00, 0x31, 0xC0,
                       0x48, 0x83, 0xC4, 0x10, 0x5D, 0xC3 ]
    relocations:
      - offset:          0x00000012
        type:            X86_64_RELOC_BRANCH
        length:          2
        pc-rel:          true
        extern:          true
        symbol:          1
global-symbols:
  - name:            _main
    type:            N_SECT
    scope:           [ N_EXT ]
    sect:            1
    value:           0x0000000000000000
undefined-symbols:
  - name:            _foo
    type:            N_UNDF
    scope:           [ N_EXT ]
    value:           0x0000000000000000

...

# CHECK:	{{[0-9a-f]+}} (__TEXT,__text) external _main
# CHECK:	{{[0-9a-f]+}} (__TEXT,__text) external _foo