Index: cppbuiltin.c
===================================================================
--- cppbuiltin.c	(revision 164917)
+++ cppbuiltin.c	(working copy)
@@ -27,6 +27,9 @@ along with GCC; see the file COPYING3.  
 #include "flags.h"
 #include "toplev.h"
 #include "cpp-id-data.h"
+#include "output.h"
+#include "tm_p.h"		/* For TARGET_CPU_CPP_BUILTINS & friends.  */
+#include "target.h"
 #include "cppbuiltin.h"
 
 
@@ -155,3 +158,82 @@ define_language_independent_builtin_macr
   define_builtin_macros_for_lp64 (pfile);
   define_builtin_macros_for_type_sizes (pfile);
 }
+
+
+/* Pass an object-like macro.  If it doesn't lie in the user's
+   namespace, defines it unconditionally.  Otherwise define a version
+   with two leading underscores, and another version with two leading
+   and trailing underscores, and define the original only if an ISO
+   standard was not nominated.
+
+   e.g. passing "unix" defines "__unix", "__unix__" and possibly
+   "unix".  Passing "_mips" defines "__mips", "__mips__" and possibly
+   "_mips".  */
+void
+define_builtin_macro_std (cpp_reader *pfile, const char *macro, bool iso_c)
+{
+  size_t len = strlen (macro);
+  char *buff = (char *) alloca (len + 5);
+  char *p = buff + 2;
+  char *q = p + len;
+
+  /* prepend __ (or maybe just _) if in user's namespace.  */
+  memcpy (p, macro, len + 1);
+  if (!( *p == '_' && (p[1] == '_' || ISUPPER (p[1]))))
+    {
+      if (*p != '_')
+	*--p = '_';
+      if (p[1] != '_')
+	*--p = '_';
+    }
+  cpp_define (pfile, p);
+
+  /* If it was in user's namespace...  */
+  if (p != buff + 2)
+    {
+      /* Define the macro with leading and following __.  */
+      if (q[-1] != '_')
+	*q++ = '_';
+      if (q[-2] != '_')
+	*q++ = '_';
+      *q = '\0';
+      cpp_define (pfile, p);
+
+      /* Finally, define the original macro if permitted.  */
+      if (iso_c)
+	cpp_define (pfile, macro);
+    }
+}
+
+
+void
+define_target_specific_builtins (cpp_reader *pfile, bool iso_c)
+{
+
+#ifndef TARGET_OBJFMT_CPP_BUILTINS
+# define TARGET_OBJFMT_CPP_BUILTINS()
+#endif
+
+#ifndef TARGET_CPU_CPP_BUILTINS
+# define TARGET_CPU_CPP_BUILTINS()
+#endif
+
+#define builtin_define(TXT) cpp_define (pfile, TXT)
+#define builtin_assert(TXT) cpp_assert (pfile, TXT)
+#define builtin_define_with_value(NAME, VALUE, IS_STR) \
+  cpp_define_formatted (pfile, IS_STR ? NAME"=%s" : NAME"=\"%s\"", VALUE)
+#define builtin_define_with_int_value(NAME, VALUE) \
+  cpp_define_formatted (pfile, NAME"="HOST_WIDE_INT_PRINT_DEC, VALUE)
+#define builtin_define_std(TXT) \
+  define_builtin_macro_std (pfile, TXT, iso_c)
+
+  TARGET_OBJFMT_CPP_BUILTINS ();
+  TARGET_CPU_CPP_BUILTINS ();
+
+#undef builtin_define
+#undef builtin_assert
+#undef builtin_define_with_value
+#undef builtin_define_with_int_value
+#undef builtin_define_std
+
+}
Index: cppbuiltin.h
===================================================================
--- cppbuiltin.h	(revision 164917)
+++ cppbuiltin.h	(working copy)
@@ -28,10 +28,17 @@ along with GCC; see the file COPYING3.  
    or "major.minor" to extract its components.  */
 extern void parse_basever (int *, int *, int *);
 
-/* Define macros builtins common to all language performing CPP
+/* Define built-in macros common to all language performing CPP
    preprocessing.  */
 extern void define_language_independent_builtin_macros (cpp_reader *);
 
+/* Define a built-in macro, and possible prevent it from polluting the
+   user's namespace.  */
+extern void define_builtin_macro_std (cpp_reader *, const char *, bool);
+
+/* Define language-independent built-in macros specific to the target.  */
+extern void define_target_specific_builtins (cpp_reader *, bool);
+
 
 #endif /* ! GCC_CPPBUILTIN_H */
 
Index: c-family/c-common.h
===================================================================
--- c-family/c-common.h	(revision 164917)
+++ c-family/c-common.h	(working copy)
@@ -943,7 +943,6 @@ extern void c_common_print_pch_checksum 
 extern const unsigned char executable_checksum[16];
 
 /* In c-cppbuiltin.c  */
-extern void builtin_define_std (const char *macro);
 extern void builtin_define_with_value (const char *, const char *, int);
 extern void c_stddef_cpp_builtins (void);
 extern void fe_file_change (const struct line_map *);
Index: c-family/c-cppbuiltin.c
===================================================================
--- c-family/c-cppbuiltin.c	(revision 164917)
+++ c-family/c-cppbuiltin.c	(working copy)
@@ -39,8 +39,8 @@ along with GCC; see the file COPYING3.  
 # define TARGET_OS_CPP_BUILTINS()
 #endif
 
-#ifndef TARGET_OBJFMT_CPP_BUILTINS
-# define TARGET_OBJFMT_CPP_BUILTINS()
+#ifndef TARGET_CPU_CPP_BUILTINS_CFAMILY
+# define TARGET_CPU_CPP_BUILTINS_CFAMILY()
 #endif
 
 #ifndef REGISTER_PREFIX
@@ -48,7 +48,6 @@ along with GCC; see the file COPYING3.  
 #endif
 
 /* Non-static as some targets don't use it.  */
