Loading...
mach_o/ChainedFixups.cpp dyld-1340 dyld-1285.19
--- dyld/dyld-1340/mach_o/ChainedFixups.cpp
+++ dyld/dyld-1285.19/mach_o/ChainedFixups.cpp
@@ -475,7 +475,7 @@
         return newValue;
     }
 
-    Error             writeChainEntry(const Fixup& fixup, const void* nextLoc, uint64_t preferedLoadAddress, std::span<const MappedSegment*>) const override {
+    void             writeChainEntry(const Fixup& fixup, const void* nextLoc, uint64_t preferedLoadAddress, std::span<const MappedSegment*>) const override {
         intptr_t delta = (nextLoc == nullptr) ? 0 : ((uint8_t*)nextLoc - (uint8_t*)fixup.location);
         if ( fixup.isBind ) {
             if ( bindBitCount() == 24 ) {
@@ -489,13 +489,9 @@
                     authBind24Ptr->diversity = fixup.auth.diversity;
                     authBind24Ptr->zero      = 0;
                     authBind24Ptr->ordinal   = fixup.bind.bindOrdinal;
-                    // validate things fit into bit fields
-                    if ( authBind24Ptr->next*stride() != delta )
-                        return badChainDistance(fixup, delta);
-                    if ( authBind24Ptr->ordinal != fixup.bind.bindOrdinal )
-                        return badBindOrdinal(fixup);
-                    if ( fixup.bind.embeddedAddend != 0 )
-                        return badAddend(fixup, fixup.bind.embeddedAddend);
+                    assert(authBind24Ptr->next*stride() == delta);
+                    assert(authBind24Ptr->ordinal == fixup.bind.bindOrdinal);
+                    assert(fixup.bind.embeddedAddend == 0);
                 }
                 else {
                     dyld_chained_ptr_arm64e_bind24* bind24Ptr = (dyld_chained_ptr_arm64e_bind24*)fixup.location;
@@ -505,12 +501,9 @@
                     bind24Ptr->addend   = fixup.bind.embeddedAddend;
                     bind24Ptr->zero     = 0;
                     bind24Ptr->ordinal  = fixup.bind.bindOrdinal;
-                    if ( signExtendedAddend(bind24Ptr) != fixup.bind.embeddedAddend )
-                        return badAddend(fixup, fixup.bind.embeddedAddend);
-                    if ( bind24Ptr->next*stride() != delta )
-                        return badChainDistance(fixup, delta);
-                    if ( bind24Ptr->ordinal != fixup.bind.bindOrdinal )
-                        return badBindOrdinal(fixup);
+                    assert(signExtendedAddend(bind24Ptr) == fixup.bind.embeddedAddend);
+                    assert(bind24Ptr->next*stride() == delta);
+                    assert(bind24Ptr->ordinal == fixup.bind.bindOrdinal);
                 }
             }
             else {
@@ -524,12 +517,9 @@
                     authBindPtr->diversity = fixup.auth.diversity;
                     authBindPtr->zero      = 0;
                     authBindPtr->ordinal   = fixup.bind.bindOrdinal;
-                    if ( authBindPtr->next*stride() != delta )
-                        return badChainDistance(fixup, delta);
-                    if ( authBindPtr->ordinal != fixup.bind.bindOrdinal )
-                        return badBindOrdinal(fixup);
-                    if ( fixup.bind.embeddedAddend != 0 )
-                        return badAddend(fixup, fixup.bind.embeddedAddend);
+                    assert(authBindPtr->next*stride() == delta);
+                    assert(authBindPtr->ordinal == fixup.bind.bindOrdinal);
+                    assert(fixup.bind.embeddedAddend == 0);
                 }
                 else {
                     dyld_chained_ptr_arm64e_bind* bindPtr = (dyld_chained_ptr_arm64e_bind*)fixup.location;
@@ -539,12 +529,9 @@
                     bindPtr->addend   = fixup.bind.embeddedAddend;
                     bindPtr->zero     = 0;
                     bindPtr->ordinal  = fixup.bind.bindOrdinal;
-                    if ( signExtendedAddend(bindPtr) != fixup.bind.embeddedAddend )
-                        return badAddend(fixup, fixup.bind.embeddedAddend);
-                    if ( bindPtr->next*stride() != delta )
-                        return badChainDistance(fixup, delta);
-                    if ( bindPtr->ordinal != fixup.bind.bindOrdinal )
-                        return badBindOrdinal(fixup);
+                    assert(signExtendedAddend(bindPtr) == fixup.bind.embeddedAddend);
+                    assert(bindPtr->next*stride() == delta);
+                    assert(bindPtr->ordinal == fixup.bind.bindOrdinal);
                 }
             }
         }
