force_load-x86_64.yaml 1.27 KB
# RUN: ld64.lld -arch x86_64  %s %p/Inputs/x86_64/libSystem.yaml \
# RUN:      %p/Inputs/libfoo.a %p/Inputs/libbar.a -o %t1
# RUN: llvm-nm -m -n %t1 | FileCheck %s
#
# RUN: ld64.lld -arch x86_64  %s %p/Inputs/x86_64/libSystem.yaml \
# RUN:      -force_load %p/Inputs/libfoo.a %p/Inputs/libbar.a -o %t2
# RUN: llvm-nm -m -n %t2 | FileCheck --check-prefix=CHECKF %s
#
# Test that -force_load causes members of static library to be loaded.
#

--- !mach-o
arch:            x86_64
file-type:       MH_OBJECT
flags:           [ MH_SUBSECTIONS_VIA_SYMBOLS ]
has-UUID:        false
OS:              unknown
sections:
  - segment:         __TEXT
    section:         __text
    type:            S_REGULAR
    attributes:      [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ]
    address:         0x0000000000000000
    content:         [ 0xC3 ]
global-symbols:
  - name:            _main
    type:            N_SECT
    scope:           [ N_EXT ]
    sect:            1
    value:           0x0000000000000000
...

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

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