misc: don't export symbols from plugins

Type: improvement
Change-Id: I2a176fe2871d2e54b010bffc4f1f7a3616f0c455
Signed-off-by: Damjan Marion <damarion@cisco.com>
diff --git a/src/cmake/plugin.cmake b/src/cmake/plugin.cmake
index 1bcff55..516588c 100644
--- a/src/cmake/plugin.cmake
+++ b/src/cmake/plugin.cmake
@@ -45,6 +45,7 @@
   endforeach()
   add_library(${plugin_name} SHARED ${PLUGIN_SOURCES} ${api_includes})
   set_target_properties(${plugin_name} PROPERTIES NO_SONAME 1)
+  target_compile_options(${plugin_name} PRIVATE "-fvisibility=hidden")
   set(deps "")
   if(PLUGIN_API_FILES)
     list(APPEND deps ${plugin_name}_api_headers)
diff --git a/src/plugins/acl/lookup_context.c b/src/plugins/acl/lookup_context.c
index 5344975..ed9b2c7 100644
--- a/src/plugins/acl/lookup_context.c
+++ b/src/plugins/acl/lookup_context.c
@@ -359,7 +359,8 @@
   return &acl_main;
 }
 
-clib_error_t *acl_plugin_methods_vtable_init(acl_plugin_methods_t *m)
+__clib_export clib_error_t *
+acl_plugin_methods_vtable_init(acl_plugin_methods_t *m)
 {
   m->p_acl_main = &acl_main;
 #define _(name) m->name = acl_plugin_ ## name;
diff --git a/src/plugins/dpdk/main.c b/src/plugins/dpdk/main.c
index ea0348a..ef93a22 100644
--- a/src/plugins/dpdk/main.c
+++ b/src/plugins/dpdk/main.c
@@ -99,7 +99,7 @@
 /* *INDENT-ON* */
 
 
-clib_error_t *
+__clib_export clib_error_t *
 dpdk_early_init (vlib_main_t *vm)
 {
   int fd = -1;
diff --git a/src/plugins/http_static/static_server.c b/src/plugins/http_static/static_server.c
index 4db3ead..b61243a 100644
--- a/src/plugins/http_static/static_server.c
+++ b/src/plugins/http_static/static_server.c
@@ -521,7 +521,7 @@
 
 /** \brief Register a builtin GET or POST handler
  */
-void http_static_server_register_builtin_handler
+__clib_export void http_static_server_register_builtin_handler
   (void *fp, char *url, int request_type)
 {
   http_static_server_main_t *hsm = &http_static_server_main;
diff --git a/src/plugins/ioam/lib-trace/trace_util.c b/src/plugins/ioam/lib-trace/trace_util.c
index af92513..d935543 100644
--- a/src/plugins/ioam/lib-trace/trace_util.c
+++ b/src/plugins/ioam/lib-trace/trace_util.c
@@ -20,7 +20,7 @@
 #include "trace_util.h"
 #include "trace_config.h"
 
-trace_main_t trace_main;
+__clib_export trace_main_t trace_main;
 
 static int
 trace_profile_cleanup (trace_profile * profile)
diff --git a/src/plugins/l2e/l2e.c b/src/plugins/l2e/l2e.c
index 01f7788..791c3f6 100644
--- a/src/plugins/l2e/l2e.c
+++ b/src/plugins/l2e/l2e.c
@@ -27,7 +27,7 @@
  */
 static const l2_emulation_t ezero = { };
 
-void
+__clib_export void
 l2_emulation_enable (u32 sw_if_index)
 {
   l2_emulation_main_t *em = &l2_emulation_main;
@@ -49,7 +49,7 @@
 }
 
 
-void
+__clib_export void
 l2_emulation_disable (u32 sw_if_index)
 {
   l2_emulation_main_t *em = &l2_emulation_main;
diff --git a/src/vlib/unix/plugin.h b/src/vlib/unix/plugin.h
index 4beae43..ae15e5d 100644
--- a/src/vlib/unix/plugin.h
+++ b/src/vlib/unix/plugin.h
@@ -150,7 +150,7 @@
 #define VLIB_PLUGIN_REGISTER() \
   vlib_plugin_registration_t vlib_plugin_registration \
   CLIB_NOSANITIZE_PLUGIN_REG_SECTION \
-  __attribute__((__section__(".vlib_plugin_registration")))
+  __clib_export __clib_section(".vlib_plugin_registration")
 
 /* Call a plugin init function: used for init function dependencies. */
 #define vlib_call_plugin_init_function(vm,p,x)                  \