From: Richard Guenther <richard.guenther@gmail.com>
To: Romain Geissler <romain.geissler@gmail.com>
Cc: gcc@gcc.gnu.org
Subject: Re: [PLUGIN] dlopen and RTLD_NOW
Date: Mon, 05 Sep 2011 07:51:00 -0000 [thread overview]
Message-ID: <CAFiYyc2mGURPMfskEm_n0JtWk60HWCg8v-x=xGVGb04ZJXB65g@mail.gmail.com> (raw)
In-Reply-To: <CAF+LTeddhPLYLvYaLM=X3N4F_0UMrk_nTGP=zdZimY_aVUUK7g@mail.gmail.com>
On Mon, Sep 5, 2011 at 9:50 AM, Romain Geissler
<romain.geissler@gmail.com> wrote:
> Hi
>
> Is there any particular reason to load plugin with the RTLD_NOW option?
> This option force .so symbol resolution to be completely made at load time,
> but this could be done only when a symbol is needed (RTLD_NOW).
>
> Here is the dlopen line in plugin.c:
> dl_handle = dlopen (plugin->full_name, RTLD_NOW | RTLD_GLOBAL);
>
> My issue is, I want to load the same plugin.so in both cc1 and cc1plus, but
> in the C++ case, I may need to reference some cc1plus specific symbols. I can
> check whether cc1 or cc1plus loaded the plugin and thus use custom C++
> symbols only when present. With RTLD_NOW, the plugin fails to load in cc1 as
> symbol resolution is forced at load time.
>
> If RTLD_NOW is removed, dlopen falls back to the RTLD_LAZY mode which fits
> my need. Moreover, if one can force the complete symbol resolution at load time
> by defining the environment LD_BIND_NOW variable.
>
> So, is RTLD_NOW use justified ?
Not really, neither RTLD_GLOBAL.
Richard.
> Romain Geissler
>
next prev parent reply other threads:[~2011-09-05 7:51 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-05 7:50 Romain Geissler
2011-09-05 7:51 ` Richard Guenther [this message]
2011-09-05 8:10 ` Jakub Jelinek
2011-09-05 17:22 ` Andrew Pinski
2011-09-05 17:47 ` Jakub Jelinek
2011-09-06 7:47 ` Romain Geissler
2011-09-06 17:56 ` David Daney
2011-09-06 18:17 ` David Daney
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='CAFiYyc2mGURPMfskEm_n0JtWk60HWCg8v-x=xGVGb04ZJXB65g@mail.gmail.com' \
--to=richard.guenther@gmail.com \
--cc=gcc@gcc.gnu.org \
--cc=romain.geissler@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).