This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix linking with -findirect-dispatch


On Tue, Apr 16, 2013 at 11:57:54AM +0200, Andreas Schwab wrote:
> Jakub Jelinek <jakub@redhat.com> writes:
> 
> > Why would that be a problem?  libgcj.so the linker sees (i.e. the dummy
> > library) doesn't intentionally have DT_NEEDED libgcj.so.N, programs and
> > shared libraries linked with -findirect-dispatch should be adding
> > libgcj_bc.so to DT_NEEDED, not libgcj.so.N.
> 
> But the dummy libgcj_bc.so doesn't define _Jv_MonitorExit, or any other
> relevant symbol.

That is not true.  Build from yesterday, on x86_64-linux:

$ readelf -Wa libjava/.libs/libgcj_bc.so | grep _Jv_MonitorExit; readelf -d libjava/.libs/libgcj_bc.so | grep NEEDED; echo ==; readelf -Wa libjava/.libs/libgcj_bc.so.1 | grep _Jv_MonitorExit; readelf -d libjava/.libs/libgcj_bc.so.1 | grep NEEDED
    25: 0000000000001250     2 FUNC    GLOBAL DEFAULT   10 _Jv_MonitorExit
    77: 0000000000001250     2 FUNC    GLOBAL DEFAULT   10 _Jv_MonitorExit
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1]
==
 0x0000000000000001 (NEEDED)             Shared library: [libgcj.so.14]

The point of -findirect-dispatch linking against -lgcj_bc rather than -lgcj
is that whenever N in libgcj.so.N is bumped, you don't need to rebuild all the
-findirect-dispatch compiled/linked programs and shared libraries, only if
you build a direct dispatch programs or shared libraries.

So, -findirect-dispatch programs and shared libraries should have:
 0x0000000000000001 (NEEDED)             Shared library: [libgcj_bc.so.1]
rather than:
 0x0000000000000001 (NEEDED)             Shared library: [libgcj.so.14]

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]