Open codetronik opened 1 year ago
Hi,
Thanks for the report, LowerSwitchPass()
was troublesome on the past, maybe something changed with latest releases.
I see you build llvm-15 but you are building with 14.0.3 from your segfault log. Is it normal ?
I solved it with the LowerSwitchPass below. https://github.com/SsageParuders/SsagePass/blob/master/Obfuscation/src/LegacyLowerSwitch.cpp
Well good to know.
Is it related to https://reviews.llvm.org/D123607 ?
There was some changed to IR in LLVM 15 https://releases.llvm.org/15.0.0/docs/ReleaseNotes.html#changes-to-the-llvm-ir
I also encountered the same problem using android-ndk-r25c (Android (9352603, based on r450784d1) clang version 14.0.7), which can be solved by removing LowerSwitchPass
.
- analysis.intersect(LowerSwitchPass().run(F, AM));
+ // analysis.intersect(LowerSwitchPass().run(F, AM));
I also encountered the same problem using android-ndk-r25c (Android (9352603, based on r450784d1) clang version 14.0.7), which can be solved by removing
LowerSwitchPass
.- analysis.intersect(LowerSwitchPass().run(F, AM)); + // analysis.intersect(LowerSwitchPass().run(F, AM));
If you remove the LowerSwitchPass, you will not be able to obtain the IR intended by flattening. Use the legacyLowerSwitchPass instead.
I also encountered the same problem using android-ndk-r25c (Android (9352603, based on r450784d1) clang version 14.0.7), which can be solved by removing
LowerSwitchPass
.- analysis.intersect(LowerSwitchPass().run(F, AM)); + // analysis.intersect(LowerSwitchPass().run(F, AM));
If you remove the LowerSwitchPass, you will not be able to obtain the IR intended by flattening. Use the legacyLowerSwitchPass instead.
I compiled two libraries and the results of comparison are the same.
I applied SCALAROPTIMIZERLATE_PASSES with flattening.
However, an error occurs when building my iPhone app.
An error occurs while executing the below source.
flattening.cpp run(Function &F, ...) { analysis.intersect(LowerSwitchPass().run(F, AM)); // crash }
llvm (clang-15) build option
cmake -S llvm -B Release -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_NEW_PASS_MANAGER=ON -DCMAKE_OSX_ARCHITECTURES=arm64 -DLLVM_CREATE_XCODE_TOOLCHAIN=ON -DLLVM_ENABLE_PROJECTS="clang;libcxx;libcxxabi"
obfuscator build option
cmake -B Release -DLLVM_DIR=/Users/kei/Downloads/llvm-project/Release/lib/cmake -DCMAKE_OSX_ARCHITECTURES=arm64
app build option
Clang -fno-legacy-pass-manager -fpass-plugin=/Users/kei/Downloads/obfuscator-llvm/Release/libLLVMObfuscator.dylib 1.c -o 1.o -DCMAKE_OSX_ARCHITECTURES=arm64