Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Sun, 1 May 2022 09:59:02 -0700
From: Fangrui Song <i@...kray.me>
To: musl@...ts.openwall.com
Subject: Re: How to support symbol versioning for musl?

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)

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.