This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: -findirect-dispatch: broken on Linux, working on Mingw?
Marco Trudel writes:
> Andrew Haley wrote:
> > Marco Trudel writes:
> > > Is there a better way to solve this problem?
> >
> > Yes, but you know already. Indirect dispatch and shared libraries is
> > the right answer to this problem.
>
> > > Maybe it was intentionally but broken in the mean time?
> > > Or maybe the linker changed? I think I updated binutils for 4.3...
> > >
> > > > However, if you really do want to do this weird thing, this link line
> > > > in install/lib/libgcj.spec might work after a fashion:
> > > >
> > > > *lib: %{static-libgcj:-non_shared -lgcj -call_shared;:%{s-bc-abi:-lgcj_bc;:-lgcj}} -lm -lpthread -lrt -ldl %(libgcc) %(liborig)
> > >
> > > No, that doesn't fix it.
> >
> > I tried it, and it works for me on GNU/Linux. We need the output
> > using "gcj -v" to know why it failed in your case.
>
> Attached:
> newLib.txt: Compilation output with your *lib: ... line.
> oldLib.txt: Compilation output with the original *lib: ... line.
>
> I should mention that I work on 32bit Windows with a static GCJ rev
> 122233. The libgcj.spec is used, I removed the *lib line and got another
> error.
Here's your newLib.txt link line:
c:/programme/javanativecompiler-1.1.1/gcc-122233-lin/bin/../libexec/gcc/i686-pc-linux-gnu/4.3.0/collect2.exe -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 c:/programme/javanativecompiler-1.1.1/gcc-122233-lin/bin/../sys-root/usr/lib/crt1.o c:/programme/javanativecompiler-1.1.1/gcc-122233-lin/bin/../sys-root/usr/lib/crti.o c:/programme/javanativecompiler-1.1.1/gcc-122233-lin/bin/../lib/gcc/i686-pc-linux-gnu/4.3.0/crtbegin.o -Lc:/programme/javanativecompiler-1.1.1/gcc-122233-lin/bin/../lib/gcc/i686-pc-linux-gnu/4.3.0 -Lc:/programme/javanativecompiler-1.1.1/gcc-122233-lin/bin/../lib/gcc -Lc:/programme/javanativecompiler-1.1.1/gcc-122233-lin/bin/../lib/gcc/i686-pc-linux-gnu/4.3.0/../../../../i686-pc-linux-gnu/lib -Lc:/programme/javanativecompiler-1.1.1/gcc-122233-lin/bin/../sys-root/lib -Lc:/programme/javanativecompiler-1.1.1/gcc-122233-lin/bin/../sys-root/usr/lib C:\DOKUME~1\Marco\LOKALE~1\Temp/cckldaaa.o C:\DOKUME~1\Marco\LOKALE~1\Temp/ccKKbaaa.o -lgcc -lgcj_bc -lm -lpthread -lrt -ldl -lgcc -lc -lgcc c:/programme/javanativecompiler-1.1.1/gcc-122233-lin/bin/../lib/gcc/i686-pc-linux-gnu/4.3.0/crtend.o c:/programme/javanativecompiler-1.1.1/gcc-122233-lin/bin/../sys-root/usr/lib/crtn.o
Notice this fragment:
-lgcc -lgcj_bc -lm
shouldn't be there. -lgcj_bc should only be linked when linking
dynamically. It should be
-lgcc -lgcj -lm
I guess my fix doesn't work on Windows becasue you don't use the
static-libgcj command, so it assumes dynamic linking. I suppose for a
staticonly build you really need
*lib: -lgcj -lm -lpthread -lrt -ldl %(libgcc) %(liborig)
Andrew.