public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Vladimir Mezentsev <vladimir.mezentsev@oracle.com>
To: binutils@sourceware.org
Subject: Re: Linker script and alias to a versioned symbol
Date: Fri, 10 Feb 2023 11:09:47 -0800	[thread overview]
Message-ID: <12250260-cb53-78db-3ecf-f0d0d939a36d@oracle.com> (raw)
In-Reply-To: <CAAJF+LnQ4Du-f0MDrj05MJWYahv8-Oby5hA4YFtzjgpAvVa=2w@mail.gmail.com>



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 ?

+1.
We need this.

>
> 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 );

   This should work:
      int (*clock_gettime_2_2_5)(clockid_t clk_id, struct timespec *tp) 
= dlvsym (RTLD_NEXT, "clock_gettime ", "GLIBC_2.2.5");
clock_gettime_2_2_5( YOUR_ARGS_FOR_CLOCK_GETTIME );


-Vladimir

>
> But it doesn't seem to work. Maybe the '@' is an invalid char above?
>
> Thanks


  reply	other threads:[~2023-02-10 19:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-10 18:35 amb
2023-02-10 19:09 ` Vladimir Mezentsev [this message]
2023-04-14  0:57 ` Vladimir Mezentsev
2023-04-14  9:00   ` Frédéric Pétrot
2023-04-14  9:04     ` Nick Clifton
2023-04-14  9:18       ` Frédéric Pétrot
2023-04-14  9:02   ` Nick Clifton

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=12250260-cb53-78db-3ecf-f0d0d939a36d@oracle.com \
    --to=vladimir.mezentsev@oracle.com \
    --cc=binutils@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).