DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] Handling missing export functions in MSVC linkage
@ 2020-06-07 12:26 Tal Shnaiderman
  2020-06-08  0:09 ` Dmitry Kozlyuk
  0 siblings, 1 reply; 6+ messages in thread
From: Tal Shnaiderman @ 2020-06-07 12:26 UTC (permalink / raw)
  To: Thomas Monjalon, Dmitry Kozlyuk, ranjit.menon, pallavi.kadam,
	Harini Ramakrishnan, navasile, bruce.richardson, William Tu,
	Dmitry Malloy (MESHCHANINOV),
	Fady Bader, Tasnim Bashar
  Cc: dev

Hi,

I was wondering if there is a known solution for the following problem:

Whenever building a DPDK library using clang/MSVC there is an linkage issue if the rte_*_version.map names a function that isn't being compiled.

For example, in librte_metrics several files in the lib build depend on the existence of jansson, however, since the functions in those files are stated in rte_metrics_version.map MSVC prints out
errors in the linkage stage in case jansson is missing:

*error LNK2001: unresolved external symbol rte_metrics_tel_.... 

In clang build the .map file is converted into Module-Definition (.Def) File.

https://docs.microsoft.com/en-us/cpp/build/reference/module-definition-dot-def-files?view=vs-2019

Is there a way to instruct the linker to ignore missing functions in the def file?

Thanks,

Tal.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] Handling missing export functions in MSVC linkage
  2020-06-07 12:26 [dpdk-dev] Handling missing export functions in MSVC linkage Tal Shnaiderman
@ 2020-06-08  0:09 ` Dmitry Kozlyuk
  2020-06-08  8:33   ` David Marchand
  2020-06-08 15:06   ` [dpdk-dev] " Tal Shnaiderman
  0 siblings, 2 replies; 6+ messages in thread
From: Dmitry Kozlyuk @ 2020-06-08  0:09 UTC (permalink / raw)
  To: Tal Shnaiderman
  Cc: Thomas Monjalon, ranjit.menon, pallavi.kadam,
	Harini Ramakrishnan, navasile, bruce.richardson, William Tu,
	Dmitry Malloy (MESHCHANINOV),
	Fady Bader, Tasnim Bashar, dev

On Sun, 7 Jun 2020 12:26:56 +0000
Tal Shnaiderman <talshn@mellanox.com> wrote:

> In clang build the .map file is converted into Module-Definition (.Def) File.

If you create a .def manually, it will override the generation from .map. Of
cause, this adds manual work and ideally all .def files should be generated.


> Is there a way to instruct the linker to ignore missing functions in the def file?

There is /FORCE:UNRESOLVED, but it will ignore *any* unresolved reference,
that's why I'm against using it---this can lead to hard-to-diagnose errors.

https://docs.microsoft.com/en-us/cpp/build/reference/force-force-file-output?view=vs-2019

The only proper way I see is forgenertor script to analyze both names .map and
symbols .lib to filter out undefined functions. Dumpbin.exe should be able to
list symbols and it comes with MS Windows SDK, IIRC.

-- 
Dmitry Kozlyuk

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] Handling missing export functions in MSVC linkage
  2020-06-08  0:09 ` Dmitry Kozlyuk
@ 2020-06-08  8:33   ` David Marchand
  2021-03-26  8:39     ` Thomas Monjalon
  2020-06-08 15:06   ` [dpdk-dev] " Tal Shnaiderman
  1 sibling, 1 reply; 6+ messages in thread
From: David Marchand @ 2020-06-08  8:33 UTC (permalink / raw)
  To: Dmitry Kozlyuk
  Cc: Tal Shnaiderman, Thomas Monjalon, ranjit.menon, pallavi.kadam,
	Harini Ramakrishnan, navasile, bruce.richardson, William Tu,
	Dmitry Malloy (MESHCHANINOV),
	Fady Bader, Tasnim Bashar, dev

