[dpdk-dev] [PATCH v3 3/6] mk: sort libraries when linking, move pmd libs to higher level

Thomas Monjalon thomas.monjalon at 6wind.com
Mon Jun 13 11:29:23 CEST 2016

2016-06-10 19:32, Ferruh Yigit:
> As stated in the comment:
>     Order is important: from higher level to lower level
> This is an attempt to make the layering order better respected.
> Limit scope of --whole-archive to pmd libraries

Compared to the link order in the v2, you did two things:
1/ move PMDs to the first position
2/ restrict --whole-archive to PMDs only

Having the PMDs first, helps the linker to get all the PMD dependencies
in the static binary. Thus it seems we do not need --whole-archive
for the PMD dependencies (ethdev, mbuf, etc).
But, if an external PMD is loaded via dlopen, it is possible that it
needs a symbol which was not used by the internal PMDs. So it will not
be found in the statically linked binary.
Let's take another example: if we disable the internal PMDs with their
config options from the static build, and we decide to build them
separately as DSOs. We won't be able to load them as plugins because
they depend on symbols which won't be found in the static binary.

To make it short, the PMDs must be considered as plugins. Therefore, we
must not rely on their availability to link the required symbols in
a static binary.
To make sure the plugin loading will be always well achieved, we must
link the static PMDs at the last position.

If you agree, I vote for the v2 of this patchset.

More information about the dev mailing list