1# RUN: ld64.lld -arch x86_64 %s %p/Inputs/hello-world-x86_64.yaml \ 2# RUN: -o %t 3# RUN: llvm-nm -m -n %t | FileCheck %s 4# 5# RUN: ld64.lld -arch x86_64 %s %p/Inputs/hello-world-x86_64.yaml \ 6# RUN: -dead_strip -o %t2 7# RUN: llvm-nm -m -n %t2 | FileCheck %s 8# 9# Test that x86_64 hello-world can be linked into a mach-o executable 10# 11 12--- !mach-o 13arch: x86_64 14file-type: MH_OBJECT 15flags: [ MH_SUBSECTIONS_VIA_SYMBOLS ] 16has-UUID: false 17OS: unknown 18sections: 19 - segment: __TEXT 20 section: __text 21 type: S_REGULAR 22 attributes: [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ] 23 address: 0x0000000000000000 24 content: [ 0x55, 0x48, 0x89, 0xE5, 0x48, 0x8B, 0x05, 0x00, 25 0x00, 0x00, 0x00, 0x48, 0x8B, 0x38, 0x48, 0x8D, 26 0x35, 0x00, 0x00, 0x00, 0x00, 0x31, 0xC0, 0xE8, 27 0x00, 0x00, 0x00, 0x00, 0x31, 0xC0, 0x5D, 0xC3 ] 28 relocations: 29 - offset: 0x00000018 30 type: X86_64_RELOC_BRANCH 31 length: 2 32 pc-rel: true 33 extern: true 34 symbol: 5 35 - offset: 0x00000011 36 type: X86_64_RELOC_SIGNED 37 length: 2 38 pc-rel: true 39 extern: true 40 symbol: 0 41 - offset: 0x00000007 42 type: X86_64_RELOC_GOT_LOAD 43 length: 2 44 pc-rel: true 45 extern: true 46 symbol: 4 47 - segment: __TEXT 48 section: __cstring 49 type: S_CSTRING_LITERALS 50 attributes: [ ] 51 address: 0x0000000000000020 52 content: [ 0x68, 0x65, 0x6C, 0x6C, 0x6F, 0x0A, 0x00 ] 53 - segment: __LD 54 section: __compact_unwind 55 type: S_REGULAR 56 attributes: [ ] 57 alignment: 8 58 address: 0x0000000000000028 59 content: [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 60 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 61 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 62 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ] 63 relocations: 64 - offset: 0x00000000 65 type: X86_64_RELOC_UNSIGNED 66 length: 3 67 pc-rel: false 68 extern: false 69 symbol: 1 70 - segment: __TEXT 71 section: __eh_frame 72 type: S_COALESCED 73 attributes: [ ] 74 alignment: 8 75 address: 0x0000000000000048 76 content: [ 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 77 0x01, 0x7A, 0x52, 0x00, 0x01, 0x78, 0x10, 0x01, 78 0x10, 0x0C, 0x07, 0x08, 0x90, 0x01, 0x00, 0x00, 79 0x24, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 80 0x98, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 81 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 82 0x00, 0x41, 0x0E, 0x10, 0x86, 0x02, 0x43, 0x0D, 83 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ] 84local-symbols: 85 - name: L1 86 type: N_SECT 87 sect: 2 88 value: 0x0000000000000020 89 - name: EH_frame0 90 type: N_SECT 91 sect: 4 92 value: 0x0000000000000048 93global-symbols: 94 - name: _main 95 type: N_SECT 96 scope: [ N_EXT ] 97 sect: 1 98 value: 0x0000000000000000 99 - name: _main.eh 100 type: N_SECT 101 scope: [ N_EXT ] 102 sect: 4 103 value: 0x0000000000000060 104undefined-symbols: 105 - name: ___stdoutp 106 type: N_UNDF 107 scope: [ N_EXT ] 108 value: 0x0000000000000000 109 - name: _fprintf 110 type: N_UNDF 111 scope: [ N_EXT ] 112 value: 0x0000000000000000 113 114... 115 116# CHECK: (undefined) external ___stdoutp (from libSystem) 117# CHECK: (undefined) external _fprintf (from libSystem) 118# CHECK: (undefined) external dyld_stub_binder (from libSystem) 119# CHECK: {{[0-9a-f]+}} (__TEXT,__text) [referenced dynamically] external __mh_execute_header 120# CHECK: {{[0-9a-f]+}} (__TEXT,__text) external _main 121