Skip to content

Commit

Permalink
to the bare minimum, we'll see if we'll have to reintroduce those bit…
Browse files Browse the repository at this point in the history
…s later
  • Loading branch information
woachk committed Jan 13, 2020
1 parent df8e6d9 commit dc3b05d
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/AddPasses/Loader_Hook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,14 @@

using namespace std;
void (*old_pmb)(void* dis,legacy::PassManagerBase &MPM);
Pass* (*old_get_LS)();
extern "C" Pass* _ZN4llvm21createLowerSwitchPassEv(){
return old_get_LS();
}

static void new_pmb(void* dis,legacy::PassManagerBase &MPM){
MPM.add(createObfuscationPass());
old_pmb(dis,MPM);
}
static __attribute__((__constructor__)) void Inject(int argc, char* argv[]){
char* executablePath=argv[0];
errs()<<"Applying Apple Clang Hooks...\n";
errs()<<"Applying Clang hook...\n";
MSImageRef exeImagemage=MSGetImageByName(executablePath);
MSHookFunction((void*)MSFindSymbol(exeImagemage,"__ZN4llvm18PassManagerBuilder25populateModulePassManagerERNS_6legacy15PassManagerBaseE"),(void*)new_pmb,(void**)&old_pmb);
old_get_LS=(Pass* (*)())MSFindSymbol(exeImagemage,"__ZN4llvm15callDefaultCtorIN12_GLOBAL__N_111LowerSwitchEEEPNS_4PassEv");
}

0 comments on commit dc3b05d

Please sign in to comment.