Fri, Jul 14, 2006 at 12:37:44AM -0400, Bryce McKinlay wrote:
Currently, binaries built with GCJ's "Binary Compatibility" ABI link
against the same SNAME as binaries built with the C++ ABI. This is
problematic because changes to the Java class libraries frequently break
C++ ABI compatibility: we need to bump the SNAME with each release, but
changing the SNAME itself breaks BC-ABI applications which would
otherwise be compatible. If the two ABIs are to continue to co-exist, we
need different SNAMEs for them.
This solution works by creating a shared library called libgcj_bc.so
which contains empty, "fake" declarations of all the symbols that BC-ABI
applications are allowed to reference in libgcj. At compilation time, if
-findirect-dispatch is specified, gcj will link with -lgcj_bc instead of
-lgcj. The linker will find libgcj_bc.so, which has an SNAME of
libgcj_bc.so.1.
This is fine.
However, libgcj_bc.so.1 itself is actually a symlink to the real
libgcj.so. So at runtime, the dynamic linker loads the real library to
resolve the libgcj_bc.so.1 SNAME.
But this has a severe disadvantage. If /usr/lib*/libgcj_bc.so.1 is
a symlink to libgcj.so.37.0.0, then only libgcj.so.37 will be in ld.so.cache
and libgcj_bc.so.1 will not be there. So, whenever an application or
library has DT_NEEDED libgcj_bc.so.1 (i.e. it has been built with
-findirect-dispatch), the dynamic linker will need to do an actual
filesystem search for it. 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 -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.
Jakub