]> git.saurik.com Git - apple/ld64.git/blobdiff - src/other/dyldinfo.cpp
ld64-278.4.tar.gz
[apple/ld64.git] / src / other / dyldinfo.cpp
index f19538f1533ef31385a1fedb4d1cf0036493efa5..e2719783b1efa0c7750c6feb791f00db5700b077 100644 (file)
@@ -236,6 +236,7 @@ bool DyldInfoPrinter<x86_64>::validFile(const uint8_t* fileContent)
                case MH_DYLIB_STUB:
                case MH_BUNDLE:
                case MH_DYLINKER:
+               case MH_KEXT_BUNDLE:
                        return true;
        }
        return false;
@@ -256,6 +257,7 @@ bool DyldInfoPrinter<arm>::validFile(const uint8_t* fileContent)
                case MH_DYLIB_STUB:
                case MH_BUNDLE:
                case MH_DYLINKER:
+               case MH_KEXT_BUNDLE:
                        return true;
        }
        return false;
@@ -274,14 +276,19 @@ bool DyldInfoPrinter<arm64>::validFile(const uint8_t* fileContent)
        switch (header->filetype()) {
                case MH_EXECUTE:
                case MH_DYLIB:
+               case MH_DYLIB_STUB:
                case MH_BUNDLE:
                case MH_DYLINKER:
+               case MH_KEXT_BUNDLE:
                        return true;
+               default:
+                       return false;
        }
        return false;
 }
 #endif
 
+
 template <typename A>
 DyldInfoPrinter<A>::DyldInfoPrinter(const uint8_t* fileContent, uint32_t fileLength, const char* path, bool printArch)
  : fHeader(NULL), fLength(fileLength), 
@@ -1652,7 +1659,10 @@ void DyldInfoPrinter<A>::printSharedRegionInfo()
                                uint64_t toOffsetCount = read_uleb128(p, infoEnd);
                                const macho_section<P>* fromSection = fSections[fromSectionIndex];
                                const macho_section<P>* toSection = fSections[toSectionIndex];
-                               printf("from sect=%s, to sect=%s, count=%lld:\n", fromSection->sectname(), toSection->sectname(), toOffsetCount);
+                               char fromSectionName[20];
+                               strncpy(fromSectionName, fromSection->sectname(), 16);
+                               fromSectionName[16] = '\0';
+                               printf("from sect=%s/%s, to sect=%s/%s, count=%lld:\n", fromSection->segname(), fromSectionName, toSection->segname(), toSection->sectname(), toOffsetCount);
                                uint64_t toSectionOffset = 0;
                                const char* lastFromSymbol = NULL;
                                for (uint64_t j=0; j < toOffsetCount; ++j) {
@@ -1933,6 +1943,7 @@ arm64::P::uint_t DyldInfoPrinter<arm64>::relocBase()
 }
 #endif
 
+
 template <>
 const char*    DyldInfoPrinter<ppc>::relocTypeName(uint8_t r_type)
 {
@@ -1994,6 +2005,7 @@ const char*       DyldInfoPrinter<arm64>::relocTypeName(uint8_t r_type)
 }
 #endif
 
+
 template <typename A>
 void DyldInfoPrinter<A>::printRelocRebaseInfo()
 {
@@ -2324,7 +2336,7 @@ static void dump(const char* path)
                                                if ( DyldInfoPrinter<arm64>::validFile(p + offset) )
                                                        DyldInfoPrinter<arm64>::make(p + offset, size, path, (sPreferredArch == 0));
                                                else
-                                                       throw "in universal file, arm64 slice does not contain arm mach-o";
+                                                       throw "in universal file, arm64 slice does not contain arm64 mach-o";
                                                break;
 #endif
                                        default: