All of lore.kernel.org
 help / color / mirror / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: "Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com>,
	"libc-alpha@sourceware.org" <libc-alpha@sourceware.org>
Cc: linux-man <linux-man@vger.kernel.org>,
	Siddhesh Poyarekar <siddhesh@sourceware.org>,
	Carlos O'Donell <carlos@redhat.com>,
	Rich Felker <dalias@aerifal.cx>, "H.J. Lu" <hjl.tools@gmail.com>
Subject: Re: Documenting the (dynamic) linking rules for symbol versioning
Date: Thu, 20 Apr 2017 15:17:52 +0200	[thread overview]
Message-ID: <5093fc5e-2f99-edff-b657-5f93f978ce1e@redhat.com> (raw)
In-Reply-To: <23c0ee0f-3abe-d411-b8fc-821d91b75fa7@gmail.com>

On 04/20/2017 01:45 PM, Michael Kerrisk (man-pages) wrote:

>>>>> 7. The way to remove a versioned symbol from a new release
>>>>>       of a shared library is to not define a default version
>>>>>       (NAME@@VERSION) for that symbol. (Right?)
>>>>>
>>>>>       In other words, if we wanted to create a VER_4 of lib_ver.so
>>>>>       that removed the symbol 'abc', we simply don't create use
>>>>>       the usual asm(".symver") magic to create abc@VER_4.
>>>>
>>>> You still need to use .symver, but with a @ version instead of a @@ version.
>>>
>>> Why is that? What functionally is the difference between
>>> having no .symver and a .symver with an @ version? (I tried
>>> both, and they *both* result in undefined symbol errors from
>>> ld(1), as I expected.
>>
>> I was assuming that you want to preserve ABI.  People who are interested
>> in symbol versioning usually want that. :)
> 
> I am thinking of the situation where one explicitly wants to
> deprecate a function in say VER_4, while still allowing that symbol
> to be available in VER_1 to VER_3. For example, one might possibly
> want to do this one day for the gets() function that has been
> removed in C11 and is deprecated in the last POSIX.1 (2008).

They way this usually works is that deprecation involves removing the 
default, but keeping the version itself around.  This means that 
existing binaries will continue to work, but new programs won't be able 
to use the symbol anymore.

> The point is that removing a symbol is possible in the traditional
> (filename-based) major versioning scheme where we create a new
> incompatible major version that drops the symbol. I've occasionally
> had people ask me how you would do something similar with symbol
> versioning.

Yes.  Removing the entire version still requires a soname bump (at which 
point you can remove all non-default versions because there aren't any 
legacy binaries anymore), which is why I believe you typically do not 
want to do that.

> To return to my question: given the two options, having no abc@VER_4

I think you mean “no abc” (with any version whatsoever).

> defined and having abc@VER_4 (not abc@@VER_4), then the effects are
> as follows:
> 
> * In both cases, the static linker would emit an error when trying
>    to resolve a reference to 'abc'.

Right.

> * In the case where we had a symbol abc@VER_4 in the SO, then
>    that symbol would be accessible to the static linker using
>    asm(".symver") (and obviously this wouldn't be possible
>    if there was no abc@VER_4 defined).
> 
> Any other differences to be aware of?

The key difference is that if there used to be an abc@@VER_4 default 
version, then older binaries did not have to use the .symver kludge to 
get the definition.  The static linker would have magically applied that 
version.

In fact, the general expectation is that the .symver backdoor to get 
symbols at non-default versions doesn't really exist. :)

Thanks,
Florian

  reply	other threads:[~2017-04-20 13:17 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-19 15:07 Documenting the (dynamic) linking rules for symbol versioning Michael Kerrisk (man-pages)
     [not found] ` <b3a962de-6703-d8b9-18f7-138185171475-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-04-19 15:48   ` Florian Weimer
     [not found]     ` <ee5e8057-7afa-c919-8ccb-9c8e6d0833c4-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2017-04-19 19:49       ` Michael Kerrisk (man-pages)
     [not found]         ` <517c3e75-93b5-0762-d6a4-7a17d196654e-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-04-20  8:49           ` Florian Weimer
     [not found]             ` <3edb27c6-c9b6-df95-3810-a8b5abc740fb-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2017-04-20 11:45               ` Michael Kerrisk (man-pages)
2017-04-20 13:17                 ` Florian Weimer [this message]
2017-04-20 14:07                   ` Michael Kerrisk (man-pages)
     [not found]                     ` <0409f767-3ae3-48f0-4836-8694361c755c-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-04-28 14:19                       ` Florian Weimer
2017-05-01 18:34                         ` Michael Kerrisk (man-pages)
2017-04-20  6:05   ` Siddhesh Poyarekar
     [not found]     ` <22f26755-f7f0-898a-ac74-3f6df92a22d7-9JcytcrH/bA+uJoB2kUjGw@public.gmane.org>
2017-04-20 12:40       ` Michael Kerrisk (man-pages)
2017-04-20 12:58         ` Siddhesh Poyarekar
     [not found]           ` <eb5bea0c-1f54-1b20-dc78-999160738ed3-9JcytcrH/bA+uJoB2kUjGw@public.gmane.org>
2017-04-20 13:01             ` Florian Weimer
2017-04-20 13:15               ` Siddhesh Poyarekar
     [not found]                 ` <c31e55fb-25af-bfe9-09db-83e622ec5e3f-9JcytcrH/bA+uJoB2kUjGw@public.gmane.org>
2017-04-20 13:45                   ` Florian Weimer
     [not found]                     ` <89907506-fddb-2429-7e18-b00b8a560070-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2017-04-20 14:09                       ` Michael Kerrisk (man-pages)
     [not found]                         ` <c1b5fd84-22ec-56de-b169-502d8072d188-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-04-20 14:35                           ` Michael Kerrisk (man-pages)
2017-05-05 14:10                           ` Florian Weimer
2017-04-26 19:57   ` Torvald Riegel
2017-05-05 19:51   ` Carlos O'Donell
     [not found]     ` <66c61101-f44f-2bbb-5ed2-b43c5d764e76-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2017-05-13 12:10       ` Michael Kerrisk (man-pages)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5093fc5e-2f99-edff-b657-5f93f978ce1e@redhat.com \
    --to=fweimer@redhat.com \
    --cc=carlos@redhat.com \
    --cc=dalias@aerifal.cx \
    --cc=hjl.tools@gmail.com \
    --cc=libc-alpha@sourceware.org \
    --cc=linux-man@vger.kernel.org \
    --cc=mtk.manpages@gmail.com \
    --cc=siddhesh@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.