On Tue, Jun 10, 2025 at 12:10 PM David Marchand <david.march...@redhat.com> wrote: > > From: Andre Muezerie <andre...@linux.microsoft.com> > > 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. > > The elimination of "static" for some of these variables caused name > clashes when __COUNTER__ predefined macro was used. As a workaround, > predefined macro __LINE__ was used instead.
We only need unique symbol names, and the driver name itself is unique. It is probably more robust than __LINE__ (that is likely to change..). I'll send a followup patch on this topic for rc2. > > Signed-off-by: Andre Muezerie <andre...@linux.microsoft.com> > Signed-off-by: David Marchand <david.march...@redhat.com> -- David Marchand