-void builtin_define_std (const char *) ATTRIBUTE_UNUSED;
 static void builtin_define_with_int_value (const char *, HOST_WIDE_INT);
 static void builtin_define_with_hex_fp_value (const char *, tree,
 					      int, const char *,
@@ -759,15 +758,20 @@ c_cpp_builtins (cpp_reader *pfile)
   builtin_define_type_sizeof ("__SIZEOF_PTRDIFF_T__",
 			      unsigned_ptrdiff_type_node);
 
+  /* Target-dependent builtins.  */
+  define_target_specific_builtins (pfile, flag_iso);
+
   /* A straightforward target hook doesn't work, because of problems
      linking that hook's body when part of non-C front ends.  */
 # define preprocessing_asm_p() (cpp_get_options (pfile)->lang == CLK_ASM)
 # define preprocessing_trad_p() (cpp_get_options (pfile)->traditional)
 # define builtin_define(TXT) cpp_define (pfile, TXT)
 # define builtin_assert(TXT) cpp_assert (pfile, TXT)
-  TARGET_CPU_CPP_BUILTINS ();
+# define builtin_define_std(TXT) \
+    define_builtin_macro_std (pfile, TXT, flag_iso)
+
   TARGET_OS_CPP_BUILTINS ();
-  TARGET_OBJFMT_CPP_BUILTINS ();
+  TARGET_CPU_CPP_BUILTINS_CFAMILY ();
 
   /* Support the __declspec keyword by turning them into attributes.
      Note that the current way we do this may result in a collision
@@ -785,50 +789,6 @@ c_cpp_builtins (cpp_reader *pfile)
     cpp_define (pfile, "__DECIMAL_BID_FORMAT__");
 }
 
-/* Pass an object-like macro.  If it doesn't lie in the user's
-   namespace, defines it unconditionally.  Otherwise define a version
-   with two leading underscores, and another version with two leading
-   and trailing underscores, and define the original only if an ISO
-   standard was not nominated.
-
-   e.g. passing "unix" defines "__unix", "__unix__" and possibly
-   "unix".  Passing "_mips" defines "__mips", "__mips__" and possibly
-   "_mips".  */
-void
-builtin_define_std (const char *macro)
-{
-  size_t len = strlen (macro);
-  char *buff = (char *) alloca (len + 5);
-  char *p = buff + 2;
-  char *q = p + len;
-
-  /* prepend __ (or maybe just _) if in user's namespace.  */
-  memcpy (p, macro, len + 1);
-  if (!( *p == '_' && (p[1] == '_' || ISUPPER (p[1]))))
-    {
-      if (*p != '_')
-	*--p = '_';
-      if (p[1] != '_')
-	*--p = '_';
-    }
-  cpp_define (parse_in, p);
-
-  /* If it was in user's namespace...  */
-  if (p != buff + 2)
-    {
-      /* Define the macro with leading and following __.  */
-      if (q[-1] != '_')
-	*q++ = '_';
-      if (q[-2] != '_')
-	*q++ = '_';
-      *q = '\0';
-      cpp_define (parse_in, p);
-
-      /* Finally, define the original macro if permitted.  */
-      if (!flag_iso)
-	cpp_define (parse_in, macro);
-    }
-}
 
 /* Pass an object-like macro and a value to define it to.  The third
    parameter says whether or not to turn the value into a string
Index: fortran/cpp.c
===================================================================
--- fortran/cpp.c	(revision 164917)
+++ fortran/cpp.c	(working copy)
@@ -46,10 +46,6 @@ along with GCC; see the file COPYING3.  
 # define TARGET_OS_CPP_BUILTINS()
 #endif
 
-#ifndef TARGET_OBJFMT_CPP_BUILTINS
-# define TARGET_OBJFMT_CPP_BUILTINS()
-#endif
-
 
 /* Holds switches parsed by gfc_cpp_handle_option (), but whose
    handling is deferred to gfc_cpp_init ().  */
@@ -174,6 +170,8 @@ cpp_define_builtins (cpp_reader *pfile)
   if (gfc_option.gfc_flag_openmp)
     cpp_define (pfile, "_OPENMP=200805");
 
+  define_target_specific_builtins (pfile, false);
+
   /* The defines below are necessary for the TARGET_* macros.
 
      FIXME:  Note that builtin_define_std() actually is a function
@@ -194,9 +192,7 @@ cpp_define_builtins (cpp_reader *pfile)
      - other platforms (not as popular) break similarly
        [grep for 'builtin_define_with_int_value' in gcc/config/]
 
-  TARGET_CPU_CPP_BUILTINS ();
-  TARGET_OS_CPP_BUILTINS ();
-  TARGET_OBJFMT_CPP_BUILTINS (); */
+  TARGET_OS_CPP_BUILTINS (); */
 
 #undef builtin_define
 #undef builtin_define_std
Index: config/alpha/alpha.h
===================================================================
--- config/alpha/alpha.h	(revision 164917)
+++ config/alpha/alpha.h	(working copy)
@@ -69,13 +69,11 @@ along with GCC; see the file COPYING3.  
 	  builtin_define ("_IEEE_FP_INEXACT");		\
 	if (TARGET_LONG_DOUBLE_128)			\
 	  builtin_define ("__LONG_DOUBLE_128__");	\
-							\
-	/* Macros dependent on the C dialect.  */	\
-	SUBTARGET_LANGUAGE_CPP_BUILTINS();		\
 } while (0)
 
-#ifndef SUBTARGET_LANGUAGE_CPP_BUILTINS
-#define SUBTARGET_LANGUAGE_CPP_BUILTINS()		\
+/* Macros dependent on the C dialect.  */
+#ifndef TARGET_CPU_CPP_BUILTINS_CFAMILY
+#define TARGET_CPU_CPP_BUILTINS_CFAMILY()		\
   do							\
     {							\
       if (preprocessing_asm_p ())			\
Index: config/alpha/netbsd.h
===================================================================
--- config/alpha/netbsd.h	(revision 164917)
+++ config/alpha/netbsd.h	(working copy)
@@ -29,8 +29,8 @@ along with GCC; see the file COPYING3.  
 
 
 /* NetBSD doesn't use the LANGUAGE* built-ins.  */
-#undef SUBTARGET_LANGUAGE_CPP_BUILTINS
-#define SUBTARGET_LANGUAGE_CPP_BUILTINS()	/* nothing */
+#undef TARGET_CPU_CPP_BUILTINS_CFAMILY
+#define TARGET_CPU_CPP_BUILTINS_CFAMILY()	/* nothing */
 
 
 /* Show that we need a GP when profiling.  */
Index: config/frv/frv.h
===================================================================
--- config/frv/frv.h	(revision 164917)
+++ config/frv/frv.h	(working copy)
@@ -262,6 +262,13 @@
 	builtin_define ("__FRV_DWORD__");				\
       if (TARGET_FDPIC)							\
 	builtin_define ("__FRV_FDPIC__");				\
+    }									\
+  while (0)
+
+/* Builtins for C languages.  */
+#define TARGET_CPU_CPP_BUILTINS_CFAMILY()				\
+  do									\
+    {									\
       if (flag_leading_underscore > 0)					\
 	builtin_define ("__FRV_UNDERSCORE__");				\
     }									\
Index: config/spu/spu-protos.h
===================================================================
--- config/spu/spu-protos.h	(revision 164917)
+++ config/spu/spu-protos.h	(working copy)
@@ -19,6 +19,7 @@
 #define _SPU_PROTOS_
 
 extern void spu_cpu_cpp_builtins (struct cpp_reader * pfile);
+extern void spu_cpu_cpp_builtins_cfamily (struct cpp_reader * pfile);
 extern void builtin_define_std (const char *);
 extern void spu_c_common_override_options (void);
 extern int valid_subreg (rtx op);
