V2 [PATCH] gas: Extend .symver directive

Fangrui Song i@maskray.me
Tue Apr 7 21:22:21 GMT 2020


On 2020-04-07, H.J. Lu via Binutils wrote:
>On Tue, Apr 7, 2020 at 5:55 AM Andreas Schwab <schwab@linux-m68k.org> wrote:
>>
>> On Apr 07 2020, H.J. Lu wrote:
>>
>> > The optional argument VISIBILITY updates the visibility of
>> > the original symbol.  The valid visibilities are 'local', 'hidden', and
>> > 'remove'.  The 'local' visibility makes the original symbol a local
>> > symbol (*note Local::).  The 'hidden' visibility sets the visibility of
>> > the original symbol to 'hidden' (*note Hidden::).  The 'remove'
>> > visibility removes the original symbol from the symbol table.  If
>> > visibility isn't specified, the original symbol is unchanged.
>>
>> Looks good.
>
>Here is the updated patch.
>
>-- 
>H.J.

Let me summarize the current status:

@@@ has the renaming semantics. (invented in 2000)
@ and @@ has the copying semantics. The original symbol remains which is usually cumbersome.

We have received some requests:

* Have a way to not retain the original symbol
* Have a way to define multiple versions `.symver something,foo@v1; .symver something,foo@v2. symver something,foo@@v3`


We have many choices.

A. make @ @@ similar to @@@
   For @@, because of the linking rule (a @@ definition can satisfy a
   referenced without a version), there should be no difference.

   For @, this will be a semantic break. Personally I don't think this
   matters. I believe 99% projects don't need the original symbol and
   will not notice anything. I also checked with FreeBSD developers.

   However, given the general conservative attitude of the binutils
   community, I think there might be some objection.

   Reusing the same stem name is very likely a mistake.
   
   .globl foo_v1
   .symver foo_v1,foo@v1
   foo_v1:
   
   A non-default version can be used to reject static archive linking
   while keep shared object compatibility. An undefined reference foo
   without a version cannot be satisfied by the definition.

   Keeping `foo` + .symver foo,foo@v1 will nullify the use case.

B. Add an optional argument to change binding/visibility or remove the
   original symbol (this patch).
   I am mostly worried that this makes the .symver semantics even harder
   to understand / explain in the documentation.

   There seems to make @@@ even more inconsistent with @/@@.

   BTW, have you checked .localentry (which can set the non-visibility
   bits of st_other)

   I ask for clarification from GCC developers why some special
   attributes (local/hidden) are needed, not other general attribute
   flags.


More information about the Binutils mailing list