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
# RUN: ld64.lld -arch x86_64  %s %p/Inputs/got-order.yaml \
# RUN: %p/Inputs/got-order2.yaml -o %t %p/Inputs/x86_64/libSystem.yaml
# RUN: llvm-objdump -macho -bind %t | FileCheck %s
#
# Test that GOT slots are sorted by name
#

--- !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 ]
    address:         0x0000000000000000
    content:         [ 0x55, 0x48, 0x89, 0xE5, 0x48, 0x8B, 0x0D, 0x00,
                       0x00, 0x00, 0x00, 0x48, 0x8B, 0x05, 0x00, 0x00,
                       0x00, 0x00, 0x8B, 0x00, 0x03, 0x01, 0x48, 0x8B,
                       0x0D, 0x00, 0x00, 0x00, 0x00, 0x03, 0x01, 0x5D,
                       0xC3 ]
    relocations:
      - offset:          0x00000019
        type:            X86_64_RELOC_GOT_LOAD
        length:          2
        pc-rel:          true
        extern:          true
        symbol:          2
      - offset:          0x0000000E
        type:            X86_64_RELOC_GOT_LOAD
        length:          2
        pc-rel:          true
        extern:          true
        symbol:          1
      - offset:          0x00000007
        type:            X86_64_RELOC_GOT_LOAD
        length:          2
        pc-rel:          true
        extern:          true
        symbol:          3
global-symbols:
  - name:            _func
    type:            N_SECT
    scope:           [ N_EXT ]
    sect:            1
    value:           0x0000000000000000
undefined-symbols:
  - name:            _aaa
    type:            N_UNDF
    scope:           [ N_EXT ]
    value:           0x0000000000000000
  - name:            _fff
    type:            N_UNDF
    scope:           [ N_EXT ]
    value:           0x0000000000000000
  - name:            _zzz
    type:            N_UNDF
    scope:           [ N_EXT ]
    value:           0x0000000000000000
...


# CHECK:	    __DATA   __got  {{[0-9a-zA-Z _]+}} pointer   0 libfoobar     _aaa
# CHECK-NEXT:	__DATA   __got  {{[0-9a-zA-Z _]+}} pointer   0 libfoobar     _bar
# CHECK-NEXT:	__DATA   __got  {{[0-9a-zA-Z _]+}} pointer   0 libfoobar     _fff
# CHECK-NEXT:	__DATA   __got  {{[0-9a-zA-Z _]+}} pointer   0 libfoobar     _foo
# CHECK-NEXT:	__DATA   __got  {{[0-9a-zA-Z _]+}} pointer   0 libfoobar     _zazzle
# CHECK-NEXT:	__DATA   __got  {{[0-9a-zA-Z _]+}} pointer   0 libfoobar     _zzz