From fb76c7a7578309cbd36b56fa8b17b4c6538d41ef Mon Sep 17 00:00:00 2001 From: linchaolong Date: Sat, 21 Dec 2024 22:55:24 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20-fla=EF=BC=88=E6=8E=A7?= =?UTF-8?q?=E5=88=B6=E6=B5=81=E5=B9=B3=E5=9D=A6=E5=8C=96=EF=BC=89=E6=8A=A5?= =?UTF-8?q?=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- llvm/lib/Passes/CMakeLists.txt | 2 ++ llvm/lib/Passes/Obfuscation/Flattening.cpp | 4 +--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/llvm/lib/Passes/CMakeLists.txt b/llvm/lib/Passes/CMakeLists.txt index 956e62820..f24bf1f54 100644 --- a/llvm/lib/Passes/CMakeLists.txt +++ b/llvm/lib/Passes/CMakeLists.txt @@ -22,6 +22,8 @@ add_llvm_component_library(LLVMPasses ADDITIONAL_HEADER_DIRS ${LLVM_MAIN_INCLUDE_DIR}/llvm ${LLVM_MAIN_INCLUDE_DIR}/llvm/Passes + ${LLVM_MAIN_INCLUDE_DIR}/llvm/lib/Passes/Obfuscation + ${LLVM_MAIN_INCLUDE_DIR}/llvm/lib/Passes/Obfuscation/compat DEPENDS intrinsics_gen diff --git a/llvm/lib/Passes/Obfuscation/Flattening.cpp b/llvm/lib/Passes/Obfuscation/Flattening.cpp index 4fccc5ee5..d0c1648b8 100644 --- a/llvm/lib/Passes/Obfuscation/Flattening.cpp +++ b/llvm/lib/Passes/Obfuscation/Flattening.cpp @@ -94,9 +94,7 @@ bool FlatteningPass::flatten(Function &F) { // 非条件跳转 else if(BB->getTerminator()->getNumSuccessors() == 1){ BasicBlock *sucBB = BB->getTerminator()->getSuccessor(0); - if (bEntryBB_isConditional) { - entryBB.getTerminator()->eraseFromParent(); - } + BB->getTerminator()->eraseFromParent(); ConstantInt *numCase = swInst->findCaseDest(sucBB); new StoreInst(numCase, swVarPtr, BB); BranchInst::Create(returnBB, BB);