forked from OSchip/llvm-project
Add MachO MH_FILESET support to objdump
https://reviews.llvm.org/D131909
This commit is contained in:
parent
8f45b5a7a9
commit
6113998069
|
@ -40,6 +40,7 @@ struct file_magic {
|
|||
macho_dsym_companion, ///< Mach-O dSYM companion file
|
||||
macho_kext_bundle, ///< Mach-O kext bundle file
|
||||
macho_universal_binary, ///< Mach-O universal binary
|
||||
macho_file_set, ///< Mach-O file set binary
|
||||
minidump, ///< Windows minidump file
|
||||
coff_cl_gl_object, ///< Microsoft cl.exe's intermediate code file
|
||||
coff_object, ///< COFF object file
|
||||
|
|
|
@ -182,6 +182,8 @@ file_magic llvm::identify_magic(StringRef Magic) {
|
|||
return file_magic::macho_dsym_companion;
|
||||
case 11:
|
||||
return file_magic::macho_kext_bundle;
|
||||
case 12:
|
||||
return file_magic::macho_file_set;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -67,6 +67,7 @@ Expected<std::unique_ptr<Binary>> object::createBinary(MemoryBufferRef Buffer,
|
|||
case file_magic::macho_dynamically_linked_shared_lib_stub:
|
||||
case file_magic::macho_dsym_companion:
|
||||
case file_magic::macho_kext_bundle:
|
||||
case file_magic::macho_file_set:
|
||||
case file_magic::coff_object:
|
||||
case file_magic::coff_import_library:
|
||||
case file_magic::pecoff_executable:
|
||||
|
|
|
@ -169,6 +169,7 @@ ObjectFile::createObjectFile(MemoryBufferRef Object, file_magic Type,
|
|||
case file_magic::macho_dynamically_linked_shared_lib_stub:
|
||||
case file_magic::macho_dsym_companion:
|
||||
case file_magic::macho_kext_bundle:
|
||||
case file_magic::macho_file_set:
|
||||
return createMachOObjectFile(Object);
|
||||
case file_magic::coff_object:
|
||||
case file_magic::coff_import_library:
|
||||
|
|
|
@ -63,6 +63,7 @@ SymbolicFile::createSymbolicFile(MemoryBufferRef Object, file_magic Type,
|
|||
case file_magic::macho_dynamically_linked_shared_lib_stub:
|
||||
case file_magic::macho_dsym_companion:
|
||||
case file_magic::macho_kext_bundle:
|
||||
case file_magic::macho_file_set:
|
||||
case file_magic::pecoff_executable:
|
||||
case file_magic::xcoff_object_32:
|
||||
case file_magic::xcoff_object_64:
|
||||
|
@ -113,6 +114,7 @@ bool SymbolicFile::isSymbolicFile(file_magic Type, const LLVMContext *Context) {
|
|||
case file_magic::macho_dynamically_linked_shared_lib_stub:
|
||||
case file_magic::macho_dsym_companion:
|
||||
case file_magic::macho_kext_bundle:
|
||||
case file_magic::macho_file_set:
|
||||
case file_magic::pecoff_executable:
|
||||
case file_magic::xcoff_object_32:
|
||||
case file_magic::xcoff_object_64:
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
# REQUIRES: host-byteorder-little-endian
|
||||
# RUN: yaml2obj %s \
|
||||
# RUN: | llvm-objdump --macho --private-header - 2>&1 \
|
||||
# RUN: | FileCheck %s
|
||||
|
||||
# CHECK: magic cputype cpusubtype caps filetype ncmds sizeofcmds flags
|
||||
# CHECK-NEXT: MH_MAGIC_64 ARM64 ALL 0x00 FILESET 0 0 0x00000000
|
||||
|
||||
--- !mach-o
|
||||
FileHeader:
|
||||
magic: 0xFEEDFACF
|
||||
cputype: 0x100000C
|
||||
cpusubtype: 0x0
|
||||
filetype: 0xC
|
||||
ncmds: 0
|
||||
sizeofcmds: 0
|
||||
flags: 0x0
|
||||
reserved: 0x0
|
|
@ -8599,6 +8599,9 @@ static void PrintMachHeader(uint32_t magic, uint32_t cputype,
|
|||
case MachO::MH_KEXT_BUNDLE:
|
||||
outs() << " KEXTBUNDLE";
|
||||
break;
|
||||
case MachO::MH_FILESET:
|
||||
outs() << " FILESET";
|
||||
break;
|
||||
default:
|
||||
outs() << format(" %10u", filetype);
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue