build: link mock lib with --whole-archive

The unit test mock library contains wrappers that aren't directly
referenced but still need to be kept to allow the final link to work
when they are used via --wrap.  Add the spdk_mock library to the
whole-archive list to prevent it from getting removed.

Fixes build with LTO enabled.

Change-Id: I2c70be7cb517a373178d34026f9980396727f8df
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/401074
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
This commit is contained in:
Daniel Verkamp 2018-02-22 16:46:56 -07:00 committed by Jim Harris
parent 4a93f5d2ad
commit 0e0a489013

View File

@ -48,6 +48,10 @@ SPDK_FILTER_LIB_LIST += $(filter net,$(SPDK_LIB_LIST))
SPDK_FILTER_LIB_LIST += $(filter scsi,$(SPDK_LIB_LIST))
SPDK_FILTER_LIB_LIST += $(filter vhost,$(SPDK_LIB_LIST))
# The unit test mock wrappers need to be wrapped in whole-archive so they don't get
# automatically removed with LTO.
SPDK_FILTER_LIB_LIST += $(filter spdk_mock,$(SPDK_LIB_LIST))
SPDK_WHOLE_ARCHIVE_LIB_LIST = $(sort $(SPDK_FILTER_LIB_LIST))
SPDK_REMAINING_LIB_LIST = $(filter-out $(SPDK_WHOLE_ARCHIVE_LIB_LIST),$(SPDK_LIB_LIST))