Skip to content
This repository has been archived by the owner on Sep 25, 2023. It is now read-only.

Commit

Permalink
[AntiClassDump]Fix Stage1 by Copy Attributes Over
Browse files Browse the repository at this point in the history
Signed-off-by: Zhang <[email protected]>
  • Loading branch information
Naville committed Dec 25, 2017
1 parent 7d86940 commit 8d13ca8
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/Transforms/Obfuscation/AntiClassDump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@ struct AntiClassDump : public ModulePass {
StructType *newType=StructType::get(M->getContext(),ArrayRef<Type*>(newStructType));
Constant *newMethodStruct=ConstantStruct::get(newType,ArrayRef<Constant*>(newStructValue));//l_OBJC_$_CLASS_METHODS_
GlobalVariable *newMethodStructGV=new GlobalVariable(*M,newType,true, GlobalValue::LinkageTypes::PrivateLinkage,newMethodStruct);
newMethodStructGV->copyAttributesFrom(methodListGV);
Constant *bitcastExpr=ConstantExpr::getBitCast(newMethodStructGV,M->getTypeByName("struct.__method_list_t")->getPointerTo());
CS->handleOperandChange(CS->getAggregateElement(5),bitcastExpr);
GlobalVariable* metadatacompilerusedGV=cast<GlobalVariable>(M->getGlobalVariable("llvm.compiler.used",true));
Expand Down Expand Up @@ -466,6 +467,7 @@ struct AntiClassDump : public ModulePass {
StructType *newType=StructType::get(M->getContext(),ArrayRef<Type*>(newStructType));
Constant *newMethodStruct=ConstantStruct::get(newType,ArrayRef<Constant*>(newStructValue));//l_OBJC_$_CLASS_METHODS_
GlobalVariable *newMethodStructGV=new GlobalVariable(*M,newType,true, GlobalValue::LinkageTypes::PrivateLinkage,newMethodStruct);
newMethodStructGV->copyAttributesFrom(methodListGV);
Constant *bitcastExpr=ConstantExpr::getBitCast(newMethodStructGV,M->getTypeByName("struct.__method_list_t")->getPointerTo());
CS->handleOperandChange(CS->getAggregateElement(5),bitcastExpr);
GlobalVariable* metadatacompilerusedGV=cast<GlobalVariable>(M->getGlobalVariable("llvm.compiler.used",true));
Expand Down

0 comments on commit 8d13ca8

Please sign in to comment.