aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2020-11-05 17:55:53 +0100
committerFlorin Coras <florin.coras@gmail.com>2020-11-05 20:49:03 +0000
commit066cd812374460e5ca8be9a88f494fe3f5bf911e (patch)
tree1a1f5fba83b01099bc9755de20b76360ecbe6c50
parenta94e26db701417ec6955997aea6b93e8bd87c032 (diff)
build: run garbage collection while linking plugins
Ask linker to remove symbols which are not referenced or exported. Type: improvement Change-Id: Iec01fda7ec5b14bab8f36d25c2652bd6fe619961 Signed-off-by: Damjan Marion <damarion@cisco.com>
-rw-r--r--src/cmake/plugin.cmake3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/cmake/plugin.cmake b/src/cmake/plugin.cmake
index 516588c7b8b..2aae89510c1 100644
--- a/src/cmake/plugin.cmake
+++ b/src/cmake/plugin.cmake
@@ -46,6 +46,9 @@ macro(add_vpp_plugin name)
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")
+ target_compile_options (${plugin_name} PRIVATE "-ffunction-sections")
+ target_compile_options (${plugin_name} PRIVATE "-fdata-sections")
+ target_link_libraries (${plugin_name} "-Wl,--gc-sections")
set(deps "")
if(PLUGIN_API_FILES)
list(APPEND deps ${plugin_name}_api_headers)