Commit Graph

300 Commits

Author SHA1 Message Date
Alessandro Di Federico d40c8d4589 scripts/revng: use 4 spaces to indent 2021-10-18 20:44:58 +02:00
Ivan Krysak 5d66973d18 Allow lines to start with .
This rule, even if it prevents weird line-breaks, prevents us to take
full advantage of both designated initializers and method-chaining
idiom.
2021-09-01 16:36:41 +02:00
Alessandro Di Federico 6d10581163 Whitespace and other minor changes 2021-07-15 13:30:25 +02:00
Ivan Krysak bc8c8f82d2 Prevent separation of 'main' headers into group 0
The prevention mechanism uses a dummy suffix:
'_THIS_SEQUENCE_IS_NEVER_GOING_TO_HAPPEN'.
2021-06-09 18:05:20 +02:00
Ivan Krysak 2e214bc661 Add an include category for Qt headers 2021-06-08 17:03:58 +02:00
Alessandro Di Federico 2b9cbb98ec Introduce --invoke-isolated-functions
This commit ensures that FunctionIsolation and EnforceABI do only
thing. This means that they no longer modify `root`.

Instead, we have a new pass, `invoke-isolated-functions` that needs to
be run after them and replaces the entry point of the functions with
invokes to the isolated functions, possibly with the appropriate
arguments.
2021-04-22 14:45:52 +02:00
Alessandro Di Federico c11065c7fd scripts/revng: handle same library multiple times
The `revng` script looks in several paths for analysis
libraries. However, before this commit, in case multiple versions of the
same library were available, you'd get unpredictable results.

This commit ensures that each library is considered at most once, in the
right order.
2021-04-22 14:45:52 +02:00
Alessandro Di Federico 1e6230b46c scripts/revng: drop print_help 2021-03-16 11:36:32 +01:00
Alessandro Di Federico 58d0509909 scripts/revng: re-engineer option parsing
We now employ `argparse` subparsers.

This commit also fixes a bug involving global options with an argument
(such as `--prefix`) that led the argument to be interpreted as the
subcommand.
2021-03-10 12:29:25 +01:00
Alessandro Di Federico e51145ec99 script/revng: introduce --prefix
`--prefix` enables projects using revng to easily and correctly employ
libraries available in build directories organized in a install
tree-like fashion.
2021-03-08 10:37:32 +01:00
Alessandro Di Federico 4780457c53 Drop StackAnalysis<false> and FBDP
This commit drops support for running StackAnalysis without ABI
analysis. This has been broken for quite some time and a source of slow
downs in (badly) crafted optimization pipelines.
2021-03-06 17:35:30 +01:00
Alessandro Di Federico 6347ef5ba5 scripts/revng: --verbose reports all commands
Previously, we were reporting only those going though `wrap`.
2021-02-24 13:05:57 +01:00
Alessandro Di Federico 27b58695a1 Let FunctionIsolation and EnforceABI use the Model 2021-02-19 09:39:49 +01:00
Alessandro Di Federico 3f0e715b98 Decrease verbosity of tests 2021-02-19 09:39:49 +01:00
Alessandro Di Federico a314fd61ef Import revng-dump-model 2021-02-18 18:46:49 +01:00
Alessandro Di Federico 0ab1b786b6 check-revng-conventions: static in C headers is OK 2021-02-18 18:44:42 +01:00
Filippo Cremonese f05f785023 Fix revng_merge_dynamic installation
This commit also substantially reorganizes the root CMakeLists.txt.
2021-02-10 00:00:38 +01:00
Alessandro Di Federico a655507a0c Use relative paths during builds 2021-01-27 19:46:53 +01:00
Filippo Cremonese c5680b2120 Refactor revng-merge-dynamic
Notable changes:

- Split in multiple files the existing revng-merge-dynamic script
- Add the option to merge additional LOAD segments in the resulting
  binary
- Align the new .dynstr to a 4 byte boundary
- Ensure the last verneed entry is marked as such (vn_next == 0)
- Ensure LOAD PHDRs are listed in ascending order,
  as mandated by ELF spec
