avast / avast/retdec

Error: Decompilation to LLVM IR failed

Open
#740 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
8.6k
Forks
1k
PR merge metrics
No merged PRs in 30d

Description

Hi there. I know that this error is there in more places.
But I'm new to this tool and I wonder I can't decomplile a 875Kb file having 16Gig of RAM!
I'm using Arch Linux, I installed retdec from the AUR using the git version.
This is the output I get:
```
$ retdec-decompiler.py -a arm --no-memory-limit -o lib.c lib.so
##### Checking if file is a Mach-O Universal static library...

##### Checking if file is an archive...
RUN: /usr/bin/retdec-ar-extractor /.../lib.so --arch-magic
Not an archive, going to the next step.

##### Gathering file information...
RUN: /usr/bin/retdec-fileinfo -c /.../lib.config.json --similarity /.../lib.so --no-hashes=all --crypto /usr/bin/../share/retdec/support/generic/yara_patterns/signsrch/signsrch.yara --crypto /usr/bin/../share/retdec/support/generic/yara_patterns/signsrch/signsrch.yarac
Input file : /.../lib.so
File format : ELF
File class : 32-bit
File type : DLL
Architecture : ARM
Endianness : Little endian
Detected tool : gold (1.12) (linker), .note section heuristic
Detected tool : GCC (4.9) (compiler), .comment section heuristic
Original language : C++

##### Trying to unpack /.../lib.so into /.../li.tmp by using generic unpacker...
RUN: /usr/bin/retdec-unpacker /.../jni/armeabi-v7a/lib.so -o /.../jni/armeabi-v7a/lib-unpacked.tmp
No matching plugins found for 'gold 1.12'
No matching plugins found for 'GCC 4.9'
##### Unpacking by using generic unpacker: nothing to do

##### Trying to unpack /.../jni/armeabi-v7a/lib.so into /.../jni/armeabi-v7a/lib-unpacked.tmp by using UPX...
RUN: upx -d /.../jni/armeabi-v7a/lib.so -o /.../jni/armeabi-v7a/lib-unpacked.tmp
upx: /.../jni/armeabi-v7a/lib.so: NotPackedException: not packed by UPX
##### Unpacking by using UPX: nothing to do

##### Decompiling /.../jni/armeabi-v7a/lib.so into /.../jni/armeabi-v7a/lib.bc...
RUN: /usr/bin/retdec-bin2llvmir -provider-init -decoder -verify -x86-addr-spaces -x87-fpu -main-detection -idioms-libgcc -inst-opt -cond-branch-opt -syscalls -stack -constants -param-return -inst-opt-rda -inst-opt -simple-types -generate-dsm -remove-asm-instrs -class-hierarchy -select-fncs -unreachable-funcs -inst-opt -register-localization -value-protect -instcombine -tbaa -basicaa -simplifycfg -early-cse -tbaa -basicaa -globalopt -mem2reg -instcombine -simplifycfg -early-cse -lazy-value-info -jump-threading -correlated-propagation -simplifycfg -instcombine -simplifycfg -reassociate -loops -loop-simplify -lcssa -loop-rotate -licm -lcssa -instcombine -loop-simplifycfg -loop-simplify -aa -loop-accesses -loop-load-elim -lcssa -indvars -loop-idiom -loop-deletion -gvn -sccp -instcombine -lazy-value-info -jump-threading -correlated-propagation -dse -bdce -adce -simplifycfg -instcombine -strip-dead-prototypes -globaldce -constmerge -constprop -instcombine -instcombine -tbaa -basicaa -simplifycfg -early-cse -tbaa -basicaa -globalopt -mem2reg -instcombine -simplifycfg -early-cse -lazy-value-info -jump-threading -correlated-propagation -simplifycfg -instcombine -simplifycfg -reassociate -loops -loop-simplify -lcssa -loop-rotate -licm -lcssa -instcombine -loop-simplifycfg -loop-simplify -aa -loop-accesses -loop-load-elim -lcssa -indvars -loop-idiom -loop-deletion -gvn -sccp -instcombine -lazy-value-info -jump-threading -correlated-propagation -dse -bdce -adce -simplifycfg -instcombine -strip-dead-prototypes -globaldce -constmerge -constprop -instcombine -inst-opt -simple-types -stack-ptr-op-remove -idioms -instcombine -inst-opt -idioms -remove-phi -value-protect -sink -config-path /.../jni/armeabi-v7a/lib.config.json -o /.../jni/armeabi-v7a/lib.bc
Running phase: Initialization ( 0.01s )
Running phase: LLVM ( 0.01s )
Running phase: Providers initialization ( 0.01s )
Running phase: Input binary to LLVM IR decoding ( 0.08s )
Running phase: LLVM ( 61.50s )
Running phase: x86 address spaces optimization ( 61.68s )
Running phase: x87 fpu register analysis ( 61.68s )
Running phase: Main function identification optimization ( 61.68s )
Running phase: Libgcc idioms optimization ( 61.68s )
Running phase: LLVM instruction optimization ( 61.73s )
Running phase: Conditional branch optimization ( 61.81s )
Error: Decompilation to LLVM IR failed
```
Is there any option to make retdec to use less memory, even losing some readability?
Why does it takes so much memory?
It stopped when my system was already using around 15Gib of RAM...

Thanks
Carlos

Contributor guide

No contributing guide indexed for this repository

Research direction

The issue names retdec-decompiler.py and the retdec-bin2llvmir invocation on lib.so; start by reproducing it on Arch Linux with the shown command and inspect the failure after Conditional branch optimization. Done means establishing why LLVM IR decompilation fails under the reported memory use and documenting a supported way to complete it or the relevant limitation.

Written by the indexing model from the issue text.

Assessment

Tech stack
arch-linux, cpp
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.