@@ -558,11 +545,9 @@
                 authRebasePtr->addrDiv   = fixup.auth.usesAddrDiversity;
                 authRebasePtr->diversity = fixup.auth.diversity;
                 authRebasePtr->target    = fixup.rebase.targetVmOffset;
-                if ( authRebasePtr->next*stride() != delta )
-                    return badChainDistance(fixup, delta);
-                if ( authRebasePtr->target != fixup.rebase.targetVmOffset )
-                    return badVmOffset(fixup);
-           }
+                assert(authRebasePtr->next*stride() == delta);
+                assert(authRebasePtr->target == fixup.rebase.targetVmOffset);
+            }
             else {
                 unaligned_dyld_chained_ptr_arm64e_rebase* rebasePtr = (unaligned_dyld_chained_ptr_arm64e_rebase*)fixup.location;
                 uint8_t   high8 = (fixup.rebase.targetVmOffset >> 56);
@@ -572,17 +557,10 @@
                 rebasePtr->next     = delta/stride();
                 rebasePtr->high8    = high8;
                 rebasePtr->target   = low56 + (this->unauthRebaseIsVmAddr() ? preferedLoadAddress : 0);
-                if ( rebasePtr->next*stride() != delta )
-                    return badChainDistance(fixup, delta);
-                if ( rebasePtr->target != (low56 + (this->unauthRebaseIsVmAddr() ? preferedLoadAddress : 0)) ) {
-                    if ( this->unauthRebaseIsVmAddr() )
-                        return badVmAddr(fixup, preferedLoadAddress);
-                    else
-                        return badVmOffset(fixup);
-                }
-            }
-        }
-        return Error::none();
+                assert(rebasePtr->next*stride() == delta);
+                assert(rebasePtr->target == (low56 + (this->unauthRebaseIsVmAddr() ? preferedLoadAddress : 0)));
+            }
+        }
     }
 
 protected:
@@ -688,7 +666,7 @@
     const char*     description() const override           { return "arm64e shared cache, 8-byte stride, target vmoffset"; }
     uint32_t        ptrAlignmentSize() const override      { return 8; } // arm64e userspace requires 8-byte ptr alignment
     uint64_t        maxRebaseTargetOffset(bool auth) const override    { return 0x3FFFFFFFFULL; }
-    Error           writeChainEntry(const Fixup& fixup, const void* nextLoc, uint64_t preferedLoadAddress, std::span<const MappedSegment*>) const override;
+    void            writeChainEntry(const Fixup& fixup, const void* nextLoc, uint64_t preferedLoadAddress, std::span<const MappedSegment*>) const override;
 protected:
     uint32_t        bindBitCount() const override          { return 0; }
     uint32_t        stride() const override                { return 8; }
@@ -715,10 +693,9 @@
 
 };
 
-Error PointerFormat_DYLD_CHAINED_PTR_ARM64E_SHARED_CACHE::writeChainEntry(const Fixup& fixup, const void* nextLoc, uint64_t preferedLoadAddress, std::span<const MappedSegment*>) const
-{
-    if ( fixup.isBind )
-        return Error ("shared cache fixup formate does not support binds");
+void PointerFormat_DYLD_CHAINED_PTR_ARM64E_SHARED_CACHE::writeChainEntry(const Fixup& fixup, const void* nextLoc, uint64_t preferedLoadAddress, std::span<const MappedSegment*>) const
+{
+    assert(!fixup.isBind && "shared cache does not support binds");
     intptr_t delta = (nextLoc == nullptr) ? 0 : ((uint8_t*)nextLoc - (uint8_t*)fixup.location);
     if ( fixup.authenticated ) {
         dyld_chained_ptr_arm64e_shared_cache_auth_rebase* authRebasePtr = (dyld_chained_ptr_arm64e_shared_cache_auth_rebase*)fixup.location;
@@ -728,10 +705,8 @@
         authRebasePtr->addrDiv       = fixup.auth.usesAddrDiversity;
         authRebasePtr->diversity     = fixup.auth.diversity;
         authRebasePtr->runtimeOffset = (fixup.rebase.targetVmOffset & 0x3FFFFFFFFULL);
-        if ( authRebasePtr->next*8 != delta )
-            return badChainDistance(fixup, delta);
-        if ( authRebasePtr->runtimeOffset != fixup.rebase.targetVmOffset )
-            return badVmOffset(fixup);
+        assert(authRebasePtr->next*8 == delta);
+        assert(authRebasePtr->runtimeOffset == fixup.rebase.targetVmOffset);
     }
     else {
         dyld_chained_ptr_arm64e_shared_cache_rebase* rebasePtr = (dyld_chained_ptr_arm64e_shared_cache_rebase*)fixup.location;
@@ -740,13 +715,8 @@
         rebasePtr->unused        = 0;
         rebasePtr->high8         = ((fixup.rebase.targetVmOffset >> 56) & 0xFF);
         rebasePtr->runtimeOffset = (fixup.rebase.targetVmOffset & 0x3FFFFFFFFULL);
-        if ( rebasePtr->next*8 != delta )
-            return badChainDistance(fixup, delta);
-        uint64_t targetFromEncoding = (rebasePtr->runtimeOffset | ((uint64_t)rebasePtr->high8 << 56));
-        if ( targetFromEncoding != fixup.rebase.targetVmOffset )
-            return badVmOffset(fixup);
-    }
-    return Error::none();
+        assert(rebasePtr->next*8 == delta);
+    }
 }
 
 
@@ -762,7 +732,7 @@
     const char*      description() const override          { return "authenticated arm64e, 8-byte stride, target segIndex/offset8"; }
     bool             is64() const override                 { return true; }
     Fixup            parseChainEntry(const void* loc, const MappedSegment* seg, uint64_t preferedLoadAddress, std::span<const uint64_t> segOffsetTable) const override;
-    Error            writeChainEntry(const Fixup& fixup, const void* nextLoc, uint64_t preferedLoadAddress, std::span<const MappedSegment*>) const override;
+    void             writeChainEntry(const Fixup& fixup, const void* nextLoc, uint64_t preferedLoadAddress, std::span<const MappedSegment*>) const override;
     const void*      nextLocation(const void* loc) const override;
     uint64_t         maxRebaseTargetOffset(bool authenticated) const override    { return 0x0FFFFFFF;  }
 protected:
@@ -808,16 +778,14 @@
 }
 
 
