Commit Graph

3168 Commits

Author SHA1 Message Date
Alessandro Di Federico d1bc0405dc LinkForTranslation: add .note.GNU-stack
In LinkForTranslation we create an object file for each segment in the
input binary. In order to do this, we use `objcopy`. However, an object
file without a `.note.GNU-stack` section will trigger the linked program
to have the stack executable, which we don't want.

This led the linker to complain as follows:

    ld.bfd: warning: object.o: missing .note.GNU-stack section implies
    executable stack
    ld.bfd: NOTE: This behaviour is deprecated and will be removed in a
    future version of the linker

This commit adds to the `objcopy` invocation a flag to create the
`.note.GNU-stack` section.
2022-09-21 18:39:25 +02:00
Djordje Todorovic 5559d8431b Introduce fix-model model pass 2022-09-21 18:37:36 +02:00
Alvise de Faveri 999df25246 Add revng model export type-graph tool
This tools dumps a type, a function or an entire type-system to a
dot file,representing dependencies between types as edges.
2022-09-19 08:35:06 +02:00
Pietro Fezzardi 12ab345848 SubGraph: make getEntryNode more const-correct
GraphTraits<SubGraph<InnerNodeType>>::getEntryNode now takes a const
GraphType &, not just a GraphType &.
2022-09-19 08:33:45 +02:00
Pietro Fezzardi e47733eb66 DLA: new Middleend pipeline 2022-09-15 11:47:11 +02:00
Pietro Fezzardi f0a1903201 DLA: add ArrangeAccessesHierarchically dla::Step 2022-09-15 11:47:11 +02:00
Pietro Fezzardi 8ff8a795e4 DLA: Add DecomposeStridedEdges dla::Step 2022-09-14 11:33:37 +02:00
Pietro Fezzardi 47c06350ca FieldSizeComputation: add #include <cstdint> 2022-09-12 17:52:53 +02:00
Pietro Fezzardi 695c1529db dla::LayoutTypeSystem add eraseEdge method 2022-09-12 17:52:50 +02:00
Pietro Fezzardi 38e4658762 Add LayoutTypeSystem::NeighborIterator type 2022-09-12 12:28:48 +02:00
Pietro Fezzardi f83e513eb7 DLA: fix bug in DeduplicateFields
A logic bug caused the wrong detection of nodes with many fields.
As a result, the field deduplication was only executed on a subset of
the real candidates.
This caused the following two problems.
- Degradation of the quality of the results, i.e. unions that could be
  deduplicated were not deduplicated.
- Failing assertions in rare cases.
  The algorithm assumes that if it's looking at the children
  (C1, ..., Cn) of node A to be deduplicated, then all (C1, ..., Cn)
  have beed already visited, hence they don't have children that should
  be duplicated because they would have been deduplicated already, when
  looking at (C1, ..., Cn). The bug possibly caused to miss the
  deduplication of children of Ci (for some i) causing assertions to
  fail when looking at A to deduplicate (C1, ..., Cn).
2022-09-12 12:14:52 +02:00
Giacomo Vercesi 37caa91e6d Ranks: fix Rank keys
Use model::Function::Key for the Function rank instead of the naked
MetaAddress as it allows forward-compatibility if the model::Function
key is ever changed.