On Mon, Jun 8, 2020 at 2:09 AM Dmitry Kozlyuk <dmitry.kozliuk@gmail.com> wrote:
>
> On Sun, 7 Jun 2020 12:26:56 +0000
> Tal Shnaiderman <talshn@mellanox.com> wrote:
>
> > In clang build the .map file is converted into Module-Definition (.Def) File.
>
> If you create a .def manually, it will override the generation from .map. Of
> cause, this adds manual work and ideally all .def files should be generated.

On this topic, I just noticed that a patch of mine, that removed
rte_eal_get_configuration() from the stable ABI, missed the
declaration in rte_eal_exports.def.
Probably worth adding a check in devtools/, to avoid further misalignment.


---
David Marchand


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] Handling missing export functions in MSVC linkage
  2020-06-08  0:09 ` Dmitry Kozlyuk
  2020-06-08  8:33   ` David Marchand
@ 2020-06-08 15:06   ` Tal Shnaiderman
  1 sibling, 0 replies; 6+ messages in thread
From: Tal Shnaiderman @ 2020-06-08 15:06 UTC (permalink / raw)
  To: Dmitry Kozlyuk
  Cc: Thomas Monjalon, ranjit.menon, pallavi.kadam,
	Harini Ramakrishnan, navasile, bruce.richardson, William Tu,
	Dmitry Malloy (MESHCHANINOV),
	Fady Bader, Tasnim Bashar, dev

> Subject: Re: Handling missing export functions in MSVC linkage
> 
> On Sun, 7 Jun 2020 12:26:56 +0000
> Tal Shnaiderman <talshn@mellanox.com> wrote:
> 
> > In clang build the .map file is converted into Module-Definition (.Def) File.
> 
> If you create a .def manually, it will override the generation from .map. Of
> cause, this adds manual work and ideally all .def files should be generated.
> 

Right, eal uses this ability, however in the metrics lib this will not be sufficient 
since in case jansson is found (and it does have Windows support) we do want
to export the full .map file

> 
> > Is there a way to instruct the linker to ignore missing functions in the def
> file?
> 
> There is /FORCE:UNRESOLVED, but it will ignore *any* unresolved reference,
> that's why I'm against using it---this can lead to hard-to-diagnose errors.
> 
> https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.
> microsoft.com%2Fen-us%2Fcpp%2Fbuild%2Freference%2Fforce-force-file-
> output%3Fview%3Dvs-
> 2019&amp;data=02%7C01%7Ctalshn%40mellanox.com%7Cee173c939f094360
> 14f708d80b403a2d%7Ca652971c7d2e4d9ba6a4d149256f461b%7C0%7C0%7C6
> 37271717789602353&amp;sdata=AfIjZd5K2Grztih%2Fu7utJQZimsjpCX7qgxn0
> Z9n0hd0%3D&amp;reserved=0
> 
> The only proper way I see is forgenertor script to analyze both names .map
> and symbols .lib to filter out undefined functions. Dumpbin.exe should be
> able to list symbols and it comes with MS Windows SDK, IIRC.
> 

Looks like a good solution to me, however I'm not familiar with the availability of Dumpbin
We can discuss this solution in the upcoming community call, thanks!

> --
> Dmitry Kozlyuk

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] Handling missing export functions in MSVC linkage
  2020-06-08  8:33   ` David Marchand
@ 2021-03-26  8:39     ` Thomas Monjalon
  2021-03-26 14:14       ` [dpdk-dev] [EXTERNAL] " Tyler Retzlaff
  0 siblings, 1 reply; 6+ messages in thread
From: Thomas Monjalon @ 2021-03-26  8:39 UTC (permalink / raw)
  To: Dmitry Kozlyuk, ranjit.menon, pallavi.kadam, Harini Ramakrishnan,
	navasile, Dmitry Malloy (MESHCHANINOV)
  Cc: dev, Tal Shnaiderman, bruce.richardson, David Marchand,
	Tyler Retzlaff, Omar Cardona

