]> git.baikalelectronics.ru Git - kernel.git/commitdiff
gcc-plugins: consolidate on PASS_INFO macro
authorKees Cook <keescook@chromium.org>
Fri, 13 Jan 2017 22:09:35 +0000 (14:09 -0800)
committerKees Cook <keescook@chromium.org>
Fri, 13 Jan 2017 22:20:03 +0000 (14:20 -0800)
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>
scripts/gcc-plugins/cyc_complexity_plugin.c
scripts/gcc-plugins/latent_entropy_plugin.c
scripts/gcc-plugins/sancov_plugin.c

index 8af7db06122d21b91667755767d0967824b05694..1909ec6174315ee982df9f5821edb99b7c5c0156 100644 (file)
@@ -52,12 +52,8 @@ static unsigned int cyc_complexity_execute(void)
 __visible int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gcc_version *version)
 {
        const char * const plugin_name = plugin_info->base_name;
-       struct register_pass_info cyc_complexity_pass_info;
 
-       cyc_complexity_pass_info.pass                           = make_cyc_complexity_pass();
-       cyc_complexity_pass_info.reference_pass_name            = "ssa";
-       cyc_complexity_pass_info.ref_pass_instance_number       = 1;
-       cyc_complexity_pass_info.pos_op                         = PASS_POS_INSERT_AFTER;
+       PASS_INFO(cyc_complexity, "ssa", 1, PASS_POS_INSERT_AFTER);
 
        if (!plugin_default_version_check(version, &gcc_version)) {
                error(G_("incompatible gcc/plugin versions"));
index 8ff203ad48093f57fccf04bb9d7c9b9e1952603b..65264960910d36878c5b8be4213638e09d3af728 100644 (file)
@@ -592,12 +592,6 @@ __visible int plugin_init(struct plugin_name_args *plugin_info,
        const struct plugin_argument * const argv = plugin_info->argv;
        int i;
 
-       struct register_pass_info latent_entropy_pass_info;
-
-       latent_entropy_pass_info.pass           = make_latent_entropy_pass();
-       latent_entropy_pass_info.reference_pass_name            = "optimized";
-       latent_entropy_pass_info.ref_pass_instance_number       = 1;
-       latent_entropy_pass_info.pos_op         = PASS_POS_INSERT_BEFORE;
        static const struct ggc_root_tab gt_ggc_r_gt_latent_entropy[] = {
                {
                        .base = &latent_entropy_decl,
@@ -609,6 +603,8 @@ __visible int plugin_init(struct plugin_name_args *plugin_info,
                LAST_GGC_ROOT_TAB
        };
 
+       PASS_INFO(latent_entropy, "optimized", 1, PASS_POS_INSERT_BEFORE);
+
        if (!plugin_default_version_check(version, &gcc_version)) {
                error(G_("incompatible gcc/plugin versions"));
                return 1;
index 70f5fe0d590a3b639e8c98ef045acd640efadf0c..9b0b5cbc5b899be4ddbafe2ce5f3ec5ab0743b6c 100644 (file)
@@ -89,7 +89,6 @@ static void sancov_start_unit(void __unused *gcc_data, void __unused *user_data)
 __visible int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gcc_version *version)
 {
        int i;
-       struct register_pass_info sancov_plugin_pass_info;
        const char * const plugin_name = plugin_info->base_name;
        const int argc = plugin_info->argc;
        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
        };
 
        /* BBs can be split afterwards?? */
-       sancov_plugin_pass_info.pass                            = make_sancov_pass();
 #if BUILDING_GCC_VERSION >= 4009
-       sancov_plugin_pass_info.reference_pass_name             = "asan";
+       PASS_INFO(sancov, "asan", 0, PASS_POS_INSERT_BEFORE);
 #else
-       sancov_plugin_pass_info.reference_pass_name             = "nrv";
+       PASS_INFO(sancov, "nrv", 1, PASS_POS_INSERT_BEFORE);
 #endif
-       sancov_plugin_pass_info.ref_pass_instance_number        = 0;
-       sancov_plugin_pass_info.pos_op                          = PASS_POS_INSERT_BEFORE;
 
        if (!plugin_default_version_check(version, &gcc_version)) {
                error(G_("incompatible gcc/plugin versions"));