Commit 3c3824a3 authored by Daniel Verkamp's avatar Daniel Verkamp
Browse files

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: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent bfc8bc87
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -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 :