DPDK patches and discussions
 help / color / mirror / Atom feed
From: Andre Muezerie <andremue@linux.microsoft.com>
To: David Marchand <david.marchand@redhat.com>
Cc: Stephen Hemminger <stephen@networkplumber.org>,
	dev@dpdk.org, thomas@monjalon.net, bruce.richardson@intel.com
Subject: Re: [RFC v4 5/8] build: generate symbol maps
Date: Thu, 20 Mar 2025 08:06:43 -0700	[thread overview]
Message-ID: <20250320150643.GA18308@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> (raw)
In-Reply-To: <CAJFAV8wnNCqWmuz5Kw9097BWE51GiiBmypJca71dMm5=WmBgyg@mail.gmail.com>

On Wed, Mar 19, 2025 at 06:12:37PM +0100, David Marchand wrote:
> On Wed, Mar 19, 2025 at 5:19 PM Stephen Hemminger
> <stephen@networkplumber.org> wrote:
> >
> > On Mon, 17 Mar 2025 16:43:01 +0100
> > David Marchand <david.marchand@redhat.com> wrote:
> >
> > > Rather than maintain a file in parallel of the code, symbols to be
> > > exported can be marked with a token RTE_EXPORT_*SYMBOL.
> > >
> > > From those marks, the build framework generates map files only for
> > > symbols actually compiled (which means that the WINDOWS_NO_EXPORT hack
> > > becomes unnecessary).
> > >
> > > The build framework directly creates a map file in the format that the
> > > linker expects (rather than converting from GNU linker to MSVC linker).
> > >
> > > Empty maps are allowed again as a replacement for drivers/version.map.
> > >
> > > The symbol check is updated to only support the new format.
> > >
> > > Signed-off-by: David Marchand <david.marchand@redhat.com>
> > > ---
> > > Changes since RFC v3:
> > > - polished python,
> > > - fixed doc updates not belonging to this patch,
> > > - renamed map files,
> > > - changed msvc->mslinker as link mode,
> > > - added parsing of AVX sources,
> > >
> > > Changes since RFC v2:
> > > - because of MSVC limitations wrt macro passed via cmdline,
> > >   used an internal header for defining RTE_EXPORT_* macros,
> > > - updated documentation and tooling,
> >
> > Looks like a good idea.
> > Is there any way to make symbols in drivers local by default?
> > Right now if a driver defines a non-static function it will
> > be visible in other code when DPDK application is statically linked.
> >
> > This can lead to problems where exports are missing or accidental
> > name conflicts. Gcc has -fvisiblity=hidden not sure about others.
> 
> This could be interesting, though it is a step further the current series.
> 
> 
> - For clang, I would expect -fvisibility is supported.
> 
> - There is one warning I am not too fond of, in gcc manual:
>            Be aware that headers from outside your project, in
> particular system headers and headers from any other library you use,
> may not be expecting to be compiled with visibility other than the
> default.  You may need to explicitly
>            say "#pragma GCC visibility push(default)" before including
> any such headers.
> 
> I also see that this requires annotating symbol at the declaration level.
> That would require to parse headers instead of sources (which seems
> more appropriate as we are talking about symbol exports).
> 
> I have some doubt though wrt base driver code, that we are not
> supposed to update...
> The current RTE_EXPORT_* macros of this series were not doing anything
> to the symbol themselves, and could be located anywhere as long as
> meson could parse them.
> 
> 
> - Not sure what the default for MSVC is, André?
> 

