mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 11:13:28 +01:00
Fix a bug in llvm-objdump’s -private-headers for 32-bit Mach-O files
printing the section header. And add some tests for this for 32-bit files. llvm-svn: 224302
This commit is contained in:
parent
33921ffabc
commit
db5408dea6
336
test/tools/llvm-objdump/ARM/macho-private-headers.test
Normal file
336
test/tools/llvm-objdump/ARM/macho-private-headers.test
Normal file
@ -0,0 +1,336 @@
|
||||
// RUN: llvm-objdump -p %p/Inputs/hello.obj.macho-arm | FileCheck %s
|
||||
// RUN: llvm-objdump -p %p/Inputs/hello.exe.macho-arm \
|
||||
// RUN: | FileCheck %s -check-prefix=EXE
|
||||
|
||||
CHECK: Mach header
|
||||
CHECK: magic cputype cpusubtype caps filetype ncmds sizeofcmds flags
|
||||
CHECK: MH_MAGIC ARM V7 0x00 OBJECT 3 568 SUBSECTIONS_VIA_SYMBOLS
|
||||
CHECK: Load command 0
|
||||
CHECK: cmd LC_SEGMENT
|
||||
CHECK: cmdsize 464
|
||||
CHECK: segname
|
||||
CHECK: vmaddr 0x00000000
|
||||
CHECK: vmsize 0x00000043
|
||||
CHECK: fileoff 596
|
||||
CHECK: filesize 67
|
||||
CHECK: maxprot rwx
|
||||
CHECK: initprot rwx
|
||||
CHECK: nsects 6
|
||||
CHECK: flags (none)
|
||||
CHECK: Section
|
||||
CHECK: sectname __text
|
||||
CHECK: segname __TEXT
|
||||
CHECK: addr 0x00000000
|
||||
CHECK: size 0x00000036
|
||||
CHECK: offset 596
|
||||
CHECK: align 2^2 (4)
|
||||
CHECK: reloff 664
|
||||
CHECK: nreloc 5
|
||||
CHECK: type S_REGULAR
|
||||
CHECK: attributes PURE_INSTRUCTIONS SOME_INSTRUCTIONS
|
||||
CHECK: reserved1 0
|
||||
CHECK: reserved2 0
|
||||
CHECK: Section
|
||||
CHECK: sectname __textcoal_nt
|
||||
CHECK: segname __TEXT
|
||||
CHECK: addr 0x00000036
|
||||
CHECK: size 0x00000000
|
||||
CHECK: offset 650
|
||||
CHECK: align 2^0 (1)
|
||||
CHECK: reloff 0
|
||||
CHECK: nreloc 0
|
||||
CHECK: type S_COALESCED
|
||||
CHECK: attributes PURE_INSTRUCTIONS
|
||||
CHECK: reserved1 0
|
||||
CHECK: reserved2 0
|
||||
CHECK: Section
|
||||
CHECK: sectname __const_coal
|
||||
CHECK: segname __TEXT
|
||||
CHECK: addr 0x00000036
|
||||
CHECK: size 0x00000000
|
||||
CHECK: offset 650
|
||||
CHECK: align 2^0 (1)
|
||||
CHECK: reloff 0
|
||||
CHECK: nreloc 0
|
||||
CHECK: type S_COALESCED
|
||||
CHECK: attributes (none)
|
||||
CHECK: reserved1 0
|
||||
CHECK: reserved2 0
|
||||
CHECK: Section
|
||||
CHECK: sectname __picsymbolstub4
|
||||
CHECK: segname __TEXT
|
||||
CHECK: addr 0x00000036
|
||||
CHECK: size 0x00000000
|
||||
CHECK: offset 650
|
||||
CHECK: align 2^0 (1)
|
||||
CHECK: reloff 0
|
||||
CHECK: nreloc 0
|
||||
CHECK: type S_SYMBOL_STUBS
|
||||
CHECK: attributes (none)
|
||||
CHECK: reserved1 0 (index into indirect symbol table)
|
||||
CHECK: reserved2 16 (size of stubs)
|
||||
CHECK: Section
|
||||
CHECK: sectname __StaticInit
|
||||
CHECK: segname __TEXT
|
||||
CHECK: addr 0x00000036
|
||||
CHECK: size 0x00000000
|
||||
CHECK: offset 650
|
||||
CHECK: align 2^0 (1)
|
||||
CHECK: reloff 0
|
||||
CHECK: nreloc 0
|
||||
CHECK: type S_REGULAR
|
||||
CHECK: attributes PURE_INSTRUCTIONS
|
||||
CHECK: reserved1 0
|
||||
CHECK: reserved2 0
|
||||
CHECK: Section
|
||||
CHECK: sectname __cstring
|
||||
CHECK: segname __TEXT
|
||||
CHECK: addr 0x00000036
|
||||
CHECK: size 0x0000000d
|
||||
CHECK: offset 650
|
||||
CHECK: align 2^0 (1)
|
||||
CHECK: reloff 0
|
||||
CHECK: nreloc 0
|
||||
CHECK: type S_CSTRING_LITERALS
|
||||
CHECK: attributes (none)
|
||||
CHECK: reserved1 0
|
||||
CHECK: reserved2 0
|
||||
CHECK: Load command 1
|
||||
CHECK: cmd LC_SYMTAB
|
||||
CHECK: cmdsize 24
|
||||
CHECK: symoff 704
|
||||
CHECK: nsyms 2
|
||||
CHECK: stroff 728
|
||||
CHECK: strsize 16
|
||||
CHECK: Load command 2
|
||||
CHECK: cmd LC_DYSYMTAB
|
||||
CHECK: cmdsize 80
|
||||
CHECK: ilocalsym 0
|
||||
CHECK: nlocalsym 0
|
||||
CHECK: iextdefsym 0
|
||||
CHECK: nextdefsym 1
|
||||
CHECK: iundefsym 1
|
||||
CHECK: nundefsym 1
|
||||
CHECK: tocoff 0
|
||||
CHECK: ntoc 0
|
||||
CHECK: modtaboff 0
|
||||
CHECK: nmodtab 0
|
||||
CHECK: extrefsymoff 0
|
||||
CHECK: nextrefsyms 0
|
||||
CHECK: indirectsymoff 0
|
||||
CHECK: nindirectsyms 0
|
||||
CHECK: extreloff 0
|
||||
CHECK: nextrel 0
|
||||
CHECK: locreloff 0
|
||||
CHECK: nlocrel 0
|
||||
|
||||
EXE: Mach header
|
||||
EXE: magic cputype cpusubtype caps filetype ncmds sizeofcmds flags
|
||||
EXE: MH_MAGIC ARM V7 0x00 EXECUTE 17 1012 NOUNDEFS DYLDLINK TWOLEVEL PIE
|
||||
EXE: Load command 0
|
||||
EXE: cmd LC_SEGMENT
|
||||
EXE: cmdsize 56
|
||||
EXE: segname __PAGEZERO
|
||||
EXE: vmaddr 0x00000000
|
||||
EXE: vmsize 0x00004000
|
||||
EXE: fileoff 0
|
||||
EXE: filesize 0
|
||||
EXE: maxprot ---
|
||||
EXE: initprot ---
|
||||
EXE: nsects 0
|
||||
EXE: flags (none)
|
||||
EXE: Load command 1
|
||||
EXE: cmd LC_SEGMENT
|
||||
EXE: cmdsize 328
|
||||
EXE: segname __TEXT
|
||||
EXE: vmaddr 0x00004000
|
||||
EXE: vmsize 0x00008000
|
||||
EXE: fileoff 0
|
||||
EXE: filesize 32768
|
||||
EXE: maxprot r-x
|
||||
EXE: initprot r-x
|
||||
EXE: nsects 4
|
||||
EXE: flags (none)
|
||||
EXE: Section
|
||||
EXE: sectname __text
|
||||
EXE: segname __TEXT
|
||||
EXE: addr 0x0000bf84
|
||||
EXE: size 0x00000036
|
||||
EXE: offset 32644
|
||||
EXE: align 2^2 (4)
|
||||
EXE: reloff 0
|
||||
EXE: nreloc 0
|
||||
EXE: type S_REGULAR
|
||||
EXE: attributes PURE_INSTRUCTIONS SOME_INSTRUCTIONS
|
||||
EXE: reserved1 0
|
||||
EXE: reserved2 0
|
||||
EXE: Section
|
||||
EXE: sectname __stub_helper
|
||||
EXE: segname __TEXT
|
||||
EXE: addr 0x0000bfbc
|
||||
EXE: size 0x00000030
|
||||
EXE: offset 32700
|
||||
EXE: align 2^2 (4)
|
||||
EXE: reloff 0
|
||||
EXE: nreloc 0
|
||||
EXE: type S_REGULAR
|
||||
EXE: attributes PURE_INSTRUCTIONS SOME_INSTRUCTIONS
|
||||
EXE: reserved1 0
|
||||
EXE: reserved2 0
|
||||
EXE: Section
|
||||
EXE: sectname __cstring
|
||||
EXE: segname __TEXT
|
||||
EXE: addr 0x0000bfec
|
||||
EXE: size 0x0000000d
|
||||
EXE: offset 32748
|
||||
EXE: align 2^0 (1)
|
||||
EXE: reloff 0
|
||||
EXE: nreloc 0
|
||||
EXE: type S_CSTRING_LITERALS
|
||||
EXE: attributes (none)
|
||||
EXE: reserved1 0
|
||||
EXE: reserved2 0
|
||||
EXE: Section
|
||||
EXE: sectname __symbolstub1
|
||||
EXE: segname __TEXT
|
||||
EXE: addr 0x0000bffc
|
||||
EXE: size 0x00000004
|
||||
EXE: offset 32764
|
||||
EXE: align 2^2 (4)
|
||||
EXE: reloff 0
|
||||
EXE: nreloc 0
|
||||
EXE: type S_SYMBOL_STUBS
|
||||
EXE: attributes PURE_INSTRUCTIONS SOME_INSTRUCTIONS
|
||||
EXE: reserved1 0 (index into indirect symbol table)
|
||||
EXE: reserved2 4 (size of stubs)
|
||||
EXE: Load command 2
|
||||
EXE: cmd LC_SEGMENT
|
||||
EXE: cmdsize 192
|
||||
EXE: segname __DATA
|
||||
EXE: vmaddr 0x0000c000
|
||||
EXE: vmsize 0x00004000
|
||||
EXE: fileoff 32768
|
||||
EXE: filesize 16384
|
||||
EXE: maxprot rw-
|
||||
EXE: initprot rw-
|
||||
EXE: nsects 2
|
||||
EXE: flags (none)
|
||||
EXE: Section
|
||||
EXE: sectname __lazy_symbol
|
||||
EXE: segname __DATA
|
||||
EXE: addr 0x0000c000
|
||||
EXE: size 0x00000004
|
||||
EXE: offset 32768
|
||||
EXE: align 2^2 (4)
|
||||
EXE: reloff 0
|
||||
EXE: nreloc 0
|
||||
EXE: type S_LAZY_SYMBOL_POINTERS
|
||||
EXE: attributes (none)
|
||||
EXE: reserved1 1 (index into indirect symbol table)
|
||||
EXE: reserved2 0
|
||||
EXE: Section
|
||||
EXE: sectname __nl_symbol_ptr
|
||||
EXE: segname __DATA
|
||||
EXE: addr 0x0000c004
|
||||
EXE: size 0x00000008
|
||||
EXE: offset 32772
|
||||
EXE: align 2^2 (4)
|
||||
EXE: reloff 0
|
||||
EXE: nreloc 0
|
||||
EXE: type S_NON_LAZY_SYMBOL_POINTERS
|
||||
EXE: attributes (none)
|
||||
EXE: reserved1 2 (index into indirect symbol table)
|
||||
EXE: reserved2 0
|
||||
EXE: Load command 3
|
||||
EXE: cmd LC_SEGMENT
|
||||
EXE: cmdsize 56
|
||||
EXE: segname __LINKEDIT
|
||||
EXE: vmaddr 0x00010000
|
||||
EXE: vmsize 0x00004000
|
||||
EXE: fileoff 49152
|
||||
EXE: filesize 256
|
||||
EXE: maxprot r--
|
||||
EXE: initprot r--
|
||||
EXE: nsects 0
|
||||
EXE: flags (none)
|
||||
EXE: Load command 4
|
||||
EXE: cmd LC_DYLD_INFO_ONLY
|
||||
EXE: cmdsize 48
|
||||
EXE: rebase_off 49152
|
||||
EXE: rebase_size 4
|
||||
EXE: bind_off 49156
|
||||
EXE: bind_size 24
|
||||
EXE: weak_bind_off 0
|
||||
EXE: weak_bind_size 0
|
||||
EXE: lazy_bind_off 49180
|
||||
EXE: lazy_bind_size 16
|
||||
EXE: export_off 49196
|
||||
EXE: export_size 44
|
||||
EXE: Load command 5
|
||||
EXE: cmd LC_SYMTAB
|
||||
EXE: cmdsize 24
|
||||
EXE: symoff 49264
|
||||
EXE: nsyms 5
|
||||
EXE: stroff 49340
|
||||
EXE: strsize 68
|
||||
EXE: Load command 6
|
||||
EXE: cmd LC_DYSYMTAB
|
||||
EXE: cmdsize 80
|
||||
EXE: ilocalsym 0
|
||||
EXE: nlocalsym 1
|
||||
EXE: iextdefsym 1
|
||||
EXE: nextdefsym 2
|
||||
EXE: iundefsym 3
|
||||
EXE: nundefsym 2
|
||||
EXE: tocoff 0
|
||||
EXE: ntoc 0
|
||||
EXE: modtaboff 0
|
||||
EXE: nmodtab 0
|
||||
EXE: extrefsymoff 0
|
||||
EXE: nextrefsyms 0
|
||||
EXE: indirectsymoff 49324
|
||||
EXE: nindirectsyms 4
|
||||
EXE: extreloff 0
|
||||
EXE: nextrel 0
|
||||
EXE: locreloff 0
|
||||
EXE: nlocrel 0
|
||||
EXE: Load command 7
|
||||
EXE: cmd LC_LOAD_DYLINKER
|
||||
EXE: cmdsize 28
|
||||
EXE: name /usr/lib/dyld (offset 12)
|
||||
EXE: Load command 8
|
||||
EXE: cmd LC_UUID
|
||||
EXE: cmdsize 24
|
||||
EXE: uuid C2D9351C-1EF1-330B-A2AB-EED6CF7D2C5D
|
||||
EXE: Load command 9
|
||||
EXE: Load command 10
|
||||
EXE: cmd LC_SOURCE_VERSION
|
||||
EXE: cmdsize 16
|
||||
EXE: version 0.0
|
||||
EXE: Load command 11
|
||||
EXE: cmd LC_MAIN
|
||||
EXE: cmdsize 24
|
||||
EXE: entryoff 32645
|
||||
EXE: stacksize 0
|
||||
EXE: Load command 12
|
||||
EXE: Load command 13
|
||||
EXE: cmd LC_LOAD_DYLIB
|
||||
EXE: cmdsize 52
|
||||
EXE: name /usr/lib/libSystem.B.dylib (offset 24)
|
||||
EXE: current version 1213.0.0
|
||||
EXE: compatibility version 1.0.0
|
||||
EXE: Load command 14
|
||||
EXE: cmd LC_FUNCTION_STARTS
|
||||
EXE: cmdsize 16
|
||||
EXE: dataoff 49240
|
||||
EXE: datasize 4
|
||||
EXE: Load command 15
|
||||
EXE: cmd LC_DATA_IN_CODE
|
||||
EXE: cmdsize 16
|
||||
EXE: dataoff 49244
|
||||
EXE: datasize 0
|
||||
EXE: Load command 16
|
||||
EXE: cmd LC_DYLIB_CODE_SIGN_DRS
|
||||
EXE: cmdsize 16
|
||||
EXE: dataoff 49244
|
||||
EXE: datasize 20
|
@ -3696,7 +3696,7 @@ static void PrintLoadCommands(const MachOObjectFile *Obj, uint32_t ncmds,
|
||||
SLC.initprot, SLC.nsects, SLC.flags, Buf.size(),
|
||||
verbose);
|
||||
for (unsigned j = 0; j < SLC.nsects; j++) {
|
||||
MachO::section_64 S = Obj->getSection64(Command, j);
|
||||
MachO::section S = Obj->getSection(Command, j);
|
||||
PrintSection(S.sectname, S.segname, S.addr, S.size, S.offset, S.align,
|
||||
S.reloff, S.nreloc, S.flags, S.reserved1, S.reserved2,
|
||||
SLC.cmd, sg_segname, filetype, Buf.size(), verbose);
|
||||
|
Loading…
Reference in New Issue
Block a user