2021-01-23 00:41:52 +01:00
Alessandro Di Federico 8549844d36 Set BaseAddress to 0x400000 by default 2021-01-06 17:40:56 +01:00
Alessandro Di Federico 28432e30c1 Disable HARD_FLAGS_* when invoking linker
This commit is necessary in order to avoid using the compiler wrapper
provided by orchestra when developing.
2021-01-06 14:40:27 +01:00
Alessandro Di Federico 3c58c7441b Whitespace changes 2020-12-29 16:14:49 +01:00
Pietro Fezzardi d37aed928e Run check-revng-conventions from outside git dirs
This enables running the check-revng-conventions script as part of the
build and install process, to generate the .clang-format file for
installation and use from other projects.
2020-12-29 16:14:45 +01:00
Pietro Fezzardi 86fcff5db4 check-revng-conventions: improve help 2020-12-29 15:43:34 +01:00
Pietro Fezzardi 13a893e91f check-revng-conventions prints errors on more opts
Options with only a single leading dash were previously recognized as
filenames.
Now they are recognized as options.
2020-12-29 15:43:34 +01:00
Pietro Fezzardi 01118920b0 Add check-revng-conventions option to print config
This option is enabled with --print-clang-format-config.
This is useful to work around the fact that clang-format configuration
is hard-coded in a file.
Using this option is easier to generate a .clang-format file that can be
dropped in single projects to be picked up by IDE.
2020-12-29 15:43:34 +01:00
Pietro Fezzardi 4b4e791afe Add missing option to check-revng-conventions help 2020-12-29 15:43:34 +01:00
Pietro Fezzardi cb2c3c610f Add --help flag to check-revng-conventions 2020-12-29 15:43:32 +01:00
Alessandro Di Federico dab8a2dfae Install clang-format-style-file 2020-11-20 18:06:16 +01:00
Pietro Fezzardi e79dcaf780 check-revng-conventions: enforce #pragma once 2020-11-13 14:12:18 +01:00
Pietro Fezzardi 9869f057b9 Use #pragma once for header include guards 2020-11-13 14:12:18 +01:00
Pietro Fezzardi 1a09c00aa1 check-revng-conventions: regroup header includes 2020-11-13 10:00:27 +01:00
Pietro Fezzardi dc4ab84ad3 Move .clang-format to scripts/
The format file has also been renamed to revng-clang-format-style-file.

The check-revng-conventions scripts now always uses the same format
file, unless otherwise specified with the new option
--use-local-clang-format-file.

In this way, the check-revng-conventions uses the same format in all the
projects by default, but if a project needs to customize it (e.g.
cold-revng which follows the Qt style) it can use the new flag to
fallback to using the local .clang-format file.
2020-11-13 09:59:42 +01:00
Alessandro Di Federico 56b6797f8c scripts/revng: backport shlex.join 2020-11-12 16:21:32 +01:00
Alessandro Di Federico 864bcdc471 scripts/revng: add --lldb 2020-11-12 14:55:57 +01:00
Alessandro Di Federico c7e0361acf scripts/revng: handle empty ASAN_OPTIONS 2020-11-12 14:55:57 +01:00
Alessandro Di Federico 0b15c965ce scripts/revng: use subprocess.Popen directly
We used to use `subprocess.run`, but it's not supported in Pytnon 3.2
(Debian 7).
2020-11-10 10:04:31 +01:00
Alessandro Di Federico ea832c5063 script/revng: print command upon failure 2020-11-02 09:05:03 +01:00
Alessandro Di Federico d1ea87e536 revng-merge-dynamic: make Python 3 compatible
Wow, we no longer need Python 2.
2020-10-30 09:50:03 +01:00
Alessandro Di Federico a08d5a14e0 scripts/revng: fix matching libraries to link 2020-10-23 17:40:13 +02:00
Alessandro Di Federico 2e995fdaa7 Pretty print JSONs 2020-10-22 11:25:31 +02:00
Alessandro Di Federico 3a78fae441 Polyfill for shutil.which 2020-10-21 10:34:35 +02:00
Alessandro Di Federico 0e4c4aad59 Make --use-debug-symbols the default 2020-10-21 10:34:34 +02:00
Alessandro Di Federico 94b28d0514 bin/revng: more robust diff of opt --help output 2020-10-06 16:04:55 +02:00
Alessandro Di Federico 1c2d3e0613 bin/revng: introduce $REAL_ARGV0 2020-10-06 16:04:32 +02:00
Alessandro Di Federico 5a7d4d194a Install check-revng-conventions 2020-10-01 18:17:53 +02:00
Alain Carlucci 9034fcb235 scripts/revng: s/log/log_error/ 2020-10-01 18:17:53 +02:00
Pietro Fezzardi 998d003d10 check-conventions.sh: better match C++ filenames 2020-10-01 18:17:46 +02:00
Pietro Fezzardi 44e47de54c check-conventions.sh: properly set exit status
Before this commit, the exit status was not really taken care of.
Now the exit status is set to error whenever some of the checks fail,
and to success only if all the checks succeed.
2020-10-01 18:17:46 +02:00
Pietro Fezzardi 643a79ede5 check-conventions.sh: add check helper functions
This commit adds two helper functions that run two set of checks:
- `run_clang_format` runs clang format
- `run_revng_checks` runs revng-specific checks

This is a preliminary commit to ease extension of `check-conventions.sh`
so that it can be better integrated with bash scripts and git hooks.
2020-10-01 18:17:45 +02:00