Skip to content

remove use of weak functions from libraries

Bruce Richardson dpdk-dev 1 version Applied

Status from this message: Applied, thanks

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 12 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/2acl: remove use of weak functionslib/librte_acl/meson.build lib/librte_acl/rte_acl.c mk/rte.app.mk+20 -84 replies
2/2bpf: remove use of weak functionslib/librte_bpf/bpf_load.c lib/librte_bpf/meson.build+4 -13 replies

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchKonstantin Ananyev
1/2A-b T-b
2/2A-b T-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [dpdk-dev] [PATCH 0/2] remove use of weak functions from libraries

Weak functions don't work well with static library builds as the linker always picks the first version of a function irrespective of whether it is weak or not. The solution to this is to use the "whole-archive" flag when linking, but this has the nasty side-effect that it causes the resulting binary to be larger than it needs to be.

A further problem with this approach of using "whole-archive" is that one either needs to link all libraries with this flag or track what libraries need it or not - the latter being especially a problem for apps not using the DPDK build system itself (i.e. most apps not shipped with DPDK itself). For meson builds this information needs to make its way all the way through to the pkgconfig file generated - not a trivial undertaking.

Thankfully, though, the use of weak functions is limited to use for multiple functions within a single library, meaning that when the lib is being built, the build system itself can know whether the "weak" function is needed or not. This allows us to change the weak function to a conditionally compiled regular function used in fallback case. This makes the need for "whole-archive" flag, and any special linking measures for the library, go away.

[This set does not touch the drivers, only the libraries, since there are other special linker flags needed for drivers in general, making the problem less severe for driver .a files.]

Bruce Richardson (2):
acl: remove use of weak functions
bpf: remove use of weak functions

 lib/librte_acl/meson.build |  7 ++++++-
 lib/librte_acl/rte_acl.c   | 18 ++++++++++++++----
 lib/librte_bpf/bpf_load.c  |  4 +++-
 lib/librte_bpf/meson.build |  1 +
 mk/rte.app.mk              |  3 ---
 5 files changed, 24 insertions(+), 9 deletions(-)
Signature · 1 line
2.20.1