This is the mail archive of the
java-discuss@sourceware.cygnus.com
mailing list for the Java project.
Re: Porting libgcj...
> > <scottb@netwinder.org> writes:
>
> I'm trying to port libgcj to run on ArmLinux on a NetWinder.
>
> It seems that when generating this file, the value for
> MAX_VALUE is interpreted as a NAN by printf.. I have been
> looking for the file generation code but have been unable to
> find it. Could someone point me in the correct direction.
Tom Tromey wrote:
>
> Most of the headers are generated from class files by a program named
> "gcjh". It is part of gcc. The source is gcc/java/gjavah.c. You
> want to look at the function print_field_info().
>
I think I have found the problem (at least for this case). It is the
WORDS_TO_DOUBLE() macro in javaop.h. The ARM has a funny floating point
memory layout for doubles. It is the IEEE format in little endian with
the words swapped. As an example:
MAX_DBL = 0xff 0xff 0xff 0xff 0xff 0xff 0xef 0x7f in little endian
MAX_DBL = 0xff 0xff 0xef 0x7f 0xff 0xff 0xff 0xff on the ARM
I updated my gcc-2.95 tree this morning and have a build going to test
this hypothesis. I have modified WORDS_TO_DOUBLE to be:
static inline jdouble
WORDS_TO_DOUBLE(jword hi, jword lo)
{ union DWord wu;
#ifdef __arm__
wu.l = WORDS_TO_LONG(lo,hi);
#else
wu.l = WORDS_TO_LONG(hi,lo);
#endif
}
This is fine to test the code, but not my idea of a decent port. There
doesn't seem to be any other way of introducing architecture dependent
code into the tree however. Does anyone have any better suggestions?
Scott