[Bug general/24498] 0.176: isn't LTO ready

mark at klomp dot org sourceware-bugzilla@sourceware.org
Thu Apr 2 11:14:06 GMT 2020


--- Comment #7 from Mark Wielaard <mark at klomp dot org> ---
We need a way to generate symbol versions without having to use (top-level)
inline assembly. It appears GCC 10 will provide this:

We should try to use this to define the symbol version macros (OLD_VERSION,

symver ("name2@nodename")

    On ELF targets this attribute creates a symbol version. The name2 part of
the parameter is the actual name of the symbol by which it will be externally
referenced. The nodename portion should be the name of a node specified in the
version script supplied to the linker when building a shared library. Versioned
symbol must be defined and must be exported with default visibility.

    __attribute__ ((__symver__ ("foo@VERS_1"))) int
    foo_v1 (void)

    Will produce a .symver foo_v1, foo@VERS_1 directive in the assembler

    It’s an error to define multiple version of a given symbol. In such case an
alias can be used.

    __attribute__ ((__symver__ ("foo@VERS_2")))
    __attribute__ ((alias ("foo_v1")))
    int symver_foo_v1 (void);

    This example creates an alias of foo_v1 with symbol name symver_foo_v1
which will be version VERS_2 of foo.

    Finally if the parameter is "name2@@nodename" then in addition to creating
a symbol version (as if "name2@nodename" was used) the version will be also
used to resolve name2 by the linker.

You are receiving this mail because:
You are on the CC list for the bug.

More information about the Elfutils-devel mailing list