Use a std::tuple<uint64_t> for TypeField as it's the current type for
{Struct,Enum,Union}Field.key()
2022-09-01 17:46:57 +02:00
Giacomo Vercesi e1adce0f69 PTMLIndentedOstream: rework write_impl
Previous implementation would write '\n' if the buffer ended with
'\n\n'.
2022-09-01 17:46:04 +02:00
Giacomo Vercesi 8e996d2394 Output PTML in revng-c
Change the output of the backend of revng-c to PTML
2022-09-01 16:59:29 +02:00
Alessandro Di Federico 74d912c01f Segregate: fix failure if nothing needs to be done
In case no model::Function needs to be acted upon, an assertion was
failing.
2022-09-01 15:10:02 +02:00
Alessandro Di Federico b0bfa5db4a CollectCFG: nop if root is absent 2022-09-01 14:58:50 +02:00
Pietro Fezzardi eb16f4141a MakeModelGEP: remove too strict assertion 2022-09-01 14:31:19 +02:00
Alessandro Di Federico 40f1e06135 CFGAnalyzer, opaque_true: use inaccessiblememonly
This prevents EarlyCSE from deduplicating calls to this functions with
the same arguments, which has unintend effects and leads to loss of
code.
2022-09-01 11:32:42 +02:00
Alessandro Di Federico df34095721 Minor changes 2022-09-01 11:32:12 +02:00
Massimo Fioravanti 9a4e97d8ea Pipeline: handle having 0 functions 2022-08-31 18:07:47 +02:00
Alessandro Di Federico 712585be48 CodeGenerator: handle PTC translation failure 2022-08-31 18:07:47 +02:00
Alessandro Di Federico d8230c3e9a revng-pipeline: improve error reporting 2022-08-31 18:07:47 +02:00
Alessandro Di Federico f93eefda66 replaceAll: move to STLExtras.h 2022-08-31 18:07:47 +02:00
Djordje Todorovic 2abd250ae0 model: Skip nameless dyn functions in PE 2022-08-31 18:07:47 +02:00
Alessandro Di Federico cd7429d100 pipes::Lift: fail if Architecture is Invalid 2022-08-29 15:13:25 +02:00
Massimo Fioravanti 9ce7b1e527 Drop Pipe suffix from pipe names 2022-08-29 14:45:45 +02:00
Massimo Fioravanti 633f49c1ef Introduce dedicated namespace for kinds and ranks 2022-08-29 14:44:53 +02:00
Massimo Fioravanti 915c083661 Pipes: reorganize who defines pipes 2022-08-29 14:44:35 +02:00
Massimo Fioravanti 2a996ef666 Pipeline: allow analyses to fail 2022-08-29 14:44:10 +02:00
Massimo Fioravanti 7e75a1a4b8 Pipeline: introduce preconditions for pipes 2022-08-29 14:44:02 +02:00
Massimo Fioravanti 6b099c57e8 Pipeline: introduce options for analyses 2022-08-29 14:43:25 +02:00
Alessandro Di Federico 178b58b9d5 ImportBinary: turn into an analysis 2022-08-26 09:50:42 +02:00
Alessandro Di Federico 38d91a793b AddPrimitiveTypes: turn into an analysis 2022-08-26 09:50:42 +02:00
Massimo Fioravanti 14d4d4e11a Rename pipes contained in namespace pipes 2022-08-25 18:17:46 +02:00
Massimo Fioravanti 370b081c0e Moved kinds to kinds namespace 2022-08-25 17:09:15 +02:00
Alessandro Di Federico 1d91ed9beb tuple_tree_generator: make C++ just a regular backend
The `tuple_tree_generator` component was still heavily treating C++ as a
special citizen.
This commit normalizes the situation.
2022-08-11 16:20:42 +02:00
Massimo Fioravanti d250d43ee4 revng-pipeline: factor out common CLI options
Common CLI options that were used by multiple tools and have now been
isolated into a single include file to be used before declaring main.
2022-08-10 09:49:24 +02:00
Massimo Fioravanti 261a114d6d Pipeline: corner-case fix in backward deduction 2022-08-10 09:49:24 +02:00
Massimo Fioravanti 0bb115a4f3 revng-pipeline: rework syntax for targets
Was: step:container:p/a/t/h:kind
Now: step/container/p/a/t/h:kind
2022-08-10 09:49:24 +02:00
Massimo Fioravanti 4cd5abe2b0 revng-pipeline: introduce --produce and --analyze 2022-08-10 09:49:24 +02:00
Massimo Fioravanti 96bd5835d8 revng-pipeline: rework file-to-container syntax 2022-08-10 09:49:24 +02:00
Massimo Fioravanti 85a9c9637f revng-pipeline: rework logging 2022-08-10 09:49:24 +02:00
Massimo Fioravanti 4abc358815 Add pipes required early outs on empty inputs 2022-08-09 12:26:01 +02:00
Pietro Fezzardi a60fa30d5b DLA/Frontend: handle indirect calls prototypes 2022-08-09 08:02:10 +02:00
Pietro Fezzardi c1641afeb6 Add LayoutTypeSystem::createArtificialLayoutTypes
This helper allows creating many artifical types at once.
2022-08-09 08:02:10 +02:00
Pietro Fezzardi f8bc4a2e77 Move isCallToIsolatedFunction to FunctionTags.h 2022-08-09 08:02:10 +02:00
Alessandro Di Federico e23656fa5f MakeSegmentRef: ignore 128-bit integer constants 2022-08-08 16:22:14 +02:00
Alessandro Di Federico d9d45fa79b ModelToHeader: fake functions no longer exist 2022-08-08 16:22:14 +02:00
Alessandro Di Federico 662cbfda84 Minor changes 2022-08-08 16:22:14 +02:00
Alessandro Di Federico 1cf9a06009 EnforceABI: use read-only model 2022-08-08 13:55:36 +02:00