ld: switching symbol versions
Richard Henderson
rth@redhat.com
Thu Sep 18 22:58:00 GMT 2014
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
>
More information about the Binutils
mailing list