Object: Handle Mach-O kext bundle files
authorJustin Bogner <mail@justinbogner.com>
Wed, 25 Feb 2015 22:59:20 +0000 (22:59 +0000)
committerJustin Bogner <mail@justinbogner.com>
Wed, 25 Feb 2015 22:59:20 +0000 (22:59 +0000)
This particular subtype of Mach-O was missing. Add it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230567 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Support/FileSystem.h
lib/Object/Binary.cpp
lib/Object/ObjectFile.cpp
lib/Object/SymbolicFile.cpp
lib/Support/Path.cpp
unittests/Support/Path.cpp

index 8c02908b639b78772044dbe62cb3ba247213f309..b3b44c46653be431b851d8922d00d51f6b789f31 100644 (file)
@@ -241,6 +241,7 @@ struct file_magic {
     macho_bundle,             ///< Mach-O Bundle file
     macho_dynamically_linked_shared_lib_stub, ///< Mach-O Shared lib stub
     macho_dsym_companion,     ///< Mach-O dSYM companion file
+    macho_kext_bundle,        ///< Mach-O kext bundle file
     macho_universal_binary,   ///< Mach-O universal binary
     coff_object,              ///< COFF object file
     coff_import_library,      ///< COFF import library
index c56eeb1ea8b8d95968726a32f504dda6f1bb0108..a2b167a665c567c0b41b9aec3785c8d21fcd23cd 100644 (file)
@@ -58,6 +58,7 @@ ErrorOr<std::unique_ptr<Binary>> object::createBinary(MemoryBufferRef Buffer,
     case sys::fs::file_magic::macho_bundle:
     case sys::fs::file_magic::macho_dynamically_linked_shared_lib_stub:
     case sys::fs::file_magic::macho_dsym_companion:
+    case sys::fs::file_magic::macho_kext_bundle:
     case sys::fs::file_magic::coff_object:
     case sys::fs::file_magic::coff_import_library:
     case sys::fs::file_magic::pecoff_executable:
index fd7827142532eaea0335814ef8ebbb287d1c2720..01b76543fa2eb97db234aa84d4caec7663897052 100644 (file)
@@ -76,6 +76,7 @@ ObjectFile::createObjectFile(MemoryBufferRef Object, sys::fs::file_magic Type) {
   case sys::fs::file_magic::macho_bundle:
   case sys::fs::file_magic::macho_dynamically_linked_shared_lib_stub:
   case sys::fs::file_magic::macho_dsym_companion:
+  case sys::fs::file_magic::macho_kext_bundle:
     return createMachOObjectFile(Object);
   case sys::fs::file_magic::coff_object:
   case sys::fs::file_magic::coff_import_library:
index de98a1228cd4a1c82573ab98727f3ab0916e8b26..854e68e40f4d663c7d2e8c85e556b15d48e8e980 100644 (file)
@@ -53,6 +53,7 @@ ErrorOr<std::unique_ptr<SymbolicFile>> SymbolicFile::createSymbolicFile(
   case sys::fs::file_magic::macho_bundle:
   case sys::fs::file_magic::macho_dynamically_linked_shared_lib_stub:
   case sys::fs::file_magic::macho_dsym_companion:
+  case sys::fs::file_magic::macho_kext_bundle:
   case sys::fs::file_magic::coff_import_library:
   case sys::fs::file_magic::pecoff_executable:
     return ObjectFile::createObjectFile(Object, Type);
index abec7b9dd221e135bacf6ffc2abd5f61847bd5e8..a11bb7feea0373a9797cebc40b52cb956e2de001 100644 (file)
@@ -1012,6 +1012,7 @@ file_magic identify_magic(StringRef Magic) {
         case 8: return file_magic::macho_bundle;
         case 9: return file_magic::macho_dynamically_linked_shared_lib_stub;
         case 10: return file_magic::macho_dsym_companion;
+        case 11: return file_magic::macho_kext_bundle;
       }
       break;
     }
index 0d661c8ae6c007a708ae9a67838811376349b91e..00af989f48571efd2dff3d2e162ce2b0b793c885 100644 (file)
@@ -557,6 +557,7 @@ const char macho_dynamically_linked_shared_lib[] =
 const char macho_dynamic_linker[] = "\xfe\xed\xfa\xce..........\x00\x07";
 const char macho_bundle[] = "\xfe\xed\xfa\xce..........\x00\x08";
 const char macho_dsym_companion[] = "\xfe\xed\xfa\xce..........\x00\x0a";
+const char macho_kext_bundle[] = "\xfe\xed\xfa\xce..........\x00\x0b";
 const char windows_resource[] = "\x00\x00\x00\x00\x020\x00\x00\x00\xff";
 const char macho_dynamically_linked_shared_lib_stub[] =
     "\xfe\xed\xfa\xce..........\x00\x09";
@@ -587,6 +588,7 @@ TEST_F(FileSystemTest, Magic) {
     DEFINE(macho_bundle),
     DEFINE(macho_dynamically_linked_shared_lib_stub),
     DEFINE(macho_dsym_companion),
+    DEFINE(macho_kext_bundle),
     DEFINE(windows_resource)
 #undef DEFINE
     };