08/06/2020 10:33, David Marchand:
> On Mon, Jun 8, 2020 at 2:09 AM Dmitry Kozlyuk <dmitry.kozliuk@gmail.com> wrote:
> > On Sun, 7 Jun 2020 12:26:56 +0000
> > If you create a .def manually, it will override the generation from .map. Of
> > cause, this adds manual work and ideally all .def files should be generated.
> 
> On this topic, I just noticed that a patch of mine, that removed
> rte_eal_get_configuration() from the stable ABI, missed the
> declaration in rte_eal_exports.def.
> Probably worth adding a check in devtools/, to avoid further misalignment.

The .def file keeps being out of sync.
We need a script to avoid forgetting the sync,
or/and we must generate this .def from the .map.
Ideally the full EAL API (except VFIO) should be implemented
for Windows.

This situation is waiting for a solution for too much time.
Windows maintainers, please solve it.




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [EXTERNAL] Re: Handling missing export functions in MSVC linkage
  2021-03-26  8:39     ` Thomas Monjalon
@ 2021-03-26 14:14       ` Tyler Retzlaff
  0 siblings, 0 replies; 6+ messages in thread
From: Tyler Retzlaff @ 2021-03-26 14:14 UTC (permalink / raw)
  To: thomas, Dmitry Kozlyuk, ranjit.menon, Kadam, Pallavi,
	Harini Ramakrishnan, navasile, Dmitry Malloy
  Cc: dev, talshn, bruce.richardson, David Marchand, Omar Cardona

Unless I misunderstood the last status of this issue was that it was desired empty stubs that fail at runtime as opposed to conditionally generating exports.

Is this no longer the case?

-----Original Message-----
From: Thomas Monjalon <thomas@monjalon.net> 
Sent: Friday, March 26, 2021 1:40 AM
To: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>; ranjit.menon <ranjit.menon@intel.com>; Kadam, Pallavi <pallavi.kadam@intel.com>; Harini Ramakrishnan <Harini.Ramakrishnan@microsoft.com>; navasile@linux.microsoft.com; Dmitry Malloy <dmitrym@microsoft.com>
Cc: dev@dpdk.org; talshn <talshn@mellanox.com>; bruce.richardson@intel.com; David Marchand <david.marchand@redhat.com>; Tyler Retzlaff <roretzla@microsoft.com>; Omar Cardona <ocardona@microsoft.com>
Subject: [EXTERNAL] Re: [dpdk-dev] Handling missing export functions in MSVC linkage

08/06/2020 10:33, David Marchand:
> On Mon, Jun 8, 2020 at 2:09 AM Dmitry Kozlyuk <dmitry.kozliuk@gmail.com> wrote:
> > On Sun, 7 Jun 2020 12:26:56 +0000
> > If you create a .def manually, it will override the generation from 
> > .map. Of cause, this adds manual work and ideally all .def files should be generated.
> 
> On this topic, I just noticed that a patch of mine, that removed
> rte_eal_get_configuration() from the stable ABI, missed the 
> declaration in rte_eal_exports.def.
> Probably worth adding a check in devtools/, to avoid further misalignment.

The .def file keeps being out of sync.
We need a script to avoid forgetting the sync, or/and we must generate this .def from the .map.
Ideally the full EAL API (except VFIO) should be implemented for Windows.

This situation is waiting for a solution for too much time.
Windows maintainers, please solve it.




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-03-29  8:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-07 12:26 [dpdk-dev] Handling missing export functions in MSVC linkage Tal Shnaiderman
2020-06-08  0:09 ` Dmitry Kozlyuk
2020-06-08  8:33   ` David Marchand
2021-03-26  8:39     ` Thomas Monjalon
2021-03-26 14:14       ` [dpdk-dev] [EXTERNAL] " Tyler Retzlaff
2020-06-08 15:06   ` [dpdk-dev] " Tal Shnaiderman

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).