* Jan Hubicka:

> Internally the patch tries to mimic what happens in ELF.  In particular
>
> __attribute__ ((__symver__ ("foo@VERS_1"))) int
> foo_v1 (void)
> {
> }
>
> creates a special form of alias with symver flag. Its assembler name is
> foo@VERS_1 since it is what happens in ELF too (normally @ is not
> allowed in symbol name).  Rest of GCC and LTO path handles is as normal
> alias (since it seems what binutils does as well) and instead of
> outputting it via .set we use .symver directive at the end.

Do you support foo@@VERS_1 for setting the default version as well?

It's sometimes useful to define multiple versions for a single symbol.
For maximum binutils compatibility, you would have to use intermediate
aliases.  __attribute__ ((__symver__ ("foo@VERS_1", "foo@@VERS_2")))
could turn into this:

  .set foo_v1.symver.1, foo_v1
  .symver foo_v1.symver.1, foo_v1@VERS_1
  .set foo_v1.symver.2, foo_v1
  .symver foo_v1.symver.2, foo_v1@@VERS_2

Sometimes it's also necessary to reference a symbol version.  I
suspect we'd need a separate attribute for that, or enhance the
__asm__ alias code to recognize @ and @@ symbols (also creating
internal aliases).

We would use both extensions (multiple symbol versions and symbol
references) internally for glibc eventually, once compiler versions
before GCC 10 are no longer supported.

Reply via email to