From e29c6fe133c48a88ec829ad741304a3356766814 Mon Sep 17 00:00:00 2001 From: Seth Howell Date: Thu, 8 Aug 2019 17:46:56 -0700 Subject: [PATCH] mk: force --no-as-needed for spdk libs. When building shared libs, we specifically don't set the --as-needed flag so that we still link against libraries that have constructor functions. LD reports on its man page that the default behavior is equivalent to --no-as-needed. For RHEL based distros like fedora and centos this works fine. While the LD man page shipped with ubuntu distributions also states that --no-as-needed is the default, they don't respect that behavior and do --as-needed linking unless you force them with --no-as-needed. Change-Id: I914ab849323de198af5c5e53fffb1f57fcaff5fe Signed-off-by: Seth Howell Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/464621 Tested-by: SPDK CI Jenkins Reviewed-by: Ben Walker Reviewed-by: Jim Harris --- lib/env_dpdk/env.mk | 2 +- mk/spdk.app_vars.mk | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/env_dpdk/env.mk b/lib/env_dpdk/env.mk index b9e370ca0e..eab339651f 100644 --- a/lib/env_dpdk/env.mk +++ b/lib/env_dpdk/env.mk @@ -116,7 +116,7 @@ ENV_CFLAGS = $(DPDK_INC) -Wno-deprecated-declarations ENV_CXXFLAGS = $(ENV_CFLAGS) ENV_DPDK_FILE = $(call spdk_lib_list_to_static_libs,env_dpdk) ENV_LIBS = $(ENV_DPDK_FILE) $(DPDK_LIB) -ENV_LINKER_ARGS = $(ENV_DPDK_FILE) -Wl,--whole-archive $(DPDK_LIB) -Wl,--no-whole-archive +ENV_LINKER_ARGS = $(ENV_DPDK_FILE) -Wl,--whole-archive,--no-as-needed $(DPDK_LIB) -Wl,--no-whole-archive ifeq ($(CONFIG_IPSEC_MB),y) ENV_LINKER_ARGS += -lIPSec_MB -L$(IPSEC_MB_DIR) diff --git a/mk/spdk.app_vars.mk b/mk/spdk.app_vars.mk index 854a6a89de..fb1b3b1e34 100644 --- a/mk/spdk.app_vars.mk +++ b/mk/spdk.app_vars.mk @@ -35,6 +35,7 @@ SPDK_LIB_FILES = $(call spdk_lib_list_to_static_libs,$(SPDK_LIB_LIST)) SPDK_LIB_LINKER_ARGS = \ -L$(SPDK_ROOT_DIR)/build/lib \ -Wl,--whole-archive \ + -Wl,--no-as-needed \ $(SPDK_LIB_LIST:%=-lspdk_%) \ -Wl,--no-whole-archive