build: link DPDK libraries with --whole-archive

The upcoming DPDK version adds objects that have no externally
referenced symbols but that must be linked in (specifically, the
default mempool handlers are now assigned by a constructor function).

Link all of the DPDK libraries with -Wl,--whole-archive to fix linking
against a static library build of DPDK.

Change-Id: Ia54b100d81aa7be30a8f4bcad65cc182e91dcc65
Reported-by: Jay Sternberg <jay.e.sternberg@intel.com>
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Daniel Verkamp 2016-07-18 15:12:10 -07:00
parent ec39dd62e7
commit 20c11032ae

View File

@ -161,7 +161,9 @@ DPDK_INC_DIR ?= $(DPDK_DIR_ABS)/include
DPDK_LIB_DIR ?= $(DPDK_DIR_ABS)/lib
DPDK_INC = -I$(DPDK_INC_DIR)
DPDK_LIB = -L$(DPDK_LIB_DIR) -Wl,--start-group -lrte_eal -lrte_mempool -lrte_ring -lrte_timer -Wl,--end-group -Wl,-rpath=$(DPDK_LIB_DIR)
DPDK_LIB = -L$(DPDK_LIB_DIR) -Wl,--start-group -Wl,--whole-archive \
-lrte_eal -lrte_mempool -lrte_ring -lrte_timer \
-Wl,--end-group -Wl,--no-whole-archive -Wl,-rpath=$(DPDK_LIB_DIR)
# librte_malloc was removed after DPDK 2.1. Link this library conditionally based on its
# existence to maintain backward compatibility.
ifneq ($(wildcard $(DPDK_DIR_ABS)/lib/librte_malloc.*),)