]> git.droids-corp.org - dpdk.git/commitdiff
build: always link whole DPDK static libraries
authorBruce Richardson <bruce.richardson@intel.com>
Tue, 30 Jun 2020 14:14:27 +0000 (15:14 +0100)
committerThomas Monjalon <thomas@monjalon.net>
Wed, 1 Jul 2020 17:30:52 +0000 (19:30 +0200)
To ensure all constructors are included in static build, we need to pass
the --whole-archive flag when linking, which is used with the
"link_whole" meson option. Since we use link_whole for all libs, we no
longer need to track the lib as part of the static dependency, just the
path to the headers for compiling.

After this patch is applied, all DPDK .a files are inside
--whole-archive/--no-whole-archive flags, but external dependencies and
shared libs being linked against remain outside.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Tested-by: Andrzej Ostruszka <aostruszka@marvell.com>
Acked-by: Luca Boccassi <bluca@debian.org>
Acked-by: Sunil Pai G <sunil.pai.g@intel.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
app/test/meson.build
drivers/meson.build
examples/meson.build
lib/meson.build

index 10f23d53b8a2934e06637cc55958cfbbe00d2057..b224d6f2bbdef324d0293c4fc45e0639fa24a37e 100644 (file)
@@ -417,7 +417,7 @@ test_dep_objs += cc.find_library('execinfo', required: false)
 link_libs = []
 link_nodes = []
 if get_option('default_library') == 'static'
-       link_libs = dpdk_drivers
+       link_libs = dpdk_static_libraries + dpdk_drivers
        link_nodes = dpdk_graph_nodes
 endif
 
index 01c860c0683375960241150fb88733cecabaa9c5..e78c76c55c62836d86b6eac6aacfd0c4de716c03 100644 (file)
@@ -200,7 +200,7 @@ foreach class:dpdk_driver_classes
                        shared_dep = declare_dependency(link_with: shared_lib,
                                        include_directories: includes,
                                        dependencies: shared_deps)
-                       static_dep = declare_dependency(link_with: static_lib,
+                       static_dep = declare_dependency(
                                        include_directories: includes,
                                        dependencies: static_deps)
 
index 3b540012f9b441b742391e09b7a24f3a2b54cef3..120eebf7166c593eb5c241d079b473da79f1c5da 100644 (file)
@@ -1,10 +1,10 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017-2019 Intel Corporation
 
-driver_libs = []
+link_whole_libs = []
 node_libs = []
 if get_option('default_library') == 'static'
-       driver_libs = dpdk_drivers
+       link_whole_libs = dpdk_static_libraries + dpdk_drivers
        node_libs = dpdk_graph_nodes
 endif
 
@@ -101,7 +101,7 @@ foreach example: examples
                endif
                executable('dpdk-' + name, sources,
                        include_directories: includes,
-                       link_whole: driver_libs + node_libs,
+                       link_whole: link_whole_libs + node_libs,
                        link_args: dpdk_extra_ldflags,
                        c_args: cflags,
                        dependencies: dep_objs)
index 4cbbca041a8637ebcab4ace32fd2d428ee96be66..c1b9e1633ff5d792614cdf08ad241a9e9acd3772 100644 (file)
@@ -134,7 +134,7 @@ foreach l:libraries
                                        dependencies: static_deps,
                                        include_directories: includes,
                                        install: true)
-                       static_dep = declare_dependency(link_with: static_lib,
+                       static_dep = declare_dependency(
                                        include_directories: includes,
                                        dependencies: static_deps)