relocations_x86_64.yaml 19 KB
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 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494
# RUN: yaml2obj %s -o %t
# RUN: llvm-objdump --macho --reloc %t | FileCheck %s --check-prefix=OBJDUMP-VERIFY

# OBJDUMP-VERIFY: Relocation information (__TEXT,__text) 2 entries
# OBJDUMP-VERIFY-NEXT: address  pcrel length extern type    scattered symbolnum/value
# OBJDUMP-VERIFY-NEXT: 00000015 True  long   True   SIGNED  False     _w
# OBJDUMP-VERIFY-NEXT: 0000000e True  long   True   SIGNED  False     _z
# OBJDUMP-VERIFY-NEXT: Relocation information (__TEXT,__StaticInit) 4 entries
# OBJDUMP-VERIFY-NEXT: address  pcrel length extern type    scattered symbolnum/value
# OBJDUMP-VERIFY-NEXT: 00000025 True  long   True   BRANCH  False     ___cxx_global_var_init
# OBJDUMP-VERIFY-NEXT: 00000018 True  long   True   SIGNED  False     _w
# OBJDUMP-VERIFY-NEXT: 0000000e True  long   True   SIGNED  False     _x
# OBJDUMP-VERIFY-NEXT: 00000007 True  long   True   SIGNED  False     _y
# OBJDUMP-VERIFY-NEXT: Relocation information (__DATA,__data) 1 entries
# OBJDUMP-VERIFY-NEXT: address  pcrel length extern type    scattered symbolnum/value
# OBJDUMP-VERIFY-NEXT: 00000008 False quad   True   UNSIGND False     _x
# OBJDUMP-VERIFY-NEXT: Relocation information (__DATA,__mod_init_func) 1 entries
# OBJDUMP-VERIFY-NEXT: address  pcrel length extern type    scattered symbolnum/value
# OBJDUMP-VERIFY-NEXT: 00000000 False quad   True   UNSIGND False     __GLOBAL__sub_I_main.cpp
# OBJDUMP-VERIFY-NEXT: Relocation information (__LD,__compact_unwind) 3 entries
# OBJDUMP-VERIFY-NEXT: address  pcrel length extern type    scattered symbolnum/value
# OBJDUMP-VERIFY-NEXT: 00000040 False quad   False  UNSIGND False     2 (__TEXT,__StaticInit)
# OBJDUMP-VERIFY-NEXT: 00000020 False quad   False  UNSIGND False     1 (__TEXT,__text)
# OBJDUMP-VERIFY-NEXT: 00000000 False quad   False  UNSIGND False     2 (__TEXT,__StaticInit)

# RUN: obj2yaml %t | FileCheck %s 
# CHECK:    Sections:
# CHECK-NEXT:      - sectname:        __text
# CHECK-NEXT:        segname:         __TEXT
# CHECK-NEXT:        addr:            0x0000000000000000
# CHECK-NEXT:        size:            27
# CHECK-NEXT:        offset:          0x00000310
# CHECK-NEXT:        align:           4
# CHECK-NEXT:        reloff:          0x00000468
# CHECK-NEXT:        nreloc:          2
# CHECK-NEXT:        flags:           0x80000400
# CHECK-NEXT:        reserved1:       0x00000000
# CHECK-NEXT:        reserved2:       0x00000000
# CHECK-NEXT:        reserved3:       0x00000000
# CHECK-NEXT:        content:         
# CHECK-NEXT:        relocations:
# CHECK-NEXT:          - address:         0x00000015
# CHECK-NEXT:            symbolnum:       3
# CHECK-NEXT:            pcrel:           true
# CHECK-NEXT:            length:          2
# CHECK-NEXT:            extern:          true
# CHECK-NEXT:            type:            1
# CHECK-NEXT:            scattered:       false
# CHECK-NEXT:            value:           0
# CHECK-NEXT:          - address:         0x0000000E
# CHECK-NEXT:            symbolnum:       6
# CHECK-NEXT:            pcrel:           true
# CHECK-NEXT:            length:          2
# CHECK-NEXT:            extern:          true
# CHECK-NEXT:            type:            1
# CHECK-NEXT:            scattered:       false
# CHECK-NEXT:            value:           0
# CHECK-NEXT:      - sectname:        __StaticInit
# CHECK-NEXT:        segname:         __TEXT
# CHECK-NEXT:        addr:            0x0000000000000020
# CHECK-NEXT:        size:            43
# CHECK-NEXT:        offset:          0x00000330
# CHECK-NEXT:        align:           4
# CHECK-NEXT:        reloff:          0x00000478
# CHECK-NEXT:        nreloc:          4
# CHECK-NEXT:        flags:           0x80000400
# CHECK-NEXT:        reserved1:       0x00000000
# CHECK-NEXT:        reserved2:       0x00000000
# CHECK-NEXT:        reserved3:       0x00000000
# CHECK-NEXT:        content:
# CHECK-NEXT:        relocations:
# CHECK-NEXT:          - address:         0x00000025
# CHECK-NEXT:            symbolnum:       0
# CHECK-NEXT:            pcrel:           true
# CHECK-NEXT:            length:          2
# CHECK-NEXT:            extern:          true
# CHECK-NEXT:            type:            2
# CHECK-NEXT:            scattered:       false
# CHECK-NEXT:            value:           0
# CHECK-NEXT:          - address:         0x00000018
# CHECK-NEXT:            symbolnum:       3
# CHECK-NEXT:            pcrel:           true
# CHECK-NEXT:            length:          2
# CHECK-NEXT:            extern:          true
# CHECK-NEXT:            type:            1
# CHECK-NEXT:            scattered:       false
# CHECK-NEXT:            value:           0
# CHECK-NEXT:          - address:         0x0000000E
# CHECK-NEXT:            symbolnum:       4
# CHECK-NEXT:            pcrel:           true
# CHECK-NEXT:            length:          2
# CHECK-NEXT:            extern:          true
# CHECK-NEXT:            type:            1
# CHECK-NEXT:            scattered:       false
# CHECK-NEXT:            value:           0
# CHECK-NEXT:          - address:         0x00000007
# CHECK-NEXT:            symbolnum:       5
# CHECK-NEXT:            pcrel:           true
# CHECK-NEXT:            length:          2
# CHECK-NEXT:            extern:          true
# CHECK-NEXT:            type:            1
# CHECK-NEXT:            scattered:       false
# CHECK-NEXT:            value:           0
# CHECK-NEXT:      - sectname:        __data
# CHECK-NEXT:        segname:         __DATA
# CHECK-NEXT:        addr:            0x0000000000000050
# CHECK-NEXT:        size:            16
# CHECK-NEXT:        offset:          0x00000360
# CHECK-NEXT:        align:           3
# CHECK-NEXT:        reloff:          0x00000498
# CHECK-NEXT:        nreloc:          1
# CHECK-NEXT:        flags:           0x00000000
# CHECK-NEXT:        reserved1:       0x00000000
# CHECK-NEXT:        reserved2:       0x00000000
# CHECK-NEXT:        reserved3:       0x00000000
# CHECK-NEXT:        content:         '01000000020000000000000000000000'
# CHECK-NEXT:        relocations:
# CHECK-NEXT:          - address:         0x00000008
# CHECK-NEXT:            symbolnum:       4
# CHECK-NEXT:            pcrel:           false
# CHECK-NEXT:            length:          3
# CHECK-NEXT:            extern:          true
# CHECK-NEXT:            type:            0
# CHECK-NEXT:            scattered:       false
# CHECK-NEXT:            value:           0
# CHECK-NEXT:      - sectname:        __common
# CHECK-NEXT:        segname:         __DATA
# CHECK-NEXT:        addr:            0x0000000000000158
# CHECK-NEXT:        size:            8
# CHECK-NEXT:        offset:          0x00000000
# CHECK-NEXT:        align:           3
# CHECK-NEXT:        reloff:          0x00000000
# CHECK-NEXT:        nreloc:          0
# CHECK-NEXT:        flags:           0x00000001
# CHECK-NEXT:        reserved1:       0x00000000
# CHECK-NEXT:        reserved2:       0x00000000
# CHECK-NEXT:        reserved3:       0x00000000
# CHECK-NEXT:      - sectname:        __mod_init_func
# CHECK-NEXT:        segname:         __DATA
# CHECK-NEXT:        addr:            0x0000000000000060
# CHECK-NEXT:        size:            8
# CHECK-NEXT:        offset:          0x00000370
# CHECK-NEXT:        align:           3
# CHECK-NEXT:        reloff:          0x000004A0
# CHECK-NEXT:        nreloc:          1
# CHECK-NEXT:        flags:           0x00000009
# CHECK-NEXT:        reserved1:       0x00000000
# CHECK-NEXT:        reserved2:       0x00000000
# CHECK-NEXT:        reserved3:       0x00000000
# CHECK-NEXT:        content:         
# CHECK-NEXT:        relocations:
# CHECK-NEXT:          - address:         0x00000000
# CHECK-NEXT:            symbolnum:       1
# CHECK-NEXT:            pcrel:           false
# CHECK-NEXT:            length:          3
# CHECK-NEXT:            extern:          true
# CHECK-NEXT:            type:            0
# CHECK-NEXT:            scattered:       false
# CHECK-NEXT:            value:           0
# CHECK-NEXT:      - sectname:        __compact_unwind
# CHECK-NEXT:        segname:         __LD
# CHECK-NEXT:        addr:            0x0000000000000068
# CHECK-NEXT:        size:            96
# CHECK-NEXT:        offset:          0x00000378
# CHECK-NEXT:        align:           3
# CHECK-NEXT:        reloff:          0x000004A8
# CHECK-NEXT:        nreloc:          3
# CHECK-NEXT:        flags:           0x02000000
# CHECK-NEXT:        reserved1:       0x00000000
# CHECK-NEXT:        reserved2:       0x00000000
# CHECK-NEXT:        reserved3:       0x00000000
# CHECK-NEXT:        content:
# CHECK-NEXT:        relocations:
# CHECK-NEXT:          - address:         0x00000040
# CHECK-NEXT:            symbolnum:       2
# CHECK-NEXT:            pcrel:           false
# CHECK-NEXT:            length:          3
# CHECK-NEXT:            extern:          false
# CHECK-NEXT:            type:            0
# CHECK-NEXT:            scattered:       false
# CHECK-NEXT:            value:           0
# CHECK-NEXT:          - address:         0x00000020
# CHECK-NEXT:            symbolnum:       1
# CHECK-NEXT:            pcrel:           false
# CHECK-NEXT:            length:          3
# CHECK-NEXT:            extern:          false
# CHECK-NEXT:            type:            0
# CHECK-NEXT:            scattered:       false
# CHECK-NEXT:            value:           0
# CHECK-NEXT:          - address:         0x00000000
# CHECK-NEXT:            symbolnum:       2
# CHECK-NEXT:            pcrel:           false
# CHECK-NEXT:            length:          3
# CHECK-NEXT:            extern:          false
# CHECK-NEXT:            type:            0
# CHECK-NEXT:            scattered:       false
# CHECK-NEXT:            value:           0
# CHECK-NEXT:      - sectname:        __eh_frame
# CHECK-NEXT:        segname:         __TEXT
# CHECK-NEXT:        addr:            0x00000000000000C8
# CHECK-NEXT:        size:            144
# CHECK-NEXT:        offset:          0x000003D8
# CHECK-NEXT:        align:           3
# CHECK-NEXT:        reloff:          0x00000000
# CHECK-NEXT:        nreloc:          0
# CHECK-NEXT:        flags:           0x6800000B
# CHECK-NEXT:        reserved1:       0x00000000
# CHECK-NEXT:        reserved2:       0x00000000
# CHECK-NEXT:        reserved3:       0x00000000