Index: config/spu/spu-c.c
===================================================================
--- config/spu/spu-c.c	(revision 164917)
+++ config/spu/spu-c.c	(working copy)
@@ -188,23 +188,7 @@ spu_resolve_overloaded_builtin (location
 void
 spu_cpu_cpp_builtins (struct cpp_reader *pfile)
 {
-  builtin_define_std ("__SPU__");
-  cpp_assert (pfile, "cpu=spu");
-  cpp_assert (pfile, "machine=spu");
-  if (spu_arch == PROCESSOR_CELLEDP)
-    builtin_define_std ("__SPU_EDP__");
-  builtin_define_std ("__vector=__attribute__((__spu_vector__))");
-  switch (spu_ea_model)
-    {
-    case 32:
-      builtin_define_std ("__EA32__");
-      break;
-    case 64:
-      builtin_define_std ("__EA64__");
-      break;
-    default:
-       gcc_unreachable ();
-    }
+  cpp_define (pfile, "__vector=__attribute__((__spu_vector__))");
 
   if (!flag_iso)
     {
Index: config/spu/spu.c
===================================================================
--- config/spu/spu.c	(revision 164917)
+++ config/spu/spu.c	(working copy)
@@ -7084,4 +7084,25 @@ spu_function_profiler (FILE * file, int 
   fprintf (file, "brsl $75,  _mcount\n");
 }
 
+void
+spu_cpu_cpp_builtins (struct cpp_reader *pfile)
+{
+  cpp_define (pfile, "__SPU__");
+  cpp_assert (pfile, "cpu=spu");
+  cpp_assert (pfile, "machine=spu");
+  if (spu_arch == PROCESSOR_CELLEDP)
+    cpp_define (pfile, "__SPU_EDP__");
+  switch (spu_ea_model)
+    {
+    case 32:
+      cpp_define (pfile, "__EA32__");
+      break;
+    case 64:
+      cpp_define (pfile, "__EA64__");
+      break;
+    default:
+       gcc_unreachable ();
+    }
+}
+
 #include "gt-spu.h"
Index: config/spu/spu.h
===================================================================
--- config/spu/spu.h	(revision 164917)
+++ config/spu/spu.h	(working copy)
@@ -16,7 +16,8 @@
 
 
 /* Run-time Target */
-#define TARGET_CPU_CPP_BUILTINS()	spu_cpu_cpp_builtins(pfile)
+#define TARGET_CPU_CPP_BUILTINS()          spu_cpu_cpp_builtins(pfile)
+#define TARGET_CPU_CPP_BUILTINS_CFAMILY()  spu_cpu_cpp_builtins_cfamily(pfile)
 
 #define TARGET_VERSION fprintf (stderr, " (spu %s)", __DATE__);
 
Index: config/i386/i386.h
===================================================================
--- config/i386/i386.h	(revision 164917)
+++ config/i386/i386.h	(working copy)
@@ -558,7 +558,7 @@ extern const char *host_detect_local_cpu
 #endif
 
 /* Target CPU builtins.  */
-#define TARGET_CPU_CPP_BUILTINS() ix86_target_macros ()
+#define TARGET_CPU_CPP_BUILTINS() ix86_target_macros (pfile, iso_c)
 
 /* Target Pragmas.  */
 #define REGISTER_TARGET_PRAGMAS() ix86_register_pragmas ()
Index: config/i386/i386-c.c
===================================================================
--- config/i386/i386-c.c	(revision 164917)
+++ config/i386/i386-c.c	(working copy)
@@ -30,233 +30,10 @@ along with GCC; see the file COPYING3.  
 #include "target.h"
 #include "target-def.h"
 #include "cpplib.h"
+#include "cppbuiltin.h"
 #include "c-family/c-pragma.h"
 
 static bool ix86_pragma_target_parse (tree, tree);
-static void ix86_target_macros_internal
-  (int, enum processor_type, enum processor_type, enum fpmath_unit,
-   void (*def_or_undef) (cpp_reader *, const char *));
-
-
-/* Internal function to either define or undef the appropriate system
-   macros.  */
-static void
-ix86_target_macros_internal (int isa_flag,
-			     enum processor_type arch,
-			     enum processor_type tune,
-			     enum fpmath_unit fpmath,
-			     void (*def_or_undef) (cpp_reader *,
-						   const char *))
-{
-  /* For some of the k6/pentium varients there weren't seperate ISA bits to
-     identify which tune/arch flag was passed, so figure it out here.  */
-  size_t arch_len = strlen (ix86_arch_string);
-  size_t tune_len = strlen (ix86_tune_string);
-  int last_arch_char = ix86_arch_string[arch_len - 1];
-  int last_tune_char = ix86_tune_string[tune_len - 1];
-
-  /* Built-ins based on -march=.  */
-  switch (arch)
-    {
-    case PROCESSOR_I386:
-      break;
-    case PROCESSOR_I486:
-      def_or_undef (parse_in, "__i486");
-      def_or_undef (parse_in, "__i486__");
-      break;
-    case PROCESSOR_PENTIUM:
-      def_or_undef (parse_in, "__i586");
-      def_or_undef (parse_in, "__i586__");
-      def_or_undef (parse_in, "__pentium");
-      def_or_undef (parse_in, "__pentium__");
-      if (isa_flag & OPTION_MASK_ISA_MMX)
-	def_or_undef (parse_in, "__pentium_mmx__");
-      break;
-    case PROCESSOR_PENTIUMPRO:
-      def_or_undef (parse_in, "__i686");
-      def_or_undef (parse_in, "__i686__");
-      def_or_undef (parse_in, "__pentiumpro");
-      def_or_undef (parse_in, "__pentiumpro__");
-      break;
-    case PROCESSOR_GEODE:
-      def_or_undef (parse_in, "__geode");
-      def_or_undef (parse_in, "__geode__");
-      break;
-    case PROCESSOR_K6:
-      def_or_undef (parse_in, "__k6");
-      def_or_undef (parse_in, "__k6__");
-      if (last_arch_char == '2')
-	def_or_undef (parse_in, "__k6_2__");
-      else if (last_arch_char == '3')
-	def_or_undef (parse_in, "__k6_3__");
-      else if (isa_flag & OPTION_MASK_ISA_3DNOW)
-	def_or_undef (parse_in, "__k6_3__");
-      break;
-    case PROCESSOR_ATHLON:
-      def_or_undef (parse_in, "__athlon");
-      def_or_undef (parse_in, "__athlon__");
-      if (isa_flag & OPTION_MASK_ISA_SSE)
-	def_or_undef (parse_in, "__athlon_sse__");
-      break;
-    case PROCESSOR_K8:
-      def_or_undef (parse_in, "__k8");
-      def_or_undef (parse_in, "__k8__");
-      break;
-    case PROCESSOR_AMDFAM10:
-      def_or_undef (parse_in, "__amdfam10");
-      def_or_undef (parse_in, "__amdfam10__");
-      break;
-    case PROCESSOR_BDVER1:
-      def_or_undef (parse_in, "__bdver1");
-      def_or_undef (parse_in, "__bdver1__");
-      break;
-    case PROCESSOR_PENTIUM4:
-      def_or_undef (parse_in, "__pentium4");
-      def_or_undef (parse_in, "__pentium4__");
-      break;
-    case PROCESSOR_NOCONA:
-      def_or_undef (parse_in, "__nocona");
-      def_or_undef (parse_in, "__nocona__");
-      break;
-    case PROCESSOR_CORE2:
-      def_or_undef (parse_in, "__core2");
-      def_or_undef (parse_in, "__core2__");
-      break;
-    case PROCESSOR_ATOM:
-      def_or_undef (parse_in, "__atom");
-      def_or_undef (parse_in, "__atom__");
-      break;
-    /* use PROCESSOR_max to not set/unset the arch macro.  */
-    case PROCESSOR_max:
-      break;
-    case PROCESSOR_GENERIC32:
-    case PROCESSOR_GENERIC64:
-      gcc_unreachable ();
-    }
-
-  /* Built-ins based on -mtune=.  */
-  switch (tune)
-    {
-    case PROCESSOR_I386:
-      def_or_undef (parse_in, "__tune_i386__");
-      break;
-    case PROCESSOR_I486:
-      def_or_undef (parse_in, "__tune_i486__");
-      break;
-    case PROCESSOR_PENTIUM:
-      def_or_undef (parse_in, "__tune_i586__");
-      def_or_undef (parse_in, "__tune_pentium__");
-      if (last_tune_char == 'x')
-	def_or_undef (parse_in, "__tune_pentium_mmx__");
-      break;
-    case PROCESSOR_PENTIUMPRO:
-      def_or_undef (parse_in, "__tune_i686__");
-      def_or_undef (parse_in, "__tune_pentiumpro__");
-      switch (last_tune_char)
-	{
-	case '3':
-	  def_or_undef (parse_in, "__tune_pentium3__");
-	  /* FALLTHRU */
-	case '2':
-	  def_or_undef (parse_in, "__tune_pentium2__");
-	  break;
-	}
-      break;
-    case PROCESSOR_GEODE:
-      def_or_undef (parse_in, "__tune_geode__");
-      break;
-    case PROCESSOR_K6:
-      def_or_undef (parse_in, "__tune_k6__");
-      if (last_tune_char == '2')
-	def_or_undef (parse_in, "__tune_k6_2__");
-      else if (last_tune_char == '3')
-	def_or_undef (parse_in, "__tune_k6_3__");
-      else if (isa_flag & OPTION_MASK_ISA_3DNOW)
-	def_or_undef (parse_in, "__tune_k6_3__");
-      break;
-    case PROCESSOR_ATHLON:
-      def_or_undef (parse_in, "__tune_athlon__");
-      if (isa_flag & OPTION_MASK_ISA_SSE)
-	def_or_undef (parse_in, "__tune_athlon_sse__");
-      break;
-    case PROCESSOR_K8:
-      def_or_undef (parse_in, "__tune_k8__");
-      break;
-    case PROCESSOR_AMDFAM10:
-      def_or_undef (parse_in, "__tune_amdfam10__");
-      break;
-    case PROCESSOR_BDVER1:
-      def_or_undef (parse_in, "__tune_bdver1__");
-      break;
-    case PROCESSOR_PENTIUM4:
-      def_or_undef (parse_in, "__tune_pentium4__");
-      break;
-    case PROCESSOR_NOCONA:
-      def_or_undef (parse_in, "__tune_nocona__");
-      break;
-    case PROCESSOR_CORE2:
-      def_or_undef (parse_in, "__tune_core2__");
-      break;
-    case PROCESSOR_ATOM:
-      def_or_undef (parse_in, "__tune_atom__");
-      break;
-    case PROCESSOR_GENERIC32:
-    case PROCESSOR_GENERIC64:
-      break;
-    /* use PROCESSOR_max to not set/unset the tune macro.  */
-    case PROCESSOR_max:
-      break;
-    }
-
-  if (isa_flag & OPTION_MASK_ISA_MMX)
-    def_or_undef (parse_in, "__MMX__");
-  if (isa_flag & OPTION_MASK_ISA_3DNOW)
-    def_or_undef (parse_in, "__3dNOW__");
-  if (isa_flag & OPTION_MASK_ISA_3DNOW_A)
-    def_or_undef (parse_in, "__3dNOW_A__");
-  if (isa_flag & OPTION_MASK_ISA_SSE)
-    def_or_undef (parse_in, "__SSE__");
-  if (isa_flag & OPTION_MASK_ISA_SSE2)
-    def_or_undef (parse_in, "__SSE2__");
-  if (isa_flag & OPTION_MASK_ISA_SSE3)
-    def_or_undef (parse_in, "__SSE3__");
-  if (isa_flag & OPTION_MASK_ISA_SSSE3)
-    def_or_undef (parse_in, "__SSSE3__");
-  if (isa_flag & OPTION_MASK_ISA_SSE4_1)
-    def_or_undef (parse_in, "__SSE4_1__");
-  if (isa_flag & OPTION_MASK_ISA_SSE4_2)
-    def_or_undef (parse_in, "__SSE4_2__");
-  if (isa_flag & OPTION_MASK_ISA_AES)
-    def_or_undef (parse_in, "__AES__");
-  if (isa_flag & OPTION_MASK_ISA_PCLMUL)
-    def_or_undef (parse_in, "__PCLMUL__");
-  if (isa_flag & OPTION_MASK_ISA_AVX)
-    def_or_undef (parse_in, "__AVX__");
-  if (isa_flag & OPTION_MASK_ISA_FMA)
-    def_or_undef (parse_in, "__FMA__");
-  if (isa_flag & OPTION_MASK_ISA_SSE4A)
-    def_or_undef (parse_in, "__SSE4A__");
-  if (isa_flag & OPTION_MASK_ISA_FMA4)
-    def_or_undef (parse_in, "__FMA4__");
-  if (isa_flag & OPTION_MASK_ISA_XOP)
-    def_or_undef (parse_in, "__XOP__");
-  if (isa_flag & OPTION_MASK_ISA_LWP)
-    def_or_undef (parse_in, "__LWP__");
-  if (isa_flag & OPTION_MASK_ISA_ABM)
-    def_or_undef (parse_in, "__ABM__");
-  if (isa_flag & OPTION_MASK_ISA_POPCNT)
-    def_or_undef (parse_in, "__POPCNT__");
-  if (isa_flag & OPTION_MASK_ISA_FSGSBASE)
-    def_or_undef (parse_in, "__FSGSBASE__");
-  if (isa_flag & OPTION_MASK_ISA_RDRND)
-    def_or_undef (parse_in, "__RDRND__");
-  if (isa_flag & OPTION_MASK_ISA_F16C)
-    def_or_undef (parse_in, "__F16C__");
-  if ((fpmath & FPMATH_SSE) && (isa_flag & OPTION_MASK_ISA_SSE))
-    def_or_undef (parse_in, "__SSE_MATH__");
-  if ((fpmath & FPMATH_SSE) && (isa_flag & OPTION_MASK_ISA_SSE2))
-    def_or_undef (parse_in, "__SSE2_MATH__");
-}
 
 
 /* Hook to validate the current #pragma GCC target and set the state, and
@@ -319,6 +96,7 @@ ix86_pragma_target_parse (tree args, tre
 			       prev_arch,
 			       prev_tune,
 			       (enum fpmath_unit) prev_opt->fpmath,
+			       parse_in,
 			       cpp_undef);
 
   /* Define all of the macros for new options that were just turned on.  */
@@ -326,42 +104,12 @@ ix86_pragma_target_parse (tree args, tre
 			       cur_arch,
 			       cur_tune,
 			       (enum fpmath_unit) cur_opt->fpmath,
+			       parse_in,
 			       cpp_define);
 
   return true;
 }
 
-/* Function to tell the preprocessor about the defines for the current target.  */
-
-void
-ix86_target_macros (void)
-{
-  /* 32/64-bit won't change with target specific options, so do the assert and
-     builtin_define_std calls here.  */
-  if (TARGET_64BIT)
-    {
-      cpp_assert (parse_in, "cpu=x86_64");
-      cpp_assert (parse_in, "machine=x86_64");
-      cpp_define (parse_in, "__amd64");
-      cpp_define (parse_in, "__amd64__");
-      cpp_define (parse_in, "__x86_64");
-      cpp_define (parse_in, "__x86_64__");
-    }
-  else
-    {
-      cpp_assert (parse_in, "cpu=i386");
-      cpp_assert (parse_in, "machine=i386");
-      builtin_define_std ("i386");
-    }
-
-  ix86_target_macros_internal (ix86_isa_flags,
-			       ix86_arch,
-			       ix86_tune,
-			       ix86_fpmath,
-			       cpp_define);
-}
-
-
 /* Register target pragmas.  We need to add the hook for parsing #pragma GCC
    option here rather than in i386.c since it will pull in various preprocessor
    functions, and those are not present in languages like fortran without a
Index: config/i386/i386-protos.h
===================================================================
--- config/i386/i386-protos.h	(revision 164917)
+++ config/i386/i386-protos.h	(working copy)
@@ -207,8 +207,13 @@ extern void ix86_expand_reduc_v4sf (rtx 
 
 extern void ix86_expand_vec_extract_even_odd (rtx, rtx, rtx, unsigned);
 
+extern void ix86_target_macros_internal
+  (int, enum processor_type, enum processor_type, enum fpmath_unit,
+   struct cpp_reader *,
+   void (*def_or_undef) (struct cpp_reader *, const char *));
+extern void ix86_target_macros (struct cpp_reader *, bool);
+
 /* In i386-c.c  */
-extern void ix86_target_macros (void);
 extern void ix86_register_pragmas (void);
 
 /* In winnt.c  */
Index: config/i386/nto.h
===================================================================
--- config/i386/nto.h	(revision 164917)
+++ config/i386/nto.h	(working copy)
@@ -27,11 +27,11 @@ along with GCC; see the file COPYING3.  
 #define TARGET_OS_CPP_BUILTINS()		\
   do						\
     {						\
-        builtin_define_std ("__X86__");		\
-        builtin_define_std ("__QNXNTO__");	\
-        builtin_define_std ("__QNX__");		\
-        builtin_define_std ("__ELF__");		\
-        builtin_define_std ("__LITTLEENDIAN__");\
+        cpp_define (pfile, "__X86__");		\
+        cpp_define (pfile, "__QNXNTO__");	\
+        cpp_define (pfile, "__QNX__");		\
+        cpp_define (pfile, "__ELF__");		\
+        cpp_define (pfile, "__LITTLEENDIAN__");	\
         builtin_assert ("system=qnx");		\
         builtin_assert ("system=qnxnto");	\
         builtin_assert ("system=nto");		\
Index: config/i386/i386.c
===================================================================
--- config/i386/i386.c	(revision 164917)
+++ config/i386/i386.c	(working copy)
@@ -56,6 +56,9 @@ along with GCC; see the file COPYING3.  
 #include "debug.h"
 #include "dwarf2out.h"
 #include "sched-int.h"
+#include "cpplib.h"
+#include "cppbuiltin.h"
+
 static rtx legitimize_dllimport_symbol (rtx, bool);
 
 #ifndef CHECK_STACK_LIMIT
@@ -32981,6 +32984,261 @@ ix86_units_per_simd_word (enum machine_m
     return TARGET_SSE ? 16 : UNITS_PER_WORD;
 }
 
+
+/* Internal function to either define or undef the appropriate system
+   macros.  */
+void
+ix86_target_macros_internal (int isa_flag,
+			     enum processor_type arch,
+			     enum processor_type tune,
+			     enum fpmath_unit fpmath,
+			     cpp_reader *pfile,
+			     void (*def_or_undef) (cpp_reader *,
+						   const char *))
+{
+  /* For some of the k6/pentium varients there weren't seperate ISA bits to
+     identify which tune/arch flag was passed, so figure it out here.  */
+  size_t arch_len = strlen (ix86_arch_string);
+  size_t tune_len = strlen (ix86_tune_string);
+  int last_arch_char = ix86_arch_string[arch_len - 1];
+  int last_tune_char = ix86_tune_string[tune_len - 1];
+
+  /* Built-ins based on -march=.  */
+  switch (arch)
+    {
+    case PROCESSOR_I386:
+      break;
+    case PROCESSOR_I486:
+      def_or_undef (pfile, "__i486");
+      def_or_undef (pfile, "__i486__");
+      break;
+    case PROCESSOR_PENTIUM:
+      def_or_undef (pfile, "__i586");
+      def_or_undef (pfile, "__i586__");
+      def_or_undef (pfile, "__pentium");
+      def_or_undef (pfile, "__pentium__");
+      if (isa_flag & OPTION_MASK_ISA_MMX)
+	def_or_undef (pfile, "__pentium_mmx__");
+      break;
+    case PROCESSOR_PENTIUMPRO:
+      def_or_undef (pfile, "__i686");
+      def_or_undef (pfile, "__i686__");
+      def_or_undef (pfile, "__pentiumpro");
+      def_or_undef (pfile, "__pentiumpro__");
+      break;
+    case PROCESSOR_GEODE:
+      def_or_undef (pfile, "__geode");
+      def_or_undef (pfile, "__geode__");
+      break;
+    case PROCESSOR_K6:
+      def_or_undef (pfile, "__k6");
+      def_or_undef (pfile, "__k6__");
+      if (last_arch_char == '2')
+	def_or_undef (pfile, "__k6_2__");
+      else if (last_arch_char == '3')
+	def_or_undef (pfile, "__k6_3__");
+      else if (isa_flag & OPTION_MASK_ISA_3DNOW)
+	def_or_undef (pfile, "__k6_3__");
+      break;
+    case PROCESSOR_ATHLON:
+      def_or_undef (pfile, "__athlon");
+      def_or_undef (pfile, "__athlon__");
+      if (isa_flag & OPTION_MASK_ISA_SSE)
+	def_or_undef (pfile, "__athlon_sse__");
+      break;
+    case PROCESSOR_K8:
+      def_or_undef (pfile, "__k8");
+      def_or_undef (pfile, "__k8__");
+      break;
+    case PROCESSOR_AMDFAM10:
+      def_or_undef (pfile, "__amdfam10");
+      def_or_undef (pfile, "__amdfam10__");
+      break;
+    case PROCESSOR_BDVER1:
+      def_or_undef (pfile, "__bdver1");
+      def_or_undef (pfile, "__bdver1__");
+      break;
+    case PROCESSOR_PENTIUM4:
+      def_or_undef (pfile, "__pentium4");
+      def_or_undef (pfile, "__pentium4__");
+      break;
+    case PROCESSOR_NOCONA:
+      def_or_undef (pfile, "__nocona");
+      def_or_undef (pfile, "__nocona__");
+      break;
+    case PROCESSOR_CORE2:
+      def_or_undef (pfile, "__core2");
+      def_or_undef (pfile, "__core2__");
+      break;
+    case PROCESSOR_ATOM:
+      def_or_undef (pfile, "__atom");
+      def_or_undef (pfile, "__atom__");
+      break;
+    /* use PROCESSOR_max to not set/unset the arch macro.  */
+    case PROCESSOR_max:
+      break;
+    case PROCESSOR_GENERIC32:
+    case PROCESSOR_GENERIC64:
+      gcc_unreachable ();
+    }
+
+  /* Built-ins based on -mtune=.  */
+  switch (tune)
+    {
+    case PROCESSOR_I386:
+      def_or_undef (pfile, "__tune_i386__");
+      break;
+    case PROCESSOR_I486:
+      def_or_undef (pfile, "__tune_i486__");
+      break;
+    case PROCESSOR_PENTIUM:
+      def_or_undef (pfile, "__tune_i586__");
+      def_or_undef (pfile, "__tune_pentium__");
+      if (last_tune_char == 'x')
+	def_or_undef (pfile, "__tune_pentium_mmx__");
+      break;
+    case PROCESSOR_PENTIUMPRO:
+      def_or_undef (pfile, "__tune_i686__");
+      def_or_undef (pfile, "__tune_pentiumpro__");
+      switch (last_tune_char)
+	{
+	case '3':
+	  def_or_undef (pfile, "__tune_pentium3__");
+	  /* FALLTHRU */
+	case '2':
+	  def_or_undef (pfile, "__tune_pentium2__");
+	  break;
+	}
+      break;
+    case PROCESSOR_GEODE:
+      def_or_undef (pfile, "__tune_geode__");
+      break;
+    case PROCESSOR_K6:
+      def_or_undef (pfile, "__tune_k6__");
+      if (last_tune_char == '2')
+	def_or_undef (pfile, "__tune_k6_2__");
+      else if (last_tune_char == '3')
+	def_or_undef (pfile, "__tune_k6_3__");
+      else if (isa_flag & OPTION_MASK_ISA_3DNOW)
+	def_or_undef (pfile, "__tune_k6_3__");
+      break;
+    case PROCESSOR_ATHLON:
+      def_or_undef (pfile, "__tune_athlon__");
+      if (isa_flag & OPTION_MASK_ISA_SSE)
+	def_or_undef (pfile, "__tune_athlon_sse__");
+      break;
+    case PROCESSOR_K8:
+      def_or_undef (pfile, "__tune_k8__");
+      break;
+    case PROCESSOR_AMDFAM10:
+      def_or_undef (pfile, "__tune_amdfam10__");
+      break;
+    case PROCESSOR_BDVER1:
+      def_or_undef (pfile, "__tune_bdver1__");
+      break;
+    case PROCESSOR_PENTIUM4:
+      def_or_undef (pfile, "__tune_pentium4__");
+      break;
+    case PROCESSOR_NOCONA:
+      def_or_undef (pfile, "__tune_nocona__");
+      break;
+    case PROCESSOR_CORE2:
+      def_or_undef (pfile, "__tune_core2__");
+      break;
+    case PROCESSOR_ATOM:
+      def_or_undef (pfile, "__tune_atom__");
+      break;
+    case PROCESSOR_GENERIC32:
+    case PROCESSOR_GENERIC64:
+      break;
+    /* use PROCESSOR_max to not set/unset the tune macro.  */
+    case PROCESSOR_max:
+      break;
+    }
+
+  if (isa_flag & OPTION_MASK_ISA_MMX)
+    def_or_undef (pfile, "__MMX__");
+  if (isa_flag & OPTION_MASK_ISA_3DNOW)
+    def_or_undef (pfile, "__3dNOW__");
+  if (isa_flag & OPTION_MASK_ISA_3DNOW_A)
+    def_or_undef (pfile, "__3dNOW_A__");
+  if (isa_flag & OPTION_MASK_ISA_SSE)
+    def_or_undef (pfile, "__SSE__");
+  if (isa_flag & OPTION_MASK_ISA_SSE2)
+    def_or_undef (pfile, "__SSE2__");
+  if (isa_flag & OPTION_MASK_ISA_SSE3)
+    def_or_undef (pfile, "__SSE3__");
+  if (isa_flag & OPTION_MASK_ISA_SSSE3)
+    def_or_undef (pfile, "__SSSE3__");
+  if (isa_flag & OPTION_MASK_ISA_SSE4_1)
+    def_or_undef (pfile, "__SSE4_1__");
+  if (isa_flag & OPTION_MASK_ISA_SSE4_2)
+    def_or_undef (pfile, "__SSE4_2__");
+  if (isa_flag & OPTION_MASK_ISA_AES)
+    def_or_undef (pfile, "__AES__");
+  if (isa_flag & OPTION_MASK_ISA_PCLMUL)
+    def_or_undef (pfile, "__PCLMUL__");
+  if (isa_flag & OPTION_MASK_ISA_AVX)
+    def_or_undef (pfile, "__AVX__");
+  if (isa_flag & OPTION_MASK_ISA_FMA)
+    def_or_undef (pfile, "__FMA__");
+  if (isa_flag & OPTION_MASK_ISA_SSE4A)
+    def_or_undef (pfile, "__SSE4A__");
+  if (isa_flag & OPTION_MASK_ISA_FMA4)
+    def_or_undef (pfile, "__FMA4__");
+  if (isa_flag & OPTION_MASK_ISA_XOP)
+    def_or_undef (pfile, "__XOP__");
+  if (isa_flag & OPTION_MASK_ISA_LWP)
+    def_or_undef (pfile, "__LWP__");
+  if (isa_flag & OPTION_MASK_ISA_ABM)
+    def_or_undef (pfile, "__ABM__");
+  if (isa_flag & OPTION_MASK_ISA_POPCNT)
+    def_or_undef (pfile, "__POPCNT__");
+  if (isa_flag & OPTION_MASK_ISA_FSGSBASE)
+    def_or_undef (pfile, "__FSGSBASE__");
+  if (isa_flag & OPTION_MASK_ISA_RDRND)
+    def_or_undef (pfile, "__RDRND__");
+  if (isa_flag & OPTION_MASK_ISA_F16C)
+    def_or_undef (pfile, "__F16C__");
+  if ((fpmath & FPMATH_SSE) && (isa_flag & OPTION_MASK_ISA_SSE))
+    def_or_undef (pfile, "__SSE_MATH__");
+  if ((fpmath & FPMATH_SSE) && (isa_flag & OPTION_MASK_ISA_SSE2))
+    def_or_undef (pfile, "__SSE2_MATH__");
+}
+
+
+/* Function to tell the preprocessor about the defines for the current
+   target.  */
+void
+ix86_target_macros (cpp_reader *pfile, bool iso_c)
+{
+  /* 32/64-bit won't change with target specific options, so do the assert and
+     builtin_define_std calls here.  */
+  if (TARGET_64BIT)
+    {
+      cpp_assert (pfile, "cpu=x86_64");
+      cpp_assert (pfile, "machine=x86_64");
+      cpp_define (pfile, "__amd64");
+      cpp_define (pfile, "__amd64__");
+      cpp_define (pfile, "__x86_64");
+      cpp_define (pfile, "__x86_64__");
+    }
+  else
+    {
+      cpp_assert (pfile, "cpu=i386");
+      cpp_assert (pfile, "machine=i386");
+      define_builtin_macro_std (pfile, "i386", iso_c);
+    }
+
+  ix86_target_macros_internal (ix86_isa_flags,
+                               ix86_arch,
+                               ix86_tune,
+                               ix86_fpmath,
+                               pfile,
+                               cpp_define);
+}
+
+
 /* Initialize the GCC target structure.  */
 #undef TARGET_RETURN_IN_MEMORY
 #define TARGET_RETURN_IN_MEMORY ix86_return_in_memory
Index: config/avr/avr.c
===================================================================
--- config/avr/avr.c	(revision 164917)
+++ config/avr/avr.c	(working copy)
@@ -45,6 +45,8 @@
 #include "target-def.h"
 #include "params.h"
 #include "df.h"
+#include "cpplib.h"
+#include "cppbuiltin.h"
 
 /* Maximal allowed offset for an address in the LD command */
 #define MAX_LD_OFFSET(MODE) (64 - (signed)GET_MODE_SIZE (MODE))
@@ -6149,4 +6151,58 @@ unsigned int avr_case_values_threshold (
   return (!AVR_HAVE_JMP_CALL || TARGET_CALL_PROLOGUES) ? 8 : 17;
 }
 
+
+/* Worker function for TARGET_CPU_CPP_BUILTINS.  */
+
+void
+avr_cpu_cpp_builtins (struct cpp_reader *pfile, bool iso_c)
+{
+  define_builtin_macro_std (pfile, "AVR", iso_c);
+
+  if (avr_current_arch->macro)
+    cpp_define (pfile, avr_current_arch->macro);
+  if (avr_extra_arch_macro)
+    cpp_define (pfile, avr_extra_arch_macro);
+  if (avr_current_arch->have_elpm)
+    cpp_define (pfile, "__AVR_HAVE_RAMPZ__");
+  if (avr_current_arch->have_elpm)
+    cpp_define (pfile, "__AVR_HAVE_ELPM__");
+  if (avr_current_arch->have_elpmx)
+    cpp_define (pfile, "__AVR_HAVE_ELPMX__");
+  if (avr_current_arch->have_movw_lpmx)
+    {
+      cpp_define (pfile, "__AVR_HAVE_MOVW__");
+      cpp_define (pfile, "__AVR_HAVE_LPMX__");
+    }
+  if (avr_current_arch->asm_only)
+    cpp_define (pfile, "__AVR_ASM_ONLY__");
+  if (avr_current_arch->have_mul)
+    {
+      cpp_define (pfile, "__AVR_ENHANCED__");
+      cpp_define (pfile, "__AVR_HAVE_MUL__");
+    }
+  if (avr_current_arch->have_jmp_call)
+    {
+      cpp_define (pfile, "__AVR_MEGA__");
+      cpp_define (pfile, "__AVR_HAVE_JMP_CALL__");
+    }
+  if (avr_current_arch->have_eijmp_eicall)
+    {
+      cpp_define (pfile, "__AVR_HAVE_EIJMP_EICALL__");
+      cpp_define (pfile, "__AVR_3_BYTE_PC__");
+    }
+  else
+    {
+      cpp_define (pfile, "__AVR_2_BYTE_PC__");
+    }
+
+  if (avr_current_device->short_sp)
+    cpp_define (pfile, "__AVR_HAVE_8BIT_SP__");
+  else
+    cpp_define (pfile, "__AVR_HAVE_16BIT_SP__");
+
+  if (TARGET_NO_INTERRUPTS)
+    cpp_define (pfile, "__NO_INTERRUPTS__");
+}
+
 #include "gt-avr.h"
Index: config/avr/t-avr
===================================================================
--- config/avr/t-avr	(revision 164917)
+++ config/avr/t-avr	(working copy)
@@ -26,11 +26,6 @@ avr-devices.o: $(srcdir)/config/avr/avr-
 	$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
 	
 
-avr-c.o: $(srcdir)/config/avr/avr-c.c \
-  $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(C_COMMON_H)
-	$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
-	
-
 
 LIB1ASMSRC = avr/libgcc.S
 LIB1ASMFUNCS = \
Index: config/avr/avr-c.c
===================================================================
--- config/avr/avr-c.c	(revision 164917)
+++ config/avr/avr-c.c	(working copy)
@@ -1,85 +0,0 @@
-/* Copyright (C) 2009
-   Free Software Foundation, Inc.
-   Contributed by Anatoly Sokolov (aesok@post.ru)
-
-   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 3, 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 COPYING3.  If not see
-   <http://www.gnu.org/licenses/>.  */
-
-
-#include "config.h"
-#include "system.h"
-#include "coretypes.h"
-#include "tm.h"
-#include "tm_p.h"
-#include "cpplib.h"
-#include "tree.h"
-#include "c-family/c-common.h"
-
-/* Not included in avr.c since this requires C front end.  */
-
-/* Worker function for TARGET_CPU_CPP_BUILTINS.  */
-
-void
-avr_cpu_cpp_builtins (struct cpp_reader *pfile)
-{
-  builtin_define_std ("AVR");
-
-  if (avr_current_arch->macro)
-    cpp_define (pfile, avr_current_arch->macro);
-  if (avr_extra_arch_macro)
-    cpp_define (pfile, avr_extra_arch_macro);
-  if (avr_current_arch->have_elpm)
-    cpp_define (pfile, "__AVR_HAVE_RAMPZ__");
-  if (avr_current_arch->have_elpm)
-    cpp_define (pfile, "__AVR_HAVE_ELPM__");
-  if (avr_current_arch->have_elpmx)
-    cpp_define (pfile, "__AVR_HAVE_ELPMX__");
-  if (avr_current_arch->have_movw_lpmx)
-    {
-      cpp_define (pfile, "__AVR_HAVE_MOVW__");
-      cpp_define (pfile, "__AVR_HAVE_LPMX__");
-    }
-  if (avr_current_arch->asm_only)
-    cpp_define (pfile, "__AVR_ASM_ONLY__");
-  if (avr_current_arch->have_mul)
-    {
-      cpp_define (pfile, "__AVR_ENHANCED__");
-      cpp_define (pfile, "__AVR_HAVE_MUL__");
-    }
-  if (avr_current_arch->have_jmp_call)
-    {
-      cpp_define (pfile, "__AVR_MEGA__");
-      cpp_define (pfile, "__AVR_HAVE_JMP_CALL__");
-    }
-  if (avr_current_arch->have_eijmp_eicall)
-    {
-      cpp_define (pfile, "__AVR_HAVE_EIJMP_EICALL__");
-      cpp_define (pfile, "__AVR_3_BYTE_PC__");
-    }
-  else
-    {
-      cpp_define (pfile, "__AVR_2_BYTE_PC__");
-    }
-
-  if (avr_current_device->short_sp)
-    cpp_define (pfile, "__AVR_HAVE_8BIT_SP__");
-  else
-    cpp_define (pfile, "__AVR_HAVE_16BIT_SP__");
-
-  if (TARGET_NO_INTERRUPTS)
-    cpp_define (pfile, "__NO_INTERRUPTS__");
-}
-
Index: config/avr/avr.h
===================================================================
--- config/avr/avr.h	(revision 164917)
+++ config/avr/avr.h	(working copy)
@@ -105,7 +105,7 @@ extern const struct mcu_type_s *avr_curr
 extern const struct mcu_type_s avr_mcu_types[];
 extern const struct base_arch_s avr_arch_types[];
 
-#define TARGET_CPU_CPP_BUILTINS()	avr_cpu_cpp_builtins (pfile)
+#define TARGET_CPU_CPP_BUILTINS()	avr_cpu_cpp_builtins (pfile, iso_c)
 
 #if !defined(IN_LIBGCC2) && !defined(IN_TARGET_LIBS)
 extern GTY(()) section *progmem_section;
Index: config/rs6000/rs6000-c.c
===================================================================
--- config/rs6000/rs6000-c.c	(revision 164917)
+++ config/rs6000/rs6000-c.c	(working copy)
@@ -259,39 +259,10 @@ rs6000_macro_to_expand (cpp_reader *pfil
 }
 
 void
-rs6000_cpu_cpp_builtins (cpp_reader *pfile)
+rs6000_cpu_cpp_builtins_cfamily (cpp_reader *pfile)
 {
-  if (TARGET_POWER2)
-    builtin_define ("_ARCH_PWR2");
-  else if (TARGET_POWER)
-    builtin_define ("_ARCH_PWR");
-  if (TARGET_POWERPC)
-    builtin_define ("_ARCH_PPC");
-  if (TARGET_PPC_GPOPT)
-    builtin_define ("_ARCH_PPCSQ");
-  if (TARGET_PPC_GFXOPT)
-    builtin_define ("_ARCH_PPCGR");
-  if (TARGET_POWERPC64)
-    builtin_define ("_ARCH_PPC64");
-  if (TARGET_MFCRF)
-    builtin_define ("_ARCH_PWR4");
-  if (TARGET_POPCNTB)
-    builtin_define ("_ARCH_PWR5");
-  if (TARGET_FPRND)
-    builtin_define ("_ARCH_PWR5X");
-  if (TARGET_CMPB)
-    builtin_define ("_ARCH_PWR6");
-  if (TARGET_MFPGPR)
-    builtin_define ("_ARCH_PWR6X");
-  if (! TARGET_POWER && ! TARGET_POWER2 && ! TARGET_POWERPC)
-    builtin_define ("_ARCH_COM");
-  if (TARGET_POPCNTD)
-    builtin_define ("_ARCH_PWR7");
   if (TARGET_ALTIVEC)
     {
-      builtin_define ("__ALTIVEC__");
-      builtin_define ("__VEC__=10206");
-
       /* Define the AltiVec syntactic elements.  */
       builtin_define ("__vector=__attribute__((altivec(vector__)))");
       builtin_define ("__pixel=__attribute__((altivec(pixel__))) unsigned short");
@@ -312,27 +283,8 @@ rs6000_cpu_cpp_builtins (cpp_reader *pfi
 	  cpp_get_callbacks (pfile)->macro_to_expand = rs6000_macro_to_expand;
 	}
     }
-  if (rs6000_cpu == PROCESSOR_CELL)
-    builtin_define ("__PPU__");
-  if (TARGET_SPE)
-    builtin_define ("__SPE__");
-  if (TARGET_PAIRED_FLOAT)
-    builtin_define ("__PAIRED__");
-  if (TARGET_SOFT_FLOAT)
-    builtin_define ("_SOFT_FLOAT");
-  if ((!(TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)))
-      ||(TARGET_HARD_FLOAT && TARGET_FPRS && !TARGET_DOUBLE_FLOAT))
-    builtin_define ("_SOFT_DOUBLE");
-  /* Used by lwarx/stwcx. errata work-around.  */
-  if (rs6000_cpu == PROCESSOR_PPC405)
-    builtin_define ("__PPC405__");
-  /* Used by libstdc++.  */
-  if (TARGET_NO_LWSYNC)
-    builtin_define ("__NO_LWSYNC__");
   if (TARGET_VSX)
     {
-      builtin_define ("__VSX__");
-
       /* For the VSX builtin functions identical to Altivec functions, just map
 	 the altivec builtin into the vsx version (the altivec functions
 	 generate VSX code if -mvsx).  */
@@ -363,68 +315,6 @@ rs6000_cpu_cpp_builtins (cpp_reader *pfi
       builtin_define ("__builtin_vsx_xvnmsubasp=__builtin_vsx_xvnmsubsp");
       builtin_define ("__builtin_vsx_xvnmsubmsp=__builtin_vsx_xvnmsubsp");
     }
-  if (RS6000_RECIP_HAVE_RE_P (DFmode))
-    builtin_define ("__RECIP__");
-  if (RS6000_RECIP_HAVE_RE_P (SFmode))
-    builtin_define ("__RECIPF__");
-  if (RS6000_RECIP_HAVE_RSQRTE_P (DFmode))
-    builtin_define ("__RSQRTE__");
-  if (RS6000_RECIP_HAVE_RSQRTE_P (SFmode))
-    builtin_define ("__RSQRTEF__");
-  if (TARGET_RECIP_PRECISION)
-    builtin_define ("__RECIP_PRECISION__");
-
-  /* Tell users they can use __builtin_bswap{16,64}.  */
-  builtin_define ("__HAVE_BSWAP__");
-
-  /* May be overridden by target configuration.  */
-  RS6000_CPU_CPP_ENDIAN_BUILTINS();
-
-  if (TARGET_LONG_DOUBLE_128)
-    {
-      builtin_define ("__LONG_DOUBLE_128__");
-      builtin_define ("__LONGDOUBLE128");
-    }
-
-  switch (rs6000_current_abi)
-    {
-    case ABI_V4:
-      builtin_define ("_CALL_SYSV");
-      break;
-    case ABI_AIX:
-      builtin_define ("_CALL_AIXDESC");
-      builtin_define ("_CALL_AIX");
-      break;
-    case ABI_DARWIN:
-      builtin_define ("_CALL_DARWIN");
-      break;
-    default:
-      break;
-    }
-
-  /* Let the compiled code know if 'f' class registers will not be available.  */
-  if (TARGET_SOFT_FLOAT || !TARGET_FPRS)
-    builtin_define ("__NO_FPRS__");
-
-  /* Generate defines for Xilinx FPU. */
-  if (rs6000_xilinx_fpu) 
-    {
-      builtin_define ("_XFPU");
-      if (rs6000_single_float && ! rs6000_double_float)
-	{
-	  if (rs6000_simple_fpu) 
-	    builtin_define ("_XFPU_SP_LITE"); 
-	  else 
-	    builtin_define ("_XFPU_SP_FULL");
-	}
-      if (rs6000_double_float)
-	{
-	  if (rs6000_simple_fpu) 
-	    builtin_define ("_XFPU_DP_LITE");
-	  else
-	    builtin_define ("_XFPU_DP_FULL");
-        }
-    }
 }
 
 
Index: config/rs6000/rs6000.c
===================================================================
--- config/rs6000/rs6000.c	(revision 164917)
+++ config/rs6000/rs6000.c	(working copy)
@@ -57,6 +57,8 @@
 #include "intl.h"
 #include "params.h"
 #include "tm-constrs.h"
+#include "cpplib.h"
+#include "cppbuiltin.h"
 #if TARGET_XCOFF
 #include "xcoffout.h"  /* get declarations of xcoff_*_section_name */
 #endif
@@ -27164,4 +27166,122 @@ rs6000_expand_convert_si_to_sfdf (rtx de
     }
 }
 
+
+void
+rs6000_cpu_cpp_builtins (cpp_reader *pfile)
+{
+  if (TARGET_POWER2)
+    builtin_define ("_ARCH_PWR2");
+  else if (TARGET_POWER)
+    builtin_define ("_ARCH_PWR");
+  if (TARGET_POWERPC)
+    builtin_define ("_ARCH_PPC");
+  if (TARGET_PPC_GPOPT)
+    builtin_define ("_ARCH_PPCSQ");
+  if (TARGET_PPC_GFXOPT)
+    builtin_define ("_ARCH_PPCGR");
+  if (TARGET_POWERPC64)
+    builtin_define ("_ARCH_PPC64");
+  if (TARGET_MFCRF)
+    builtin_define ("_ARCH_PWR4");
+  if (TARGET_POPCNTB)
+    builtin_define ("_ARCH_PWR5");
+  if (TARGET_FPRND)
+    builtin_define ("_ARCH_PWR5X");
+  if (TARGET_CMPB)
+    builtin_define ("_ARCH_PWR6");
+  if (TARGET_MFPGPR)
+    builtin_define ("_ARCH_PWR6X");
+  if (! TARGET_POWER && ! TARGET_POWER2 && ! TARGET_POWERPC)
+    builtin_define ("_ARCH_COM");
+  if (TARGET_POPCNTD)
+    builtin_define ("_ARCH_PWR7");
+  if (TARGET_ALTIVEC)
+    {
+      builtin_define ("__ALTIVEC__");
+      builtin_define ("__VEC__=10206");
+    }
+  if (rs6000_cpu == PROCESSOR_CELL)
+    builtin_define ("__PPU__");
+  if (TARGET_SPE)
+    builtin_define ("__SPE__");
+  if (TARGET_PAIRED_FLOAT)
+    builtin_define ("__PAIRED__");
+  if (TARGET_SOFT_FLOAT)
+    builtin_define ("_SOFT_FLOAT");
+  if ((!(TARGET_HARD_FLOAT && (TARGET_FPRS || TARGET_E500_DOUBLE)))
+      ||(TARGET_HARD_FLOAT && TARGET_FPRS && !TARGET_DOUBLE_FLOAT))
+    builtin_define ("_SOFT_DOUBLE");
+  /* Used by lwarx/stwcx. errata work-around.  */
+  if (rs6000_cpu == PROCESSOR_PPC405)
+    builtin_define ("__PPC405__");
+  /* Used by libstdc++.  */
+  if (TARGET_NO_LWSYNC)
+    builtin_define ("__NO_LWSYNC__");
+  if (TARGET_VSX)
+    builtin_define ("__VSX__");
+  if (RS6000_RECIP_HAVE_RE_P (DFmode))
+    builtin_define ("__RECIP__");
+  if (RS6000_RECIP_HAVE_RE_P (SFmode))
+    builtin_define ("__RECIPF__");
+  if (RS6000_RECIP_HAVE_RSQRTE_P (DFmode))
+    builtin_define ("__RSQRTE__");
+  if (RS6000_RECIP_HAVE_RSQRTE_P (SFmode))
+    builtin_define ("__RSQRTEF__");
+  if (TARGET_RECIP_PRECISION)
+    builtin_define ("__RECIP_PRECISION__");
+
+  /* Tell users they can use __builtin_bswap{16,64}.  */
+  builtin_define ("__HAVE_BSWAP__");
+
+  /* May be overridden by target configuration.  */
+  RS6000_CPU_CPP_ENDIAN_BUILTINS();
+
+  if (TARGET_LONG_DOUBLE_128)
+    {
+      builtin_define ("__LONG_DOUBLE_128__");
+      builtin_define ("__LONGDOUBLE128");
+    }
+
+  switch (rs6000_current_abi)
+    {
+    case ABI_V4:
+      builtin_define ("_CALL_SYSV");
+      break;
+    case ABI_AIX:
+      builtin_define ("_CALL_AIXDESC");
+      builtin_define ("_CALL_AIX");
+      break;
+    case ABI_DARWIN:
+      builtin_define ("_CALL_DARWIN");
+      break;
+    default:
+      break;
+    }
+
+  /* Let the compiled code know if 'f' class registers will not be available.  */
+  if (TARGET_SOFT_FLOAT || !TARGET_FPRS)
+    builtin_define ("__NO_FPRS__");
+
+  /* Generate defines for Xilinx FPU. */
+  if (rs6000_xilinx_fpu) 
+    {
+      builtin_define ("_XFPU");
+      if (rs6000_single_float && ! rs6000_double_float)
+	{
+	  if (rs6000_simple_fpu) 
+	    builtin_define ("_XFPU_SP_LITE"); 
+	  else 
+	    builtin_define ("_XFPU_SP_FULL");
+	}
+      if (rs6000_double_float)
+	{
+	  if (rs6000_simple_fpu) 
+	    builtin_define ("_XFPU_DP_LITE");
+	  else
+	    builtin_define ("_XFPU_DP_FULL");
+        }
+    }
+}
+
 #include "gt-rs6000.h"
Index: config/rs6000/rs6000.h
===================================================================
--- config/rs6000/rs6000.h	(revision 164917)
+++ config/rs6000/rs6000.h	(working copy)
@@ -637,6 +637,8 @@ extern unsigned char rs6000_recip_bits[]
 /* Target #defines.  */
 #define TARGET_CPU_CPP_BUILTINS() \
   rs6000_cpu_cpp_builtins (pfile)
+#define TARGET_CPU_CPP_BUILTINS_CFAMILY() \
+  rs6000_cpu_cpp_builtins_cfamily (pfile)
 
 /* This is used by rs6000_cpu_cpp_builtins to indicate the byte order
    we're compiling for.  Some configurations may need to override it.  */
Index: config.gcc
===================================================================
--- config.gcc	(revision 164917)
+++ config.gcc	(working copy)
@@ -291,8 +291,6 @@ arm*-*-*)
 	;;
 avr-*-*)
 	cpu_type=avr
-	c_target_objs="avr-c.o"
-	cxx_target_objs="avr-c.o"
 	;;
 bfin*-*)
 	cpu_type=bfin
