Commit da7389ac authored by Kees Cook's avatar Kees Cook

gcc-plugins: Export symbols needed by gcc

This explicitly exports symbols that gcc expects from plugins.

Based on code from Emese Revfy.
Signed-off-by: default avatarKees Cook <keescook@chromium.org>
parent 07d9a380
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#include "gcc-common.h" #include "gcc-common.h"
int plugin_is_GPL_compatible; __visible int plugin_is_GPL_compatible;
static struct plugin_info cyc_complexity_plugin_info = { static struct plugin_info cyc_complexity_plugin_info = {
.version = "20160225", .version = "20160225",
...@@ -49,7 +49,7 @@ static unsigned int cyc_complexity_execute(void) ...@@ -49,7 +49,7 @@ static unsigned int cyc_complexity_execute(void)
#include "gcc-generate-gimple-pass.h" #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; const char * const plugin_name = plugin_info->base_name;
struct register_pass_info cyc_complexity_pass_info; struct register_pass_info cyc_complexity_pass_info;
......
...@@ -130,6 +130,7 @@ extern void dump_gimple_stmt(pretty_printer *, gimple, int, int); ...@@ -130,6 +130,7 @@ extern void dump_gimple_stmt(pretty_printer *, gimple, int, int);
#endif #endif
#define __unused __attribute__((__unused__)) #define __unused __attribute__((__unused__))
#define __visible __attribute__((visibility("default")))
#define DECL_NAME_POINTER(node) IDENTIFIER_POINTER(DECL_NAME(node)) #define DECL_NAME_POINTER(node) IDENTIFIER_POINTER(DECL_NAME(node))
#define DECL_NAME_LENGTH(node) IDENTIFIER_LENGTH(DECL_NAME(node)) #define DECL_NAME_LENGTH(node) IDENTIFIER_LENGTH(DECL_NAME(node))
......
...@@ -77,7 +77,7 @@ ...@@ -77,7 +77,7 @@
#include "gcc-common.h" #include "gcc-common.h"
int plugin_is_GPL_compatible; __visible int plugin_is_GPL_compatible;
static GTY(()) tree latent_entropy_decl; static GTY(()) tree latent_entropy_decl;
...@@ -584,8 +584,8 @@ static void latent_entropy_start_unit(void *gcc_data __unused, ...@@ -584,8 +584,8 @@ static void latent_entropy_start_unit(void *gcc_data __unused,
| TODO_update_ssa | TODO_update_ssa
#include "gcc-generate-gimple-pass.h" #include "gcc-generate-gimple-pass.h"
int plugin_init(struct plugin_name_args *plugin_info, __visible int plugin_init(struct plugin_name_args *plugin_info,
struct plugin_gcc_version *version) struct plugin_gcc_version *version)
{ {
bool enabled = true; bool enabled = true;
const char * const plugin_name = plugin_info->base_name; const char * const plugin_name = plugin_info->base_name;
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#include "gcc-common.h" #include "gcc-common.h"
int plugin_is_GPL_compatible; __visible int plugin_is_GPL_compatible;
tree sancov_fndecl; tree sancov_fndecl;
...@@ -86,7 +86,7 @@ static void sancov_start_unit(void __unused *gcc_data, void __unused *user_data) ...@@ -86,7 +86,7 @@ static void sancov_start_unit(void __unused *gcc_data, void __unused *user_data)
#endif #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; int i;
struct register_pass_info sancov_plugin_pass_info; struct register_pass_info sancov_plugin_pass_info;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment