public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* A problem with shared library and libgcc.a
@ 1998-04-29 18:36 H.J. Lu
  0 siblings, 0 replies; only message in thread
From: H.J. Lu @ 1998-04-29 18:36 UTC (permalink / raw)
  To: Ulrich Drepper; +Cc: egcs, GNU C Library

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)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1998-04-29 18:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-04-29 18:36 A problem with shared library and libgcc.a H.J. Lu

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).