mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Jon Chesterfield <jonathanchesterfield@gmail.com>
To: John Hu <heat0415@gmail.com>, musl@lists.openwall.com
Subject: Re: A question about pure static linking with libdl
Date: Sat, 10 Jun 2017 12:19:43 +0100	[thread overview]
Message-ID: <CAOUYtQC=1h+RebMmhDACXSsjMUi2sre66vzMH1YBXCohSKJJuw@mail.gmail.com> (raw)
In-Reply-To: <20170516103036.GD9350@port70.net>

[-- Attachment #1: Type: text/plain, Size: 2019 bytes --]

I think using dlopen in static binaries is an interesting (though niche)
use case. I'm subscribed to this list with a vague intention of
implementing it but haven't found the time.

The application of interest to me is a plugin architecture where the main
executable is static, mostly so it's easier to distribute, and the plugged
in components are independent of any libc. Essentially trying to use elf as
part of a jit loading mechanism.

No eta on this work though. Could be years :(

Cheers

On 16 May 2017 17:30, "Szabolcs Nagy" <nsz@port70.net> wrote:

* John Hu <heat0415@gmail.com> [2017-05-16 15:40:28 +0800]:
> Recently I have an experiment about whether full static-linked ld.gold
with
> plugin function enabled can use its --plugin option to dynamically load
> plugins such as LLVMgold.so. I use "./configure --enable --enable-plugins
> --disable-werror LDFLAGS="-static" "  to generate a full statically linked
> ld.gold which does not have any dynamic library dependency, then I exec
> "./ld.gold --plugin LLVMgold.so" but an error occurs that "could not load
> plugin library: Dynamic loading not supported". I doubt this is a bug
> because it is claimed that musl supports full static linking but I am not
> sure about that. BTW, my experiment environment is Alpine 3.5.

dlopen is not supported in static linked binaries yet, that is non-trivial
to support and in your use case it does not make sense: the loaded lib is
linked against the host libc (and many other libs) and is in a package that
is updated independently of the libc, there is no guarantee that the static
linked libc is compatible with the host libc (and if there is then you
don't really need static linking anyway, you could get the same effect
by using your custom libc to launch ld.gold as ./mylibc.so ld-gold ).

>
> Now I send this email again because I want this email to be replied
> according to "If you are not subscribed and want to receive a reply,
please
> mention in your email that you want to be Cc'd." in the website.

[-- Attachment #2: Type: text/html, Size: 2790 bytes --]

  parent reply	other threads:[~2017-06-10 11:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-16  7:40 John Hu
2017-05-16 10:30 ` Szabolcs Nagy
2017-05-17  4:28   ` John Hu
2017-06-10 11:19   ` Jon Chesterfield [this message]
2017-06-10 16:37     ` Szabolcs Nagy
2017-06-10 19:54       ` Rich Felker
  -- strict thread matches above, loose matches on Subject: below --
2017-05-16  6:46 John Hu

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='CAOUYtQC=1h+RebMmhDACXSsjMUi2sre66vzMH1YBXCohSKJJuw@mail.gmail.com' \
    --to=jonathanchesterfield@gmail.com \
    --cc=heat0415@gmail.com \
    --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).