diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index c9cda02600ac27bb279ce644fcb75300e51bfc77..d95408bf93a4659355f4300798d01cb9ab5bb64b 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,25 @@
+2003-07-13  Zack Weinberg  <zack@codesourcery.com>
+
+	* Makefile.in (LIBCPP_DEPS): Remove coretypes.h and $(TM_H).
+	(hashtable.o, line-map.o, mkdeps.o): Likewise, from dependency
+	list.  Move these all together down by cpplib.
+
+	* cpplib.h: Don't refer to MAX_WCHAR_TYPE_SIZE when determining
+	definition of CPPCHAR_SIGNED_T.
+
+	* cppcharset.c, cpperror.c, cppexp.c, cppfiles.c, cpphash.c, cppinit.c
+	* cpplex.c, cpplib.c, cppmacro.c, cpppch.c, cpptrad.c, hashtable.c
+	* line-map.c, mkdeps.c: Don't include coretypes.h or tm.h.
+
+	* cpphash.c (_cpp_init_hashtable): Don't use gcc_obstack_init.
+	* cppinit.c (cpp_create_reader): Likewise.
+
+	* cpphash.h (scan_out_logical_line): Rename _cpp_scan_out_logical_line.
+	* cpptrad.c: Likewise.  All callers changed.
+	* cpplib.c: All callers changed.
+	* c-ppoutput.c: Replace 'uchar' with 'unsigned char' throughout.
+	* hashtable.h: Define GTY(x) to nothing here too.
+
 2003-07-13  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
 
 	* stor-layout.c (compute_record_mode): Remove very obsolete test
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 3573a3eacee1ce561e18d239dd90a32a4ffc8cb7..ed2a23ae7600268d1658485c6ad730a8f2eb45c5 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -1450,10 +1450,6 @@ ggc-page.o: ggc-page.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(TR
 stringpool.o: stringpool.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
 	$(TREE_H) $(GGC_H) gt-stringpool.h
 
-hashtable.o: hashtable.c hashtable.h $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(OBSTACK_H)
-
-line-map.o: line-map.c line-map.h intl.h $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H)
-
 ggc-none.o: ggc-none.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(GTM_H) $(GGC_H)
 	$(CC) -c $(ALL_CFLAGS) -DGENERATOR_FILE $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
 
@@ -2356,7 +2352,7 @@ LIBCPP_OBJS =	cpplib.o cpplex.o cppmacro.o cppexp.o cppfiles.o cpptrad.o \
 		hashtable.o line-map.o mkdeps.o cpppch.o
 
 LIBCPP_DEPS =	$(CPPLIB_H) cpphash.h line-map.h hashtable.h intl.h \
-		$(OBSTACK_H) $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H)
+		$(OBSTACK_H) $(CONFIG_H) $(SYSTEM_H)
 
 # Most of the other archives built/used by this makefile are for
 # targets.  This one is strictly for the host.
@@ -2383,7 +2379,9 @@ cppdefault.o: cppdefault.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
 	  $(PREPROCESSOR_DEFINES) \
 	  -c $(srcdir)/cppdefault.c $(OUTPUT_OPTION)
 
-mkdeps.o: mkdeps.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) mkdeps.h
+mkdeps.o: mkdeps.c $(CONFIG_H) $(SYSTEM_H) mkdeps.h
+hashtable.o: hashtable.c hashtable.h $(CONFIG_H) $(SYSTEM_H) $(OBSTACK_H)
+line-map.o: line-map.c line-map.h intl.h $(CONFIG_H) $(SYSTEM_H)
 
 # Note for the stamp targets, we run the program `true' instead of
 # having an empty command (nothing following the semicolon).
diff --git a/gcc/c-ppoutput.c b/gcc/c-ppoutput.c
index 333da30b2e923b858a1a5ec911eebfebc3c1d81a..c37435fbf39340e8e00d7a7df223ff12f0afe77c 100644
--- a/gcc/c-ppoutput.c
+++ b/gcc/c-ppoutput.c
@@ -42,7 +42,7 @@ static struct
 /* General output routines.  */
 static void scan_translation_unit (cpp_reader *);
 static void scan_translation_unit_trad (cpp_reader *);
