1# RUN: ld64.lld -arch x86_64 -r -print_atoms %s -o %t | FileCheck %s \ 2# RUN: && ld64.lld -arch x86_64 -r -print_atoms %t -o %t2 | FileCheck %s 3# 4# Test parsing of x86_64 tlv relocations. 5 6--- !mach-o 7arch: x86_64 8file-type: MH_OBJECT 9flags: [ MH_SUBSECTIONS_VIA_SYMBOLS ] 10compat-version: 0.0 11current-version: 0.0 12has-UUID: false 13OS: unknown 14sections: 15 - segment: __TEXT 16 section: __text 17 type: S_REGULAR 18 attributes: [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ] 19 alignment: 16 20 address: 0x0000000000000000 21 content: [ 0x55, 0x48, 0x89, 0xE5, 0x48, 0x8B, 0x3D, 0x00, 22 0x00, 0x00, 0x00, 0xFF, 0x17, 0x8B, 0x00, 0x5D, 23 0xC3 ] 24 relocations: 25 - offset: 0x00000007 26 type: X86_64_RELOC_TLV 27 length: 2 28 pc-rel: true 29 extern: true 30 symbol: 2 31 - segment: __DATA 32 section: __thread_data 33 type: S_THREAD_LOCAL_REGULAR 34 attributes: [ ] 35 alignment: 4 36 address: 0x0000000000000014 37 content: [ 0x07, 0x00, 0x00, 0x00 ] 38 - segment: __DATA 39 section: __thread_vars 40 type: S_THREAD_LOCAL_VARIABLES 41 attributes: [ ] 42 address: 0x0000000000000018 43 content: [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 44 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 45 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ] 46 relocations: 47 - offset: 0x00000010 48 type: X86_64_RELOC_UNSIGNED 49 length: 3 50 pc-rel: false 51 extern: true 52 symbol: 0 53 - offset: 0x00000000 54 type: X86_64_RELOC_UNSIGNED 55 length: 3 56 pc-rel: false 57 extern: true 58 symbol: 3 59local-symbols: 60 - name: '_x$tlv$init' 61 type: N_SECT 62 sect: 2 63 value: 0x0000000000000014 64global-symbols: 65 - name: _main 66 type: N_SECT 67 scope: [ N_EXT ] 68 sect: 1 69 value: 0x0000000000000000 70 - name: _x 71 type: N_SECT 72 scope: [ N_EXT ] 73 sect: 3 74 value: 0x0000000000000018 75undefined-symbols: 76 - name: __tlv_bootstrap 77 type: N_UNDF 78 scope: [ N_EXT ] 79 value: 0x0000000000000000 80page-size: 0x00000000 81... 82 83# CHECK: - name: _x 84# CHECK-NEXT: scope: global 85# CHECK-NEXT: type: tlv-thunk 86# CHECK-NOT: - name: 87# CHECK: references: 88# CHECK-NEXT: - kind: pointer64 89# CHECK-NEXT: offset: 0 90# CHECK-NEXT: target: __tlv_bootstrap 91# CHECK-NEXT: - kind: tlvInitSectionOffset 92# CHECK-NEXT: offset: 16 93# CHECK-NEXT: target: '_x$tlv$init' 94# CHECK: - name: _main 95# CHECK-NOT: - name: 96# CHECK-NEXT: scope: global 97# CHECK: references: 98# CHECK-NEXT: - kind: ripRel32Tlv 99# CHECK-NEXT: offset: 7 100# CHECK-NEXT: target: _x 101