mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Kai Peter <kp@lists.qware.org>
To: musl@lists.openwall.com
Subject: Re: [musl] How to support symbol versioning for musl?
Date: Wed, 20 Apr 2022 10:42:19 +0200	[thread overview]
Message-ID: <c949f3550fe1d4b8fe8d790e608aa8cd@lists.qware.org> (raw)
In-Reply-To: <20220328153707.GE7074@brightrain.aerifal.cx>

On 2022-03-28 17:37, Rich Felker wrote:
> 
> This is a topic that's come up before. Symbol versioning was
> intentionally not implemented to begin with because it's a really bad
> tool for what it's intended for and we intended not to use it in musl
> itself, but indeed still some things want to use it on their own, and
> at one point there was some wacky use of symbol versioning in
> libgcc_s.so that looked like it was going to be a problem to handle
> without supporting symbol versioning. So there has been talk on and
> off about supporting it in the future, but I think it's still a topic
> members of the community disagree over.
> 
> Implementation-wise, supporting versioning requires adding the logic
> to symbol lookups. Right now they use the versym table only to
> determine if the candidate symbol is default-version (that would be
> used by ld), in order not to break linking with libraries that were
> built with versioning. They don't have access to the version requested
> by the reference to the symbol. So additional information would have
> to be passed into the inner lookup loops, where it likely does have
> nontrivial costs for symbol lookup performance.
> 
> Lines 244-330 of ldso/dynlink.c are the relevant location where this
> would take place. Making it efficient might also require setting up
> some additional data in advance; I'm not sure. It's been a long time
> since I looked at what it might take to do this.
> 
> If actual symbol versioning isn't a hard requirement for what you're
> doing, you might look at alternate ways of achieving what you want.
> The core flaw of symbol versioning is that versions are bound at
> link-time, but the actual version needed comes from what headers the
> consumer of the library was built with at compile-time. A much simpler
> and more-correct version of symbol versioning can therefore be
> achieved just by using the preprocessor to remap identifiers in the
> library's headers:
> 
> #define libfoo_funcbar libfoo_funcbar_v2
> ...
> 
> Rich

Thanks for your quick reply. I'm not sure if I understood this 
versioning thing overall. However your hint to look in dynlink.c was 
very useful. I did some changes to musl's pathes anyway and did set the 
sys_path now accordingly to my needs. This is fine for this custom 
system. It's working perfect.

Kai

  parent reply	other threads:[~2022-04-20  8:42 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 [this message]
2022-04-25  6:02   ` Yang Zhonghua
2022-05-01 16:59     ` Fangrui Song

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=c949f3550fe1d4b8fe8d790e608aa8cd@lists.qware.org \
    --to=kp@lists.qware.org \
    --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).