1## Check that removing load commands updates the indexes of special LCs: 2 3# RUN: yaml2obj %s -o %t 4# RUN: llvm-install-name-tool -delete_rpath @executable_a/. %t 5# RUN: llvm-objdump -p %t | FileCheck %s --check-prefix=INDEX 6 7# INDEX: Load command 3 8# INDEX-NEXT: cmd LC_DYLD_INFO_ONLY 9# INDEX: Load command 5 10# INDEX-NEXT: cmd LC_DATA_IN_CODE 11# INDEX: Load command 8 12# INDEX-NEXT: cmd LC_FUNCTION_STARTS 13# INDEX: Load command 13 14# INDEX-NEXT: cmd LC_DYSYMTAB 15# INDEX: Load command 14 16# INDEX-NEXT: cmd LC_SYMTAB 17 18--- !mach-o 19FileHeader: 20 magic: 0xFEEDFACF 21 cputype: 0x01000007 22 cpusubtype: 0x80000003 23 filetype: 0x00000002 24 ncmds: 16 25 sizeofcmds: 1008 26 flags: 0x00200085 27 reserved: 0x00000000 28LoadCommands: 29 - cmd: LC_SEGMENT_64 30 cmdsize: 72 31 segname: __PAGEZERO 32 vmaddr: 0 33 vmsize: 4294967296 34 fileoff: 0 35 filesize: 0 36 maxprot: 0 37 initprot: 0 38 nsects: 0 39 flags: 0 40 - cmd: LC_SEGMENT_64 41 cmdsize: 232 42 segname: __TEXT 43 vmaddr: 4294967296 44 vmsize: 4096 45 fileoff: 0 46 filesize: 4096 47 maxprot: 7 48 initprot: 5 49 nsects: 2 50 flags: 0 51 Sections: 52 - sectname: __text 53 segname: __TEXT 54 addr: 0x0000000100000F90 55 size: 36 56 offset: 0x00000F90 57 align: 4 58 reloff: 0x00000000 59 nreloc: 0 60 flags: 0x80000400 61 reserved1: 0x00000000 62 reserved2: 0x00000000 63 reserved3: 0x00000000 64 - sectname: __unwind_info 65 segname: __TEXT 66 addr: 0x0000000100000FB4 67 size: 72 68 offset: 0x00000FB4 69 align: 2 70 reloff: 0x00000000 71 nreloc: 0 72 flags: 0x00000000 73 reserved1: 0x00000000 74 reserved2: 0x00000000 75 reserved3: 0x00000000 76 - cmd: LC_SEGMENT_64 77 cmdsize: 232 78 segname: __DATA 79 vmaddr: 4294971392 80 vmsize: 4096 81 fileoff: 4096 82 filesize: 4096 83 maxprot: 7 84 initprot: 3 85 nsects: 2 86 flags: 0 87 Sections: 88 - sectname: __data 89 segname: __DATA 90 addr: 0x0000000100001000 91 size: 4 92 offset: 0x00001000 93 align: 2 94 reloff: 0x00000000 95 nreloc: 0 96 flags: 0x00000000 97 reserved1: 0x00000000 98 reserved2: 0x00000000 99 reserved3: 0x00000000 100 - sectname: __common 101 segname: __DATA 102 addr: 0x0000000100001004 103 size: 4 104 offset: 0x00000000 105 align: 2 106 reloff: 0x00000000 107 nreloc: 0 108 flags: 0x00000001 109 reserved1: 0x00000000 110 reserved2: 0x00000000 111 reserved3: 0x00000000 112 - cmd: LC_RPATH 113 cmdsize: 32 114 path: 12 115 Content: '@executable_a/.' 116 - cmd: LC_DYLD_INFO_ONLY 117 cmdsize: 48 118 rebase_off: 0 119 rebase_size: 0 120 bind_off: 0 121 bind_size: 0 122 weak_bind_off: 0 123 weak_bind_size: 0 124 lazy_bind_off: 0 125 lazy_bind_size: 0 126 export_off: 8192 127 export_size: 56 128 - cmd: LC_SEGMENT_64 129 cmdsize: 72 130 segname: __LINKEDIT 131 vmaddr: 4294975488 132 vmsize: 4096 133 fileoff: 8192 134 filesize: 496 135 maxprot: 7 136 initprot: 1 137 nsects: 0 138 flags: 0 139 - cmd: LC_DATA_IN_CODE 140 cmdsize: 16 141 dataoff: 8256 142 datasize: 8 143 - cmd: LC_LOAD_DYLINKER 144 cmdsize: 32 145 name: 12 146 Content: '/usr/lib/dyld' 147 ZeroPadBytes: 7 148 - cmd: LC_UUID 149 cmdsize: 24 150 uuid: 56D84164-1DA8-393B-8589-BC4C6B56168E 151 - cmd: LC_FUNCTION_STARTS 152 cmdsize: 16 153 dataoff: 8248 154 datasize: 8 155 - cmd: LC_BUILD_VERSION 156 cmdsize: 32 157 platform: 1 158 minos: 658944 159 sdk: 658944 160 ntools: 1 161 Tools: 162 - tool: 3 163 version: 29491968 164 - cmd: LC_SOURCE_VERSION 165 cmdsize: 16 166 version: 0 167 - cmd: LC_MAIN 168 cmdsize: 24 169 entryoff: 3984 170 stacksize: 0 171 - cmd: LC_LOAD_DYLIB 172 cmdsize: 56 173 dylib: 174 name: 24 175 timestamp: 2 176 current_version: 82115073 177 compatibility_version: 65536 178 Content: '/usr/lib/libSystem.B.dylib' 179 ZeroPadBytes: 6 180 - cmd: LC_DYSYMTAB 181 cmdsize: 80 182 ilocalsym: 0 183 nlocalsym: 11 184 iextdefsym: 11 185 nextdefsym: 3 186 iundefsym: 14 187 nundefsym: 1 188 tocoff: 0 189 ntoc: 0 190 modtaboff: 0 191 nmodtab: 0 192 extrefsymoff: 0 193 nextrefsyms: 0 194 indirectsymoff: 8264 195 nindirectsyms: 0 196 extreloff: 0 197 nextrel: 0 198 locreloff: 0 199 nlocrel: 0 200 - cmd: LC_SYMTAB 201 cmdsize: 24 202 symoff: 8264 203 nsyms: 15 204 stroff: 8504 205 strsize: 192 206LinkEditData: 207 ExportTrie: 208 TerminalSize: 0 209 NodeOffset: 0 210 Name: '' 211 Flags: 0x0000000000000000 212 Address: 0x0000000000000000 213 Other: 0x0000000000000000 214 ImportName: '' 215 Children: 216 - TerminalSize: 0 217 NodeOffset: 5 218 Name: _ 219 Flags: 0x0000000000000000 220 Address: 0x0000000000000000 221 Other: 0x0000000000000000 222 ImportName: '' 223 Children: 224 - TerminalSize: 2 225 NodeOffset: 38 226 Name: _mh_execute_header 227 Flags: 0x0000000000000000 228 Address: 0x0000000000000000 229 Other: 0x0000000000000000 230 ImportName: '' 231 - TerminalSize: 3 232 NodeOffset: 42 233 Name: main 234 Flags: 0x0000000000000000 235 Address: 0x0000000000000F90 236 Other: 0x0000000000000000 237 ImportName: '' 238 - TerminalSize: 3 239 NodeOffset: 47 240 Name: foo 241 Flags: 0x0000000000000000 242 Address: 0x0000000000001004 243 Other: 0x0000000000000000 244 ImportName: '' 245 NameList: 246 - n_strx: 50 247 n_type: 0x64 248 n_sect: 0 249 n_desc: 0 250 n_value: 0 251 - n_strx: 92 252 n_type: 0x64 253 n_sect: 0 254 n_desc: 0 255 n_value: 0 256 - n_strx: 100 257 n_type: 0x66 258 n_sect: 3 259 n_desc: 1 260 n_value: 1564714240 261 - n_strx: 1 262 n_type: 0x2E 263 n_sect: 1 264 n_desc: 0 265 n_value: 4294971280 266 - n_strx: 164 267 n_type: 0x24 268 n_sect: 1 269 n_desc: 0 270 n_value: 4294971280 271 - n_strx: 1 272 n_type: 0x24 273 n_sect: 0 274 n_desc: 0 275 n_value: 36 276 - n_strx: 1 277 n_type: 0x4E 278 n_sect: 1 279 n_desc: 0 280 n_value: 36 281 - n_strx: 170 282 n_type: 0x26 283 n_sect: 3 284 n_desc: 0 285 n_value: 4294971392 286 ## A local undefined SymDebugTable entry followed by 287 - n_strx: 175 288 n_type: 0x20 289 n_sect: 0 290 n_desc: 0 291 n_value: 0 292 ## a defined SymDebugTable entry. 293 - n_strx: 1 294 n_type: 0x64 295 n_sect: 1 296 n_desc: 0 297 n_value: 0 298 - n_strx: 180 299 n_type: 0x0E 300 n_sect: 3 301 n_desc: 0 302 n_value: 4294971392 303 - n_strx: 2 304 n_type: 0x0F 305 n_sect: 1 306 n_desc: 16 307 n_value: 4294967296 308 - n_strx: 22 309 n_type: 0x0F 310 n_sect: 4 311 n_desc: 0 312 n_value: 4294971396 313 - n_strx: 27 314 n_type: 0x0F 315 n_sect: 1 316 n_desc: 0 317 n_value: 4294971280 318 - n_strx: 33 319 n_type: 0x01 320 n_sect: 0 321 n_desc: 256 322 n_value: 0 323 StringTable: 324 - ' ' 325 - __mh_execute_header 326 - _foo 327 - _main 328 - dyld_stub_binder 329 - '/Users/anonymous/llvm-project/llvm/build/' 330 - strip.c 331 - '/var/folders/g7/l0p5czpd2jz6w0gswg6cwgjc0000gn/T/strip-95c4bf.o' 332 - _main 333 - _bar 334 - _foo 335 - _bar 336 - '' 337 - '' 338 - '' 339 - '' 340 - '' 341 - '' 342 - '' 343... 344