DPDK patches and discussions
 help / color / mirror / Atom feed
From: Andre Muezerie <andremue@linux.microsoft.com>
To: David Marchand <david.marchand@redhat.com>
Cc: dev@dpdk.org
Subject: Re: [PATCH v4 0/4] allow pmdinfo to be inserted and parsed using MSVC
Date: Wed, 4 Jun 2025 06:56:23 -0700	[thread overview]
Message-ID: <20250604135623.GA4412@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> (raw)
In-Reply-To: <CAJFAV8xoy+Tuk-mOi93W6bo=0Su2Q-cPy5vjoZ6i4U9N0BkGZg@mail.gmail.com>

On Wed, Jun 04, 2025 at 02:03:56PM +0200, David Marchand wrote:
> On Tue, Jun 3, 2025 at 3:01 AM Andre Muezerie
> <andremue@linux.microsoft.com> wrote:
> >
> > On Wed, Apr 16, 2025 at 02:44:54PM -0700, Andre Muezerie wrote:
> > > 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.
> > >
> > > Macro RTE_INCLUDE is used 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. However, when __COUNTER__
> > > was used directly from a header file, __LINE__ had to be used from the
> > > .c files, otherwise it would also not result in a unique symbol. This
> > > required a parameter to be added to some macros so that the __LINE__
> > > could be passed from the .c file to the macro defined in the header
> > > (which was originally using __COUNTER__).
> > >
> > > With this patchset commands like the one below provide the same JSON
> > > output as would be obtained on Linux.
> > >
> > > python usertools\dpdk-pmdinfo.py build\app\dpdk-testpmd.exe
> > >
> > > v4:
> > >  - limited the use of __LINE__ to the header files, reducing number of
> > >    changes made in previous versions of this patchset.
> 
> Open question, since the submission of this series, __rte_used is used
> in the new symbol export macros.
> It seems those macros are not affected by the problem you described
> (and fixed with RTE_INCLUDE).
> Is it because the symbols are explicitly listed as exported?
> 

Correct. When using MSVC, "__rte_used" is stripped away by the preprocessor
and therefore has no effect. All required symbols need to be explicitly
listed as exported, otherwise the linker will complain about symbols not
found.

> 
> -- 
> David Marchand

  reply	other threads:[~2025-06-04 13:56 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-11 19:39 [PATCH " Andre Muezerie
2025-04-11 19:39 ` [PATCH 1/4] eal: add macro to embed information in binaries Andre Muezerie
2025-04-11 19:39 ` [PATCH 2/4] buildtools: use " Andre Muezerie
2025-04-11 20:07   ` Dmitry Kozlyuk
2025-04-11 19:39 ` [PATCH 3/4] usertools: parse strings from PE images Andre Muezerie
2025-04-11 20:09   ` Dmitry Kozlyuk
2025-04-11 19:39 ` [PATCH 4/4] drivers: use macro to embed information in binaries Andre Muezerie
2025-04-15  1:21 ` [PATCH v2 0/4] allow pmdinfo to be inserted and parsed using MSVC Andre Muezerie
2025-04-15  1:21   ` [PATCH v2 1/4] eal: add macro to embed information in binaries Andre Muezerie
2025-04-15  1:21   ` [PATCH v2 2/4] buildtools: use " Andre Muezerie
2025-04-15  7:44     ` Dmitry Kozlyuk
2025-04-15 14:36       ` Andre Muezerie
2025-04-15  1:21   ` [PATCH v2 3/4] usertools: parse strings from PE images Andre Muezerie
2025-04-15 11:19     ` Robin Jarry
2025-04-15  1:21   ` [PATCH v2 4/4] drivers: use macro to embed information in binaries Andre Muezerie
2025-04-16  0:05     ` Stephen Hemminger
2025-04-17 17:10       ` Andre Muezerie
2025-04-15 22:31 ` [PATCH v3 0/4] allow pmdinfo to be inserted and parsed using MSVC Andre Muezerie
2025-04-15 22:31   ` [PATCH v3 1/4] eal: add macro to embed information in binaries Andre Muezerie
2025-04-15 22:31   ` [PATCH v3 2/4] buildtools: use " Andre Muezerie
2025-04-15 22:31   ` [PATCH v3 3/4] usertools: parse strings from PE images Andre Muezerie
2025-04-15 22:31   ` [PATCH v3 4/4] drivers: use macro to embed information in binaries Andre Muezerie
2025-04-16 21:44 ` [PATCH v4 0/4] allow pmdinfo to be inserted and parsed using MSVC Andre Muezerie
2025-04-16 21:44   ` [PATCH v4 1/4] eal: add macro to embed information in binaries Andre Muezerie
2025-06-04 14:13     ` Bruce Richardson
2025-06-04 14:52       ` Andre Muezerie
2025-04-16 21:44   ` [PATCH v4 2/4] buildtools: use " Andre Muezerie
2025-06-04 11:04     ` David Marchand
2025-06-04 13:59       ` Andre Muezerie
2025-04-16 21:44   ` [PATCH v4 3/4] usertools: parse strings from PE images Andre Muezerie
2025-04-16 21:44   ` [PATCH v4 4/4] drivers: use macro to embed information in binaries Andre Muezerie
2025-06-03  1:01   ` [PATCH v4 0/4] allow pmdinfo to be inserted and parsed using MSVC Andre Muezerie
2025-06-04 12:03     ` David Marchand
2025-06-04 13:56       ` Andre Muezerie [this message]
2025-06-04 13:50 ` [PATCH v5 " Andre Muezerie
2025-06-04 13:50   ` [PATCH v5 1/4] eal: add macro to embed information in binaries Andre Muezerie
2025-06-04 13:50   ` [PATCH v5 2/4] buildtools: use " Andre Muezerie
2025-06-04 13:50   ` [PATCH v5 3/4] usertools: parse strings from PE images Andre Muezerie
2025-06-04 13:50   ` [PATCH v5 4/4] drivers: use macro to embed information in binaries Andre Muezerie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250604135623.GA4412@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net \
    --to=andremue@linux.microsoft.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).