patch 'dev: export driver information with MSVC' has been queued to stable release 24.11.9

luca.boccassi at gmail.com luca.boccassi at gmail.com
Thu Nov 5 17:43:22 CET 2026


Hi,

FYI, your patch has been queued to stable release 24.11.9

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 11/07/26. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://github.com/bluca/dpdk-stable

This queued commit can be viewed at:
https://github.com/bluca/dpdk-stable/commit/13ce0684a6f93b143861f878e1ace9dff262e650

Thanks.

Luca Boccassi

---
>From 13ce0684a6f93b143861f878e1ace9dff262e650 Mon Sep 17 00:00:00 2001
From: Andre Muezerie <andremue at linux.microsoft.com>
Date: Wed, 4 Jun 2025 06:50:40 -0700
Subject: [PATCH] dev: export driver information with MSVC

[ upstream commit 87cf44faf0e8f5a0b12db1bbaf3e995da39d0e6c ]

DPDK uses GCC attribute "used" through macro __rte_used to indicate
that a variable not referenced in the code should be assumed being
used and therefore not be optimized away. This technique is used to embed
information in the binaries, by having crafted information stored in
them.

MSVC offers similar functionality, but it differs significantly: MSVC
requires a pragma to be used to send a command to the linker telling it
explicitly the name of the symbol that should be included (even if not
referenced). As a side-effect, variables called out to be included cannot
be static, otherwise their symbols are not "seen" by the linker. This
restriction requires some DPDK code to be refactored.

To assimilate these requirements/restrictions, a new macro
RTE_PMD_EXPORT_SYMBOL is added in this patch to ensure these special
variables make it to the final binaries.

Signed-off-by: Andre Muezerie <andremue at linux.microsoft.com>
Signed-off-by: David Marchand <david.marchand at redhat.com>
Acked-by: Andre Muezerie <andremue at linux.microsoft.com>
---
 drivers/bus/cdx/bus_cdx_driver.h    |  3 +--
 lib/eal/common/eal_common_options.c |  2 +-
 lib/eal/include/rte_dev.h           | 19 ++++++++++++-------
 3 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/drivers/bus/cdx/bus_cdx_driver.h b/drivers/bus/cdx/bus_cdx_driver.h
index 4febf1fd3bf..f0780a84ad0 100644
--- a/drivers/bus/cdx/bus_cdx_driver.h
+++ b/drivers/bus/cdx/bus_cdx_driver.h
@@ -35,8 +35,7 @@ struct rte_cdx_bus;
 #define RTE_CDX_ANY_ID (0xffff)
 
 #define RTE_PMD_REGISTER_CDX_TABLE(name, table) \
-static const char DRV_EXP_TAG(name, cdx_tbl_export)[] __rte_used = \
-RTE_STR(table)
+RTE_PMD_EXPORT_SYMBOL(const char, DRV_EXP_TAG(name, cdx_tbl_export))[] = RTE_STR(table)
 
 /** Device needs resource mapping */
 #define RTE_CDX_DRV_NEED_MAPPING 0x0001
diff --git a/lib/eal/common/eal_common_options.c b/lib/eal/common/eal_common_options.c
index bf4ff858c9a..fcc922ec923 100644
--- a/lib/eal/common/eal_common_options.c
+++ b/lib/eal/common/eal_common_options.c
@@ -134,7 +134,7 @@ static const char *default_solib_dir = RTE_EAL_PMD_PATH;
  * Note: PLEASE DO NOT ALTER THIS without making a corresponding
  * change to usertools/dpdk-pmdinfo.py
  */
-static const char dpdk_solib_path[] __rte_used =
+RTE_PMD_EXPORT_SYMBOL(const char, dpdk_solib_path)[] =
 "DPDK_PLUGIN_PATH=" RTE_EAL_PMD_PATH;
 
 TAILQ_HEAD(device_option_list, device_option);
diff --git a/lib/eal/include/rte_dev.h b/lib/eal/include/rte_dev.h
index afbdaf7690d..f6ccb74c9a2 100644
--- a/lib/eal/include/rte_dev.h
+++ b/lib/eal/include/rte_dev.h
@@ -232,18 +232,24 @@ int rte_dev_remove(struct rte_device *dev);
  */
 typedef int (*rte_dev_cmp_t)(const struct rte_device *dev, const void *data);
 
