-findirect-dispatch: broken on Linux, working on Mingw?
Marco Trudel
mtrudel@gmx.ch
Fri Mar 9 13:27:00 GMT 2007
Andrew Haley wrote:
> 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)
BTW, the original lines are:
win: *lib: %{s-bc-abi:-lgcj_bc;:-lgcj} -lm -lpthread -lrt -ldl
%(libgcc) %(liborig)
lin: *lib: %{static-libgcj:-non_shared} %{s-bc-abi:-lgcj_bc;:-lgcj}
%{static-libgcj:-call_shared} -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 -lpthrea
d -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
Well then, lets take your suggested line:
*lib: %{static-libgcj:-non_shared -lgcj
-call_shared;:%{s-bc-abi:-lgcj_bc;:-lgcj}} -lm -lpthread -lrt -ldl
%(libgcc) %(liborig)
and change it to:
*lib: %{static-libgcj:-non_shared -lgcj
-call_shared;:%{s-bc-abi:-lgcj;:-lgcj}} -lm -lpthread -lrt -ldl
%(libgcc) %(liborig)
That makes compiling the sample with indirect dispatch work (it also
runs correct). But I really have no idea what I'm doing... Maybe you
know more?
> 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)
You mean the original line, right?
Well, your original fix doesn't work on Linux either. But with the
changed one, it works too...
Marco
More information about the Java
mailing list