public inbox for libc-help@sourceware.org
 help / color / mirror / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: Fengkai Sun via Libc-help <libc-help@sourceware.org>
Cc: Fengkai Sun <qcloud1014@gmail.com>
Subject: Re: Usage of rtld_active() in dlfcn functions
Date: Thu, 03 Sep 2020 10:08:51 +0200	[thread overview]
Message-ID: <875z8vmgdo.fsf@oldenburg2.str.redhat.com> (raw)
In-Reply-To: <CAF6YOcMoicQdn=a5Sy3mhZ_St82zpEkV_sXb1evRd9PmfQM3zw@mail.gmail.com> (Fengkai Sun via Libc-help's message of "Thu, 3 Sep 2020 15:17:20 +0800")

* Fengkai Sun via Libc-help:

> My question is, why can dlfcn functions be called before ld.so is
> initialized? Obviously a program written by the user cannot do that, and I
> can't find the reference to dlfcn functions in rtld.c.
> So what is rtld_active() used for?
>
> Additionally, what does "static dlopen" mean?

It means dlopen called from a statically linked application.  The
application does not use ld.so in this case.  It gets still loaded after
dlopen, but this version is not functional.  It cannot be initialized
because that would conflict with the process initialization the
statically linked program has already performed.

This is just how things are today.  Other approaches might be possible,
some of which could well eliminate this problem and use ld.so directly
even from statically linked programs.

Thanks,
Florian


      reply	other threads:[~2020-09-03  8:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-03  7:17 Fengkai Sun
2020-09-03  8:08 ` Florian Weimer [this message]

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=875z8vmgdo.fsf@oldenburg2.str.redhat.com \
    --to=fweimer@redhat.com \
    --cc=libc-help@sourceware.org \
    --cc=qcloud1014@gmail.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).