-findirect-dispatch: broken on Linux, working on Mingw?

Marco Trudel mtrudel@gmx.ch
Sat Mar 10 17:42:00 GMT 2007


Andrew Haley wrote:
> Marco Trudel writes:
> > Andrew Haley wrote:
>> [snip]
>> > > Without use_libgcj_bc set to "yes" you should get the simple *lib line
> > > above. There should be no references to -lgcj_bc.
> > 
> > What about the the host=Linux target=Linux compiler? -findirect-dispatch 
> > doesn't work either.
>> Eh? Works for me and everyone else using it.

It seems we talked about different setups all along. So let me start 
from scratch again, simplify it and combine it with the progress you 
already archived:
I use a static gcj rev 122749, host=Linux, target=Linux.
Compiling a HelloWorld with indirect dispatch fails with:
/tmp/cciWx2S5.o: In function `main':ccxsXCuN.i:(.text+0x13): undefined 
reference to `_Jv_Compiler_Properties'
:ccxsXCuN.i:(.text+0x30): undefined reference to `JvRunMainName'
/tmp/ccmjyQHx.o: In function `void 
Test::main(JArray<java::lang::String*>*)':Test.class:(.text+0x2e): 
undefined reference to `_Jv_InitClass'
:Test.class:(.text+0x51): undefined reference to `_Jv_ResolvePoolEntry'
/tmp/ccmjyQHx.o: In function `global constructors keyed to 
0__ZN4TestC1Ev':Test.class:(.text+0xb6): undefined reference to 
`_Jv_RegisterNewClasses'
/tmp/ccmjyQHx.o:(.eh_frame+0x11): undefined reference to 
`__gcj_personality_v0'
collect2: ld returned 1 exit status
There's not much sense in using indirect dispatch for a simple 
HelloWorld than just showing the issue. Compiling without that flag 
works perfectly.
In my libgcj.spec, I have this line:
*lib: %{static-libgcj:-non_shared} %{s-bc-abi:-lgcj_bc;:-lgcj} 
%{static-libgcj:-call_shared} -lm -lpthread -lrt -ldl %(libgcc) 
%(liborig)
Replacing it with your suggested line:
*lib: %{s-bc-abi:} -lgcj -lm -lpthread -lrt -ldl %(libgcc) %(liborig)
Makes the compilation succeed and the final binary works. Adding 
"-static-libgcj" on the other hand, makes compilation work but the 
binary will exit with:
libgcj error: This is libgcj_bc.so, a fake library used only for linking.
Please create a symlink from libgcj_bc.so.1 to the real libgcj.so.
So it seems the *lib line should be corrected.
Hope that helps...
thanks
Marco


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /