Skip to content

Commit 6ce1b95

Browse files
committed
changes from last revision:
* add references to other sections of this document * remove content about non-SysV platforms and systems without IFUNCs
1 parent cf6ab3d commit 6ce1b95

File tree

1 file changed

+14
-26
lines changed

1 file changed

+14
-26
lines changed

sysvabi64/sysvabi64.rst

Lines changed: 14 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1599,18 +1599,17 @@ Function Multi-versioning (FMV) is an Arm C Language Extension that
15991599
lets the compiler generate multiple function versions and auto-dispatch
16001600
between them. Each of the function versions is specialized for a set
16011601
of architecture extensions. The most suitable version is selected
1602-
dynamically. This requires runtime information about the CPU features
1602+
at load time. This requires runtime information about the CPU features
16031603
available on the host. FMV is supported on GNU/Linux, Android, and
16041604
many of the BSD operating systems.
16051605

16061606
On System V platforms Function Multi-versioning is implemented using
16071607
GNU Indirect Functions (IFUNC). The compiler generated IFUNC resolver
1608-
may rely on a runtime library for selecting the most suitable function
1609-
version, but it is not a requirement.
1610-
1611-
If a runtime library is used, it must ensure that a global variable
1612-
``__aarch64_cpu_features`` containing a description of the detected
1613-
CPU features is populated before the application code reaches main.
1608+
may rely on the presence of a global variable ``__aarch64_cpu_features``
1609+
provided by the runtime library. It contains information about the
1610+
available CPU features. The runtime library must also provide a
1611+
function ``__init_cpu_features_resolver`` that the IFUNC resolver
1612+
can call to initialize ``__aarch64_cpu_features``.
16141613

16151614
.. code-block:: c
16161615
@@ -1720,21 +1719,10 @@ A special value ``FEAT_INIT = (1U << 63);`` is used to signify
17201719
initialization completion.
17211720

17221721
Implementing FMV using ``__aarch64_cpu_features`` is not required.
1723-
Accessing ``__aarch64_cpu_features`` from outside a FMV resolver
1724-
function is not well defined.
1725-
1726-
Initialization of the ``__aarch64_cpu_features`` is performed by
1727-
the runtime library. Each FMV resolver function will call the
1728-
``__init_cpu_features_resolver`` function at load time. This runtime
1729-
function must ensure that ``__aarch64_cpu_features`` is populated.
1730-
1731-
Systems without support for IFUNC may call the
1732-
``__init_cpu_features_resolver`` function from an
1733-
``__attribute__((constructor))`` function provided by the runtime.
1734-
1735-
Systems with support for IFUNC should place the global variable
1736-
``__aarch64_cpu_features`` in Relocation Read Only (RELRO) segment
1737-
to prevent it from being modified after the FMV resolvers have run.
1722+
Accessing this variable from outside a FMV resolver function is
1723+
not well defined. The variable may be placed in the
1724+
`Relocation Read Only (RELRO)`_ program segment to prevent it
1725+
from being modified after the FMV resolvers have run.
17381726

17391727
The ``__init_cpu_features_resolver`` function has the following
17401728
prototype:
@@ -1744,10 +1732,10 @@ prototype:
17441732
void __init_cpu_features_resolver (uint64_t, const uint64_t *);
17451733
17461734
The above interface expects the same parameters as a GNU Indirect
1747-
Function resolver. Other platforms may use a different interface
1748-
with the runtime library. However, all implementations must provide
1749-
a DSO local definition of the function by setting the symbol
1750-
visibility to ``STV_HIDDEN``.
1735+
Function resolver. See `GNU C Library IFUNC interface`_. Other
1736+
platforms may use a different interface with the runtime library.
1737+
However, all implementations must provide a DSO local definition
1738+
of the function by setting the symbol visibility to ``STV_HIDDEN``.
17511739

17521740
Initialization and Termination Functions
17531741
----------------------------------------

0 commit comments

Comments
 (0)