`InlineAsm` instructions resemble function calls. You also have to
provide the prototype of the called function. Before this commit, we
were employing `void(void)`, which was wrong since we were passing in a
CSV.
In this commit we add a pointer argument to this prototype, which
prevents an assertion in LLVM from being triggered.
In stack analysis' output, the list of basic blocks composing a function
was not sorted. This lead a test to fail due to the presence of the
`--order` flag when comparing the output.
This commit ensures that this list is ordered, by basic block name.
Update an assertion trying to enforce the fact that `alloca`s copied
from `root` where in the original entry block, while they should be in
the `dummy` entry block.
Additionally, an improvement has been introduced which ensures only one
`alloca` is copied per-function, while, before, we were creating a new
`alloca` for each use in that function.
This commit dismisses the `argparse` library (the only non-runtime C
component of rev.ng) in favor of LLVM's CommandLine library, which
offers several benefits. Among others, now command line arguments can be
easily specified as a global variable, decentralizing their management
and avoiding the long list of arguments in the constructor of singleton
objects such as `CodeGenerator`.
This commit introduces `revng_log`, a macro analagous to `revng_assert`,
which basically allows to have the benefit of the `Logger` class without
having to compute the expression to log if the logger is disabled.
This commit also completely dismisses the `DBG` macro, converting all
the old code to `Logger` + `revng_log`.
In `support.c`, we employ `arch_prctl` to set the value of segment
registers. However glibc, despite providing that function, doesn't
provide its prototype in any header file. This commit declares it,
according to the declaration provided in the man page.
This commit moves around most files. The new directory structure is as
follows:
* `lib/$LIBRARY/`: contains a library, i.e., a set of `.cpp` files used
by multiple libraries/tools.
* `include/revng/$LIBRARY/`: contains the public headers associated to
the library in `lib/$LIBRARY/`.
* `tools/$TOOL/`: directory where all the `.cpp` files (and private
headers) for a tool reside. Currently we have two tools: `revamb` and
`revamb-dump`.
On top of this, all file names are now in camel case.
This commit checks if valgrind headers are available and, if so, defines
a macro. In this way, if the heders are not available,
`valgrindhelper.h` can be aware of this fact and become a no-op.
`FunctionPass` has a static field `ID`. In templated passes, this needs
to be declared in the header file and defined in a `.cpp` file.
This does this, the right way.
This commit suppresses a warning due to the fact that an instance of
`std::integral_context` embedding `dlclose` was missing the `noexcept`
specifier in the type, due to a `decltype` limitation.
This commit introduces a trick for having optional arguments in
macros. This enables the `revng_abort` and `revng_unreachable` macros to
have 0 or 1 argument, and the `revng_assert` and `revng_check` macros to
have 1 or 2 arguments.
Note that, by employing a macro trick (instead of C++ default
arguments), we keep the header compatible with C files.
The macro invoking ``__builtin_assume` was using the expression passed
by the user to the builtin directly. This commit introduces an explicit
cast to `bool`, which is sometimes required.
`clang-format` tends to make fit as much content as possible within a
line, even splitting string literals. However, this is not legal for
`_Pragma` expressions.
This commit disables `clang-format` in the portion of code using
`_Pragma`.
This commit enforces, through `scripts/check-conventions.sh`, the
absence of `assert(false)` and direct calls to `assert`, `abort` and
`llvm_unreachable`.
Certain non-`static` functions were missing prototype declarations,
triggering a compiler warning.
This was due to a missing header or due to a bug in boost.
This commit resolves this situation.
This commit enforces on the whole project the usage of our own assertion
system. This means all calls to `abort`, `assert` and `llvm_unreachable`
have been replaced with calls to `revng_abort`, `revng_assert` and
`revng_unreachable`, respectively.
The error messages, usually expressed as `assert(Condition &&
"Message")` have now been replaced using the second (optional) argument
of `revng_assert`.
Additionally, all the `assert(false)` statements have been replaced with
calls to `revng_abort`. Apart from readibility, this ensures the
compilers is aware of the fact that call will never return.
This change will enable us to drop many statements whose sole purpose
was marking a variable employed in an assertion as used in release
mode. In fact, with the new assertion system this is no longer
necessary.
We used to have a `_` prefix for include guards macros, however,
according to the standard, macros starting with an underscore are
reserved. This commit drops them all.
Include directives are groups by library, the groups should be sorted
from the most general (i.e., the STL) to the most specific (the local
includes).
This commit ensures that Boost includes are before LLVM includes.
This commit introduces a check in `check-conventions.sh` to prevent
committing code denoted by a `// WIP` comment, that are supposed to be
used to remind the developer something has to be changed before
submitting a pull request.
For a long time we had an issue on ARM: the linker would use as the
first page 0x10000. However, on many distros, that matches the first
page that can be mapped (see `/proc/sys/vm/mmap_min_addr`). Therefore,
this shouldn't be a problem, except the fact that the translated program
also needs the preceeding page for the (outer) ELF header.
We used to suggest users to run:
echo 4096 | sudo tee /proc/sys/vm/mmap_min_addr
Now in our tests, we force the text segment page to be at 0x20000,
therefore, this will no longer be necessary.
The symbol handling has been extended to register whether a symbol
represents a function or not. This information is then used to register,
during the global data harvesting phase, all the function symbols and
explicitly mark them through the "FunctionSymbol" `JTReason`.
We use this information during the CFEP harvesting phase to integrate
the information produced by the function boundaries detection with
potential unidentified CFEPs.
This option can be enabled with the `--use-debug-symbols`, which
supersedes `--use-sections`.
From version 0.25 pyelftools changed the API for ENUM_P_TYPE.
This commit wraps the import in a try-except block to handle older and
newer versions gracefully.
This is a very large commit importing the reviewed (and heavily
simplified) stack analysis and the new ABI analysis, which provides
information on the calling convention of each function and so on.
For an overview of the new analyses please consult OVERVIEW.md.
This commit fixes a bug triggered by the fact that the constructor of
the `FilePortion` class was not initializing fields featuring a "native"
type (which are therefore not automatically zero-initialized).
In particular, this bug was triggered when dealing with a dynamic binary
lacking the sections for dynamic relocations.