------- Additional Comments From nickc at redhat dot com 2007-03-23 10:29 ------- Subject: Re: New: hidden alias not found while linking gcj compiled Java class with native C++ lib and CNI binding under Linux x86
Hi Andreas, Well I can shed some light on how this problem is happening, although not necessarily why: > de/dbt/simplelibclient/SimpleCPPLib.o:(.data.rel+0x68): undefined reference to > `hidden alias for de::dbt::simplelibclient::SimpleCPPLib::square(int)' Looking at libSimpleCPPLib.so, where you would expect to find the definition of the alias shows: % nm -C SimpleCPPLib/Debug/libSimpleCPPLib.so | grep square 0000071c t hidden alias for de::dbt::simplelibclient::SimpleCPPLib::square(int) 0000071c T de::dbt::simplelibclient::SimpleCPPLib::square(int) The "t" is critical. It indicates that the hidden alias is local to the file and not visible outside the library. Hence you are getting the link-time error. Looking at the SimpleCPPLib.o file on its own, (ie not inside the library) shows: % nm -C SimpleCPPLib/Debug/SimpleCPPLib.o | grep square 00000000 T hidden alias for de::dbt::simplelibclient::SimpleCPPLib::square(int) 00000000 T de::dbt::simplelibclient::SimpleCPPLib::square(int) ie here the hidden alias is type "T", an exported text symbol. This explains why you can link directly against the SimpleCPPLib.o file and obtain a fully resolved executable. I am not an expert on java, but it seems to me that you should not be trying to reference the hidden alias at all, (after all it is hidden). Instead SimpleLibClient/de/dbt/simplelibclient/SimpleCPPLib.o ought to be referencing the unaliased symbol [de::dbt::simplelibclient::SimpleCPPLib::square(int)] which *is* exported from libSimpleCPPLib.so. So to me this implies that this is a java compiler (gcj) problem. If there is a good reason for referencing the hidden alias then the problem is either that you should not be linking against the libSimpleCPPLib.so library but instead linking against the object file, or that the transformation of SimpleCPPLib.o into libSimpleCPPLib.so should not be transforming the globally visible hidden alias into a local-only hidden alias. Cheers Nick -- http://sourceware.org/bugzilla/show_bug.cgi?id=4266 ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-binutils