Linker script and alias to a versioned symbol

Vladimir Mezentsev vladimir.mezentsev@oracle.com
Fri Apr 14 00:57:19 GMT 2023


  Hi Experts,

Is it possible with compiler/linker options to change the default 
version of clock_gettime (or GLIBC) in the test below.

Thank you,
-Vladimir

On 2/10/23 10:35, amb via Binutils wrote:
> Hi,
>
> I would like to know whether it is possible, in a linker script, to
> define an alias to a versioned symbol.
>
> As an example, let me use these two versioned symbols in glibc:
>
>    XXXX: 00000000000XXXX   119 FUNC    GLOBAL DEFAULT   15
> clock_gettime@GLIBC_2.2.5
>    XXXX: 00000000000XXXX   119 FUNC    GLOBAL DEFAULT   15
> clock_gettime@@GLIBC_2.17
>
> In a linker script, is it possible to make sure that a call to
> clock_gettime ends up invoking clock_gettime@GLIBC_2.2.5 ?
>
> I am familiar with how `__asm__(".symver SYM,SYM@GLIBC_VERSION");`
> works but that's not what I am looking for. I would like to know if
> there is a way to achieve this goal using only a linker script and
> nothing else.
>
> I tried something like this:
>
> PROVIDE( clock_gettime = clock_gettime@GLIBC_2.2.5 );
>
> But it doesn't seem to work. Maybe the '@' is an invalid char above?
>
> Thanks



More information about the Binutils mailing list