-static void account_for_newlines (const uchar *, size_t);
+static void account_for_newlines (const unsigned char *, size_t);
 static int dump_macro (cpp_reader *, cpp_hashnode *, void *);
 
 static void print_line (const struct line_map *, unsigned int,
@@ -174,7 +174,7 @@ scan_translation_unit (cpp_reader *pfile)
 
 /* Adjust print.line for newlines embedded in output.  */
 static void
-account_for_newlines (const uchar *str, size_t len)
+account_for_newlines (const unsigned char *str, size_t len)
 {
   while (len--)
     if (*str++ == '\n')
diff --git a/gcc/cppcharset.c b/gcc/cppcharset.c
index 0fc87f2ce24a073bd11b9de392dc14fcae1b13ec..b38eea01ad64837af79a246e21c12cae4575a77e 100644
--- a/gcc/cppcharset.c
+++ b/gcc/cppcharset.c
@@ -20,8 +20,6 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 #include "config.h"
 #include "system.h"
-#include "coretypes.h"
-#include "tm.h"
 #include "cpplib.h"
 #include "cpphash.h"
 #include "cppucnid.h"
diff --git a/gcc/cpperror.c b/gcc/cpperror.c
index cb681f00f247fbd3a2b15a4e789067d723ff5e1e..ceb4b938bb5c17b30af55e257059541a95b560af 100644
--- a/gcc/cpperror.c
+++ b/gcc/cpperror.c
@@ -25,8 +25,6 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 #include "config.h"
 #include "system.h"
-#include "coretypes.h"
-#include "tm.h"
 #include "cpplib.h"
 #include "cpphash.h"
 #include "intl.h"
diff --git a/gcc/cppexp.c b/gcc/cppexp.c
index 16082efd5e224a56e1bd3ba9c59aa81e77af836e..b558b3e8b8aa4b147ad842d7e95b580108878b9c 100644
--- a/gcc/cppexp.c
+++ b/gcc/cppexp.c
@@ -20,8 +20,6 @@ Boston, MA 02111-1307, USA.  */
 
 #include "config.h"
 #include "system.h"
-#include "coretypes.h"
-#include "tm.h"
 #include "cpplib.h"
 #include "cpphash.h"
 
diff --git a/gcc/cppfiles.c b/gcc/cppfiles.c
index 019b005931899736668f213d63a2eba1565329a1..742e5f110efe83c6f39b4c9cd561750db3ebe439 100644
--- a/gcc/cppfiles.c
+++ b/gcc/cppfiles.c
@@ -23,8 +23,6 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #include "config.h"
 #include "system.h"
 #include <dirent.h>
-#include "coretypes.h"
-#include "tm.h"
 #include "cpplib.h"
 #include "cpphash.h"
 #include "intl.h"
diff --git a/gcc/cpphash.c b/gcc/cpphash.c
index 01cd0a41f26317a956ef070399a4e9e639935829..8016189bc5d26b2eb745fff0a63f1e25eb01f73e 100644
--- a/gcc/cpphash.c
+++ b/gcc/cpphash.c
@@ -25,8 +25,6 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 #include "config.h"
 #include "system.h"
-#include "coretypes.h"
-#include "tm.h"
 #include "cpplib.h"
 #include "cpphash.h"
 
@@ -57,7 +55,10 @@ _cpp_init_hashtable (cpp_reader *pfile, hash_table *table)
       pfile->our_hashtable = 1;
       table = ht_create (13);	/* 8K (=2^13) entries.  */
       table->alloc_node = (hashnode (*) (hash_table *)) alloc_node;
-      gcc_obstack_init (&pfile->hash_ob);
+
+      _obstack_begin (&pfile->hash_ob, 0, 0,
+		      (void *(*) (long)) xmalloc,
+		      (void (*) (void *)) free);
     }
 
   table->pfile = pfile;
diff --git a/gcc/cpphash.h b/gcc/cpphash.h
index 0e1bb3922ce88c27421eed615fd7c00de2f965de..f814b9fd280cb70b383380641f2d611c8adf73ba 100644
--- a/gcc/cpphash.h
+++ b/gcc/cpphash.h
@@ -552,7 +552,7 @@ extern void _cpp_do_file_change (cpp_reader *, enum lc_reason, const char *,
 extern void _cpp_pop_buffer (cpp_reader *);
 
 /* In cpptrad.c.  */
-extern bool scan_out_logical_line (cpp_reader *, cpp_macro *);
+extern bool _cpp_scan_out_logical_line (cpp_reader *, cpp_macro *);
 extern bool _cpp_read_logical_line_trad (cpp_reader *);
 extern void _cpp_overlay_buffer (cpp_reader *pfile, const uchar *, size_t);
 extern void _cpp_remove_overlay (cpp_reader *);
diff --git a/gcc/cppinit.c b/gcc/cppinit.c
index f12cf1cc3472923e989654ff6fb5238d64e428dc..0c107b77e988db655cbb784a26bac751c3da0c46 100644
--- a/gcc/cppinit.c
+++ b/gcc/cppinit.c
@@ -21,8 +21,6 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 #include "config.h"
 #include "system.h"
-#include "coretypes.h"
-#include "tm.h"
 #include "cpplib.h"
 #include "cpphash.h"
 #include "mkdeps.h"
@@ -194,7 +192,9 @@ cpp_create_reader (enum c_lang lang, hash_table *table)
   _cpp_expand_op_stack (pfile);
 
   /* Initialize the buffer obstack.  */
-  gcc_obstack_init (&pfile->buffer_ob);
+  _obstack_begin (&pfile->buffer_ob, 0, 0,
+		  (void *(*) (long)) xmalloc,
+		  (void (*) (void *)) free);
 
   _cpp_init_includes (pfile);
 
diff --git a/gcc/cpplex.c b/gcc/cpplex.c
index 463064546fdd069909f3b83fc62f09cd9b2627aa..a7f13e79eae08f1c44f96af5508ec2dba206eb25 100644
--- a/gcc/cpplex.c
+++ b/gcc/cpplex.c
@@ -21,8 +21,6 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 #include "config.h"
 #include "system.h"
-#include "coretypes.h"
-#include "tm.h"
 #include "cpplib.h"
 #include "cpphash.h"
 
diff --git a/gcc/cpplib.c b/gcc/cpplib.c
index bbd6d016e01166a824f37ade784594f08d5d568f..3169f363569a68917e30fc37a1c63881357f9c8d 100644
--- a/gcc/cpplib.c
+++ b/gcc/cpplib.c
@@ -21,9 +21,6 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 #include "config.h"
 #include "system.h"
-#include "coretypes.h"
-#include "tm.h"
-
 #include "cpplib.h"
 #include "cpphash.h"
 #include "obstack.h"
@@ -280,7 +277,7 @@ prepare_directive_trad (cpp_reader *pfile)
 				    || pfile->directive == &dtable[T_ELIF]);
       if (no_expand)
 	pfile->state.prevent_expansion++;
-      scan_out_logical_line (pfile, NULL);
+      _cpp_scan_out_logical_line (pfile, NULL);
       if (no_expand)
 	pfile->state.prevent_expansion--;
       pfile->state.skipping = was_skipping;
diff --git a/gcc/cpplib.h b/gcc/cpplib.h
index 661bbe5467d47e2bed79fca7ae593d23ed1fcee8..434e455331a00a1d404304986d46f5e2be6b2436 100644
--- a/gcc/cpplib.h
+++ b/gcc/cpplib.h
@@ -191,18 +191,18 @@ struct cpp_token
 
 /* A type wide enough to hold any multibyte source character.
    cpplib's character constant interpreter requires an unsigned type.
-   Also, a typedef for the signed equivalent.  */
-#ifndef MAX_WCHAR_TYPE_SIZE
-# define MAX_WCHAR_TYPE_SIZE WCHAR_TYPE_SIZE
-#endif
-#if CHAR_BIT * SIZEOF_INT >= MAX_WCHAR_TYPE_SIZE
+   Also, a typedef for the signed equivalent.
+   The width of this type is capped at 32 bits; there do exist targets
+   where wchar_t is 64 bits, but only in a non-default mode, and there
+   would be no meaningful interpretation for a wchar_t value greater
+   than 2^32 anyway -- the widest wide-character encoding around is
+   ISO 10646, which stops at 2^31.  */
+#if CHAR_BIT * SIZEOF_INT >= 32
 # define CPPCHAR_SIGNED_T int
+#elif CHAR_BIT * SIZEOF_LONG >= 32
+# define CPPCHAR_SIGNED_T long
 #else
-# if CHAR_BIT * SIZEOF_LONG >= MAX_WCHAR_TYPE_SIZE || !HAVE_LONG_LONG
-#  define CPPCHAR_SIGNED_T long
-# else
-#  define CPPCHAR_SIGNED_T long long
-# endif
+# error "Cannot find a least-32-bit signed integer type"
 #endif
 typedef unsigned CPPCHAR_SIGNED_T cppchar_t;
 typedef CPPCHAR_SIGNED_T cppchar_signed_t;
diff --git a/gcc/cppmacro.c b/gcc/cppmacro.c
index 2b9c9b5f89bdadebc6f6502552c004572dcec516..87ad5927754eb7f55fd090773d5b6bf0ccfce8af 100644
--- a/gcc/cppmacro.c
+++ b/gcc/cppmacro.c
@@ -25,8 +25,6 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 #include "config.h"
 #include "system.h"
-#include "coretypes.h"
-#include "tm.h"
 #include "cpplib.h"
 #include "cpphash.h"
 
diff --git a/gcc/cpppch.c b/gcc/cpppch.c
index 6b60c57eaacd184b6e549713a74e28b41659c848..bdb7d16cfa0a125f114d79126183a181924011ab 100644
--- a/gcc/cpppch.c
+++ b/gcc/cpppch.c
@@ -17,7 +17,6 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 #include "config.h"
 #include "system.h"
-#include "coretypes.h"
 #include "cpplib.h"
 #include "cpphash.h"
 #include "intl.h"
diff --git a/gcc/cpptrad.c b/gcc/cpptrad.c
index 9b08e31138fff1488a951556853b6ae0b684d0a2..152bc0fd657fdd3c8e77f5d6afbdc2914b70bc56 100644
--- a/gcc/cpptrad.c
+++ b/gcc/cpptrad.c
@@ -18,8 +18,6 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 #include "config.h"
 #include "system.h"
-#include "coretypes.h"
-#include "tm.h"
 #include "cpplib.h"
 #include "cpphash.h"
 
@@ -305,7 +303,7 @@ _cpp_read_logical_line_trad (cpp_reader *pfile)
       if (pfile->buffer->need_line && !_cpp_get_fresh_line (pfile))
 	return false;
     }
