public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: hjl@lucon.org (H.J. Lu)
To: drepper@cygnus.com (Ulrich Drepper)
Cc: egcs@cygnus.com, libc-hacker@gnu.org (GNU C Library)
Subject: A problem with shared library and libgcc.a
Date: Wed, 29 Apr 1998 18:36:00 -0000	[thread overview]
Message-ID: <m0yUhRj-000268C@ocean.lucon.org> (raw)

Hi,

I think I figured out why gcc -shared doesn't with glibc 2.1 if dlopen
is used by the static executable.

The problem is with gcc -shared including -lgcc. When we build libfoo.so
with

# gcc -shared -o libfoo.so

It includes -lgcc -lc. As the result

# ldd libfoo.so
        libc.so.6 => /opt/glibc-2/lib/libc.so.6 (0x40007000)
	/opt/glibc-2/lib/ld-linux.so.2 => /opt/glibc-2/lib/ld-linux.so.2 (0x00000000)

When dlopen () is called, libfoo.so and libc.so.6 are loaded, libfoo.so
first and followed by libc.so.6. Since __register_frame_info and
__deregister_frame_info from libgcc.a are in libfoo.so, libc.so.6
also uses the same __register_frame_info and __deregister_frame_info
in libfoo.so. When dlclose is called, libfoo.so is munmapped first.
When libc.so.6 is removed from memory, __deregister_frame_info is
called. But now __deregister_frame_info in libfoo.so is no longer
in memory. We get a problem.

I don't know what the best solution is. But it should be fixed.

Thanks.


-- 
H.J. Lu (hjl@gnu.org)

                 reply	other threads:[~1998-04-29 18:36 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=m0yUhRj-000268C@ocean.lucon.org \
    --to=hjl@lucon.org \
    --cc=drepper@cygnus.com \
    --cc=egcs@cygnus.com \
    --cc=libc-hacker@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).