My understanding is that "-fvisiblity=hidden" only has effect on dynamic linking.
For static linking a similar goal can be achieved with ld's option --exclude-libs
(https://sourceware.org/binutils/docs/ld/Options.html).

The default for msvc is hidden. Only functions that are explicitly exported
with __declspec(dllexport) modifier or through a .def file are visible externally.

It seems this matches exactly the behavior you would get by using -fvisiblity=hidden
with gcc/clang.
--
Andre Muezerie

> 
> -- 
> David Marchand

  reply	other threads:[~2025-03-20 15:06 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-05 21:23 [RFC] eal: add new function versioning macros David Marchand
2025-03-06  2:57 ` Patrick Robb
2025-03-06 10:23 ` Bruce Richardson
2025-03-06 12:50 ` [RFC v2 1/2] " David Marchand
2025-03-06 12:50   ` [RFC v2 2/2] build: generate symbol maps David Marchand
2025-03-06 15:45   ` [RFC v2 1/2] eal: add new function versioning macros Andre Muezerie
2025-03-11  9:55 ` [RFC v3 0/8] Symbol versioning and export rework David Marchand
2025-03-11  9:55   ` [RFC v3 1/8] lib: remove incorrect exported symbols David Marchand
2025-03-11  9:56   ` [RFC v3 2/8] drivers: " David Marchand
2025-03-11  9:56   ` [RFC v3 3/8] eal: rework function versioning macros David Marchand
2025-03-13 16:53     ` Bruce Richardson
2025-03-13 17:09       ` David Marchand
2025-03-11  9:56   ` [RFC v3 4/8] buildtools: display version when listing symbols David Marchand
2025-03-11  9:56   ` [RFC v3 5/8] build: generate symbol maps David Marchand
2025-03-13 17:26     ` Bruce Richardson
2025-03-14 15:38       ` David Marchand
2025-03-14 14:24     ` Thomas Monjalon
2025-03-14 15:38       ` David Marchand
2025-03-14 15:27     ` Andre Muezerie
2025-03-14 15:51       ` David Marchand
2025-03-11  9:56   ` [RFC v3 6/8] build: mark exported symbols David Marchand
2025-03-13 17:30     ` Bruce Richardson
2025-03-14 16:14       ` David Marchand
2025-03-14 16:23         ` Bruce Richardson
2025-03-14 16:53           ` David Marchand
2025-03-14 17:21             ` David Marchand
2025-03-14 17:28             ` Bruce Richardson
2025-03-14 17:39               ` David Marchand
2025-03-14 17:51                 ` Bruce Richardson
2025-03-11  9:56   ` [RFC v3 7/8] build: use dynamically generated version maps David Marchand
2025-03-11  9:56   ` [RFC v3 8/8] build: remove static " David Marchand
2025-03-11 10:18   ` [RFC v3 0/8] Symbol versioning and export rework Morten Brørup
2025-03-11 13:43     ` David Marchand
2025-03-17 15:42 ` [RFC v4 " David Marchand
2025-03-17 15:42   ` [RFC v4 1/8] lib: remove incorrect exported symbols David Marchand
2025-03-17 15:42   ` [RFC v4 2/8] drivers: " David Marchand
2025-03-17 15:42   ` [RFC v4 3/8] eal: rework function versioning macros David Marchand
2025-03-17 15:43   ` [RFC v4 4/8] buildtools: display version when listing symbols David Marchand
2025-03-17 15:43   ` [RFC v4 5/8] build: generate symbol maps David Marchand
2025-03-19 16:19     ` Stephen Hemminger
2025-03-19 17:12       ` David Marchand
2025-03-20 15:06         ` Andre Muezerie [this message]
2025-03-17 15:43   ` [RFC v4 6/8] build: mark exported symbols David Marchand
2025-03-17 15:43   ` [RFC v4 7/8] build: use dynamically generated version maps David Marchand
2025-03-17 15:43   ` [RFC v4 8/8] build: remove static " David Marchand
2025-03-18  8:19   ` [RFC v4 0/8] Symbol versioning and export rework David Marchand
2025-03-26 12:02   ` David Marchand
2025-03-26 12:26     ` Morten Brørup
2025-03-26 13:07     ` Bruce Richardson
2025-03-26 13:36     ` Bruce Richardson
2025-03-26 13:54       ` David Marchand
2025-03-26 14:16         ` Bruce Richardson
2025-03-27 13:36 ` [PATCH v5 " David Marchand
2025-03-27 13:36   ` [PATCH v5 1/8] lib: remove incorrect exported symbols David Marchand
2025-03-27 13:36   ` [PATCH v5 2/8] drivers: " David Marchand
2025-03-27 13:36   ` [PATCH v5 3/8] buildtools: display version when listing symbols David Marchand
2025-03-27 13:36   ` [PATCH v5 4/8] build: generate symbol maps David Marchand
2025-03-27 13:36   ` [PATCH v5 5/8] build: mark exported symbols David Marchand
2025-03-27 18:21     ` David Marchand
2025-03-27 13:36   ` [PATCH v5 6/8] build: use dynamically generated version maps David Marchand
2025-03-27 13:36   ` [PATCH v5 7/8] build: remove static " David Marchand
2025-03-27 13:36   ` [PATCH v5 8/8] eal: rework function versioning macros David Marchand
2025-03-27 18:22   ` [PATCH v5 0/8] Symbol versioning and export rework David Marchand

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=20250320150643.GA18308@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net \
    --to=andremue@linux.microsoft.com \
    --cc=bruce.richardson@intel.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=stephen@networkplumber.org \
    --cc=thomas@monjalon.net \
    /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).