--- !mach-o
FileHeader:
  magic:           0xFEEDFACF
  cputype:         0x01000007
  cpusubtype:      0x00000003
  filetype:        0x00000001
  ncmds:           4
  sizeofcmds:      752
  flags:           0x00002000
  reserved:        0x00000000
LoadCommands:
  - cmd:             LC_SEGMENT_64
    cmdsize:         632
    segname:         ''
    vmaddr:          0
    vmsize:          352
    fileoff:         784
    filesize:        344
    maxprot:         7
    initprot:        7
    nsects:          7
    flags:           0
    Sections:
      - sectname:        __text
        segname:         __TEXT
        addr:            0x0000000000000000
        size:            27
        offset:          0x00000310
        align:           4
        reloff:          0x00000468
        nreloc:          2
        flags:           0x80000400
        reserved1:       0x00000000
        reserved2:       0x00000000
        reserved3:       0x00000000
        content:         554889E5C745FC00000000488B0500000000480305000000005DC3
        relocations:
          - address:         0x00000015
            symbolnum:       3
            pcrel:           true
            length:          2
            extern:          true
            type:            1
            scattered:       false
            value:           0
          - address:         0x0000000E
            symbolnum:       6
            pcrel:           true
            length:          2
            extern:          true
            type:            1
            scattered:       false
            value:           0
      - sectname:        __StaticInit
        segname:         __TEXT
        addr:            0x0000000000000020
        size:            43
        offset:          0x00000330
        align:           4
        reloff:          0x00000478
        nreloc:          4
        flags:           0x80000400
        reserved1:       0x00000000
        reserved2:       0x00000000
        reserved3:       0x00000000
        content:         554889E5488D0500000000488D0D000000004829C148890D000000005DC36690554889E5E8000000005DC3
        relocations:
          - address:         0x00000025
            symbolnum:       0
            pcrel:           true
            length:          2
            extern:          true
            type:            2
            scattered:       false
            value:           0
          - address:         0x00000018
            symbolnum:       3
            pcrel:           true
            length:          2
            extern:          true
            type:            1
            scattered:       false
            value:           0
          - address:         0x0000000E
            symbolnum:       4
            pcrel:           true
            length:          2
            extern:          true
            type:            1
            scattered:       false
            value:           0
          - address:         0x00000007
            symbolnum:       5
            pcrel:           true
            length:          2
            extern:          true
            type:            1
            scattered:       false
            value:           0
      - sectname:        __data
        segname:         __DATA
        addr:            0x0000000000000050
        size:            16
        offset:          0x00000360
        align:           3
        reloff:          0x00000498
        nreloc:          1
        flags:           0x00000000
        reserved1:       0x00000000
        reserved2:       0x00000000
        reserved3:       0x00000000
        content:         '01000000020000000000000000000000'
        relocations:
          - address:         0x00000008
            symbolnum:       4
            pcrel:           false
            length:          3
            extern:          true
            type:            0
            scattered:       false
            value:           0
      - sectname:        __common
        segname:         __DATA
        addr:            0x0000000000000158
        size:            8
        offset:          0x00000000
        align:           3
        reloff:          0x00000000
        nreloc:          0
        flags:           0x00000001
        reserved1:       0x00000000
        reserved2:       0x00000000
        reserved3:       0x00000000
      - sectname:        __mod_init_func
        segname:         __DATA
        addr:            0x0000000000000060
        size:            8
        offset:          0x00000370
        align:           3
        reloff:          0x000004A0
        nreloc:          1
        flags:           0x00000009
        reserved1:       0x00000000
        reserved2:       0x00000000
        reserved3:       0x00000000
        content:         '0000000000000000'
        relocations:
          - address:         0x00000000
            symbolnum:       1
            pcrel:           false
            length:          3
            extern:          true
            type:            0
            scattered:       false
            value:           0
      - sectname:        __compact_unwind
        segname:         __LD
        addr:            0x0000000000000068
        size:            96
        offset:          0x00000378
        align:           3
        reloff:          0x000004A8
        nreloc:          3
        flags:           0x02000000
        reserved1:       0x00000000
        reserved2:       0x00000000
        reserved3:       0x00000000
        content:         20000000000000001E000000000000010000000000000000000000000000000000000000000000001B000000000000010000000000000000000000000000000040000000000000000B0000000000000100000000000000000000000000000000
        relocations:
          - address:         0x00000040
            symbolnum:       2
            pcrel:           false
            length:          3
            extern:          false
            type:            0
            scattered:       false
            value:           0
          - address:         0x00000020
            symbolnum:       1
            pcrel:           false
            length:          3
            extern:          false
            type:            0
            scattered:       false
            value:           0
          - address:         0x00000000
            symbolnum:       2
            pcrel:           false
            length:          3
            extern:          false
            type:            0
            scattered:       false
            value:           0
      - sectname:        __eh_frame
        segname:         __TEXT
        addr:            0x00000000000000C8
        size:            144
        offset:          0x000003D8
        align:           3
        reloff:          0x00000000
        nreloc:          0
        flags:           0x6800000B
        reserved1:       0x00000000
        reserved2:       0x00000000
        reserved3:       0x00000000
        content:         1400000000000000017A520001781001100C070890010000240000001C00000038FFFFFFFFFFFFFF1E0000000000000000410E108602430D06000000000000002400000044000000F0FEFFFFFFFFFFFF1B0000000000000000410E108602430D0600000000000000240000006C00000008FFFFFFFFFFFFFF0B0000000000000000410E108602430D0600000000000000
  - cmd:             LC_VERSION_MIN_MACOSX
    cmdsize:         16
    version:         658944
    sdk:             0
  - cmd:             LC_SYMTAB
    cmdsize:         24
    symoff:          1216
    nsyms:           7
    stroff:          1328
    strsize:         68
  - cmd:             LC_DYSYMTAB
    cmdsize:         80
    ilocalsym:       0
    nlocalsym:       2
    iextdefsym:      2
    nextdefsym:      5
    iundefsym:       7
    nundefsym:       0
    tocoff:          0
    ntoc:            0
    modtaboff:       0
    nmodtab:         0
    extrefsymoff:    0
    nextrefsyms:     0
    indirectsymoff:  0
    nindirectsyms:   0
    extreloff:       0
    nextrel:         0
    locreloff:       0
    nlocrel:         0
LinkEditData:
  NameList:
    - n_strx:          13
      n_type:          0x0E
      n_sect:          2
      n_desc:          0
      n_value:         32
    - n_strx:          36
      n_type:          0x0E
      n_sect:          2
      n_desc:          0
      n_value:         64
    - n_strx:          61
      n_type:          0x0F
      n_sect:          1
      n_desc:          0
      n_value:         0
    - n_strx:          10
      n_type:          0x0F
      n_sect:          4
      n_desc:          0
      n_value:         344
    - n_strx:          7
      n_type:          0x0F
      n_sect:          3
      n_desc:          0
      n_value:         80
    - n_strx:          4
      n_type:          0x0F
      n_sect:          3
      n_desc:          0
      n_value:         84
    - n_strx:          1
      n_type:          0x0F
      n_sect:          3
      n_desc:          0
      n_value:         88
  StringTable:
    - ''
    - _z
    - _y
    - _x
    - _w
    - ___cxx_global_var_init
    - __GLOBAL__sub_I_main.cpp
    - _main
    - ''
...