mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Fangrui Song <i@maskray.me>
To: musl@lists.openwall.com
Subject: Re: [musl] How to support symbol versioning for musl?
Date: Sun, 1 May 2022 09:59:02 -0700	[thread overview]
Message-ID: <20220501165902.owup2lvij54yrmyg@gmail.com> (raw)
In-Reply-To: <tencent_6A32958C35E7796805F90B0DB6D8CD18490A@qq.com>

On 2022-04-25, Yang Zhonghua wrote:
>Hi guys,
>
>
>I tried to use the "versym" member of "struct dso", referring to the function "checkver()" of src/internal/vdso.c file.
>
>
>prerequisites:
>defining three versions for one symbol.
>
>
>questions:
>As "dso-&gt;strings + dso-&gt;syms[i].st_name" of the three symbols was the same name, I tried to use "dso-&gt;versym[i]" to distinguish versions. But only the default symbol version was a positive value, the others were both negative values(-32766).
>
>
>Is there any way to get the right "dso-&gt;versym[i]" value for all symbol versions?
>Looking forward to your valuable advice. Thank you so much!
>
>
>Yang Zhonghua

You may want to switch posting style
https://www.idallen.com/topposting.html (Top-posting vs Bottom-posting)
to match others.

I have a write-up about glibc rtld behavior (also FreeBSD rtld-elf's) at
https://maskray.me/blog/2020-11-26-all-about-symbol-versioning#rtld-behavior
Paste the most relevant part below:


When searching a definition for `foo`,

* for an object without symbol versioning
   + it can be bound to `foo`
* for an object with symbol versioning
   + it can be bound to `foo` of version `VER_NDX_GLOBAL`. This takes precendence over the next two rules
   + it can be bound to `foo` of any default version
   + it can be bound to `foo` of non-default version index 2 in relocation resolving phase (not dlvsym). The rule retains compatibility when a shared object becomes versioned.

When searching a definition for `foo@v1`,

* for an object without symbol versioning
   + it can be bound to `foo`
* for an object with symbol versioning
   + it can be bound to `foo@v1` or `foo@@v1`
   + it can be bound to `foo` of version `VER_NDX_GLOBAL` in relocation resolving phase (not dlvsym)

      reply	other threads:[~2022-05-01 16:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-28  9:44 up
2022-03-28 15:37 ` Rich Felker
2022-04-20  7:30   ` up
2022-04-20  8:42   ` Kai Peter
2022-04-25  6:02   ` Yang Zhonghua
2022-05-01 16:59     ` Fangrui Song [this message]

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=20220501165902.owup2lvij54yrmyg@gmail.com \
    --to=i@maskray.me \
    --cc=musl@lists.openwall.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

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 NNTP newsgroup(s).