Closed GXSZone closed 2 years ago
我根据文章操作,"在toolchain/llvm-project/llvm/lib/Transforms/Obfuscation/中加入自己的代码" (Obfuscation没有这个文件夹,我直接把你的Pluto-Obfuscator里的文件夹及文件复制过去了)
然后python3 toolchain/llvm_android/build.py --no-build linux
最后报错:
-- Configuring done -- Generating done -- Build files have been written to: /home/guo/test/llvm-toolchain/out/stage1 DEBUG:utils:subprocess.run:10:26:48 /home/guo/test/llvm-toolchain/prebuilts/build-tools/linux-x86/bin/ninja [5/44] Linking CXX shared library lib6...libclang_rt.ubsan_standalone-x86_64.so clang-12: warning: argument unused during compilation: '-static-libstdc++' [-Wunused-command-line-argument] [6/44] Linking CXX shared library lib6...lib/linux/libclang_rt.hwasan-x86_64.so clang-12: warning: argument unused during compilation: '-static-libstdc++' [-Wunused-command-line-argument] [7/44] Linking CXX shared library lib6...9/lib/linux/libclang_rt.asan-x86_64.so clang-12: warning: argument unused during compilation: '-static-libstdc++' [-Wunused-command-line-argument] [8/44] Linking CXX shared library lib6...ib/linux/libclang_rt.memprof-x86_64.so clang-12: warning: argument unused during compilation: '-static-libstdc++' [-Wunused-command-line-argument] [9/44] Building CXX object lib/Transfo...s/LLVMipo.dir/PassManagerBuilder.cpp.o FAILED: lib/Transforms/IPO/CMakeFiles/LLVMipo.dir/PassManagerBuilder.cpp.o /home/guo/test/llvm-toolchain/prebuilts/clang/host/linux-x86/clang-bootstrap/bin/clang++ --sysroot=/home/guo/test/llvm-toolchain/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.17-4.8/sysroot -DGTEST_HAS_RTTI=0 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Ilib/Transforms/IPO -I/home/guo/test/llvm-toolchain/out/llvm-project/llvm/lib/Transforms/IPO -Iinclude -I/home/guo/test/llvm-toolchain/out/llvm-project/llvm/include -ffile-prefix-map=/home/guo/test/llvm-toolchain/= -B/home/guo/test/llvm-toolchain/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.17-4.8/x86_64-linux/bin -stdlib=libc++ -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wstring-conversion -fdiagnostics-color -ffunction-sections -fdata-sections -fexperimental-new-pass-manager -O3 -DNDEBUG -fPIC -fno-exceptions -fno-rtti -std=c++14 -MD -MT lib/Transforms/IPO/CMakeFiles/LLVMipo.dir/PassManagerBuilder.cpp.o -MF lib/Transforms/IPO/CMakeFiles/LLVMipo.dir/PassManagerBuilder.cpp.o.d -o lib/Transforms/IPO/CMakeFiles/LLVMipo.dir/PassManagerBuilder.cpp.o -c /home/guo/test/llvm-toolchain/out/llvm-project/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp /home/guo/test/llvm-toolchain/out/llvm-project/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp:51:10: fatal error: 'llvm/Transforms/Obfuscation/HelloWorld.h' file not found #include "llvm/Transforms/Obfuscation/HelloWorld.h" ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 error generated. [10/44] Building CXX object tools/llvm...iles/llvm-config.dir/llvm-config.cpp.o ninja: build stopped: subcommand failed. Traceback (most recent call last): File "/home/guo/test/llvm-toolchain/toolchain/llvm_android/do_build.py", line 768, in <module> main() File "/home/guo/test/llvm-toolchain/toolchain/llvm_android/do_build.py", line 678, in main stage1.build() File "/home/guo/test/llvm-toolchain/toolchain/llvm_android/builder_registry.py", line 67, in wrapper function(builder, *args, **kwargs) File "/home/guo/test/llvm-toolchain/toolchain/llvm_android/base_builders.py", line 139, in build self._build_config() File "/home/guo/test/llvm-toolchain/toolchain/llvm_android/base_builders.py", line 424, in _build_config utils.check_call(ninja_cmd, cwd=self.output_dir, env=env) File "/home/guo/test/llvm-toolchain/toolchain/llvm_android/utils.py", line 56, in check_call return subprocess_run(cmd, *args, **kwargs, check=True) File "/home/guo/test/llvm-toolchain/toolchain/llvm_android/utils.py", line 46, in subprocess_run return subprocess.run(cmd, *args, **kwargs, text=True) File "/home/guo/test/llvm-toolchain/prebuilts/python/linux-x86/lib/python3.9/subprocess.py", line 524, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command '['/home/guo/test/llvm-toolchain/prebuilts/build-tools/linux-x86/bin/ninja']' returned non-zero exit status 1. Traceback (most recent call last): File "/home/guo/test/llvm-toolchain/toolchain/llvm_android/build.py", line 21, in <module> py3_utils.run_with_py3('do_build.py') File "/home/guo/test/llvm-toolchain/toolchain/llvm_android/py3_utils.py", line 35, in run_with_py3 subprocess.check_call( File "/usr/lib/python3.10/subprocess.py", line 369, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['/home/guo/test/llvm-toolchain/prebuilts/python/linux-x86/bin/python3', '/home/guo/test/llvm-toolchain/toolchain/llvm_android/do_build.py', '--no-build', 'linux']' returned non-zero exit status 1.
fatal error: 'llvm/Transforms/Obfuscation/HelloWorld.h' file not found
实际上我试着把关于HelloWorld的添加的三行注释掉
cl::opt RunHelloWorld("hlw",cl::init(false),cl::desc("Enable the HelloWorld pass"));
MPM.add(createHelloWorldPass(RunHelloworld));
但后面添加的的SplitBasicBlock,Flattening等等依然会报没有发现文件
另外我翻阅项目里的Pluto-Obfuscator\Pluto-Obfuscator-main\llvm\lib\Transforms\CMakeLists.txt
add_subdirectory(Utils) add_subdirectory(Instrumentation) add_subdirectory(AggressiveInstCombine) add_subdirectory(InstCombine) add_subdirectory(Scalar) add_subdirectory(IPO) add_subdirectory(Vectorize) add_subdirectory(Hello) add_subdirectory(HelloNew) add_subdirectory(ObjCARC) add_subdirectory(Coroutines) add_subdirectory(CFGuard) add_subdirectory(Obfuscation)
add_subdirectory(Obfuscation) 在看雪文章里并没有提及添加,我根据看雪文章步骤操作是否需要添加呢
我根据文章操作,"在toolchain/llvm-project/llvm/lib/Transforms/Obfuscation/中加入自己的代码" (Obfuscation没有这个文件夹,我直接把你的Pluto-Obfuscator里的文件夹及文件复制过去了)
然后python3 toolchain/llvm_android/build.py --no-build linux
最后报错:
fatal error: 'llvm/Transforms/Obfuscation/HelloWorld.h' file not found
实际上我试着把关于HelloWorld的添加的三行注释掉
include "llvm/Transforms/Obfuscation/HelloWorld.h"
cl::opt RunHelloWorld("hlw",cl::init(false),cl::desc("Enable the HelloWorld pass"));
MPM.add(createHelloWorldPass(RunHelloworld));
但后面添加的的SplitBasicBlock,Flattening等等依然会报没有发现文件
另外我翻阅项目里的Pluto-Obfuscator\Pluto-Obfuscator-main\llvm\lib\Transforms\CMakeLists.txt
add_subdirectory(Obfuscation) 在看雪文章里并没有提及添加,我根据看雪文章步骤操作是否需要添加呢