1# RUN: ld64.lld -arch x86_64 %s %p/Inputs/got-order.yaml \ 2# RUN: %p/Inputs/got-order2.yaml -o %t %p/Inputs/x86_64/libSystem.yaml 3# RUN: llvm-objdump --macho --bind %t | FileCheck %s 4# 5# Test that GOT slots are sorted by name 6# 7 8--- !mach-o 9arch: x86_64 10file-type: MH_OBJECT 11flags: [ MH_SUBSECTIONS_VIA_SYMBOLS ] 12sections: 13 - segment: __TEXT 14 section: __text 15 type: S_REGULAR 16 attributes: [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ] 17 address: 0x0000000000000000 18 content: [ 0x55, 0x48, 0x89, 0xE5, 0x48, 0x8B, 0x0D, 0x00, 19 0x00, 0x00, 0x00, 0x48, 0x8B, 0x05, 0x00, 0x00, 20 0x00, 0x00, 0x8B, 0x00, 0x03, 0x01, 0x48, 0x8B, 21 0x0D, 0x00, 0x00, 0x00, 0x00, 0x03, 0x01, 0x5D, 22 0xC3 ] 23 relocations: 24 - offset: 0x00000019 25 type: X86_64_RELOC_GOT_LOAD 26 length: 2 27 pc-rel: true 28 extern: true 29 symbol: 2 30 - offset: 0x0000000E 31 type: X86_64_RELOC_GOT_LOAD 32 length: 2 33 pc-rel: true 34 extern: true 35 symbol: 1 36 - offset: 0x00000007 37 type: X86_64_RELOC_GOT_LOAD 38 length: 2 39 pc-rel: true 40 extern: true 41 symbol: 3 42global-symbols: 43 - name: _func 44 type: N_SECT 45 scope: [ N_EXT ] 46 sect: 1 47 value: 0x0000000000000000 48undefined-symbols: 49 - name: _aaa 50 type: N_UNDF 51 scope: [ N_EXT ] 52 value: 0x0000000000000000 53 - name: _fff 54 type: N_UNDF 55 scope: [ N_EXT ] 56 value: 0x0000000000000000 57 - name: _zzz 58 type: N_UNDF 59 scope: [ N_EXT ] 60 value: 0x0000000000000000 61... 62 63 64# CHECK: __DATA __got {{[0-9a-zA-Z _]+}} pointer 0 libfoobar _aaa 65# CHECK-NEXT: __DATA __got {{[0-9a-zA-Z _]+}} pointer 0 libfoobar _bar 66# CHECK-NEXT: __DATA __got {{[0-9a-zA-Z _]+}} pointer 0 libfoobar _fff 67# CHECK-NEXT: __DATA __got {{[0-9a-zA-Z _]+}} pointer 0 libfoobar _foo 68# CHECK-NEXT: __DATA __got {{[0-9a-zA-Z _]+}} pointer 0 libfoobar _zazzle 69# CHECK-NEXT: __DATA __got {{[0-9a-zA-Z _]+}} pointer 0 libfoobar _zzz 70