This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] [Java]: Create a new Java-specific ggc-none.c


Hi People,

This is the sequel to this patch:

http://gcc.gnu.org/ml/gcc-patches/2004-09/msg00525.html

In the last episode, we got (i686-pc-linux-gnu,i686-pc-linux-gnu,i686-pc-mingw32)
to build. (For an explanation of what that triplet means, see:
http://gcc.gnu.org/ml/gcc-patches/2004-09/msg00533.html).

In this episode, we're now trying to get (i686-pc-linux-gnu,i686-pc-mingw32,i686-pc-mingw32)
to build, but it breaks due to item 5 of this patch:

http://gcc.gnu.org/ml/gcc-patches/2004-08/msg00265.html

Unfortunately, both gcjh and jcf-dump rely on ggc-none.o (cf. java/Make-lang.in)
and when build!=host, they end up trying to link in the ggc-none.o
built using $(CC_FOR_BUILD), which is incorrect (and sort of freaky,
if you think about it).

After pondering the possible alternatives, I figured that the least instrusive
alternative was to respect the semantics and intended consumption rules of the
top-level ggc-none.c and create create a new Java-specific variant which includes
config.h rather than bconfig.h. See the comments in ggc-none.c of the
following patch for further details.

I tested this in conjunction with my first patch for the following builds:

- (i686-pc-linux-gnu,i686-pc-linux-gnu,i686-pc-linux-gnu)
- (i686-pc-linux-gnu,i686-pc-linux-gnu,i686-pc-mingw32)
- (i686-pc-linux-gnu,i686-pc-mingw32,i686-pc-mingw32)

...and successfully building and running both C++ and Java executables
on these. (That was yesterday. Today's CVS HEAD is broken for the
third build for inexplicable reasons that couldn't have anything to do
with this patch. :( )

-- Mohan
http://www.thisiscool.com/
http://www.animalsong.org/

2004-09-05  Mohan Embar  <gnustuff@thisiscool.com>

	* ggc-none.c: New file.
	* Make-lang.in (GCJH_OBJS): Change dependency from
	ggc-none.o to java/ggc-none.o
	(JCFDUMP_OBJS): Likewise.
	(java/ggc-none.o): New target.

Index: ggc-none.c
===================================================================
--- ggc-none.c	2004-09-04 20:43:20.000000000 -0500
+++ ggc-none.c	2004-09-04 20:50:11.000000000 -0500
@@ -0,0 +1,66 @@
+/* Null garbage collection for the GNU compiler.
+   Copyright (C) 1998, 1999, 2000, 2003, 2004
+   Free Software Foundation, Inc.
+
+   This file is part of GCC.
+
+   GCC is free software; you can redistribute it and/or modify it
+   under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   GCC is distributed in the hope that it will be useful, but WITHOUT
+   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
+   License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with GCC; see the file COPYING.  If not, write to the Free
+   Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+   02111-1307, USA.  */
+
+/* This file is essentially the same as the one in the parent gcc
+   directory, but modified to include config.h instead of bconfig.h.
+   It is needed because several java targets used to incorrectly depend
+   on the parent ggc-none, which was only advertised to be consumable
+   by one of the gen* programs which are built using the build machine's
+   gcc. The java targets which need ggc-none need it to be built by
+   the compiler which can produce executables for the target machine,
+   not the build machine.  */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "ggc.h"
+
+void *
+ggc_alloc_typed_stat (enum gt_types_enum ARG_UNUSED (gte), size_t size
+		      MEM_STAT_DECL)
+{
+  return xmalloc (size);
+}
+
+void *
+ggc_alloc_stat (size_t size MEM_STAT_DECL)
+{
+  return xmalloc (size);
+}
+
+void *
+ggc_alloc_zone_stat (size_t size, struct alloc_zone * ARG_UNUSED (zone)
+		     MEM_STAT_DECL)
+{
+  return xmalloc (size);
+}
+
+void *
+ggc_alloc_cleared_stat (size_t size MEM_STAT_DECL)
+{
+  return xcalloc (size, 1);
+}
+
+void *
+ggc_realloc_stat (void *x, size_t size MEM_STAT_DECL)
+{
+  return xrealloc (x, size);
+}
Index: Make-lang.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/Make-lang.in,v
retrieving revision 1.141
diff -u -2 -r1.141 Make-lang.in
--- Make-lang.in	5 Aug 2004 19:29:09 -0000	1.141
+++ Make-lang.in	5 Sep 2004 03:23:57 -0000
@@ -109,5 +109,5 @@
 
 GCJH_OBJS = java/gjavah.o java/jcf-io.o java/jcf-depend.o java/jcf-path.o \
-  java/win32-host.o java/zextract.o version.o errors.o ggc-none.o \
+  java/win32-host.o java/zextract.o version.o errors.o java/ggc-none.o \
   intl.o
 
@@ -115,5 +115,5 @@
 
 JCFDUMP_OBJS = java/jcf-dump.o java/jcf-io.o java/jcf-depend.o java/jcf-path.o \
-		java/win32-host.o java/zextract.o errors.o version.o ggc-none.o intl.o
+		java/win32-host.o java/zextract.o errors.o version.o java/ggc-none.o intl.o
 
 JVGENMAIN_OBJS = java/jvgenmain.o java/mangle_name.o errors.o intl.o
@@ -302,4 +302,5 @@
   java/java-except.h java/java-except.h java/parse.h toplev.h \
   $(SYSTEM_H) coretypes.h $(TM_H) $(GGC_H) gt-java-expr.h target.h
+java/ggc-none.o: java/ggc-none.c $(CONFIG_H) $(SYSTEM_H) coretypes.h ggc.h
 java/jcf-depend.o: java/jcf-depend.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
   $(TM_H) java/jcf.h





Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]