From 57415de4ca2cf80a940ff2230bfc47677ef618cf Mon Sep 17 00:00:00 2001 From: Amy Date: Tue, 5 Sep 2023 20:51:37 -0400 Subject: [PATCH] strip MH_DYLIB_IN_CACHE, disable header growth thank you to @cgudrian for catching the MH_DYLIB_IN_CACHE flag issue, lldb should finally work now! also disable something which was causing a regression for the past couple versions --- Output.m | 22 +++++++++++++--------- Readme.md | 12 ++++++++---- Run.tool | 22 +++------------------- 3 files changed, 24 insertions(+), 32 deletions(-) diff --git a/Output.m b/Output.m index 7c08e91..c418d6c 100644 --- a/Output.m +++ b/Output.m @@ -2,9 +2,12 @@ #define IMPOSTOR_OBJC_OLD "dsce.objc.old" #define IMPOSTOR_GOT "dsce.got" #define IMPOSTOR_PAD "dsce.pad" -#define HEADER_EXTRA 0x1000 #define IMPORT_HACK_OFFSET 0x1000000000 +// TODO: broken currently + +#define HEADER_EXTRA 0 // 0x1000 + // https://en.wikipedia.org/wiki/LEB128 NSData* ulebWithLong(long value) @@ -127,6 +130,7 @@ -(void)stepImportHeader self.header=ImageHeader.alloc.initEmpty.autorelease; self.header.header->flags=self.cacheImage.header.header->flags; + self.header.header->flags&=~MH_DYLIB_IN_CACHE; __block int copied=0; __block int skipped=0; @@ -903,7 +907,7 @@ -(void)stepFixSelRefs long* refs=(long*)wrapOffset(self,section->offset).pointer; int count=section->size/sizeof(long); - trace(@"fixing %x selector refs",count); + trace(@"fix %x selector refs",count); for(int index=0;indexoffset).pointer; int count=section->size/sizeof(long); - trace(@"fixing %x classes",count); + trace(@"fix %x classes",count); for(int index=0;indexoffset).pointer; int count=section->size/sizeof(long); - trace(@"fixing %x categories",count); + trace(@"fix %x categories",count); for(int index=0;indexoffset).pointer; int count=section->size/sizeof(long); - trace(@"fixing %x protocol refs",count); + trace(@"fix %x protocol refs",count); for(int index=0;indexoffset).pointer; int count=section->size/sizeof(long); - trace(@"fixing %x protocols",count); + trace(@"fix %x protocols",count); for(int index=0;indexoffset).pointer; int count=section->size/sizeof(int); - trace(@"fixing %x initializer offsets",count); + trace(@"fix %x initializer offsets (delta %lx)",count,self.baseAddressDelta); for(int index=0;index