264 lines · yaml
1# Check we don't error out on MachO files with stabs symbol entries that2# repurpose the section field so it's out of range for normal symbols.3 4# RUN: yaml2obj %s -o %t5# RUN: llvm-objdump --syms %t | FileCheck %s6 7# CHECK: 0000000000000000 d *UND*8--- !mach-o9FileHeader:10 magic: 0xFEEDFACF11 cputype: 0x100000C12 cpusubtype: 0x013 filetype: 0x214 ncmds: 1615 sizeofcmds: 74416 flags: 0x20008517 reserved: 0x018LoadCommands:19 - cmd: LC_SEGMENT_6420 cmdsize: 7221 segname: __PAGEZERO22 vmaddr: 023 vmsize: 429496729624 fileoff: 025 filesize: 026 maxprot: 027 initprot: 028 nsects: 029 flags: 030 - cmd: LC_SEGMENT_6431 cmdsize: 23232 segname: __TEXT33 vmaddr: 429496729634 vmsize: 1638435 fileoff: 036 filesize: 1638437 maxprot: 538 initprot: 539 nsects: 240 flags: 041 Sections:42 - sectname: __text43 segname: __TEXT44 addr: 0x100003FA045 size: 846 offset: 0x3FA047 align: 248 reloff: 0x049 nreloc: 050 flags: 0x8000040051 reserved1: 0x052 reserved2: 0x053 reserved3: 0x054 content: 00008052C0035FD655 - sectname: __unwind_info56 segname: __TEXT57 addr: 0x100003FA858 size: 8859 offset: 0x3FA860 align: 261 reloff: 0x062 nreloc: 063 flags: 0x064 reserved1: 0x065 reserved2: 0x066 reserved3: 0x067 content: 010000001C000000000000001C000000000000001C00000002000000A03F00004000000040000000A83F00000000000040000000000000000000000000000000030000000C0001001000010000000000000000020000000068 - cmd: LC_SEGMENT_6469 cmdsize: 7270 segname: __LINKEDIT71 vmaddr: 429498368072 vmsize: 1638473 fileoff: 1638474 filesize: 68875 maxprot: 176 initprot: 177 nsects: 078 flags: 079 - cmd: LC_DYLD_CHAINED_FIXUPS80 cmdsize: 1681 dataoff: 1638482 datasize: 5683 - cmd: LC_DYLD_EXPORTS_TRIE84 cmdsize: 1685 dataoff: 1644086 datasize: 4887 - cmd: LC_SYMTAB88 cmdsize: 2489 symoff: 1649690 nsyms: 1191 stroff: 1667292 strsize: 12093 - cmd: LC_DYSYMTAB94 cmdsize: 8095 ilocalsym: 096 nlocalsym: 997 iextdefsym: 998 nextdefsym: 299 iundefsym: 11100 nundefsym: 0101 tocoff: 0102 ntoc: 0103 modtaboff: 0104 nmodtab: 0105 extrefsymoff: 0106 nextrefsyms: 0107 indirectsymoff: 0108 nindirectsyms: 0109 extreloff: 0110 nextrel: 0111 locreloff: 0112 nlocrel: 0113 - cmd: LC_LOAD_DYLINKER114 cmdsize: 32115 name: 12116 Content: '/usr/lib/dyld'117 ZeroPadBytes: 7118 - cmd: LC_UUID119 cmdsize: 24120 uuid: 73BD5072-2F45-39FD-8013-8102F002C240121 - cmd: LC_BUILD_VERSION122 cmdsize: 32123 platform: 1124 minos: 917504125 sdk: 918528126 ntools: 1127 Tools:128 - tool: 3129 version: 72942592130 - cmd: LC_SOURCE_VERSION131 cmdsize: 16132 version: 0133 - cmd: LC_MAIN134 cmdsize: 24135 entryoff: 16288136 stacksize: 0137 - cmd: LC_LOAD_DYLIB138 cmdsize: 56139 dylib:140 name: 24141 timestamp: 2142 current_version: 88171522143 compatibility_version: 65536144 Content: '/usr/lib/libSystem.B.dylib'145 ZeroPadBytes: 6146 - cmd: LC_FUNCTION_STARTS147 cmdsize: 16148 dataoff: 16488149 datasize: 8150 - cmd: LC_DATA_IN_CODE151 cmdsize: 16152 dataoff: 16496153 datasize: 0154 - cmd: LC_CODE_SIGNATURE155 cmdsize: 16156 dataoff: 16800157 datasize: 272158LinkEditData:159 ExportTrie:160 TerminalSize: 0161 NodeOffset: 0162 Name: ''163 Flags: 0x0164 Address: 0x0165 Other: 0x0166 ImportName: ''167 Children:168 - TerminalSize: 0169 NodeOffset: 18170 Name: _171 Flags: 0x0172 Address: 0x0173 Other: 0x0174 ImportName: ''175 Children:176 - TerminalSize: 2177 NodeOffset: 9178 Name: _mh_execute_header179 Flags: 0x0180 Address: 0x0181 Other: 0x0182 ImportName: ''183 - TerminalSize: 3184 NodeOffset: 13185 Name: main186 Flags: 0x0187 Address: 0x3FA0188 Other: 0x0189 ImportName: ''190 NameList:191 - n_strx: 1192 n_type: 0x64193 # This line has been changed from a real object file to move the section194 # out of valid range for normal symbols.195 n_sect: 42196 n_desc: 0197 n_value: 0198 - n_strx: 28199 n_type: 0x64200 n_sect: 0201 n_desc: 0202 n_value: 0203 - n_strx: 68204 n_type: 0x64205 n_sect: 0206 n_desc: 0207 n_value: 0208 - n_strx: 74209 n_type: 0x66210 n_sect: 0211 n_desc: 1212 n_value: 1713522175213 - n_strx: 1214 n_type: 0x2E215 n_sect: 1216 n_desc: 0217 n_value: 4294983584218 - n_strx: 22219 n_type: 0x24220 n_sect: 1221 n_desc: 0222 n_value: 4294983584223 - n_strx: 1224 n_type: 0x24225 n_sect: 0226 n_desc: 0227 n_value: 8228 - n_strx: 1229 n_type: 0x4E230 n_sect: 1231 n_desc: 0232 n_value: 4294983584233 - n_strx: 1234 n_type: 0x64235 n_sect: 1236 n_desc: 0237 n_value: 0238 - n_strx: 2239 n_type: 0xF240 n_sect: 1241 n_desc: 16242 n_value: 4294967296243 - n_strx: 22244 n_type: 0xF245 n_sect: 1246 n_desc: 0247 n_value: 4294983584248 StringTable:249 - ' '250 - __mh_execute_header251 - _main252 - '/Users/tim/llvm/llvm-project/build.rel/'253 - tmp.c254 - '/Users/tim/llvm/llvm-project/build.rel/tmp.o'255 - ''256 FunctionStarts: [ 0x3FA0 ]257 ChainedFixups: [ 0x0, 0x0, 0x0, 0x0, 0x20, 0x0, 0x0, 0x0, 0x30, 0x0,258 0x0, 0x0, 0x30, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,259 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,260 0x0, 0x0, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,261 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,262 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 ]263...264