+#ifdef RTE_TOOLCHAIN_MSVC
+#define RTE_PMD_EXPORT_SYMBOL(type, name) \
+__pragma(comment(linker, "/include:" RTE_STR(name))) type name
+#else
+#define RTE_PMD_EXPORT_SYMBOL(type, name) \
+__attribute__((used)) type name
+#endif
+
 #define RTE_PMD_EXPORT_NAME(name) \
-static const char this_pmd_name ## name[] __rte_used = RTE_STR(name)
+RTE_PMD_EXPORT_SYMBOL(const char, this_pmd_name ## name)[] = RTE_STR(name)
 
 #define DRV_EXP_TAG(name, tag) __##name##_##tag
 
 #define RTE_PMD_REGISTER_PCI_TABLE(name, table) \
-static const char DRV_EXP_TAG(name, pci_tbl_export)[] __rte_used = \
-RTE_STR(table)
+RTE_PMD_EXPORT_SYMBOL(const char, DRV_EXP_TAG(name, pci_tbl_export))[] = RTE_STR(table)
 
 #define RTE_PMD_REGISTER_PARAM_STRING(name, str) \
-static const char DRV_EXP_TAG(name, param_string_export)[] \
-__rte_used = str
+RTE_PMD_EXPORT_SYMBOL(const char, DRV_EXP_TAG(name, param_string_export))[] = str
 
 /**
  * Advertise the list of kernel modules required to run this driver
@@ -267,8 +273,7 @@ __rte_used = str
  * - "* igb_uio | uio_pci_generic | vfio"
  */
 #define RTE_PMD_REGISTER_KMOD_DEP(name, str) \
-static const char DRV_EXP_TAG(name, kmod_dep_export)[] \
-__rte_used = str
+RTE_PMD_EXPORT_SYMBOL(const char, DRV_EXP_TAG(name, kmod_dep_export))[] = str
 
 /**
  * Iteration context.
-- 
2.47.3

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2026-11-05 16:42:49.325925788 +0000
+++ 0115-dev-export-driver-information-with-MSVC.patch	2026-11-05 16:42:45.077065448 +0000
@@ -1 +1 @@
-From 87cf44faf0e8f5a0b12db1bbaf3e995da39d0e6c Mon Sep 17 00:00:00 2001
+From 13ce0684a6f93b143861f878e1ace9dff262e650 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 87cf44faf0e8f5a0b12db1bbaf3e995da39d0e6c ]
+
@@ -29 +31 @@
- lib/eal/include/dev_driver.h        | 19 ++++++++++++-------
+ lib/eal/include/rte_dev.h           | 19 ++++++++++++-------
@@ -33 +35 @@
-index 4febf1fd3b..f0780a84ad 100644
+index 4febf1fd3bf..f0780a84ad0 100644
@@ -47 +49 @@
-index b4f0e23a9c..83b6fc7e89 100644
+index bf4ff858c9a..fcc922ec923 100644
@@ -50 +52 @@
-@@ -137,7 +137,7 @@ static const char *default_solib_dir = RTE_EAL_PMD_PATH;
+@@ -134,7 +134,7 @@ static const char *default_solib_dir = RTE_EAL_PMD_PATH;
@@ -59,7 +61,7 @@
-diff --git a/lib/eal/include/dev_driver.h b/lib/eal/include/dev_driver.h
-index 7766038b1b..a2517ac1d4 100644
---- a/lib/eal/include/dev_driver.h
-+++ b/lib/eal/include/dev_driver.h
-@@ -30,18 +30,24 @@ struct rte_device {
- 	struct rte_devargs *devargs;  /**< Arguments for latest probing */
- };
+diff --git a/lib/eal/include/rte_dev.h b/lib/eal/include/rte_dev.h
+index afbdaf7690d..f6ccb74c9a2 100644
+--- a/lib/eal/include/rte_dev.h
++++ b/lib/eal/include/rte_dev.h
+@@ -232,18 +232,24 @@ int rte_dev_remove(struct rte_device *dev);
+  */
+ typedef int (*rte_dev_cmp_t)(const struct rte_device *dev, const void *data);
@@ -76 +78 @@
--static const char this_pmd_name ## name __rte_used = RTE_STR(name)
+-static const char this_pmd_name ## name[] __rte_used = RTE_STR(name)
@@ -93 +95 @@
-@@ -65,7 +71,6 @@ __rte_used = str
+@@ -267,8 +273,7 @@ __rte_used = str
@@ -101 +103,2 @@
- #endif /* DEV_DRIVER_H */
+ /**
+  * Iteration context.


More information about the stable mailing list