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
  101
  102
  103
  104
  105
  106
  107
  108
  109
  110
  111
  112
  113
  114
  115
  116
  117
  118
  119
  120
  121
  122
  123
  124
  125
  126
  127
  128
  129
  130
  131
  132
  133
  134
  135
  136
  137
  138
  139
  140
  141
  142
  143
  144
  145
  146
  147
  148
  149
  150
  151
  152
  153
  154
  155
  156
  157
  158
  159
  160
  161
  162
  163
  164
  165
  166
  167
  168
  169
  170
  171
  172
  173
  174
  175
  176
# RUN: ld64.lld -arch x86_64 -r -print_atoms %s -o %t | FileCheck %s
#
# Test parsing of x86_64 __eh_frame (dwarf unwind) 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, 0xE8, 0x00, 0x00, 0x00,
                       0x00, 0x5D, 0xC3, 0x48, 0x89, 0xC7, 0xE8, 0x00,
                       0x00, 0x00, 0x00, 0x5D, 0xE9, 0x00, 0x00, 0x00,
                       0x00, 0x0F, 0x1F, 0x80, 0x00, 0x00, 0x00, 0x00,
                       0x55, 0x48, 0x89, 0xE5, 0x5D, 0xC3, 0x66, 0x2E,
                       0x0F, 0x1F, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00,
                       0x55, 0x48, 0x89, 0xE5, 0xE8, 0x00, 0x00, 0x00,
                       0x00, 0x5D, 0xC3, 0x48, 0x89, 0xC7, 0xE8, 0x00,
                       0x00, 0x00, 0x00, 0x5D, 0xE9, 0x00, 0x00, 0x00,
                       0x00 ]
  - segment:         __TEXT
    section:         __gcc_except_tab
    type:            S_REGULAR
    attributes:      [  ]
    alignment:       4
    address:         0x000000000000004C
    content:         [ 0xFF, 0x9B, 0xA2, 0x80, 0x80, 0x00, 0x03, 0x1A,
                       0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
                       0x0B, 0x00, 0x00, 0x00, 0x01, 0x09, 0x00, 0x00,
                       0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                       0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
                       0xFF, 0x9B, 0xA2, 0x80, 0x80, 0x00, 0x03, 0x1A,
                       0x04, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
                       0x0B, 0x00, 0x00, 0x00, 0x01, 0x09, 0x00, 0x00,
                       0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                       0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 ]
  - segment:         __TEXT
    section:         __eh_frame
    type:            S_COALESCED
    attributes:      [  ]
    alignment:       8
    address:         0x0000000000000100
    content:         [ 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                       0x03, 0x7A, 0x50, 0x4C, 0x52, 0x00, 0x01, 0x78,
                       0x10, 0x07, 0x9B, 0x04, 0x00, 0x00, 0x00, 0x10,
                       0x10, 0x0C, 0x07, 0x08, 0x90, 0x01, 0x00, 0x00,
                       0x2C, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00,
                       0xD8, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
                       0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                       0x08, 0x13, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
                       0xFF, 0x41, 0x0E, 0x10, 0x86, 0x02, 0x43, 0x0D,
                       0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                       0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                       0x03, 0x7A, 0x52, 0x00, 0x01, 0x78, 0x10, 0x01,
                       0x10, 0x0C, 0x07, 0x08, 0x90, 0x01, 0x00, 0x00,
                       0x24, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00,
                       0xB0, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
                       0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                       0x00, 0x41, 0x0E, 0x10, 0x86, 0x02, 0x43, 0x0D,
                       0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                       0x2C, 0x00, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00,
                       0x98, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
                       0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                       0x08, 0xCB, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
                       0xFF, 0x41, 0x0E, 0x10, 0x86, 0x02, 0x43, 0x0D,
                       0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ]
    relocations:
      - offset:          0x00000013
        type:            X86_64_RELOC_GOT
        length:          2
        pc-rel:          true
        extern:          true
        symbol:          8
local-symbols:
  - name:            GCC_except_table0
    type:            N_SECT
    sect:            2
    value:           0x000000000000004C
  - name:            GCC_except_table2
    type:            N_SECT
    sect:            2
    value:           0x0000000000000074
global-symbols:
  - name:            _catchMyException1
    type:            N_SECT
    scope:           [ N_EXT ]
    sect:            1
    value:           0x0000000000000000
  - name:            _catchMyException2
    type:            N_SECT
    scope:           [ N_EXT ]
    sect:            1
    value:           0x0000000000000030
  - name:            _bar
    type:            N_SECT
    scope:           [ N_EXT ]
    sect:            1
    value:           0x0000000000000020
undefined-symbols:
  - name:            _foo
    type:            N_UNDF
    scope:           [ N_EXT ]
    value:           0x0000000000000000
  - name:            ___cxa_begin_catch
    type:            N_UNDF
    scope:           [ N_EXT ]
    value:           0x0000000000000000
  - name:            ___cxa_end_catch
    type:            N_UNDF
    scope:           [ N_EXT ]
    value:           0x0000000000000000
  - name:            ___gxx_personality_v0
    type:            N_UNDF
    scope:           [ N_EXT ]
    value:           0x0000000000000000
page-size:       0x00000000
...

# Check that LSDA fields are fixed up correctly, even when there are multiple
# CIEs involved.
#
# (1) Check that we can relocate an LSDA at all. Requires correct interpretation
#     of augmentation data strings in CIEs and augmentation data fields of FDEs.
#
# CHECK:       - type:            unwind-cfi
# CHECK-NOT:   - type:
# CHECK:         references:
# CHECK-NEXT:      - kind:            negDelta32
# CHECK-NEXT:        offset:          4
# CHECK-NEXT:        target:          L002
# CHECK-NEXT:      - kind:            unwindFDEToFunction
# CHECK-NEXT:        offset:          8
# CHECK-NEXT:        target:          _catchMyException1
# CHECK-NEXT:      - kind:            unwindFDEToFunction
# CHECK-NEXT:        offset:          25
# CHECK-NEXT:        target:          GCC_except_table0
#
# (2) Check that we have an intervening FDE with a different CIE.
#     If the test fails here then test (3) probably isn't testing what it
#     should, and this test-case should be updated.
#
# CHECK:       - type:            unwind-cfi
# CHECK-NOT:   - type:
# CHECK:         references:
# CHECK-NEXT:      - kind:            negDelta32
# CHECK-NEXT:        offset:          4
# CHECK-NEXT:        target:          L001
# CHECK-NEXT:      - kind:            unwindFDEToFunction
# CHECK-NEXT:        offset:          8
# CHECK-NEXT:        target:          _bar
#
# (3) Check that we can relocate the LSDA on a second FDE that references the
#     original CIE from (1). Requires us to match this FDE up with the correct
#     CIE.
#
# CHECK-NEXT:  - type:            unwind-cfi
# CHECK-NOT:   - type:
# CHECK:         references:
# CHECK-NEXT:      - kind:            negDelta32
# CHECK-NEXT:        offset:          4
# CHECK-NEXT:        target:          L002
# CHECK-NEXT:      - kind:            unwindFDEToFunction
# CHECK-NEXT:        offset:          8
# CHECK-NEXT:        target:          _catchMyException2
# CHECK-NEXT:      - kind:            unwindFDEToFunction
# CHECK-NEXT:        offset:          25
# CHECK-NEXT:        target:          GCC_except_table2