reference, declarationdefinition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced
    1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67
   68
   69
   70
   71
   72
   73
   74
   75
   76
   77
   78
   79
   80
   81
   82
   83
   84
   85
   86
   87
   88
   89
   90
   91
   92
   93
   94
   95
   96
   97
   98
   99
  100
# RUN: ld64.lld -arch x86_64 -r -print_atoms %s -o %t | FileCheck %s \
# RUN:  && ld64.lld -arch x86_64 -r -print_atoms %t -o %t2 | FileCheck %s
#
# Test parsing of x86_64 tlv relocations.

--- !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
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, 0x48, 0x8B, 0x3D, 0x00,
                       0x00, 0x00, 0x00, 0xFF, 0x17, 0x8B, 0x00, 0x5D,
                       0xC3 ]
    relocations:
      - offset:          0x00000007
        type:            X86_64_RELOC_TLV
        length:          2
        pc-rel:          true
        extern:          true
        symbol:          2
  - segment:         __DATA
    section:         __thread_data
    type:            S_THREAD_LOCAL_REGULAR
    attributes:      [  ]
    alignment:       4
    address:         0x0000000000000014
    content:         [ 0x07, 0x00, 0x00, 0x00 ]
  - segment:         __DATA
    section:         __thread_vars
    type:            S_THREAD_LOCAL_VARIABLES
    attributes:      [  ]
    address:         0x0000000000000018
    content:         [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ]
    relocations:
      - offset:          0x00000010
        type:            X86_64_RELOC_UNSIGNED
        length:          3
        pc-rel:          false
        extern:          true
        symbol:          0
      - offset:          0x00000000
        type:            X86_64_RELOC_UNSIGNED
        length:          3
        pc-rel:          false
        extern:          true
        symbol:          3
local-symbols:
  - name:            '_x$tlv$init'
    type:            N_SECT
    sect:            2
    value:           0x0000000000000014
global-symbols:
  - name:            _main
    type:            N_SECT
    scope:           [ N_EXT ]
    sect:            1
    value:           0x0000000000000000
  - name:            _x
    type:            N_SECT
    scope:           [ N_EXT ]
    sect:            3
    value:           0x0000000000000018
undefined-symbols:
  - name:            __tlv_bootstrap
    type:            N_UNDF
    scope:           [ N_EXT ]
    value:           0x0000000000000000
page-size:       0x00000000
...

# CHECK:        - name:            _x
# CHECK-NEXT:     scope:           global
# CHECK-NEXT:     type:            tlv-thunk
# CHECK-NOT:    - name:
# CHECK:          references:
# CHECK-NEXT:       - kind:            pointer64
# CHECK-NEXT:         offset:          0
# CHECK-NEXT:         target:          __tlv_bootstrap
# CHECK-NEXT:       - kind:            tlvInitSectionOffset
# CHECK-NEXT:         offset:          16
# CHECK-NEXT:         target:          '_x$tlv$init'
# CHECK:        - name:            _main
# CHECK-NOT:    - name:
# CHECK-NEXT:     scope:           global
# CHECK:          references:
# CHECK-NEXT:      - kind:            ripRel32Tlv
# CHECK-NEXT:        offset:          7
# CHECK-NEXT:        target:          _x