Symbol compression?, linking problems.

Shane Nay shane@minirl.com
Mon May 14 18:08:00 GMT 2001


> Gcj thinks that MenuItemPeer should be gnu.awt.peer.MenuItemPeer,
> whereas the generated C++ counterpart thinks it should be
> java.awt.peer.MenuItemPeer. The import is pretty clear about that, so
> it must be a problem with gcj, not related to mangling but to the way
> gcj resolves type. What's really puzzling is that the first argument
> to addItem is explicitly fully qualified.


Right..., except that "gnu.awt.peer.MenuItemPeer" doesn't exist.  I think I 
found the problem.  I noticed I wasn't getting anywhere in my creation of a 
testcase, until I made it so that the package contained a name that had some 
baseclass of the variables I was passing.  In the following test case (Which 
is too long, I'm sorry.., I futzed and futzed to make it smaller, but was 
having "issues"), if you replace all references to casetest.lang with 
casetest.bang, the symbols work just fine.  So, I'm guessing there is an 
error in the compression routines that check for text matchups in gcj, but 
then don't go back to the parent class to see if it matchs up.
Test case:
natTestCase.cc:
#include "TestCase.h"

void casetest::lang::TestCase::nativeTestSymbol (::java::util::Vector *, 
::java::net::URL *) {}

  void casetest::lang::TestCase::create (::java::lang::String *) {}

  void casetest::lang::TestCase::addItem 
(::java::lang::reflect::ReflectPermission *, jint, jboolean) {}
  void casetest::lang::TestCase::addItem (::java::lang::reflect::Method *, 
::java::lang::reflect::ReflectPermission *) {}


TestCase.java:
package casetest.lang;
import java.util.Vector;
import java.net.URL;
import java.lang.reflect.ReflectPermission;
import java.lang.reflect.Method;
class TestCase {
        public native void nativeTestSymbol(Vector m, URL u);
        public native void create (String label);
        public native void addItem (ReflectPermission item, int key, boolean 
shiftModifier);
        public native void addItem(Method item, ReflectPermission ms);
        public void javaTestSymbol(Vector j, URL m, Vector u, Vector c, 
ReflectPermission b) {}

}

c++filt output of natTestCase.cc's output: (Cleaned up a little to reduce 
clutter, and correct)
casetest::lang::TestCase::nativeTestSymbol(java::util::Vector*, 
java::net::URL*)
casetest::lang::TestCase::create(java::lang::String*)
casetest::lang::TestCase::addItem(java::lang::reflect::ReflectPermission*, 
int, bool)
casetest::lang::TestCase::addItem(java::lang::reflect::Method*, 
java::lang::reflect::ReflectPermission*)

Strangeness starts here:
c++filt output of TestCase.java's output:
casetest::lang::TestCase::javaTestSymbol(java::util::Vector*, 
java::net::URL*, java::util::Vector*, java::util::Vector*, 
java::lang::reflect::ReflectPermission*)
casetest::lang::TestCase::nativeTestSymbol(java::util::Vector*, 
java::net::URL*)
casetest::lang::TestCase::create(casetest::lang::String*)  
casetest::lang::TestCase::addItem(casetest::lang::reflect::ReflectPermission*, 
int, bool)
casetest::lang::TestCase::addItem(casetest::lang::reflect::Method*, 
casetest::lang::reflect::ReflectPermission*)



More information about the Java mailing list