jdk15/javaws on amd64

Aryeh M. Friedman aryeh.friedman at gmail.com
Tue Mar 18 21:48:45 UTC 2008

Peter Jeremy wrote:
> On Tue, Mar 18, 2008 at 05:15:25PM +1100, Peter Jeremy wrote:
>> I've done some poking at it with both some printf()s and gdb and it
>> appears to be a gcc bug - in fact, I'm surprised it works at all...
>> The relevant function is GetBootClassPath():
>> char* GetBootClassPath(void) {
>>  static char bootclasspath[MAXPATHLEN];
>> #ifdef _DEBUG
>>  sprintf(bootclasspath, "%s%c%s%c%s%c%s", 
>>                sysGetJarLib(), FILE_SEPARATOR, "javaws_g.jar",
>>                PATH_SEPARATOR, sysGetJarLib(), FILE_SEPARATOR, "deploy_g.jar");
>> #else
>>  sprintf(bootclasspath, "%s%c%s%c%s%c%s", 
>>                sysGetJarLib(), FILE_SEPARATOR, "javaws.jar",
>>                PATH_SEPARATOR, sysGetJarLib(), FILE_SEPARATOR, "deploy.jar");
>> #endif
>>  return bootclasspath;
>> }
> I've done a bit more investigating and the problem is that
> sysGetJarLib() returns char*, and this is assumed by the above code.
> But there is no prototype in scope for the above code so gcc assumes
> that sysGetJarLib() returns int and passes it to sprintf as an int.
> Looking further, there is no prototype for sysGetJarLib() anywhere in
> the source code - or, for that matter many of the other functions in
> deploy/src/javaws/share/native/system.c that also return char*.
> This code can't work correctly on any platform where
> sizeof(int) != sizeof(void*) so I'm not quite sure how Sun make it
> work on Sun SPARC...
> I'm currently trying to rebuild Java with -Wall to see how many of
> these sorts of bugs exist.  In the meantime, I would suggest that
> java is broken on any 64-bit architecture.
Diablo is also broken on AMD64 after the removal of KSE threading in 
8-current (so are the Sun Linux binaries)... thus as a result it is not 
possible to get Java working in any shapre or form on 8-current AMD64

More information about the freebsd-java mailing list