public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Szabolcs Nagy <Szabolcs.Nagy@arm.com>
To: Florian Weimer <fweimer@redhat.com>, David Kilroy <David.Kilroy@arm.com>
Cc: nd <nd@arm.com>, "libc-alpha@sourceware.org" <libc-alpha@sourceware.org>
Subject: Re: [PATCH 1/3] elf: Allow dlopen of filter object to work [BZ #16272]
Date: Mon, 21 Oct 2019 16:42:00 -0000	[thread overview]
Message-ID: <6cbb4c5e-72e0-507d-fa34-5a70db35c03a@arm.com> (raw)
In-Reply-To: <87imoinprn.fsf@oldenburg2.str.redhat.com>

On 21/10/2019 15:21, Florian Weimer wrote:
> * David Kilroy:
>> I suspect that this wouldn't work in my use case though. External projects
>> link against the filter object we produce, and don't know about the filtee
>> (which is effectively an implementation detail). Different suppliers can also
>> supply the library (which may or may not be a filter object), so having the
>> external project link the library differently based on implementation is...
>> suboptimal.
> 
> If you currently use a symbolic link for the .so link object, it should
> be easy enough to replace that with the script.  If the link time DSO is
> stored under its soname, then of course this does not work, but you
> wouldn't be able to transparently inject the filter either, so that
> doesn't seem to be your scenario.

linker script only works at static link time, not for dlopen.

> I'm less clear how this all interacts with dlopen.  It seems that you
> want a simple alias mechanism for dlopen.  In that case, a simple
> symbolic link with the soname should work, and you don't need a separate
> filter object, either.

the scenario is:

libA.so and libB.so export a set of symbols.  this is abi
and there are multiple providers of libA.so and libB.so.

one provider wants to have a single libinternal.so that
defines all the symbols of libA and libB as they share a
lot of code.

(1) having libA.so and libB.so as "wrapper libraries" around
libinternal.so with RTLD_NEXT would work, but that's less
efficient because of the extra indirection,

(2) the filter library magic would avoid the wrapper.

(3) symlinking libA.so and libB.so to libinternal.so makes
all symbols visible when either of them is loaded, polluting
the link namespace.

(4) creating two copies of libinternal.so with different
set of exported symbols would work just waste memory (assuming
there is no internal global state that needs to be shared)

i think if link namespace pollution is ok then (3) is the best
solution otherwise it's less clear, but probably (4) is most
reliable.

(libinternal.so is a video driver lib and libA, libB, .. are
various opengl libs with fixed abi)

  reply	other threads:[~2019-10-21 16:42 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-17 10:33 [PATCH 0/3] " David Kilroy
2019-10-17 10:33 ` [PATCH 2/3] elf: avoid redundant sort in dlopen David Kilroy
2019-10-17 10:33 ` [PATCH 3/3] elf: avoid stack allocation in dl_open_worker David Kilroy
2019-10-17 10:33 ` [PATCH 1/3] elf: Allow dlopen of filter object to work [BZ #16272] David Kilroy
2019-10-18 11:43   ` Florian Weimer
2019-10-18 15:09     ` David Kilroy
2019-10-21 11:27       ` Florian Weimer
2019-10-21 14:12         ` David Kilroy
2019-10-21 14:21           ` Florian Weimer
2019-10-21 16:42             ` Szabolcs Nagy [this message]
2019-10-22  9:22               ` David Kilroy
2019-10-22  9:49                 ` Florian Weimer
2019-10-22 11:20                   ` David Kilroy
2019-10-22  9:43               ` Florian Weimer
2019-10-22 11:18                 ` David Kilroy
2019-10-22 11:22                   ` Florian Weimer
2019-10-22 11:27                     ` David Kilroy
2019-10-22 11:31                       ` Florian Weimer
2019-10-22  8:28             ` David Kilroy
2019-10-22  8:36               ` Florian Weimer
2019-10-22  9:39                 ` David Kilroy
2019-10-22  9:57                   ` Florian Weimer
2019-10-22 11:24                     ` David Kilroy
2019-10-22 14:29     ` David Kilroy

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=6cbb4c5e-72e0-507d-fa34-5a70db35c03a@arm.com \
    --to=szabolcs.nagy@arm.com \
    --cc=David.Kilroy@arm.com \
    --cc=fweimer@redhat.com \
    --cc=libc-alpha@sourceware.org \
    --cc=nd@arm.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.
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).