public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/60731] [4.7/4.8/4.9 Regression] dynamic library not getting reinitialized on multiple calls to dlopen()
Date: Wed, 02 Apr 2014 09:49:00 -0000	[thread overview]
Message-ID: <bug-60731-4-F0SmLiIvwb@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-60731-4@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60731

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
We hit

void
_dl_close (void *_map)
{
  struct link_map *map = _map;

  /* First see whether we can remove the object at all.  */
  if (__builtin_expect (map->l_flags_1 & DF_1_NODELETE, 0))
    {
      assert (map->l_init_called);
      /* Nope.  Do nothing.  */
      return;

the DF_1_NODELETE flag is set already after the first dlopen call which sets
it via do_lookup_x for the STB_GNU_UNIQUE symbol _ZGVZ16make_static_stayvE3smp

                  if (map->l_type == lt_loaded)
                    /* Make sure we don't unload this object by
                       setting the appropriate flag.  */
                    ((struct link_map *) map)->l_flags_1 |= DF_1_NODELETE;

so this either points to a "bad" design on the guard code for initializing
'smp' or to a weakness in the dynamic loader which doesn't handle unloading
of objects which define any(?) STB_GNU_UNIQUE symbol.  Note the above is
guarded with

              if ((type_class & ELF_RTYPE_CLASS_COPY) != 0)
                enter (entries, size, new_hash, strtab + sym->st_name, ref,
                       undef_map);
              else
                {
                  enter (entries, size, new_hash, strtab + sym->st_name, sym,
                         map);

                  if (map->l_type == lt_loaded)
                    /* Make sure we don't unload this object by
                       setting the appropriate flag.  */
                    ((struct link_map *) map)->l_flags_1 |= DF_1_NODELETE;
                }

thus if this were referenced via a copy relocation it would work.

Jason?


  parent reply	other threads:[~2014-04-02  9:49 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-01 17:01 [Bug c++/60731] New: " tim.moloney at mrsl dot com
2014-04-02  9:00 ` [Bug c++/60731] [4.7/4.8/4.9 Regression] " rguenth at gcc dot gnu.org
2014-04-02  9:49 ` rguenth at gcc dot gnu.org [this message]
2014-04-02 18:30 ` jason at gcc dot gnu.org
2014-04-03  9:48 ` rguenth at gcc dot gnu.org
2014-04-03 11:32 ` rguenth at gcc dot gnu.org
2014-04-07 13:28 ` jason at gcc dot gnu.org
2014-04-07 13:28 ` jason at gcc dot gnu.org
2014-04-23  9:09 ` neleai at seznam dot cz
2014-05-05 16:04 ` jason at gcc dot gnu.org
2014-06-13 16:19 ` jason at gcc dot gnu.org
2014-06-13 16:40 ` jason at gcc dot gnu.org
2015-01-15 15:03 ` davejohansen at gmail dot com

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=bug-60731-4-F0SmLiIvwb@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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).