nvmf_tgt: add list of libs that need whole-archive

Some of the SPDK libraries only expose constructor functions, so they
would normally be eliminted by the linker.  Add a new list in the
Makefile of libraries that must be linked with --whole-archive (while
still being added to the dependency list for the app).

Change-Id: I7e41a807c945468730fa84f1bdee23dfd6b59358
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Daniel Verkamp 2016-10-27 09:25:27 -07:00
parent bfc8bc87fb
commit 3c3824a3d2

View File

@ -54,6 +54,10 @@ SPDK_LIBS = \
$(SPDK_ROOT_DIR)/lib/rpc/libspdk_rpc.a \
$(SPDK_ROOT_DIR)/lib/jsonrpc/libspdk_jsonrpc.a \
$(SPDK_ROOT_DIR)/lib/json/libspdk_json.a \
# These libraries do not expose any external API, only constructors,
# so they must be linked specially to ensure they are not removed.
SPDK_WHOLE_LIBS = \
$(SPDK_ROOT_DIR)/lib/event/rpc/libspdk_app_rpc.a \
$(SPDK_ROOT_DIR)/lib/log/rpc/libspdk_log_rpc.a \
@ -62,6 +66,8 @@ LIBS += $(BLOCKDEV_MODULES_LINKER_ARGS) \
LIBS += $(SPDK_LIBS)
LIBS += -Wl,--whole-archive $(SPDK_WHOLE_LIBS) -Wl,--no-whole-archive
ifeq ($(CONFIG_RDMA),y)
LIBS += -libverbs -lrdmacm
endif
@ -70,7 +76,7 @@ LIBS += $(ENV_LINKER_ARGS)
all : $(APP)
$(APP) : $(OBJS) $(SPDK_LIBS) $(BLOCKDEV_MODULES) $(LINKER_MODULES) $(ENV_LIBS)
$(APP) : $(OBJS) $(SPDK_LIBS) $(SPDK_WHOLE_LIBS) $(BLOCKDEV_MODULES) $(LINKER_MODULES) $(ENV_LIBS)
$(LINK_C)
clean :