-Error PointerFormat_DYLD_CHAINED_PTR_ARM64E_SEGMENTED::writeChainEntry(const Fixup& fixup, const void* nextLoc, uint64_t preferedLoadAddress, std::span<const MappedSegment*> segments) const
+void PointerFormat_DYLD_CHAINED_PTR_ARM64E_SEGMENTED::writeChainEntry(const Fixup& fixup, const void* nextLoc, uint64_t preferedLoadAddress, std::span<const MappedSegment*> segments) const
 {
     intptr_t delta = (nextLoc == nullptr) ? 0 : ((uint8_t*)nextLoc - (uint8_t*)fixup.location);
-    if ( fixup.isBind )
-        return Error("firmware format does not support binds");
+    assert(!fixup.isBind && "firmware format does not support binds");
     uint8_t  segIndex;
     uint64_t segOffset;
     bool found = findSegIndexAndOffset(segments, fixup.rebase.targetVmOffset, segIndex, segOffset);
-    if ( !found )
-        return Error("target vm address not in any segment");
+    assert(found && "target vm address not in any segment");
 
     if ( fixup.authenticated ) {
         //fprintf(stderr, "key=%d, addr=%d, div=0x%04X\n", fixup.auth.key, fixup.auth.usesAddrDiversity, fixup.auth.diversity);
@@ -829,10 +797,9 @@
         authRebasePtr->diversity        = fixup.auth.diversity;
         authRebasePtr->targetSegIndex   = segIndex;
         authRebasePtr->targetSegOffset  = (uint32_t)segOffset;
-        if ( authRebasePtr->next*stride() != delta )
-            return badChainDistance(fixup, delta);
-        if ( (authRebasePtr->targetSegIndex != segIndex) || (authRebasePtr->targetSegOffset != segOffset) )
-            return badSegIndexOrOffset(fixup, segIndex, segOffset);
+        assert(authRebasePtr->next*stride()   == delta);
+        assert(authRebasePtr->targetSegIndex  == segIndex);
+        assert(authRebasePtr->targetSegOffset == segOffset);
     }
     else {
         //fprintf(stderr, "segIndex=%d, segOffset=0x%0llX\n", segIndex, segOffset);
@@ -842,12 +809,10 @@
         rebasePtr->padding          = 0;
         rebasePtr->targetSegIndex   = segIndex;
         rebasePtr->targetSegOffset  = (uint32_t)segOffset;
-        if ( rebasePtr->next*stride() != delta )
-            return badChainDistance(fixup, delta);
-        if ( (rebasePtr->targetSegIndex != segIndex) || (rebasePtr->targetSegOffset != segOffset) )
-            return badSegIndexOrOffset(fixup, segIndex, segOffset);
-    }
-    return Error::none();
+        assert(rebasePtr->next*stride()   == delta);
+        assert(rebasePtr->targetSegIndex  == segIndex);
+        assert(rebasePtr->targetSegOffset == segOffset);
+    }
 }
 
 
@@ -888,7 +853,7 @@
             return Fixup(loc, seg, ((uint64_t)(rebasePtr->high8) << 56) | rebasePtr->target);
     }
 
