Implement the pruning of container caches (resume directory) when there
is a mismatch between the current revng components' hash and the saved
one. This functionality is activated via `-check-components-version`.
The detection of directories in S3StorageClient was flawed as it did not
account for files with a suffix. This commit forces the use of a `/` at
the end to guarantee that the matched path is a sub-{file,directory}.
The `GzipTarWriter::append` method erroneously added an empty block of
padding when an empty file (size == 0) was supplied. This corrects the
algorithm by excluding 512 as a valid padding size.
Before this commit, the method could partly fail in moving the edge
target even in legitimate scenarios, because of a bug in how it fixed up
the Successors link in the edge source.
This commit fixes the bug.
Explicitly casting to uint8_t has the semantics of truncating, in case
the value being casted is larger than 8 bits.
Avoiding the cast default to regular C behavior, where every non-zero
integer is considered true.
This enables to generate LocalVariables with nicer-looking types,
learning from Stores that write values into them.
RemoveLoadStore had to be updated to handle cstringLiteral as a corner
case.
In the future, we can probably treat cstringLiteral homogeneously if we
change MakeSegmentRefs so to inject AddressOf around cstringLiteral, and
change cstringLiteral itself to have reference semantics.
The pass has always been redundant, only used to simplify the IR and not
for anything useful.
Recently, after the work done to tidy up casts, it has started to give
problems: turns out ModelGEPRefs without indices are not always
redundant, and removing them can cause `trunc` instructions that then
end pessimizing the C code generation.
This commit drops the pass altogether.
Improve the way in which we connect the non reachable `JumpTargets` when
rebuilding the dispatcher for non `SemanticsPreserving` `CFGForm`s.
When connecting group of jump targets that are not currently reachable
from the entry dispatcher, we elect the jump target with the lowest
program counter value, as the one to be connected to the dispatcher.
We also mark the jump targets now transitively reachables from the
elected one, as reachable, so to avoid adding other unnecessary edges
from the dispatcher.
Before this commit, the code was making a couple of broken assumptions on
OpaqueExtractValues
- that OpaqueExtractValues were always ordered in the same way as struct
fields (e.g. the OpaqueExtractValue extracting field 0 was always the
first use of the struct-typed value it was extracting from)
- that there was always one and exactly one OpaqueExtractValue for each
field index in the struct
This commit fixes the issue, while reusing available facilities for
dealing with OpaqueExtractValues.
The invalidation map passed by callers of pipeline invalidate was
assumed to be always empty. This requirement has been relaxed.
The pipe invalidation cache now checks that what must be removed is
actually present. This is relevant for targets that are killed by later
pipes before the end of the step.
Replace the stub implementation of invalidation with the proper
implementation. A ReadPathCache is added to each global so that it can
keep tracks of what target are associated to which read paths.
This commit heavily reworks how we handle returned values, making things
a bit more elegant.
Apart from this, it fixes how were handling types that on the model are
aggregates but were being returned via registers on the IR.
DetectStackSize only updates RawFunctionTypes. However it must also
handle CABIFunctionTypes, when met in a call site. This commit employs
abi::FunctionType::Layout to fix the situation.
This commit:
1. Introduces an alloca for stack arguments of a function. This enables
us to "write" to stack argument. In order to do so, we simply map the
relevant stack portion to the alloca that, since it's a memory
object, can be `load`'d from and `store`'d to.
Note that `llvm::Argument`s are always scalar since if the original
argument was an aggregate, it would have been passed as a pointer,
which is a scalar.
Note also that previously we were using scalar arguments as if they
were *pointers* to the stack arguments. This commit fixes that too
(and updates the tests accordingly).
2. Introduces an alloca for *scalar* stack arguments of a call site.
The alloca is then mapped to the corresponding part of the stack.
Previously, there was no redirection and negative offsets from
`_stack_frame` would pop up.
This commit splits in two stages handleCallSite and
handleMemoryAccess. Running the latter after all the call sites have
been handled, is necessary in order to properly replace certain memory
accesses targeting stack arguments of a call site.
We used to manually purge `raise_exception_helper`, which has now been
split in `_abort` and `_unreachable`. We want to purge the latter but
keep the former. The latter is marked as `Exceptional`, so this commit
updates the logic to purge all functions with `Exceptional` tag.
Also, due to the inability of the backend to emit globals of `struct`
type, we ban `set_PlainMetaAddress`, which is not critical for
decompiled code.
This commit switches the approach with which we run the ABI analyses: we
now run them until we reach a fixed point. This enables proper
interprocedural propagation of arguments and return values.
Basically, we now inject reads before call sites, so that, if a function
immediately calls another one, the arguments of the callee are
propagated to the caller.
This commit also updates the logic with which we propagate function
prototypes (and names) to callers. The main advantage of this, is that
function wrappers (in particular, PLT entries) now have the same name as
the function they wrap.