1# REQUIRES: x86 2# RUN: mkdir -p %t 3# RUN: yaml2obj %s -o %t/libnoid.dylib 4# RUN: echo ".globl _main; .text; _main: ret" | llvm-mc -filetype=obj -triple=x86_64-apple-darwin -o %t/no-id-dylink.o 5# RUN: not %lld -o %t/no-id-dylink -L%t -lnoid %t/no-id-dylink.o 2>&1 | FileCheck %s 6# CHECK: error: dylib {{.*}}libnoid.dylib missing LC_ID_DYLIB load command 7 8## This YAML file was originally generated from linking the following source 9## input with ld64 and passing the resulting binary through obj2yaml: 10## 11## .section __TEXT,__cstring 12## .globl _hello_world 13## 14## _hello_world: 15## .asciz "Hello world!\n" 16## 17## Then we deleted the LC_ID_DYLIB command from the file. 18 19!mach-o 20FileHeader: 21 magic: 0xFEEDFACF 22 cputype: 0x01000007 23 cpusubtype: 0x00000003 24 filetype: 0x00000006 25 ncmds: 10 26 sizeofcmds: 616 27 flags: 0x00100085 28 reserved: 0x00000000 29LoadCommands: 30 - cmd: LC_SEGMENT_64 31 cmdsize: 232 32 segname: __TEXT 33 vmaddr: 0 34 vmsize: 4096 35 fileoff: 0 36 filesize: 4096 37 maxprot: 5 38 initprot: 5 39 nsects: 2 40 flags: 0 41 Sections: 42 - sectname: __text 43 segname: __TEXT 44 addr: 0x0000000000000FF2 45 size: 0 46 offset: 0x00000FF2 47 align: 0 48 reloff: 0x00000000 49 nreloc: 0 50 flags: 0x80000400 51 reserved1: 0x00000000 52 reserved2: 0x00000000 53 reserved3: 0x00000000 54 content: '' 55 - sectname: __cstring 56 segname: __TEXT 57 addr: 0x0000000000000FF2 58 size: 14 59 offset: 0x00000FF2 60 align: 0 61 reloff: 0x00000000 62 nreloc: 0 63 flags: 0x00000002 64 reserved1: 0x00000000 65 reserved2: 0x00000000 66 reserved3: 0x00000000 67 content: 48656C6C6F20776F726C64210A00 68 - cmd: LC_SEGMENT_64 69 cmdsize: 72 70 segname: __LINKEDIT 71 vmaddr: 4096 72 vmsize: 4096 73 fileoff: 4096 74 filesize: 64 75 maxprot: 1 76 initprot: 1 77 nsects: 0 78 flags: 0 79 - cmd: LC_DYLD_INFO_ONLY 80 cmdsize: 48 81 rebase_off: 0 82 rebase_size: 0 83 bind_off: 0 84 bind_size: 0 85 weak_bind_off: 0 86 weak_bind_size: 0 87 lazy_bind_off: 0 88 lazy_bind_size: 0 89 export_off: 4096 90 export_size: 24 91 - cmd: LC_SYMTAB 92 cmdsize: 24 93 symoff: 4128 94 nsyms: 1 95 stroff: 4144 96 strsize: 16 97 - cmd: LC_DYSYMTAB 98 cmdsize: 80 99 ilocalsym: 0 100 nlocalsym: 0 101 iextdefsym: 0 102 nextdefsym: 1 103 iundefsym: 1 104 nundefsym: 0 105 tocoff: 0 106 ntoc: 0 107 modtaboff: 0 108 nmodtab: 0 109 extrefsymoff: 0 110 nextrefsyms: 0 111 indirectsymoff: 0 112 nindirectsyms: 0 113 extreloff: 0 114 nextrel: 0 115 locreloff: 0 116 nlocrel: 0 117 - cmd: LC_UUID 118 cmdsize: 24 119 uuid: 4826226E-9210-3984-A388-D5BD6D6DB368 120 - cmd: LC_BUILD_VERSION 121 cmdsize: 32 122 platform: 1 123 minos: 659200 124 sdk: 659200 125 ntools: 1 126 Tools: 127 - tool: 3 128 version: 34734080 129 - cmd: LC_SOURCE_VERSION 130 cmdsize: 16 131 version: 0 132 - cmd: LC_FUNCTION_STARTS 133 cmdsize: 16 134 dataoff: 4120 135 datasize: 8 136 - cmd: LC_DATA_IN_CODE 137 cmdsize: 16 138 dataoff: 4128 139 datasize: 0 140LinkEditData: 141 ExportTrie: 142 TerminalSize: 0 143 NodeOffset: 0 144 Name: '' 145 Flags: 0x0000000000000000 146 Address: 0x0000000000000000 147 Other: 0x0000000000000000 148 ImportName: '' 149 Children: 150 - TerminalSize: 3 151 NodeOffset: 16 152 Name: _hello_world 153 Flags: 0x0000000000000000 154 Address: 0x0000000000000FF2 155 Other: 0x0000000000000000 156 ImportName: '' 157 NameList: 158 - n_strx: 2 159 n_type: 0x0F 160 n_sect: 2 161 n_desc: 0 162 n_value: 4082 163 StringTable: 164 - ' ' 165 - _hello_world 166 - '' 167