diff options
| author | Kees Cook <keescook@chromium.org> | 2017-01-13 17:09:35 -0500 |
|---|---|---|
| committer | Kees Cook <keescook@chromium.org> | 2017-01-13 17:20:03 -0500 |
| commit | 5a45a4c5c3f5e36a03770deb102ca6ba256ff3d7 (patch) | |
| tree | 0764f01c69440d5499223737496bbdecf05e3ca9 /scripts | |
| parent | 8d4973a1c01d4b38871fbc6631e1fdd20e6c9e90 (diff) | |
gcc-plugins: consolidate on PASS_INFO macro
Now that PASS_INFO() exists, use it in the other existing gcc plugins,
instead of always open coding the same thing.
Based on updates to the grsecurity/PaX gcc plugins.
Signed-off-by: Kees Cook <keescook@chromium.org>
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/gcc-plugins/cyc_complexity_plugin.c | 6 | ||||
| -rw-r--r-- | scripts/gcc-plugins/latent_entropy_plugin.c | 8 | ||||
| -rw-r--r-- | scripts/gcc-plugins/sancov_plugin.c | 8 |
3 files changed, 5 insertions, 17 deletions
diff --git a/scripts/gcc-plugins/cyc_complexity_plugin.c b/scripts/gcc-plugins/cyc_complexity_plugin.c index 8af7db06122d..1909ec617431 100644 --- a/scripts/gcc-plugins/cyc_complexity_plugin.c +++ b/scripts/gcc-plugins/cyc_complexity_plugin.c | |||
| @@ -52,12 +52,8 @@ static unsigned int cyc_complexity_execute(void) | |||
| 52 | __visible int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gcc_version *version) | 52 | __visible int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gcc_version *version) |
| 53 | { | 53 | { |
| 54 | const char * const plugin_name = plugin_info->base_name; | 54 | const char * const plugin_name = plugin_info->base_name; |
| 55 | struct register_pass_info cyc_complexity_pass_info; | ||
| 56 | 55 | ||
| 57 | cyc_complexity_pass_info.pass = make_cyc_complexity_pass(); | 56 | PASS_INFO(cyc_complexity, "ssa", 1, PASS_POS_INSERT_AFTER); |
| 58 | cyc_complexity_pass_info.reference_pass_name = "ssa"; | ||
| 59 | cyc_complexity_pass_info.ref_pass_instance_number = 1; | ||
| 60 | cyc_complexity_pass_info.pos_op = PASS_POS_INSERT_AFTER; | ||
| 61 | 57 | ||
| 62 | if (!plugin_default_version_check(version, &gcc_version)) { | 58 | if (!plugin_default_version_check(version, &gcc_version)) { |
| 63 | error(G_("incompatible gcc/plugin versions")); | 59 | error(G_("incompatible gcc/plugin versions")); |
diff --git a/scripts/gcc-plugins/latent_entropy_plugin.c b/scripts/gcc-plugins/latent_entropy_plugin.c index 8ff203ad4809..65264960910d 100644 --- a/scripts/gcc-plugins/latent_entropy_plugin.c +++ b/scripts/gcc-plugins/latent_entropy_plugin.c | |||
| @@ -592,12 +592,6 @@ __visible int plugin_init(struct plugin_name_args *plugin_info, | |||
| 592 | const struct plugin_argument * const argv = plugin_info->argv; | 592 | const struct plugin_argument * const argv = plugin_info->argv; |
| 593 | int i; | 593 | int i; |
| 594 | 594 | ||
| 595 | struct register_pass_info latent_entropy_pass_info; | ||
| 596 | |||
| 597 | latent_entropy_pass_info.pass = make_latent_entropy_pass(); | ||
| 598 | latent_entropy_pass_info.reference_pass_name = "optimized"; | ||
| 599 | latent_entropy_pass_info.ref_pass_instance_number = 1; | ||
| 600 | latent_entropy_pass_info.pos_op = PASS_POS_INSERT_BEFORE; | ||
| 601 | static const struct ggc_root_tab gt_ggc_r_gt_latent_entropy[] = { | 595 | static const struct ggc_root_tab gt_ggc_r_gt_latent_entropy[] = { |
| 602 | { | 596 | { |
| 603 | .base = &latent_entropy_decl, | 597 | .base = &latent_entropy_decl, |
| @@ -609,6 +603,8 @@ __visible int plugin_init(struct plugin_name_args *plugin_info, | |||
| 609 | LAST_GGC_ROOT_TAB | 603 | LAST_GGC_ROOT_TAB |
| 610 | }; | 604 | }; |
| 611 | 605 | ||
| 606 | PASS_INFO(latent_entropy, "optimized", 1, PASS_POS_INSERT_BEFORE); | ||
| 607 | |||
| 612 | if (!plugin_default_version_check(version, &gcc_version)) { | 608 | if (!plugin_default_version_check(version, &gcc_version)) { |
| 613 | error(G_("incompatible gcc/plugin versions")); | 609 | error(G_("incompatible gcc/plugin versions")); |
| 614 | return 1; | 610 | return 1; |
diff --git a/scripts/gcc-plugins/sancov_plugin.c b/scripts/gcc-plugins/sancov_plugin.c index 70f5fe0d590a..9b0b5cbc5b89 100644 --- a/scripts/gcc-plugins/sancov_plugin.c +++ b/scripts/gcc-plugins/sancov_plugin.c | |||
| @@ -89,7 +89,6 @@ static void sancov_start_unit(void __unused *gcc_data, void __unused *user_data) | |||
| 89 | __visible int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gcc_version *version) | 89 | __visible int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gcc_version *version) |
| 90 | { | 90 | { |
| 91 | int i; | 91 | int i; |
| 92 | struct register_pass_info sancov_plugin_pass_info; | ||
| 93 | const char * const plugin_name = plugin_info->base_name; | 92 | const char * const plugin_name = plugin_info->base_name; |
| 94 | const int argc = plugin_info->argc; | 93 | const int argc = plugin_info->argc; |
| 95 | const struct plugin_argument * const argv = plugin_info->argv; | 94 | const struct plugin_argument * const argv = plugin_info->argv; |
| @@ -107,14 +106,11 @@ __visible int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gc | |||
| 107 | }; | 106 | }; |
| 108 | 107 | ||
| 109 | /* BBs can be split afterwards?? */ | 108 | /* BBs can be split afterwards?? */ |
| 110 | sancov_plugin_pass_info.pass = make_sancov_pass(); | ||
| 111 | #if BUILDING_GCC_VERSION >= 4009 | 109 | #if BUILDING_GCC_VERSION >= 4009 |
| 112 | sancov_plugin_pass_info.reference_pass_name = "asan"; | 110 | PASS_INFO(sancov, "asan", 0, PASS_POS_INSERT_BEFORE); |
| 113 | #else | 111 | #else |
| 114 | sancov_plugin_pass_info.reference_pass_name = "nrv"; | 112 | PASS_INFO(sancov, "nrv", 1, PASS_POS_INSERT_BEFORE); |
| 115 | #endif | 113 | #endif |
| 116 | sancov_plugin_pass_info.ref_pass_instance_number = 0; | ||
| 117 | sancov_plugin_pass_info.pos_op = PASS_POS_INSERT_BEFORE; | ||
| 118 | 114 | ||
| 119 | if (!plugin_default_version_check(version, &gcc_version)) { | 115 | if (!plugin_default_version_check(version, &gcc_version)) { |
| 120 | error(G_("incompatible gcc/plugin versions")); | 116 | error(G_("incompatible gcc/plugin versions")); |
