This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Patch: embedded target fixes
- To: java-patches at gcc dot gnu dot org
- Subject: Patch: embedded target fixes
- From: Anthony Green <green at redhat dot com>
- Date: Sun, 11 Nov 2001 08:42:25 -0800
- Reply-to: green at redhat dot com
This patch contains a number of small clean-ups for embedded targets.
Let me know if you'd like them broken out.
The changes include:
* Add missing DISABLE_JAVA_NET markers in our net code.
* Add missing DISABLE_GETENV_PROPERTIES in one place.
* Introduce DISABLE_MAIN_ARGS. Many embedded platforms don't pass
reasonable args to main. This is a problem for libjava which
tries to process them. Override the default in configure.host.
* Newlib doesn't provide tzname, so deal with that.
* Add xscale*-elf to configure.host.
Ok?
2001-11-11 Anthony Green <green@redhat.com>
* configure.host: Add support for xscale-elf embedded target.
* include/config.h.in: Rebuilt.
* acconfig.h: Add DISABLE_MAIN_ARGS.
* prims.cc (_Jv_RunMain): Use DISABLE_MAIN_ARGS.
* configure: Rebuilt.
* configure.in: Add --disable-main-args option.
* java/lang/natSystem.cc (init_properties): Don't use
_Jv_Environment_Properties if DISABLE_GETENV_PROPERTIES is
defined.
* java/net/natPlainDatagramSocketImpl.cc (_Jv_bind): Don't build
when DISABLE_JAVA_NET.
* java/net/natPlainSocketImpl.cc (_Jv_bind, _Jv_connect,
_Jv_accept): Don't build when DISABLE_JAVA_NET.
* include/config.h.in: Rebuilt.
* acconfig.h (NO_TZNAME): New define.
* configure: Rebuilt.
* configure.in (NO_TZNAME): Define for newlib target.
Index: acconfig.h
===================================================================
RCS file: /cvs/gcc/gcc/libjava/acconfig.h,v
retrieving revision 1.21
diff -c -r1.21 acconfig.h
*** acconfig.h 2001/08/01 17:52:59 1.21
--- acconfig.h 2001/11/11 16:28:12
***************
*** 123,128 ****
--- 123,131 ----
getenv("GCJ_PROPERTIES"). */
#undef DISABLE_GETENV_PROPERTIES
+ /* Define if we should ignore arguments to main(). */
+ #undef DISABLE_MAIN_ARGS
+
/* Define if using setjmp/longjmp exceptions. */
#undef SJLJ_EXCEPTIONS
***************
*** 132,137 ****
--- 135,143 ----
/* Define if you have dladdr() */
#undef HAVE_DLADDR
+ /* Define if tzname is missing. */
+ #undef NO_TZNAME
+
/* Define if getuid() and friends are missing. */
#undef NO_GETUID
Index: configure.host
===================================================================
RCS file: /cvs/gcc/gcc/libjava/configure.host,v
retrieving revision 1.21
diff -c -r1.21 configure.host
*** configure.host 2001/07/23 03:51:15 1.21
--- configure.host 2001/11/11 16:28:15
***************
*** 72,77 ****
--- 72,84 ----
libgcj_interpreter=yes
enable_hash_synchronization_default=yes
;;
+ xscale*-elf)
+ with_libffi_default=no
+ PROCESS=Ecos
+ enable_java_net_default=no
+ enable_getenv_properties_default=no
+ enable_main_args_default=no
+ ;;
powerpc*-*)
libgcj_interpreter=yes
;;
Index: configure.in
===================================================================
RCS file: /cvs/gcc/gcc/libjava/configure.in,v
retrieving revision 1.101
diff -c -r1.101 configure.in
*** configure.in 2001/10/24 21:57:06 1.101
--- configure.in 2001/11/11 16:28:16
***************
*** 63,69 ****
--- 63,77 ----
AC_DEFINE(DISABLE_GETENV_PROPERTIES)
fi
+ dnl Whether we should use arguments to main()
+ if test -z "$enable_main_args"; then
+ enable_main_args=${enable_main_args_default-yes}
+ fi
+ if test "$enable_main_args" = no; then
+ AC_DEFINE(DISABLE_MAIN_ARGS)
+ fi
+
dnl Should we use hashtable-based synchronization?
dnl Currently works only for Linux X86/ia64
dnl Typically faster and more space-efficient
***************
*** 423,428 ****
--- 431,439 ----
dnl Assume we do not have getuid and friends.
AC_DEFINE(NO_GETUID)
+
+ dnl Assume we do not have tzname
+ AC_DEFINE(NO_TZNAME)
ZLIBSPEC=-lzgcj
ZLIBTESTSPEC="-L`pwd`/../zlib/.libs -rpath `pwd`/../zlib/.libs"
Index: prims.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/prims.cc,v
retrieving revision 1.62
diff -c -r1.62 prims.cc
*** prims.cc 2001/10/23 05:42:02 1.62
--- prims.cc 2001/11/11 16:28:17
***************
*** 976,988 ****
java::lang::Runtime *runtime = NULL;
#ifdef HAVE_PROC_SELF_EXE
char exec_name[20];
sprintf (exec_name, "/proc/%d/exe", getpid ());
_Jv_ThisExecutable (exec_name);
#else
_Jv_ThisExecutable (argv[0]);
! #endif
try
{
--- 976,993 ----
java::lang::Runtime *runtime = NULL;
+
+ #ifdef DISABLE_MAIN_ARGS
+ _Jv_ThisExecutable ("[Embedded App]");
+ #else
#ifdef HAVE_PROC_SELF_EXE
char exec_name[20];
sprintf (exec_name, "/proc/%d/exe", getpid ());
_Jv_ThisExecutable (exec_name);
#else
_Jv_ThisExecutable (argv[0]);
! #endif /* HAVE_PROC_SELF_EXE */
! #endif /* DISABLE_MAIN_ARGS */
try
{
***************
*** 992,998 ****
--- 997,1007 ----
// for `main'; that way it will be set up if `main' is a JNI method.
runtime = java::lang::Runtime::getRuntime ();
+ #ifdef DISABLE_MAIN_ARGS
+ arg_vec = JvConvertArgv (0, 0);
+ #else
arg_vec = JvConvertArgv (argc - 1, argv + 1);
+ #endif
if (klass)
main_thread = new gnu::gcj::runtime::FirstThread (klass, arg_vec);
Index: include/config.h.in
===================================================================
RCS file: /cvs/gcc/gcc/libjava/include/config.h.in,v
retrieving revision 1.33
diff -c -r1.33 config.h.in
*** config.h.in 2001/09/29 19:16:27 1.33
--- config.h.in 2001/11/11 16:28:17
***************
*** 141,146 ****
--- 141,149 ----
getenv("GCJ_PROPERTIES"). */
#undef DISABLE_GETENV_PROPERTIES
+ /* Define if we should ignore arguments to main(). */
+ #undef DISABLE_MAIN_ARGS
+
/* Define if you have /proc/self/exe */
#undef HAVE_PROC_SELF_EXE
***************
*** 151,156 ****
--- 154,162 ----
/* Define if yo have dlopen(). */
#undef HAVE_DLOPEN
+ /* Define if tzname is missing. */
+ #undef NO_TZNAME
+
/* Define if getuid() and friends are missing. */
#undef NO_GETUID
Index: java/lang/natSystem.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/lang/natSystem.cc,v
retrieving revision 1.41
diff -c -r1.41 natSystem.cc
*** natSystem.cc 2001/09/05 17:11:57 1.41
--- natSystem.cc 2001/11/11 16:28:18
***************
*** 263,268 ****
--- 263,273 ----
// issue exists in java/util/natGregorianCalendar.cc.
tzoffset = 0L;
#endif
+ #ifdef NO_TZNAME
+ // FIXME: is there some better way to handle targets with no tzname?
+ static char *_tzname[] = { 0, 0};
+ char **tzname = _tzname;
+ #endif
tzinfo = tzname;
if ((tzoffset % 3600) == 0)
***************
*** 463,468 ****
--- 468,474 ----
}
// Set the system properties from the user's environment.
+ #ifndef DISABLE_GETENV_PROPERTIES
if (_Jv_Environment_Properties)
{
size_t i = 0;
***************
*** 474,479 ****
--- 480,486 ----
i++;
}
}
+ #endif
if (_Jv_Jar_Class_Path)
newprops->put(JvNewStringLatin1 ("java.class.path"),
Index: java/net/natPlainDatagramSocketImpl.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/net/natPlainDatagramSocketImpl.cc,v
retrieving revision 1.29
diff -c -r1.29 natPlainDatagramSocketImpl.cc
*** natPlainDatagramSocketImpl.cc 2001/08/01 17:53:00 1.29
--- natPlainDatagramSocketImpl.cc 2001/11/11 16:28:19
***************
*** 36,41 ****
--- 36,42 ----
#include <bstring.h>
#endif
+ #ifndef DISABLE_JAVA_NET
// Avoid macro definitions of bind from system headers, e.g. on
// Solaris 7 with _XOPEN_SOURCE. FIXME
static inline int
***************
*** 43,48 ****
--- 44,50 ----
{
return ::bind (fd, addr, addrlen);
}
+ #endif /* DISABLE_JAVA_NET */
#ifdef bind
#undef bind
Index: java/net/natPlainSocketImpl.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/net/natPlainSocketImpl.cc,v
retrieving revision 1.25
diff -c -r1.25 natPlainSocketImpl.cc
*** natPlainSocketImpl.cc 2001/08/01 17:53:00 1.25
--- natPlainSocketImpl.cc 2001/11/11 16:28:19
***************
*** 37,42 ****
--- 37,44 ----
typedef int socklen_t;
#endif
+ #ifndef DISABLE_JAVA_NET
+
// Avoid macro definitions of bind, connect from system headers, e.g. on
// Solaris 7 with _XOPEN_SOURCE. FIXME
static inline int
***************
*** 69,74 ****
--- 71,78 ----
#ifdef accept
#undef accept
#endif
+
+ #endif /* DISABLE_JAVA_NET */
#include <gcj/cni.h>
#include <gcj/javaprims.h>