]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
gcc-plugins: Export symbols needed by gcc
authorKees Cook <keescook@chromium.org>
Mon, 31 Oct 2016 17:40:13 +0000 (10:40 -0700)
committerKees Cook <keescook@chromium.org>
Mon, 31 Oct 2016 17:40:13 +0000 (10:40 -0700)
This explicitly exports symbols that gcc expects from plugins.

Based on code from Emese Revfy.

Signed-off-by: Kees Cook <keescook@chromium.org>
scripts/gcc-plugins/cyc_complexity_plugin.c
scripts/gcc-plugins/gcc-common.h
scripts/gcc-plugins/latent_entropy_plugin.c
scripts/gcc-plugins/sancov_plugin.c

index 34df974c6ba3a586435dc0ce313a3986d0031d6c..8af7db06122d21b91667755767d0967824b05694 100644 (file)
@@ -20,7 +20,7 @@
 
 #include "gcc-common.h"
 
-int plugin_is_GPL_compatible;
+__visible int plugin_is_GPL_compatible;
 
 static struct plugin_info cyc_complexity_plugin_info = {
        .version        = "20160225",
@@ -49,7 +49,7 @@ static unsigned int cyc_complexity_execute(void)
 
 #include "gcc-generate-gimple-pass.h"
 
-int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gcc_version *version)
+__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;
index 172850bcd0d9f0eefe6b575f6417ed2397889ccf..950fd2e64bb73b9f261188bba272ea7e7ec10249 100644 (file)
@@ -130,6 +130,7 @@ extern void dump_gimple_stmt(pretty_printer *, gimple, int, int);
 #endif
 
 #define __unused __attribute__((__unused__))
+#define __visible __attribute__((visibility("default")))
 
 #define DECL_NAME_POINTER(node) IDENTIFIER_POINTER(DECL_NAME(node))
 #define DECL_NAME_LENGTH(node) IDENTIFIER_LENGTH(DECL_NAME(node))
index ff1939b804aefe75631431b45e6f7ce80cc133f3..9d3d4adf3be83aef1c45b8beaa46f42d5e0fe1cf 100644 (file)
@@ -77,7 +77,7 @@
 
 #include "gcc-common.h"
 
-int plugin_is_GPL_compatible;
+__visible int plugin_is_GPL_compatible;
 
 static GTY(()) tree latent_entropy_decl;
 
@@ -584,8 +584,8 @@ static void latent_entropy_start_unit(void *gcc_data __unused,
        | TODO_update_ssa
 #include "gcc-generate-gimple-pass.h"
 
-int plugin_init(struct plugin_name_args *plugin_info,
-               struct plugin_gcc_version *version)
+__visible int plugin_init(struct plugin_name_args *plugin_info,
+                         struct plugin_gcc_version *version)
 {
        bool enabled = true;
        const char * const plugin_name = plugin_info->base_name;
index aedd6113cb731bcbbec89620e1e4fb4512cef4b2..7ea0b3f50739e319a8ec57de40654d241e5a78f7 100644 (file)
@@ -21,7 +21,7 @@
 
 #include "gcc-common.h"
 
-int plugin_is_GPL_compatible;
+__visible int plugin_is_GPL_compatible;
 
 tree sancov_fndecl;
 
@@ -86,7 +86,7 @@ static void sancov_start_unit(void __unused *gcc_data, void __unused *user_data)
 #endif
 }
 
-int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gcc_version *version)
+__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;