https://sourceware.org/bugzilla/show_bug.cgi?id=25295

--- Comment #15 from Fangrui Song <i at maskray dot me> ---
(In reply to H.J. Lu from comment #14)
> Created attachment 12440 [details]
> The updated patch
> 
> Also support
> 
> [hjl@gnu-cfl-2 pr25295]$ cat a.s
>       .global foo
> foo:
>       ret
>       .symver foo, bar@V1
>       .symver foo, baz@V2
> [hjl@gnu-cfl-2 pr25295]$ make a.o
> ./as   -o a.o a.s
> [hjl@gnu-cfl-2 pr25295]$ readelf -sW a.o
> 
> Symbol table '.symtab' contains 7 entries:
>    Num:    Value          Size Type    Bind   Vis      Ndx Name
>      0: 0000000000000000     0 NOTYPE  LOCAL  DEFAULT  UND 
>      1: 0000000000000000     0 SECTION LOCAL  DEFAULT    1 
>      2: 0000000000000000     0 SECTION LOCAL  DEFAULT    2 
>      3: 0000000000000000     0 SECTION LOCAL  DEFAULT    3 
>      4: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT    1 foo
>      5: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT    1 bar@V1
>      6: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT    1 baz@V2
> [hjl@gnu-cfl-2 pr25295]$

Thanks for your efforts to clean up .symver mess. In particular, I am very
happy that in 2000
(https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=79082ff0c6032d8e1e832fe35cc69b3b46d4bd91)
you invented @@@ to fix @@ deficiency.

Fundamentally I am not against the following

  .symver foo,foo@v1
  .symver foo,foo@v2

but I suspect it can make implementation difficult. The renaming semantics can
probably simplify GNU ld bfd_link_hash_indirect as well.


If the intention is to make a symbol available simultaneously as foo@v1 and
foo@v2, the renaming semantics can work with a .set directive:

  globl foo_v1
  .symver foo_v1, foo@v1
  foo_v1:

  .globl foo_v2
  .set foo_v2, foo_v1
  .symver foo_v2, foo@v2

>      4: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT    1 foo

I still hope we can remove `foo` from the symbol table, which is also Comment
#3's request.
It is just very inconvenient for an archive user if the symbol remains in the
symbol table.

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

Reply via email to