From: Markus Wichmann <nullplan@gmx.net>
To: musl@lists.openwall.com
Subject: Re: [musl] Dynamic linking of NEEDED with absolute path differs than that of glibc
Date: Wed, 22 Dec 2021 06:46:46 +0100 [thread overview]
Message-ID: <20211222054646.GB1950@voyager> (raw)
In-Reply-To: <CAH4OOv6b3AnNJOb_3ezW2GSBZdghrXGAp2BMFpH-jxbGW-wscQ@mail.gmail.com>
On Tue, Dec 21, 2021 at 10:56:33AM -0800, Farid Zakaria wrote:
> Hello!
>
> I am working, along with Tom <scogland1@llnl.gov> on a contribution to
> patchelf[1] that takes all the NEEDED from downstream shared object
> dependencies and lifts them to the top executable. I then change the
> NEEDED in the top executable to be absolute paths. This seems to work
> as expected in glibc.
>
May I ask why you copy the transitive dependencies? This also used to be
the default behavior of GNU ld, and it didn't make sense to me then,
either. I noticed it when I was using Gentoo. I had some library
providing some cryptographic service, but not actually implementing the
crypto itself; it could use at least two backends for that. Something
happened that broke one backend, so I recompiled the library to use the
other backend, but the executables now would not load, because they
contained a dependency on the library they never actually needed
directly. So I had to recompile the program. And I thought not having to
recompile the programs when you update the libraries was supposed to be
a strength of shared libraries.
>
> Tom helped track this down due to the shortname assignment behavior[2]
>
This has already been the subject of discussion years ago. The stated
reason (Rich gave) back then was that loading a library by explicit file
name is not the same as loading it by short name. Loading the library by
explicit file name can mean that you have a module with a private
version of a library, that is not meant to be globally accessible, and
if then later someone comes along to load a library by the short name,
they do not mean the same version, but rather, the system version of the
library.
Though I don't know if this applies to DT_NEEDED as much as to dlopen().
Ciao,
Markus
next prev parent reply other threads:[~2021-12-22 5:47 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-21 18:56 Farid Zakaria
2021-12-22 5:46 ` Markus Wichmann [this message]
2021-12-22 13:58 ` Farid Zakaria
2021-12-23 11:46 ` Adhemerval Zanella
2021-12-23 20:41 ` Tom Scogland
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=20211222054646.GB1950@voyager \
--to=nullplan@gmx.net \
--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).