diff options
author | rmathew <rmathew@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-07-05 02:15:51 +0000 |
---|---|---|
committer | rmathew <rmathew@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-07-05 02:15:51 +0000 |
commit | 621f785f3df099453294bb6ea97b9896ff45e77c (patch) | |
tree | 0a98e27f40c056a0c593499932dea332859cbd04 | |
parent | d03ad30f9009d648232ad5db3fe7f9a66d9e881f (diff) | |
download | gcc-621f785f3df099453294bb6ea97b9896ff45e77c.tar.gz |
* libgcj.spec.in: Use THREADSTARTFILESPEC to affect the spec for
startfile.
* configure.ac: Allow targets to affect the spec for startfile
by specifying a THREADSTARTFILESPEC variable. Define this for
the win32 threads package to include crtmt.o.
* configure: Regenerate.
* win32.cc (_CRT_MT): Remove definition.
(__mingwthr_key_dtor): Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@115196 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | libjava/ChangeLog | 12 | ||||
-rwxr-xr-x | libjava/configure | 29 | ||||
-rw-r--r-- | libjava/configure.ac | 16 | ||||
-rw-r--r-- | libjava/libgcj.spec.in | 3 | ||||
-rw-r--r-- | libjava/win32.cc | 15 |
5 files changed, 54 insertions, 21 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 95d783cae7b..60a8fdab107 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,15 @@ +2006-07-05 Ranjit Mathew <rmathew@gcc.gnu.org> + Danny Smith <dannysmith@users.sourceforge.net> + + * libgcj.spec.in: Use THREADSTARTFILESPEC to affect the spec for + startfile. + * configure.ac: Allow targets to affect the spec for startfile + by specifying a THREADSTARTFILESPEC variable. Define this for + the win32 threads package to include crtmt.o. + * configure: Regenerate. + * win32.cc (_CRT_MT): Remove definition. + (__mingwthr_key_dtor): Likewise. + 2006-07-04 Andreas Tobler <a.tobler@schweiz.ch> * testsuite/lib/libjava.exp (libjava_init): Call the GCJ_UNDER_TEST with diff --git a/libjava/configure b/libjava/configure index 17284a822e8..ed4bc356341 100755 --- a/libjava/configure +++ b/libjava/configure @@ -310,7 +310,7 @@ ac_includes_default="\ # include <unistd.h> #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os build_subdir host_subdir target_subdir libgcj_basedir host host_cpu host_vendor host_os target target_cpu target_vendor target_os target_noncanonical LN_S mkinstalldirs CC ac_ct_CC EXEEXT OBJEXT CXX ac_ct_CXX CFLAGS CXXFLAGS LDFLAGS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE AS ac_ct_AS LD ac_ct_LD AR ac_ct_AR RANLIB ac_ct_RANLIB JAR ZIP UNZIP BASH_JAR_TRUE BASH_JAR_FALSE MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT LIBGCJ_CFLAGS LIBGCJ_CXXFLAGS LIBGCJ_JAVAFLAGS LIBGCJ_LD_SYMBOLIC LIBGCJDEBUG TOOLKIT XLIB_AWT_TRUE XLIB_AWT_FALSE GCJH INCLTDL LIBLTDL DIRLTDL LIBTOOL CXXCPP CPPFLAGS GCJ GCJFLAGS GCJDEPMODE am__fastdepGCJ_TRUE am__fastdepGCJ_FALSE subdirs TESTSUBDIR_TRUE TESTSUBDIR_FALSE JAVA_HOME_SET_TRUE JAVA_HOME_SET_FALSE JAVA_HOME INTERPRETER LIBFFI LIBFFIINCS PLATFORM_INNER_NAT_HDRS CPP EGREP USING_WIN32_PLATFORM_TRUE USING_WIN32_PLATFORM_FALSE USING_POSIX_PLATFORM_TRUE USING_POSIX_PLATFORM_FALSE USING_DARWIN_CRT_TRUE USING_DARWIN_CRT_FALSE SYSTEMSPEC LIBGCJTESTSPEC ZLIBSPEC ZLIBTESTSPEC X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS extra_ldflags_libjava GCLIBS GCINCS GCDEPS GCSPEC JC1GCSPEC GCTESTSPEC USING_BOEHMGC_TRUE USING_BOEHMGC_FALSE USING_NOGC_TRUE USING_NOGC_FALSE THREADLIBS THREADINCS THREADDEPS THREADSPEC THREADLDFLAGS THREADCXXFLAGS USING_POSIX_THREADS_TRUE USING_POSIX_THREADS_FALSE USING_WIN32_THREADS_TRUE USING_WIN32_THREADS_FALSE USING_NO_THREADS_TRUE USING_NO_THREADS_FALSE HASH_SYNC_SPEC USING_GCC_TRUE USING_GCC_FALSE LIBICONV LTLIBICONV PKG_CONFIG GTK_CFLAGS GTK_LIBS GLIB_CFLAGS GLIB_LIBS LIBART_CFLAGS LIBART_LIBS CLASSPATH_SEPARATOR ac_ct_GCJ ZLIBS SYS_ZLIBS ZINCS DIVIDESPEC CHECKREFSPEC EXCEPTIONSPEC BACKTRACESPEC IEEESPEC NATIVE_TRUE NATIVE_FALSE NEEDS_DATA_START_TRUE NEEDS_DATA_START_FALSE GCC_UNWIND_INCLUDE toolexecdir toolexecmainlibdir toolexeclibdir dbexecdir GCJVERSION gxx_include_dir libstdcxx_incdir ALLOCA PERL SYSDEP_SOURCES LD_START_STATIC_SPEC LD_FINISH_STATIC_SPEC here LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os build_subdir host_subdir target_subdir libgcj_basedir host host_cpu host_vendor host_os target target_cpu target_vendor target_os target_noncanonical LN_S mkinstalldirs CC ac_ct_CC EXEEXT OBJEXT CXX ac_ct_CXX CFLAGS CXXFLAGS LDFLAGS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE AS ac_ct_AS LD ac_ct_LD AR ac_ct_AR RANLIB ac_ct_RANLIB JAR ZIP UNZIP BASH_JAR_TRUE BASH_JAR_FALSE MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT LIBGCJ_CFLAGS LIBGCJ_CXXFLAGS LIBGCJ_JAVAFLAGS LIBGCJ_LD_SYMBOLIC LIBGCJDEBUG TOOLKIT XLIB_AWT_TRUE XLIB_AWT_FALSE GCJH INCLTDL LIBLTDL DIRLTDL LIBTOOL CXXCPP CPPFLAGS GCJ GCJFLAGS GCJDEPMODE am__fastdepGCJ_TRUE am__fastdepGCJ_FALSE subdirs TESTSUBDIR_TRUE TESTSUBDIR_FALSE JAVA_HOME_SET_TRUE JAVA_HOME_SET_FALSE JAVA_HOME INTERPRETER LIBFFI LIBFFIINCS PLATFORM_INNER_NAT_HDRS CPP EGREP USING_WIN32_PLATFORM_TRUE USING_WIN32_PLATFORM_FALSE USING_POSIX_PLATFORM_TRUE USING_POSIX_PLATFORM_FALSE USING_DARWIN_CRT_TRUE USING_DARWIN_CRT_FALSE SYSTEMSPEC LIBGCJTESTSPEC ZLIBSPEC ZLIBTESTSPEC X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS extra_ldflags_libjava GCLIBS GCINCS GCDEPS GCSPEC JC1GCSPEC GCTESTSPEC USING_BOEHMGC_TRUE USING_BOEHMGC_FALSE USING_NOGC_TRUE USING_NOGC_FALSE THREADLIBS THREADINCS THREADDEPS THREADSPEC THREADSTARTFILESPEC THREADLDFLAGS THREADCXXFLAGS USING_POSIX_THREADS_TRUE USING_POSIX_THREADS_FALSE USING_WIN32_THREADS_TRUE USING_WIN32_THREADS_FALSE USING_NO_THREADS_TRUE USING_NO_THREADS_FALSE HASH_SYNC_SPEC USING_GCC_TRUE USING_GCC_FALSE LIBICONV LTLIBICONV PKG_CONFIG GTK_CFLAGS GTK_LIBS GLIB_CFLAGS GLIB_LIBS LIBART_CFLAGS LIBART_LIBS CLASSPATH_SEPARATOR ac_ct_GCJ ZLIBS SYS_ZLIBS ZINCS DIVIDESPEC CHECKREFSPEC EXCEPTIONSPEC BACKTRACESPEC IEEESPEC NATIVE_TRUE NATIVE_FALSE NEEDS_DATA_START_TRUE NEEDS_DATA_START_FALSE GCC_UNWIND_INCLUDE toolexecdir toolexecmainlibdir toolexeclibdir dbexecdir GCJVERSION gxx_include_dir libstdcxx_incdir ALLOCA PERL SYSDEP_SOURCES LD_START_STATIC_SPEC LD_FINISH_STATIC_SPEC here LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -7595,7 +7595,7 @@ ac_x_header_dirs=' /usr/openwin/share/include' if test "$ac_x_includes" = no; then - # Guess where to find include files, by looking for Xlib.h. + # Guess where to find include files, by looking for Intrinsic.h. # First, try using that file with no special directory specified. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -7603,7 +7603,7 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include <X11/Xlib.h> +#include <X11/Intrinsic.h> _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 @@ -7630,7 +7630,7 @@ else sed 's/^/| /' conftest.$ac_ext >&5 for ac_dir in $ac_x_header_dirs; do - if test -r "$ac_dir/X11/Xlib.h"; then + if test -r "$ac_dir/X11/Intrinsic.h"; then ac_x_includes=$ac_dir break fi @@ -7656,11 +7656,11 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include <X11/Xlib.h> +#include <X11/Intrinsic.h> int main () { -XrmInitialize () +XtMalloc (0) ; return 0; } @@ -9100,6 +9100,7 @@ THREADINCS= THREADDEPS= THREADH= THREADSPEC= +THREADSTARTFILESPEC= case "$THREADS" in posix) case "$host" in @@ -9163,6 +9164,20 @@ _ACEOF win32) THREADH=win32-threads.h + THREADCXXFLAGS=-mthreads + # We need thread-safe exception handling so _CRT_MT should be set to 1. + # But we do not want the executables created to be dependent on + # mingwm10.dll which provides a __mingwthr_key_dtor() that cleans up + # exception handling contexts. The following kludge achieves this effect + # and causes a dummy __mingwthr_key_dtor() to be linked in from + # libmingw32.a. This causes a memory leak of about 24 bytes per thread. + # A workaround is to explicitly use -mthreads while linking Java programs. + # See PR libgcj/28263. + # + # FIXME: In Java we are able to detect thread death at the end of + # Thread.run() so we should be able to clean up the exception handling + # contexts ourselves. + THREADSTARTFILESPEC='crtmt%O%s' ;; none) @@ -9179,6 +9194,7 @@ esac + if test "$THREADS" = posix; then USING_POSIX_THREADS_TRUE= USING_POSIX_THREADS_FALSE='#' @@ -17541,6 +17557,7 @@ s,@THREADLIBS@,$THREADLIBS,;t t s,@THREADINCS@,$THREADINCS,;t t s,@THREADDEPS@,$THREADDEPS,;t t s,@THREADSPEC@,$THREADSPEC,;t t +s,@THREADSTARTFILESPEC@,$THREADSTARTFILESPEC,;t t s,@THREADLDFLAGS@,$THREADLDFLAGS,;t t s,@THREADCXXFLAGS@,$THREADCXXFLAGS,;t t s,@USING_POSIX_THREADS_TRUE@,$USING_POSIX_THREADS_TRUE,;t t diff --git a/libjava/configure.ac b/libjava/configure.ac index 7dcbe88daf6..fab02646701 100644 --- a/libjava/configure.ac +++ b/libjava/configure.ac @@ -783,6 +783,7 @@ THREADINCS= THREADDEPS= THREADH= THREADSPEC= +THREADSTARTFILESPEC= case "$THREADS" in posix) case "$host" in @@ -834,6 +835,20 @@ case "$THREADS" in win32) THREADH=win32-threads.h + THREADCXXFLAGS=-mthreads + # We need thread-safe exception handling so _CRT_MT should be set to 1. + # But we do not want the executables created to be dependent on + # mingwm10.dll which provides a __mingwthr_key_dtor() that cleans up + # exception handling contexts. The following kludge achieves this effect + # and causes a dummy __mingwthr_key_dtor() to be linked in from + # libmingw32.a. This causes a memory leak of about 24 bytes per thread. + # A workaround is to explicitly use -mthreads while linking Java programs. + # See PR libgcj/28263. + # + # FIXME: In Java we are able to detect thread death at the end of + # Thread.run() so we should be able to clean up the exception handling + # contexts ourselves. + THREADSTARTFILESPEC='crtmt%O%s' ;; none) @@ -845,6 +860,7 @@ AC_SUBST(THREADLIBS) AC_SUBST(THREADINCS) AC_SUBST(THREADDEPS) AC_SUBST(THREADSPEC) +AC_SUBST(THREADSTARTFILESPEC) AC_SUBST(THREADLDFLAGS) AC_SUBST(THREADCXXFLAGS) AM_CONDITIONAL(USING_POSIX_THREADS, test "$THREADS" = posix) diff --git a/libjava/libgcj.spec.in b/libjava/libgcj.spec.in index 0af8811b954..f48212509bf 100644 --- a/libjava/libgcj.spec.in +++ b/libjava/libgcj.spec.in @@ -3,6 +3,9 @@ # It is used to specify the standard libraries we need in order # to link with libgcj. # +%rename startfile startfileorig +*startfile: @THREADSTARTFILESPEC@ %(startfileorig) + %rename lib liborig *lib: @LD_START_STATIC_SPEC@ -lgcj @LD_FINISH_STATIC_SPEC@ -lm @LIBICONV@ @GCSPEC@ @THREADSPEC@ @ZLIBSPEC@ @SYSTEMSPEC@ %(libgcc) %(liborig) diff --git a/libjava/win32.cc b/libjava/win32.cc index 00b42796ce4..6a1c2c736de 100644 --- a/libjava/win32.cc +++ b/libjava/win32.cc @@ -288,21 +288,6 @@ _Jv_platform_nanotime () return _Jv_platform_gettimeofday () * 1000LL; } -// The following definitions "fake out" mingw to think that -mthreads -// was enabled and that mingwthr.dll was linked. GCJ-compiled -// applications don't need this helper library because we can safely -// detect thread death (return from Thread.run()). - -int _CRT_MT = 1; - -extern "C" int -__mingwthr_key_dtor (DWORD, void (*) (void *)) -{ - // FIXME: for now we do nothing; this causes a memory leak of - // approximately 24 bytes per thread created. - return 0; -} - static bool dirExists (LPCTSTR dir) { DWORD dwAttrs = ::GetFileAttributes (dir); |