[dpdk-dev] [PATCH 10/19] make: include whole archive on static link

Neil Horman nhorman at tuxdriver.com
Thu Apr 10 22:50:00 CEST 2014


This happens automatically on dyanmic linking, but when linking an archive we
need to to include the whole archive to make sure we call all the constructors.
Not doing this causes them to be discarded due to the fact theres no symbolic
reference connecting the pmds to the application.

Signed-off-by: Neil Horman <nhorman at tuxdriver.com>
---
 mk/rte.app.mk | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index 2f2ff16..41eab08 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -198,6 +198,8 @@ endif
 ifeq ($(LINK_USING_CC),1)
 comma := ,
 LDLIBS := $(addprefix -Wl$(comma),$(LDLIBS))
+LDLIBS := -Wl$(comma)--whole-archive $(LDLIBS)
+LDLIBS += -Wl,--no-whole-archive -Wl,-z -Wl,muldefs
 LDFLAGS := $(addprefix -Wl$(comma),$(LDFLAGS))
 override EXTRA_LDFLAGS := $(addprefix -Wl$(comma),$(EXTRA_LDFLAGS))
 O_TO_EXE = $(CC) $(CFLAGS) $(LDFLAGS_$(@)) \
-- 
1.8.3.1



More information about the dev mailing list