@@ -123,6 +123,10 @@ ifneq (,$(findstring y,$(MVEP-y)))
_LDLIBS-y += -lrte_common_mvep -L$(LIBMUSDK_PATH)/lib -lmusdk
endif
+# Bus devices use constructors to register and therefore
+# need to be always linked in (--whole-archive already enabled)
+_LDLIBS-y += --no-as-needed
+
ifeq ($(CONFIG_RTE_LIBRTE_DPAA_BUS),y)
_LDLIBS-$(CONFIG_RTE_LIBRTE_COMMON_DPAAX) += -lrte_common_dpaax
endif
@@ -137,6 +141,9 @@ ifeq ($(CONFIG_RTE_EAL_VFIO),y)
_LDLIBS-$(CONFIG_RTE_LIBRTE_FSLMC_BUS) += -lrte_bus_fslmc
endif
+# drivers are as-needed
+_LDLIBS-y += --as-needed
+
ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),n)
# plugins (link only if static libraries)
If DPDK is built as a shared library, then any application linked with rte.app.mk will not find any buses (including PCI devices). This is because the linker will not call the initializers of the bus libraries since they are not directly called by application or EAL. Bugzilla ID: 333 Fixes: c752998b5e2e ("pci: introduce library and driver") Cc: stable@dpdk.org Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- mk/rte.app.mk | 7 +++++++ 1 file changed, 7 insertions(+)