This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: ld: switching symbol versions
- From: Richard Henderson <rth at redhat dot com>
- To: Nikos Mavrogiannopoulos <n dot mavrogiannopoulos at gmail dot com>, binutils at sourceware dot org
- Date: Thu, 18 Sep 2014 15:58:08 -0700
- Subject: Re: ld: switching symbol versions
- Authentication-results: sourceware.org; auth=none
- References: <CAJU7zaJP_iBdX7EqmUQcMVQS1Z=4Ycpfy7nABnowLyo-Yt45MQ at mail dot gmail dot com>
On 09/17/2014 12:49 AM, Nikos Mavrogiannopoulos wrote:
> Hello,
> I'm using in a library versioned symbols, and for reasons outside my
> control I'd like to phase out the old versioned symbols (e.g., with
> tag XXX) and move to a new version (e.g., tag NEW). During that phase
> out period I'd like to keep the old symbols available. That is, I'd
> like some symbols to be under the NEW and the XXX tag, and I'd like
> any new compiled programs to use the NEW tag instead of XXX.
This happens within glibc, as interfaces are retired (for one reason or
another) and new ones take their place.
> NEW {
> my symbol;
> }
>
> XXX {
> my_symbol;
> }
>
>
> And it seems to achieve what I need. Old programs that use the XXX ABI
> work seamlessly and new programs link against the NEW ABI. My question
> is, whether this behavior is random, or is the intended one and I can
> rely on it.
I'd be surprised if this really does what you want.
You want the old symbols to be defined with non default versions
my_symbol@XXX
and new symbols to be defined with default versions
my_symbol@@NEW
As far as I know from glibc development, this requires defining the symbols in
this manner within the object files. C.f.
glibc/sysdeps/unix/sysv/linux/xstat64.c
which exports __xstat64 with both GLIBC_2_1 and GLIBC_2_2 versions.
r~
>
> regards,
> Nikos
>
> [0]. https://sourceware.org/binutils/docs/ld/VERSION.html#VERSION
>