Spdk/mk
Jim Harris 2ac1cbbf07 build: link all static libs with --whole-archive
SPDK uses constructor functions for registration functionality
in several different areas - RPCs, bdev modules, event tracing,
etc.  Since these functions are not explicitly referenced, the
linker will remove these constructor functions from the linked
application unless their library is included using the
--whole-archive linker option.

SPDK has tried to minimize the number of libraries linked with
--whole-archive to only those that are necessary.  But there
are still a lot of exceptions that we need to work around.  The
benefit to trying to restrict it is minimal - for example,
an nvmf_tgt binary built before this patch is 4746320 bytes
on my system, but linking all of the libraries with
--whole-archive only increases it to 4784080 bytes - a difference
of less than 1%.

Note that DPDK also links all libraries with --whole-archive by
default.

This will also simplify some upcoming changes around shared
library dependencies - we will be able to blindly use
--whole-archive when linking the shared library as well.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Iab0dbbace06a3d15c835491e55683ab4cf9e53f0
Reviewed-on: https://review.gerrithub.io/434107
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2018-11-28 08:13:46 +00:00
..
nvme.libtest.mk nvme: Add the NVMe over fabrics TCP/IP transport support 2018-11-19 20:36:05 +00:00
spdk.app.mk build: link all static libs with --whole-archive 2018-11-28 08:13:46 +00:00
spdk.common.mk mk: set executable bit only for real libraries 2018-11-02 17:57:49 +00:00
spdk.deps.mk build: add copyright header where missing 2016-11-22 16:41:47 -07:00
spdk.lib.mk mk: add framework for defining inter-lib dependencies 2018-11-01 21:25:55 +00:00
spdk.mock.unittest.mk test/mock: add pthread_self 2017-09-19 17:15:15 -04:00
spdk.modules.mk build: remove sock from SOCK_MODULES_LIST 2018-11-28 08:13:46 +00:00
spdk.subdirs.mk mk: add framework for defining inter-lib dependencies 2018-11-01 21:25:55 +00:00
spdk.unittest.mk build: link all static libs with --whole-archive 2018-11-28 08:13:46 +00:00