function versioning is incompatible with LTO
http://bugs.dpdk.org/show_bug.cgi?id=1949
Bug ID: 1949
Summary: function versioning is incompatible with LTO
Product: DPDK
Version: 25.07
Hardware: All
OS: All
Status: UNCONFIRMED
Severity: minor
Priority: Normal
Component: core
Assignee: [email protected]
Reporter: [email protected]Target Milestone: ---
The default-version symver (@@) fails to assemble when build is using LTO.
Building a shared library with LTO fails when a function uses RTE_DEFAULT_SYMBOL.
I introduces a new versioned symbol rte_eth_dev_get_name_by_port (ethdev). This fails when doing LTO build with
invalid attempt to declare external version name as default in symbol `rte_eth_dev_get_name_by_port@@DPDK_27'
Cause: the versioning macros emit a file-scope __asm__(".symver …@@DPDK_<ver>"). Top-level asm is opaque to LTO, so GCC may place the directive in a different ltrans partition than the _v<ver> definition. The implementation symbol is then external in that partition, and gas rejects binding a default version (@@) to an external symbol. Only the @@ (default) line fails; the single-@ compat line is legal on an external symbol.
Fix: use the GCC symver function attribute (GCC ≥ 10) instead of top-level asm, gated on __has_attribute(symver); retain the asm path as fallback. Clang lacks the attribute and stays on the asm path (LTO + versioning remains unsupported there).
Marking severity as minor since no current in-tree code uses versioned symbols. But it is a trap waiting to happen.
Signature · 2 lines
You are receiving this mail because: You are the assignee for the bug.