From mboxrd@z Thu Jan 1 00:00:00 1970 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 Message-id: X-SW-Source: 1998-04/msg01173.html 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)