This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Try to solve shared libgcc and glibc
- To: GNU C Library <libc-alpha at sourceware dot cygnus dot com>
- Subject: Try to solve shared libgcc and glibc
- From: "H . J . Lu" <hjl at lucon dot org>
- Date: Thu, 22 Mar 2001 11:59:12 -0800
I am trying to address an issue with shared libgcc and glibc. I can
understand the need for shared libgcc from gcc. But I don't think
the current scheme will work for glibc. I propose the system based
on glibc also provides the shared libgcc as a system library. It is
trivial to build our own libgcc_s.so.0 during the glibc build. We
provide libgcc_s.so as
# cat << EOF > /usr/lib/libgcc_s.so
GROUP (
/lib/libgcc_s.so.0
-lgcc
)
EOF
We then make libgcc_s.so.0 an auxiliary filter for libc.so. I enclosed
a demo here:
cc -g -O -fPIC -c -o bar-1.o bar-1.c
cc -Wl,-soname,libbar.so -shared -o libbar-1.so bar-1.o -Wl,--version-script,libbar-1.map
cc -g -O -fPIC -c -o bar-2.o bar-2.c
cc -Wl,-soname,libfoo.so -shared -o libfoo.so foo.c -Wl,--version-script,libfoo.map
cc -Wl,-soname,libbar.so -shared -o libbar-2.so bar-2.o -Wl,-f,libfoo.so -Wl,--version-script,libbar-2.map
ln -sf libbar-1.so libbar.so
cc -o test test.c -lbar -L./ -Wl,-rpath,.
./test
bar
foo-1
ln -sf libbar-2.so libbar.so
./test
bar
foo
cc -o test test.c -lbar -L./ -Wl,-rpath,.
./test
bar
foo
ln -sf libbar-1.so libbar.so
./test
bar
foo-1
In this demo, the definition of foo () is moved from libbar-1.so to
libfoo.so when libbar-2.so is introduced. Should it work for libgcc?
Any comments?
Thanks.
H.J.