A problem with shared library and libgcc.a
H.J. Lu
hjl@lucon.org
Wed Apr 29 18:36:00 GMT 1998
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)
More information about the Gcc
mailing list