-  while (!scan_out_logical_line (pfile, NULL) || pfile->state.skipping);
+  while (!_cpp_scan_out_logical_line (pfile, NULL) || pfile->state.skipping);
 
   return true;
 }
@@ -343,7 +341,7 @@ save_argument (struct fun_macro *macro, size_t offset)
    MACRO, and we call save_replacement_text() every time we meet an
    argument.  */
 bool
-scan_out_logical_line (cpp_reader *pfile, cpp_macro *macro)
+_cpp_scan_out_logical_line (cpp_reader *pfile, cpp_macro *macro)
 {
   bool result = true;
   cpp_context *context;
@@ -982,7 +980,7 @@ _cpp_create_trad_definition (cpp_reader *pfile, cpp_macro *macro)
   if (* CUR (context) == '(')
     {
       /* Setting macro to NULL indicates an error occurred, and
-	 prevents unnecessary work in scan_out_logical_line.  */
+	 prevents unnecessary work in _cpp_scan_out_logical_line.  */
       if (!scan_parameters (pfile, macro))
 	macro = NULL;
       else
@@ -1000,7 +998,7 @@ _cpp_create_trad_definition (cpp_reader *pfile, cpp_macro *macro)
 		       CPP_OPTION (pfile, discard_comments_in_macro_exp));
 
   pfile->state.prevent_expansion++;
-  scan_out_logical_line (pfile, macro);
+  _cpp_scan_out_logical_line (pfile, macro);
   pfile->state.prevent_expansion--;
 
   if (!macro)
diff --git a/gcc/hashtable.c b/gcc/hashtable.c
index 88b1a293456bb4f8a04db3b67744d1c8a57b0a21..fafa1000a03b4cbf78d6cd08f3aa9ddc24481942 100644
--- a/gcc/hashtable.c
+++ b/gcc/hashtable.c
@@ -21,8 +21,6 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 #include "config.h"
 #include "system.h"
-#include "coretypes.h"
-#include "tm.h"
 #include "hashtable.h"
 
 /* The code below is a specialization of Vladimir Makarov's expandable
@@ -63,7 +61,10 @@ ht_create (unsigned int order)
   memset (table, 0, sizeof (hash_table));
 
   /* Strings need no alignment.  */
-  gcc_obstack_init (&table->stack);
+  _obstack_begin (&table->stack, 0, 0,
+		  (void *(*) (long)) xmalloc,
+		  (void (*) (void *)) free);
+
   obstack_alignment_mask (&table->stack) = 0;
 
   table->entries = (hashnode *) xcalloc (nslots, sizeof (hashnode));
diff --git a/gcc/hashtable.h b/gcc/hashtable.h
index 47ec1cccd3bd920edcfa7ad6fbbcf713fb673428..b14ab18bfaff3ef59911033e98b5eeff854a45af 100644
--- a/gcc/hashtable.h
+++ b/gcc/hashtable.h
@@ -19,6 +19,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #define GCC_HASHTABLE_H
 
 #include "obstack.h"
+#define GTY(x) /* nothing */
 
 /* This is what each hash table entry points to.  It may be embedded
    deeply within another object.  */
diff --git a/gcc/line-map.c b/gcc/line-map.c
index 8bbe863693be55546700fcd7f55fa8169ad28aeb..1023b9132ebb46a77e46cb991848b6f86bc85c29 100644
--- a/gcc/line-map.c
+++ b/gcc/line-map.c
@@ -22,8 +22,6 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 #include "config.h"
 #include "system.h"
-#include "coretypes.h"
-#include "tm.h"
 #include "line-map.h"
 #include "intl.h"
 
diff --git a/gcc/mkdeps.c b/gcc/mkdeps.c
index 71aab3d9fc55ee32bcf425a611f1a57d0d849a0d..bb084a59d0a1b19242b12bceb8c1b14eeffba0c0 100644
--- a/gcc/mkdeps.c
+++ b/gcc/mkdeps.c
@@ -22,8 +22,6 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 #include "config.h"
 #include "system.h"
-#include "coretypes.h"
-#include "tm.h"
 #include "mkdeps.h"
 
 /* Keep this structure local to this file, so clients don't find it