This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Re: [java] RFC/RFA: libgcj_bc.so.1
On Fri, Jul 14, 2006 at 12:19:43PM -0400, Bryce McKinlay wrote:
> >>>On the other side, if
> >>>/usr/lib*/libgcj_bc.so.1 is a symlink to
> >>>libgcj_bc.so.1.0.0 and /usr/lib*/libgcj_bc.so.1.0.0 is a dummy shared
> >>>library (
> >>>gcc -shared -O2 -fpic -xc /dev/null -Wl,-soname,libgcj_bc.so.1 -o
> >>>libgcj_bc.so.1.0.0 -lgcj
> >>>), then both libgcj.so.37 and libgcj_bc.so.1 will be in ld.so.conf.
> >>>
> >>>
> >>Well, we already tried this approach. It doesn't work because if
> >>libgcj_bc.so.1 is linked to libgcj.so.37, then the linker adds a
> >>DT_NEEDED for libgcj.so.37 to any binaries that are linked with
> >>-lgcj_bc. The --no-add-needed linker option is supposed to stop this
> >>from happening, but it doesn't work.
> >>
> >
> >Even when libgcj_bc.so (i.e. the static link time dummy lib) doesn't
> >have DT_NEEDED on libgcj.so.* at all?
> >
>
> How does libgcj.so.37 get loaded at runtime, then?
libgcj_bc.so.1.0.0 has that DT_NEEDED, but not libgcj_bc.so.
Try:
gcc -shared -O2 -fpic -Wl,-soname,libgcj_bc.so.1 -o libgcj_bc.so libgcj_bc.c
gcc -shared -O2 -fpic -nostdlib -Wl,-soname,libgcj_bc.so.1 -o libgcj_bc.so.1.0.0 -xc /dev/null -lgcj
ln -sf libgcj_bc.so.1.0.0 libgcj_bc.so.1
and then link some -findirect-dispatch samples, with s/-lgcj/-lgcj_bc/ on
the ld command line.
BTW, you need #include <stdlib.h> in libgcj_bc.c.
Jakub