avast / avast/retdec

Infrastructure for compilation of C sources to various binary flavours

Open
#130 0 comments 0 reactions 0 assignees View on GitHub
C-scripts C-tests D-help-wanted new-feature Q-discussion
Dominant language
C++
Stars
8.6k
Forks
1k
PR merge metrics
No merged PRs in 30d

Description

Originally, there was a functionality inside `retdec-decompiler.sh` script that allowed to decompile C sources. You gave it a C source, specified architecture, format, compiler, endian, etc., and it compiled the source to such binary, and then decompiled it. It was useful for experiments and testing. It was possible to use this in regression tests as well. However, the decompilation script was not the right place for it. Moreover, in order to work, it needed many compilers, configuration, etc. We decided to remove it prior the open-sourcing to make the script's code cleaner, RetDec's installation process simpler, and to prevent problems with licensing of used compilers.

This kind of thing would however still be extremely useful. But it needs to be done in a proper way:
* New dedicated script for compiling C/C++ sources to selected binary flavour - architecture, bit size, file format, compiler, endian, etc.
* Support all, or as many as possible, combinations that RetDec can handle.
* Maybe some kind of plugin support - make it possible to configure it to use any specified compiler, not just some predetermined set.
* Support Mach-O universal binaries.
* Maybe create a wrapper script around `retdec-decompiler.sh` that would allow compilation and decompilation in one step. Do not modify `retdec-decompiler.sh` itself, it does not make sense to have any kind of compilation in that script.
* Use only compilers with good licenses - so that this infrastructure can be shared and used by anyone.
* Scripts will be in a repository, but scripts will need compilers to work with. These will not be in our repository. Automate the process of getting and configuring them as much as possible. If not possible, write documentation (wiki) with clear instructions how to get it working.

If anyone who reads this have any experience/idea how to make something like this as painless and with minimal effort as possible, please comment.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reviewing retdec-decompiler.sh and the former compilation behavior described in this issue. Define the supported architecture, binary format, compiler, endian, and Mach-O combinations, then investigate how external compilers can be configured and obtained under acceptable licenses. Done means a separate compilation tool and any documentation or wrapper needed to reproduce the supported workflows without modifying retdec-decompiler.sh.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, cpp
Domain
build-system, compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.