-    Error            writeChainEntry(const Fixup& fixup, const void* nextLoc, uint64_t preferedLoadAddress, std::span<const MappedSegment*>) const override {
+    void             writeChainEntry(const Fixup& fixup, const void* nextLoc, uint64_t preferedLoadAddress, std::span<const MappedSegment*>) const override {
         intptr_t delta = (nextLoc == nullptr) ? 0 : ((uint8_t*)nextLoc - (uint8_t*)fixup.location);
         if ( fixup.isBind ) {
             dyld_chained_ptr_64_bind*  bindPtr = (dyld_chained_ptr_64_bind*)fixup.location;
@@ -897,12 +862,9 @@
             bindPtr->reserved = 0;
             bindPtr->addend   = fixup.bind.embeddedAddend;
             bindPtr->ordinal  = fixup.bind.bindOrdinal;
-            if ( bindPtr->addend != fixup.bind.embeddedAddend )
-                return badAddend(fixup, fixup.bind.embeddedAddend);
-            if ( bindPtr->next*4 != delta )
-                return badChainDistance(fixup, delta);
-            if ( bindPtr->ordinal != fixup.bind.bindOrdinal )
-                return badBindOrdinal(fixup);
+            assert(bindPtr->addend == fixup.bind.embeddedAddend);
+            assert(bindPtr->next*4 == delta);
+            assert(bindPtr->ordinal == fixup.bind.bindOrdinal);
         }
         else if ( unauthRebaseIsVmAddr() ) {
             dyld_chained_ptr_64_rebase* rebasePtr = (dyld_chained_ptr_64_rebase*)fixup.location;
@@ -913,11 +875,9 @@
             rebasePtr->reserved = 0;
             rebasePtr->high8    = high8;
             rebasePtr->target   = low56+preferedLoadAddress;
-            if ( rebasePtr->next*4 != delta )
-                return badChainDistance(fixup, delta);
-            if ( rebasePtr->target != (low56+preferedLoadAddress) )
-                return badVmAddr(fixup, preferedLoadAddress);
-       }
+            assert(rebasePtr->next*4 == delta);
+            assert(rebasePtr->target == (low56+preferedLoadAddress));
+        }
         else {
             dyld_chained_ptr_64_rebase* rebasePtr = (dyld_chained_ptr_64_rebase*)fixup.location;
             uint8_t   high8 = (fixup.rebase.targetVmOffset >> 56);
@@ -927,13 +887,9 @@
             rebasePtr->reserved = 0;
             rebasePtr->high8    = high8;
             rebasePtr->target   = low56;
-            if ( rebasePtr->next*4 != delta )
-                return badChainDistance(fixup, delta);
-            uint64_t targetFromEncoding = (low56 | ((uint64_t)rebasePtr->high8 << 56));
-            if ( targetFromEncoding != fixup.rebase.targetVmOffset )
-                return badVmOffset(fixup);
-        }
-        return Error::none();
+            assert(rebasePtr->next*4 == delta);
+            assert(rebasePtr->target == low56);
+        }
     }
 
 protected:
@@ -976,7 +932,7 @@
             return Fixup(loc, seg, rebasePtr->target);
     }
 
-    Error            writeChainEntry(const Fixup& fixup, const void* nextLoc, uint64_t preferedLoadAddress, std::span<const MappedSegment*>) const override {
+    void             writeChainEntry(const Fixup& fixup, const void* nextLoc, uint64_t preferedLoadAddress, std::span<const MappedSegment*>) const override {
         intptr_t delta = (nextLoc == nullptr) ? 0 : ((uint8_t*)nextLoc - (uint8_t*)fixup.location);
         if ( fixup.isBind ) {
             dyld_chained_ptr_32_bind* bindPtr = (dyld_chained_ptr_32_bind*)fixup.location;
@@ -984,12 +940,9 @@
             bindPtr->next     = (uint32_t)(delta/4);
             bindPtr->addend   = fixup.bind.embeddedAddend;
             bindPtr->ordinal  = fixup.bind.bindOrdinal;
-            if ( bindPtr->next*4 != delta )
-                return badChainDistance(fixup, delta);
-            if ( bindPtr->addend != fixup.bind.embeddedAddend )
-                return badAddend(fixup, fixup.bind.embeddedAddend);
-            if ( bindPtr->ordinal != fixup.bind.bindOrdinal )
-                return badBindOrdinal(fixup);
+            assert(bindPtr->next*4 == delta);
+            assert(bindPtr->addend == fixup.bind.embeddedAddend);
+            assert(bindPtr->ordinal == fixup.bind.bindOrdinal);
         }
         else {
             dyld_chained_ptr_32_rebase*  rebasePtr = (dyld_chained_ptr_32_rebase*)fixup.location;
@@ -997,12 +950,9 @@
             rebasePtr->next     = (uint32_t)(delta/4);
             uint64_t target = fixup.rebase.targetVmOffset+preferedLoadAddress;
             rebasePtr->target   = (uint32_t)target;
-            if ( rebasePtr->next*4 != delta )
-                return badChainDistance(fixup, delta);
-            if ( rebasePtr->target != target )
-                return badVmOffset(fixup);
-        }
-        return Error::none();
+            assert(rebasePtr->next*4 == delta);
+            assert(rebasePtr->target == target);
+        }
     }
 
 };
@@ -1039,16 +989,13 @@
         return Fixup(loc, seg, rebasePtr->target);
     }
 
-    Error            writeChainEntry(const Fixup& fixup, const void* nextLoc, uint64_t preferedLoadAddress, std::span<const MappedSegment*>) const override {
+    void             writeChainEntry(const Fixup& fixup, const void* nextLoc, uint64_t preferedLoadAddress, std::span<const MappedSegment*>) const override {
         intptr_t delta = (nextLoc == nullptr) ? 0 : ((uint8_t*)nextLoc - (uint8_t*)fixup.location);
         dyld_chained_ptr_32_cache_rebase*  rebasePtr = (dyld_chained_ptr_32_cache_rebase*)fixup.location;
         rebasePtr->next     = (uint32_t)(delta/4);
         rebasePtr->target   = (uint32_t)fixup.rebase.targetVmOffset;
-        if ( rebasePtr->next*4 != delta )
-            return badChainDistance(fixup, delta);
-        if ( rebasePtr->target != fixup.rebase.targetVmOffset )
-            return badVmOffset(fixup);
-        return Error::none();
+        assert(rebasePtr->next*4 == delta);
+        assert(rebasePtr->target == fixup.rebase.targetVmOffset);
     }
 };
 
@@ -1085,16 +1032,13 @@
         return Fixup(loc, seg, rebasePtr->target - preferedLoadAddress);
     }
 
-    Error            writeChainEntry(const Fixup& fixup, const void* nextLoc, uint64_t preferedLoadAddress, std::span<const MappedSegment*>) const override {
+    void             writeChainEntry(const Fixup& fixup, const void* nextLoc, uint64_t preferedLoadAddress, std::span<const MappedSegment*>) const override {
         intptr_t delta = (nextLoc == nullptr) ? 0 : ((uint8_t*)nextLoc - (uint8_t*)fixup.location);
         dyld_chained_ptr_32_firmware_rebase*  rebasePtr = (dyld_chained_ptr_32_firmware_rebase*)fixup.location;
         rebasePtr->next     = (uint32_t)(delta/4);
         rebasePtr->target   = (uint32_t)fixup.rebase.targetVmOffset;
-        if ( rebasePtr->next*4 != delta )
-            return badChainDistance(fixup, delta);
-        if ( rebasePtr->target != fixup.rebase.targetVmOffset )
-            return badVmOffset(fixup);
-        return Error::none();
+        assert(rebasePtr->next*4 == delta);
+        assert(rebasePtr->target == fixup.rebase.targetVmOffset);
     }
 };
 
@@ -1148,7 +1092,7 @@
 
     }
 
-    Error            writeChainEntry(const Fixup& fixup, const void* nextLoc, uint64_t preferedLoadAddress, std::span<const MappedSegment*>) const override {
+    void             writeChainEntry(const Fixup& fixup, const void* nextLoc, uint64_t preferedLoadAddress, std::span<const MappedSegment*>) const override {
         intptr_t delta = (nextLoc == nullptr) ? 0 : ((uint8_t*)nextLoc - (uint8_t*)fixup.location);
         dyld_chained_ptr_64_kernel_cache_rebase* rebasePtr = (dyld_chained_ptr_64_kernel_cache_rebase*)fixup.location;
 
@@ -1159,11 +1103,8 @@
         rebasePtr->diversity  = fixup.auth.diversity;
         rebasePtr->cacheLevel = 0;  // FIXME
         rebasePtr->target     = fixup.rebase.targetVmOffset;
-        if ( rebasePtr->next*4 != delta )
-            return badChainDistance(fixup, delta);
-        if ( rebasePtr->target != fixup.rebase.targetVmOffset )
-            return badVmOffset(fixup);
-        return Error::none();
+        assert(rebasePtr->next*4 == delta);
+        assert(rebasePtr->target == fixup.rebase.targetVmOffset);
     }
 };
 
@@ -1203,7 +1144,7 @@
 
     }
 
