Skip to content

Commit

Permalink
fix cff pass crash on llvm-9
Browse files Browse the repository at this point in the history
  • Loading branch information
amimo authored and Ylarod committed May 4, 2021
1 parent c76f673 commit 33bd5d4
Show file tree
Hide file tree
Showing 4 changed files with 568 additions and 0 deletions.
10 changes: 10 additions & 0 deletions llvm/include/llvm/Transforms/Obfuscation/LegacyLowerSwitch.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#ifndef _LEGACY_LOWERSWITCH_INCLUDES_
#define _LEGACY_LOWERSWITCH_INCLUDES_

namespace llvm {
class FunctionPass;
FunctionPass *createLegacyLowerSwitchPass();
}

#endif

1 change: 1 addition & 0 deletions llvm/lib/Transforms/Obfuscation/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ add_llvm_library(LLVMObfuscation
IndirectGlobalVariable.cpp
Flattening.cpp
StringEncryption.cpp
LegacyLowerSwitch.cpp
DEPENDS
LLVMLinker
)
Expand Down
5 changes: 5 additions & 0 deletions llvm/lib/Transforms/Obfuscation/Flattening.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
//===----------------------------------------------------------------------===//

#include "llvm/Transforms/Obfuscation/Flattening.h"
#include "llvm/Transforms/Obfuscation/LegacyLowerSwitch.h"
#include "llvm/Transforms/Obfuscation/Utils.h"
#include "llvm/Transforms/Obfuscation/IPObfuscationContext.h"
#include "llvm/Transforms/Utils.h"
Expand Down Expand Up @@ -78,7 +79,11 @@ bool Flattening::flatten(Function *f) {
// END OF SCRAMBLER

// Lower switch
#if LLVM_VERSION_MAJOR * 10 + LLVM_VERSION_MINOR >= 90
FunctionPass *lower = createLegacyLowerSwitchPass();
#else
FunctionPass *lower = createLowerSwitchPass();
#endif
lower->runOnFunction(*f);

// Save all original BB
Expand Down
Loading

0 comments on commit 33bd5d4

Please sign in to comment.