[dpdk-dev,1/2] mk: move libs that don't dependent PMD libs out of whole archive

Message ID 20170131115950.25660-1-ferruh.yigit@intel.com (mailing list archive)
State Superseded, archived
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel compilation success Compilation OK

Commit Message

Ferruh Yigit Jan. 31, 2017, 11:59 a.m. UTC
  During app build with static library, some libraries wrapped with
--whole-archive compiler flag.

Wrapped libraries are mainly PMD libraries, this is required because PMD
APIs not directly called but run through callbacks registered via
constructor functions.

Also some set of libraries, depends to the PMD libraries needs this,
because of same reason.

But other libraries can be out of this flag, and this saves some size in
final binary.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
 mk/rte.app.mk | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
  

Comments

Thomas Monjalon Jan. 31, 2017, 1:59 p.m. UTC | #1
2017-01-31 11:59, Ferruh Yigit:
> During app build with static library, some libraries wrapped with
> --whole-archive compiler flag.
> 
> Wrapped libraries are mainly PMD libraries, this is required because PMD
> APIs not directly called but run through callbacks registered via
> constructor functions.
> 
> Also some set of libraries, depends to the PMD libraries needs this,
> because of same reason.

All the libraries used by a plugin (any driver) must be in --whole-archive
to ensure that every symbols will be available for the plugin.
This should be explained in this patch (verbatim copy allowed).

> But other libraries can be out of this flag, and this saves some size in
> final binary.
[...]
> +_LDLIBS-$(CONFIG_RTE_LIBRTE_TIMER)          += -lrte_timer
> +_LDLIBS-$(CONFIG_RTE_LIBRTE_EFD)            += -lrte_efd
> +_LDLIBS-$(CONFIG_RTE_LIBRTE_CFGFILE)        += -lrte_cfgfile
> +
>  _LDLIBS-y += --whole-archive

Yes we can move these libraries out of --whole-archive as they are not
used by any driver.

Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
  

Patch

diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index 0d0a970..aeadbc3 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -81,13 +81,14 @@  _LDLIBS-$(CONFIG_RTE_LIBRTE_ACL)            += --no-whole-archive
 _LDLIBS-$(CONFIG_RTE_LIBRTE_JOBSTATS)       += -lrte_jobstats
 _LDLIBS-$(CONFIG_RTE_LIBRTE_POWER)          += -lrte_power
 
+_LDLIBS-$(CONFIG_RTE_LIBRTE_TIMER)          += -lrte_timer
+_LDLIBS-$(CONFIG_RTE_LIBRTE_EFD)            += -lrte_efd
+_LDLIBS-$(CONFIG_RTE_LIBRTE_CFGFILE)        += -lrte_cfgfile
+
 _LDLIBS-y += --whole-archive
 
-_LDLIBS-$(CONFIG_RTE_LIBRTE_TIMER)          += -lrte_timer
 _LDLIBS-$(CONFIG_RTE_LIBRTE_HASH)           += -lrte_hash
-_LDLIBS-$(CONFIG_RTE_LIBRTE_EFD)            += -lrte_efd
 _LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST)          += -lrte_vhost
-
 _LDLIBS-$(CONFIG_RTE_LIBRTE_KVARGS)         += -lrte_kvargs
 _LDLIBS-$(CONFIG_RTE_LIBRTE_MBUF)           += -lrte_mbuf
 _LDLIBS-$(CONFIG_RTE_LIBRTE_NET)            += -lrte_net
@@ -97,7 +98,6 @@  _LDLIBS-$(CONFIG_RTE_LIBRTE_MEMPOOL)        += -lrte_mempool
 _LDLIBS-$(CONFIG_RTE_LIBRTE_RING)           += -lrte_ring
 _LDLIBS-$(CONFIG_RTE_LIBRTE_EAL)            += -lrte_eal
 _LDLIBS-$(CONFIG_RTE_LIBRTE_CMDLINE)        += -lrte_cmdline
-_LDLIBS-$(CONFIG_RTE_LIBRTE_CFGFILE)        += -lrte_cfgfile
 _LDLIBS-$(CONFIG_RTE_LIBRTE_REORDER)        += -lrte_reorder
 
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_BOND)       += -lrte_pmd_bond