-    Error            writeChainEntry(const Fixup& fixup, const void* nextLoc, uint64_t preferedLoadAddress, std::span<const MappedSegment*>) const override {
+    void             writeChainEntry(const Fixup& fixup, const void* nextLoc, uint64_t preferedLoadAddress, std::span<const MappedSegment*>) const override {
         intptr_t delta = (nextLoc == nullptr) ? 0 : ((uint8_t*)nextLoc - (uint8_t*)fixup.location);
         dyld_chained_ptr_64_kernel_cache_rebase* rebasePtr = (dyld_chained_ptr_64_kernel_cache_rebase*)fixup.location;
 
@@ -1214,55 +1155,10 @@
         rebasePtr->diversity  = 0;
         rebasePtr->cacheLevel = 0;  // FIXME
         rebasePtr->target     = fixup.rebase.targetVmOffset;
-        if ( rebasePtr->next != delta )
-            return badChainDistance(fixup, delta);
-        if ( rebasePtr->target != fixup.rebase.targetVmOffset )
-            return badVmOffset(fixup);
-        return Error::none();
-    }
-};
-
-Error ChainedFixups::PointerFormat::badChainDistance(const Fixup& fixup, intptr_t delta) const
-{
-    return Error("distance between fixups (%ld) is not encodable in chain for fixup at %.*s+0x%0lX",
-                 delta, (int)fixup.segment->segName.size(), fixup.segment->segName.data(),
-                 (uintptr_t)fixup.location - (uintptr_t)fixup.segment->content);
-}
-
-Error ChainedFixups::PointerFormat::badBindOrdinal(const Fixup& fixup) const
-{
-    return Error("bind ordinal (%u) too large in fixup at %.*s+0x%0lX",
-                 fixup.bind.bindOrdinal, (int)fixup.segment->segName.size(), fixup.segment->segName.data(),
-                 (uintptr_t)fixup.location - (uintptr_t)fixup.segment->content);
-}
-
-Error ChainedFixups::PointerFormat::badVmOffset(const Fixup& fixup) const
-{
-    return Error("vmOffset (0x%0llX) cannot fit in fixup at %.*s+0x%0lX",
-                 fixup.rebase.targetVmOffset, (int)fixup.segment->segName.size(), fixup.segment->segName.data(),
-                 (uintptr_t)fixup.location - (uintptr_t)fixup.segment->content);
-}
-
-Error ChainedFixups::PointerFormat::badVmAddr(const Fixup& fixup, uint64_t baseAddress) const
-{
-    return Error("vmAddress (0x%0llX) cannot fit in fixup at %.*s+0x%0lX",
-                 fixup.rebase.targetVmOffset+baseAddress, (int)fixup.segment->segName.size(), fixup.segment->segName.data(),
-                 (uintptr_t)fixup.location - (uintptr_t)fixup.segment->content);
-}
-
-Error ChainedFixups::PointerFormat::badAddend(const Fixup& fixup, int64_t addend) const
-{
-    return Error("addend (%lld) cannot fit in fixup at %.*s+0x%0lX",
-                 addend, (int)fixup.segment->segName.size(), fixup.segment->segName.data(),
-                 (uintptr_t)fixup.location - (uintptr_t)fixup.segment->content);
-}
-
-Error ChainedFixups::PointerFormat::badSegIndexOrOffset(const Fixup& fixup, uint8_t segIndex, uint64_t segOffset) const
-{
-    return Error("segIndex (%d) and segOffset (0x%0llX) cannot fit in fixup at %.*s+0x%0lX",
-                 segIndex, segOffset, (int)fixup.segment->segName.size(), fixup.segment->segName.data(),
-                 (uintptr_t)fixup.location - (uintptr_t)fixup.segment->content);
-}
+        assert(rebasePtr->next == delta);
+        assert(rebasePtr->target == fixup.rebase.targetVmOffset);
+    }
+};
 
 
 bool ChainedFixups::PointerFormat::valid(uint16_t pointer_format)