Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

集成NDK编译出错 #3

Open
yfw123 opened this issue Apr 17, 2023 · 1 comment
Open

集成NDK编译出错 #3

yfw123 opened this issue Apr 17, 2023 · 1 comment

Comments

@yfw123
Copy link

yfw123 commented Apr 17, 2023

NDK版本 21.0.6113669
源码
__attribute((annotate(("vmp"))))
uint32_t tea_decrypt (uint32_t* v) {
uint32_t v0=v[0], v1=v[1], sum=0xC6EF3720, i; /* set up /
uint32_t delta=0x9e3779b9; /
a key schedule constant /
uint32_t k0=0x94C36D33, k1=0x164512A3, k2=0xFEEEDA59, k3=0x87BD19BD; /
cache key /
for (i=0; i<32; i++) { /
basic cycle start /
v1 -= ((v0<<4) + k2) ^ (v0 + sum) ^ ((v0>>5) + k3);
v0 -= ((v1<<4) + k0) ^ (v1 + sum) ^ ((v1>>5) + k1);
sum -= delta;
} /
end cycle */
v[0]=v0; v[1]=v1;
return v[0];
}
出错信息
` is_interpreter_function: callinst_dispatch_tea_decrypt is not found
is_interpreter_function: callinst_dispatch_tea_decrypt is not found
is_interpreter_function: callinst_dispatch_tea_decrypt is not found
is_interpreter_function: callinst_dispatch_tea_decrypt is not found
Stack dump:
0. Program arguments: /home/test/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ -cc1 -triple x86_64-none-linux-android21 -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name main.cpp -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -target-feature +sse4.2 -target-feature +popcnt -dwarf-column-info -debug-info-kind=standalone -dwarf-version=4 -debugger-tuning=gdb -ffunction-sections -fdata-sections -coverage-notes-file /home/test/work/other/lspacth/LSPatch_mtso/app/.cxx/Debug/485w53z5/x86_64/CMakeFiles/patchother.dir/main.cpp.gcno -resource-dir /home/test/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/linux-x86_64/lib/clang/8.0.0 -dependency-file CMakeFiles/patchother.dir/main.cpp.o.d -sys-header-deps -MT CMakeFiles/patchother.dir/main.cpp.o -D patchother_EXPORTS -D ANDROID -D _FORTIFY_SOURCE=2 -isysroot /home/test/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/linux-x86_64/sysroot -internal-isystem /home/test/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1 -internal-isystem /home/test/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/local/include -internal-isystem /home/test/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/linux-x86_64/lib/clang/8.0.0/include -internal-externc-isystem /home/test/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/x86_64-linux-android -internal-externc-isystem /home/test/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/linux-x86_64/sysroot/include -internal-externc-isystem /home/test/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include -O0 -Wformat -Werror=format-security -fdeprecated-macro -fdebug-compilation-dir /home/test/work/other/lspacth/LSPatch_mtso/app/.cxx/Debug/485w53z5/x86_64 -ferror-limit 19 -fmessage-length 0 -fvisibility hidden -stack-protector 2 -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -o CMakeFiles/patchother.dir/main.cpp.o -x c++ /home/test/work/other/lspacth/LSPatch_mtso/app/src/main/cpp/main.cpp

  1. parser at end of file
  2. Code generation
  3. Running pass 'Function Pass Manager' on module '/home/test/work/other/lspacth/LSPatch_mtso/app/src/main/cpp/main.cpp'.
    4. Running pass 'X86 DAG->DAG Instruction Selection' on function '@vm_interpreter_callinst_dispatch_tea_decrypt'
    #0 0x00005612526f8fbe llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/home/test/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+++0x243afbe)
    llvm12移植时问题 #1 0x00005612526f70c4 llvm::sys::RunSignalHandlers() (/home/test/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+++0x24390c4)
    能否整合进ndk,生成arm32或者arm64的so? #2 0x00005612526f7245 SignalHandler(int) (/home/test/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+++0x2439245)
    集成NDK编译出错 #3 0x00007f04cc411420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
    please put up guide #4 0x000056125207334f llvm::DataLayout::getAlignment(llvm::Type*, bool) const (.localalias) (/home/test/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+++0x1db534f)
    代码混淆后问题 #5 0x000056125323c5d6 llvm::SelectionDAG::getEVTAlignment(llvm::EVT) const (/home/test/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+++0x2f7e5d6)
    Does not work with new Clang versions #6 0x000056125325122d llvm::SelectionDAG::getLoad(llvm::ISD::MemIndexedMode, llvm::ISD::LoadExtType, llvm::EVT, llvm::SDLoc const&, llvm::SDValue, llvm::SDValue, llvm::SDValue, llvm::MachinePointerInfo, llvm::EVT, unsigned int, llvm::MachineMemOperand::Flags, llvm::AAMDNodes const&, llvm::MDNode const*) (/home/test/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+++0x2f9322d)
    build fails #7 0x0000561253257eef llvm::SelectionDAG::getLoad(llvm::EVT, llvm::SDLoc const&, llvm::SDValue, llvm::SDValue, llvm::MachinePointerInfo, unsigned int, llvm::MachineMemOperand::Flags, llvm::AAMDNodes const&, llvm::MDNode const*) (/home/test/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+++0x2f99eef)
    Solution to all problems! #8 0x0000561253217ee2 llvm::SelectionDAGBuilder::visitLoad(llvm::LoadInst const&) (/home/test/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+++0x2f59ee2)
    c++标准库代码是否不支持vmp选项 #9 0x0000561253238a3d llvm::SelectionDAGBuilder::visit(llvm::Instruction const&) (/home/test/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+++0x2f7aa3d)
    #10 0x00005612532846a4 llvm::SelectionDAGISel::SelectBasicBlock(llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::Instruction, false, false, void>, false, true>, llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::Instruction, false, false, void>, false, true>, bool&) (/home/test/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+++0x2fc66a4)
    #11 0x0000561253288b81 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/home/test/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+++0x2fcab81)
    #12 0x000056125328be96 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (.part.0) (/home/test/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+++0x2fcde96)
    #13 0x0000561251879ca5 (anonymous namespace)::X86DAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/home/test/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+++0x15bbca5)
    #14 0x0000561251dbd52b llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/home/test/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+++0x1aff52b)
    #15 0x00005612520f11d0 llvm::FPPassManager::runOnFunction(llvm::Function&) (/home/test/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+++0x1e331d0)
    #16 0x00005612520f1229 llvm::FPPassManager::runOnModule(llvm::Module&) (/home/test/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+++0x1e33229)
    #17 0x00005612520f0587 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/home/test/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+++0x1e32587)
    #18 0x000056125292924d (anonymous namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_deletellvm::raw_pwrite_stream >) (/home/test/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+++0x266b24d)
    #19 0x000056125292ab8d clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::DataLayout const&, llvm::Module*, clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_deletellvm::raw_pwrite_stream >) (/home/test/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+++0x266cb8d)
    #20 0x0000561253366694 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/home/test/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+++0x30a8694)
    #21 0x0000561253ec85f1 clang::ParseAST(clang::Sema&, bool, bool) (/home/test/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+++0x3c0a5f1)
    #22 0x000056125336551b clang::CodeGenAction::ExecuteAction() (/home/test/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+++0x30a751b)
    #23 0x0000561252e4b416 clang::FrontendAction::Execute() (/home/test/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+++0x2b8d416)
    #24 0x0000561252e0845e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/home/test/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+++0x2b4a45e)
    #25 0x0000561252f0e80b clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/home/test/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+++0x2c5080b)
    #26 0x0000561250d0cd68 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/home/test/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+++0xa4ed68)
    #27 0x0000561250c5d38a main (/home/test/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+++0x99f38a)
    #28 0x00007f04cbebf083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
    #29 0x0000561250d0a9be _start (/home/test/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/linux-x86_64/bin/clang+++0xa4c9be)
    clang++: error: unable to execute command: Segmentation fault (core dumped)
    clang++: error: clang frontend command failed due to signal (use -v to see invocation)
    Obfuscator-LLVM clang version 8.0.0 (based on Obfuscator-LLVM 8.0.0)
    Target: x86_64-none-linux-android21
    Thread model: posix
    InstalledDir: /home/test/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/linux-x86_64/bin
    clang++: note: diagnostic msg: PLEASE submit a bug report to http://o-llvm.org and include the crash backtrace, preprocessed source, and associated run script.
    clang++: note: diagnostic msg:
    ********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang++: note: diagnostic msg: /tmp/main-9b27fe.cpp
clang++: note: diagnostic msg: /tmp/main-9b27fe.sh
clang++: note: diagnostic msg:`
@GANGE666
Copy link
Owner

看trace发现是崩在其他Pass里的,请用C而非CPP试一试,并减少不必要的编译选项。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants