[Midnightbsd-cvs] src: contrib/gcc4: add the local patches from freebsd (for the most part

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sun Mar 29 15:46:28 EDT 2009


Log Message:
-----------
add the local patches from freebsd (for the most part until we can get around to cleaning this up

Modified Files:
--------------
    src/contrib/gcc4:
        c-decl.c (r1.1.1.1 -> r1.2)
        c-format.c (r1.1.1.1 -> r1.2)
        c-format.h (r1.1.1.1 -> r1.2)
        c-opts.c (r1.1.1.1 -> r1.2)
        c.opt (r1.1.1.1 -> r1.2)
        fold-const.c (r1.1.1.1 -> r1.2)
        function.c (r1.1.1.1 -> r1.2)
        gcc.c (r1.1.1.1 -> r1.2)
        gthr-posix.h (r1.1.1.1 -> r1.2)
        opts.c (r1.1.1.1 -> r1.2)
        toplev.c (r1.1.1.1 -> r1.2)
        version.c (r1.1.1.1 -> r1.2)
    src/contrib/gcc4/config:
        freebsd-spec.h (r1.1.1.1 -> r1.2)
        freebsd.h (r1.1.1.1 -> r1.2)
    src/contrib/gcc4/config/arm:
        freebsd.h (r1.1.1.1 -> r1.2)
    src/contrib/gcc4/config/i386:
        freebsd.h (r1.1.1.1 -> r1.2)
        freebsd64.h (r1.1.1.1 -> r1.2)
        i386.c (r1.1.1.1 -> r1.2)
        i386.h (r1.1.1.1 -> r1.2)
        x86-64.h (r1.1.1.1 -> r1.2)
    src/contrib/gcc4/config/rs6000:
        freebsd.h (r1.1.1.1 -> r1.2)
    src/contrib/gcc4/config/sparc:
        freebsd.h (r1.1.1.1 -> r1.2)
    src/contrib/gcc4/cp:
        ptree.c (r1.1.1.1 -> r1.2)

-------------- next part --------------
Index: fold-const.c
===================================================================
RCS file: /home/cvs/src/contrib/gcc4/fold-const.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L contrib/gcc4/fold-const.c -L contrib/gcc4/fold-const.c -u -r1.1.1.1 -r1.2
--- contrib/gcc4/fold-const.c
+++ contrib/gcc4/fold-const.c
@@ -5661,6 +5661,9 @@
             }
           break;
         }
+      /* If the constant is negative, we cannot simplify this.  */
+      if (tree_int_cst_sgn (c) == -1)
+	break;
       /* FALLTHROUGH */
     case NEGATE_EXPR:
       if ((t1 = extract_muldiv (op0, c, code, wide_type, strict_overflow_p))
Index: c-format.h
===================================================================
RCS file: /home/cvs/src/contrib/gcc4/c-format.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L contrib/gcc4/c-format.h -L contrib/gcc4/c-format.h -u -r1.1.1.1 -r1.2
--- contrib/gcc4/c-format.h
+++ contrib/gcc4/c-format.h
@@ -74,11 +74,12 @@
   FMT_FLAG_EMPTY_PREC_OK = 64,
   /* Gaps are allowed in the arguments with $ operand numbers if all
      arguments are pointers (scanf).  */
-  FMT_FLAG_DOLLAR_GAP_POINTER_OK = 128
+  FMT_FLAG_DOLLAR_GAP_POINTER_OK = 128,
   /* Not included here: details of whether width or precision may occur
      (controlled by width_char and precision_char); details of whether
      '*' can be used for these (width_type and precision_type); details
      of whether length modifiers can occur (length_char_specs).  */
+  FMT_FLAG_NULL_FORMAT_OK = 256
 };
 
 
Index: opts.c
===================================================================
RCS file: /home/cvs/src/contrib/gcc4/opts.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L contrib/gcc4/opts.c -L contrib/gcc4/opts.c -u -r1.1.1.1 -r1.2
--- contrib/gcc4/opts.c
+++ contrib/gcc4/opts.c
@@ -20,6 +20,8 @@
 Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
 02110-1301, USA.  */
 
+/* $FreeBSD: src/contrib/gcc/opts.c,v 1.5 2007/10/03 01:26:24 obrien Exp $ */
+
 #include "config.h"
 #include "system.h"
 #include "intl.h"
@@ -499,7 +501,10 @@
       flag_reorder_functions = 1;
       flag_tree_store_ccp = 1;
       flag_tree_store_copy_prop = 1;
-      flag_tree_vrp = 1;
+      /* XXX: some issues with ports have been traced to -ftree-vrp.
+         So remove it from -O2 and above.  Note that jdk1{5,6} are affected
+         and they build with w/-O3 - so we cannot just move it to -O3. */
+      // flag_tree_vrp = 1;
 
       if (!optimize_size)
 	{
@@ -515,7 +520,7 @@
       flag_gcse_after_reload = 1;
     }
 
-  if (optimize < 2 || optimize_size)
+  if (optimize_size)
     {
       align_loops = 1;
       align_jumps = 1;
Index: gthr-posix.h
===================================================================
RCS file: /home/cvs/src/contrib/gcc4/gthr-posix.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L contrib/gcc4/gthr-posix.h -L contrib/gcc4/gthr-posix.h -u -r1.1.1.1 -r1.2
--- contrib/gcc4/gthr-posix.h
+++ contrib/gcc4/gthr-posix.h
@@ -152,9 +152,12 @@
    it is passed so we cannot pretend that the interface is active if -pthreads
    is not specified.  On Solaris 2.5.1, the interface is not exposed at all so
    we need to play the usual game with weak symbols.  On Solaris 10 and up, a
-   working interface is always exposed.  */
+   working interface is always exposed.  On FreeBSD 6 and later, libc also
+   exposes a dummy POSIX threads interface, similar to what Solaris 2.6 up
+   to 9 does.  FreeBSD >= 700014 even provides a pthread_cancel stub in libc,
+   which means the alternate __gthread_active_p below cannot be used there.  */
 
-#if defined(__sun) && defined(__svr4__)
+#if defined(__FreeBSD__) || (defined(__sun) && defined(__svr4__))
 
 static volatile int __gthread_active = -1;
 
@@ -197,7 +200,7 @@
   return __gthread_active_latest_value != 0;
 }
 
-#else /* not Solaris */
+#else /* neither FreeBSD nor Solaris */
 
 static inline int
 __gthread_active_p (void)
@@ -207,7 +210,7 @@
   return __gthread_active_ptr != 0;
 }
 
-#endif /* Solaris */
+#endif /* FreeBSD or Solaris */
 
 #else /* not SUPPORTS_WEAK */
 
Index: function.c
===================================================================
RCS file: /home/cvs/src/contrib/gcc4/function.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L contrib/gcc4/function.c -L contrib/gcc4/function.c -u -r1.1.1.1 -r1.2
--- contrib/gcc4/function.c
+++ contrib/gcc4/function.c
@@ -20,6 +20,8 @@
 Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
 02110-1301, USA.  */
 
+/* $FreeBSD: src/contrib/gcc/function.c,v 1.25 2007/08/14 03:04:42 kan Exp $ */
+
 /* This file handles the generation of rtl code from tree structure
    at the level of the function as a whole.
    It creates the rtl expressions for parameters and auto variables
@@ -4373,6 +4375,21 @@
   /* Output the label for the actual return from the function.  */
   emit_label (return_label);
 
+#ifdef TARGET_PROFILER_EPILOGUE
+  if (current_function_profile && TARGET_PROFILER_EPILOGUE)
+    {
+      static rtx mexitcount_libfunc;
+      static int initialized;
+
+      if (!initialized)
+	{
+	  mexitcount_libfunc = init_one_libfunc (".mexitcount");
+	  initialized = 0;
+	}
+      emit_library_call (mexitcount_libfunc, LCT_NORMAL, VOIDmode, 0);
+    }
+#endif
+
   if (USING_SJLJ_EXCEPTIONS)
     {
       /* Let except.c know where it should emit the call to unregister
Index: c.opt
===================================================================
RCS file: /home/cvs/src/contrib/gcc4/c.opt,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L contrib/gcc4/c.opt -L contrib/gcc4/c.opt -u -r1.1.1.1 -r1.2
--- contrib/gcc4/c.opt
+++ contrib/gcc4/c.opt
@@ -20,6 +20,7 @@
 
 ; See the GCC internals manual for a description of this file's format.
 
+; $FreeBSD: src/contrib/gcc/c.opt,v 1.4 2007/05/19 02:12:19 kan Exp $
 ; Please try to keep this file in ASCII collating order.
 
 Language
Index: gcc.c
===================================================================
RCS file: /home/cvs/src/contrib/gcc4/gcc.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L contrib/gcc4/gcc.c -L contrib/gcc4/gcc.c -u -r1.1.1.1 -r1.2
--- contrib/gcc4/gcc.c
+++ contrib/gcc4/gcc.c
@@ -23,6 +23,8 @@
 This paragraph is here to try to keep Sun CC from dying.
 The number of chars here seems crucial!!!!  */
 
+/* $FreeBSD: src/contrib/gcc/gcc.c,v 1.43 2007/05/28 23:02:56 kan Exp $ */
+
 /* This program is the user interface to the C compiler and possibly to
 other compilers.  It is used because compilation is a complicated procedure
 which involves running several programs and passing temporary files between
@@ -697,6 +699,7 @@
    scripts which exist in user specified directories, or in standard
    directories.  */
 #ifndef LINK_COMMAND_SPEC
+#ifndef FREEBSD_NATIVE
 #define LINK_COMMAND_SPEC "\
 %{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:\
     %(linker) %l " LINK_PIE_SPEC "%X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} %{r}\
@@ -706,6 +709,17 @@
     %{fprofile-arcs|fprofile-generate|coverage:-lgcov}\
     %{!nostdlib:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}\
     %{!A:%{!nostdlib:%{!nostartfiles:%E}}} %{T*} }}}}}}"
+#else
+#define LINK_COMMAND_SPEC "\
+%{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:\
+    %(linker) %l " LINK_PIE_SPEC "%X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} %{r}\
+    %{s} %{t} %{u*} %{x} %{z} %{Z} %{!A:%{!nostdlib:%{!nostartfiles:%S}}}\
+    %{static:} %{L*} %(mfwrap) %(link_libgcc) %o\
+    %{fopenmp: -lgomp} %(mflib)\
+    %{fprofile-arcs|fprofile-generate|coverage:-lgcov}\
+    %{!nostdlib:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}\
+    %{!A:%{!nostdlib:%{!nostartfiles:%E}}} %{T*} }}}}}}"
+#endif
 #endif
 
 #ifndef LINK_LIBGCC_SPEC
@@ -1488,7 +1502,9 @@
 static const char *const tooldir_base_prefix = TOOLDIR_BASE_PREFIX;
 static const char *tooldir_prefix;
 
+#ifndef FREEBSD_NATIVE
 static const char *const standard_bindir_prefix = STANDARD_BINDIR_PREFIX;
+#endif	/* not FREEBSD_NATIVE */
 
 static const char *standard_libexec_prefix = STANDARD_LIBEXEC_PREFIX;
 
@@ -1619,7 +1635,8 @@
 {
   char *buf;
 
-  buf = concat ("%{static|static-libgcc:", static_name, " ", eh_name, "}"
+  buf = concat ("%{pg:",  static_name, " ", eh_name, "} %{!pg:",
+		"%{static|static-libgcc|pg:", static_name, " ", eh_name, "}"
 		"%{!static:%{!static-libgcc:"
 #if USE_LD_AS_NEEDED
 		"%{!shared-libgcc:",
@@ -1642,7 +1659,7 @@
 		"%{shared:", shared_name, "}"
 #endif
 #endif
-		"}}", NULL);
+		"}}}", NULL);
 
   obstack_grow (obstack, buf, strlen (buf));
   free (buf);
@@ -1735,8 +1752,13 @@
 			    " -lunwind"
 #endif
 			    ,
+#ifdef FREEBSD_NATIVE
+			    LIBGCC_STATIC_LIB_SPEC,
+			    LIBGCC_EH_STATIC_LIB_SPEC
+#else
 			    "-lgcc",
 			    "-lgcc_eh"
+#endif
 #ifdef USE_LIBUNWIND_EXCEPTIONS
 # ifdef HAVE_LD_STATIC_DYNAMIC
 			    " %{!static:-Bstatic} -lunwind %{!static:-Bdynamic}"
@@ -3361,6 +3383,7 @@
      see if we can create it from the pathname specified in argv[0].  */
 
   gcc_libexec_prefix = standard_libexec_prefix;
+#ifndef FREEBSD_NATIVE
 #ifndef VMS
   /* FIXME: make_relative_prefix doesn't yet work for VMS.  */
   if (!gcc_exec_prefix)
@@ -3387,6 +3410,7 @@
     }
 #else
 #endif
+#endif	/* not FREEBSD_NATIVE */
 
   if (gcc_exec_prefix)
     {
@@ -3512,6 +3536,44 @@
 	}
     }
 
+  /* Options specified as if they appeared on the command line.  */
+  temp = getenv ("GCC_OPTIONS");
+  if ((temp) && (strlen (temp) > 0))
+    {
+      int len;
+      int optc = 1;
+      int new_argc;
+      const char **new_argv;
+      char *envopts;
+
+      while (isspace (*temp))
+	temp++;
+      len = strlen (temp);
+      envopts = (char *) xmalloc (len + 1);
+      strcpy (envopts, temp);
+
+      for (i = 0; i < (len - 1); i++)
+	if ((isspace (envopts[i])) && ! (isspace (envopts[i+1])))
+	  optc++;
+
+      new_argv = (const char **) alloca ((optc + argc) * sizeof(char *));
+
+      for (i = 0, new_argc = 1; new_argc <= optc; new_argc++)
+	{
+	  while (isspace (envopts[i]))
+	    i++;
+	  new_argv[new_argc] = envopts + i;
+	  while (!isspace (envopts[i]) && (envopts[i] != '\0'))
+	    i++;
+	  envopts[i++] = '\0';
+	}
+      for (i = 1; i < argc; i++)
+	new_argv[new_argc++] = argv[i];
+
+      argv = new_argv;
+      argc = new_argc;
+    }
+
   /* Convert new-style -- options to old-style.  */
   translate_options (&argc, (const char *const **) &argv);
 
@@ -3937,6 +3999,10 @@
     }
 
   /* Set up the search paths before we go looking for config files.  */
+#ifdef	FREEBSD_NATIVE
+  add_prefix (&exec_prefixes, PREFIX"/bin/", "BINUTILS",
+	      PREFIX_PRIORITY_LAST, 0, 0);
+#endif	/* FREEBSD_NATIVE */
 
   /* These come before the md prefixes so that we will find gcc's subcommands
      (such as cpp) rather than those of the host system.  */
@@ -3947,6 +4013,7 @@
 	      PREFIX_PRIORITY_LAST, 1, 0);
   add_prefix (&exec_prefixes, standard_libexec_prefix, "BINUTILS",
 	      PREFIX_PRIORITY_LAST, 2, 0);
+#ifndef	FREEBSD_NATIVE
   add_prefix (&exec_prefixes, standard_exec_prefix, "BINUTILS",
 	      PREFIX_PRIORITY_LAST, 2, 0);
   add_prefix (&exec_prefixes, standard_exec_prefix_1, "BINUTILS",
@@ -3954,7 +4021,9 @@
   add_prefix (&exec_prefixes, standard_exec_prefix_2, "BINUTILS",
 	      PREFIX_PRIORITY_LAST, 2, 0);
 #endif
+#endif
 
+#ifndef	FREEBSD_NATIVE
   add_prefix (&startfile_prefixes, standard_exec_prefix, "BINUTILS",
 	      PREFIX_PRIORITY_LAST, 1, 0);
   add_prefix (&startfile_prefixes, standard_exec_prefix_2, "BINUTILS",
@@ -4017,6 +4086,7 @@
 	}
     }
 #endif
+#endif /* FREEBSD_NATIVE */
 
   /* More prefixes are enabled in main, after we read the specs file
      and determine whether this is cross-compilation or not.  */
@@ -6003,6 +6073,7 @@
   *cp++ = '.';
   *cp = '\0';
 
+#ifndef FREEBSD_NATIVE
   /* Exclude directories that the linker is known to search.  */
   if (linker
       && IS_DIR_SEPARATOR (path[0])
@@ -6013,6 +6084,7 @@
 	      && IS_DIR_SEPARATOR (path[4])
 	      && strncmp (path + 5, "lib", 3) == 0)))
     return 0;
+#endif /* FREEBSD_NATIVE */
 
   return (stat (path, &st) >= 0 && S_ISDIR (st.st_mode));
 }
@@ -6201,9 +6273,14 @@
 
   /* Read specs from a file if there is one.  */
 
+#ifdef FREEBSD_NATIVE
+  machine_suffix = "";
+  just_machine_suffix = "";
+#else	/* FREEBSD_NATIVE */
   machine_suffix = concat (spec_machine, dir_separator_str,
 			   spec_version, dir_separator_str, NULL);
   just_machine_suffix = concat (spec_machine, dir_separator_str, NULL);
+#endif /* FREEBSD_NATIVE */
 
   specs_file = find_a_file (&startfile_prefixes, "specs", R_OK, true);
   /* Read the specs file unless it is a default one.  */
@@ -6214,10 +6291,11 @@
 
   /* We need to check standard_exec_prefix/just_machine_suffix/specs
      for any override of as, ld and libraries.  */
-  specs_file = alloca (strlen (standard_exec_prefix)
-		       + strlen (just_machine_suffix) + sizeof ("specs"));
+  specs_file = (char *) alloca (strlen (FBSD_DATA_PREFIX)
+				+ strlen (just_machine_suffix)
+				+ sizeof ("specs"));
 
-  strcpy (specs_file, standard_exec_prefix);
+  strcpy (specs_file, FBSD_DATA_PREFIX);
   strcat (specs_file, just_machine_suffix);
   strcat (specs_file, "specs");
   if (access (specs_file, R_OK) == 0)
@@ -6326,6 +6404,7 @@
 		      NULL, PREFIX_PRIORITY_LAST, 0, 1);
 	}
 
+#ifndef FREEBSD_NATIVE
       if (*standard_startfile_prefix_1)
  	add_sysrooted_prefix (&startfile_prefixes,
 			      standard_startfile_prefix_1, "BINUTILS",
@@ -6334,6 +6413,7 @@
 	add_sysrooted_prefix (&startfile_prefixes,
 			      standard_startfile_prefix_2, "BINUTILS",
 			      PREFIX_PRIORITY_LAST, 0, 1);
+#endif
     }
 
   /* Process any user specified specs in the order given on the command
@@ -6369,7 +6449,11 @@
 
   if (print_search_dirs)
     {
+#ifndef	FREEBSD_NATIVE
       printf (_("install: %s%s\n"), standard_exec_prefix, machine_suffix);
+#else
+      printf (_("install: %s\n"), standard_exec_prefix);
+#endif
       printf (_("programs: %s\n"),
 	      build_search_list (&exec_prefixes, "", false, false));
       printf (_("libraries: %s\n"),
@@ -6482,7 +6566,7 @@
     }
 
   if (n_infiles == added_libraries)
-    fatal ("no input files");
+    fatal ("No input files specified");
 
   /* Make a place to record the compiler output file names
      that correspond to the input files.  */
Index: c-decl.c
===================================================================
RCS file: /home/cvs/src/contrib/gcc4/c-decl.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L contrib/gcc4/c-decl.c -L contrib/gcc4/c-decl.c -u -r1.1.1.1 -r1.2
--- contrib/gcc4/c-decl.c
+++ contrib/gcc4/c-decl.c
@@ -19,6 +19,8 @@
 Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
 02110-1301, USA.  */
 
+/* $FreeBSD: src/contrib/gcc/c-decl.c,v 1.15 2007/05/19 02:12:19 kan Exp $ */
+
 /* Process declarations and symbol lookup for C front end.
    Also constructs types; the standard scalar types at initialization,
    and structure, union, array and enum types when they are declared.  */
Index: c-format.c
===================================================================
RCS file: /home/cvs/src/contrib/gcc4/c-format.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L contrib/gcc4/c-format.c -L contrib/gcc4/c-format.c -u -r1.1.1.1 -r1.2
--- contrib/gcc4/c-format.c
+++ contrib/gcc4/c-format.c
@@ -19,6 +19,8 @@
 Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
 02110-1301, USA.  */
 
+/* $FreeBSD: src/contrib/gcc/c-format.c,v 1.11 2007/05/19 02:16:45 kan Exp $ */
+
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
@@ -183,7 +185,7 @@
   if (TREE_CODE (format_type_id) != IDENTIFIER_NODE)
     {
       gcc_assert (!validated_p);
-      error ("unrecognized format specifier");
+      error ("%Junrecognized format specifier", lang_hooks.decls.getdecls ());
       return false;
     }
   else
@@ -513,6 +515,26 @@
   { NULL,  0, 0, NOLENGTHS, NULL, NULL, NULL }
 };
 
+static const format_char_info fbsd_ext_char_info =
+{ NULL,   1, STD_EXT, { T89_C,  BADLEN,   BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN  }, "",      "cR", NULL };
+
+static const format_char_info fbsd_print_char_table[] =
+{
+  /* BSD conversion specifiers.  */
+  /* FreeBSD kernel extensions (src/sys/kern/subr_prf.c).
+     The format %b is supported to decode error registers.
+     Its usage is:	printf("reg=%b\n", regval, "<base><arg>*");
+     which produces:	reg=3<BITTWO,BITONE>
+     The format %D provides a hexdump given a pointer and separator string:
+     ("%6D", ptr, ":")		-> XX:XX:XX:XX:XX:XX
+     ("%*D", len, ptr, " ")	-> XX XX XX XX ...
+   */
+  { "D",   1, STD_EXT, { T89_V,  BADLEN,   BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN }, "-wp",      "cR", &fbsd_ext_char_info },
+  { "b",   0, STD_EXT, { T89_I,  BADLEN,   BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN  }, "-wp",      "",   &fbsd_ext_char_info },
+  { "ry",  0, STD_EXT, { T89_I,  BADLEN,   BADLEN,   T89_L,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN  }, "-wp0 +#",  "i",  NULL  },
+  { NULL,  0, 0, NOLENGTHS, NULL, NULL }
+};
+
 static const format_char_info asm_fprintf_char_table[] =
 {
   /* C89 conversion specifiers.  */
@@ -759,6 +781,12 @@
     strfmon_flag_specs, strfmon_flag_pairs,
     FMT_FLAG_ARG_CONVERT, 'w', '#', 'p', 0, 'L',
     NULL, NULL
+  },
+  { "printf0",   printf_length_specs,  print_char_table, " +#0-'I", NULL, 
+    printf_flag_specs, printf_flag_pairs,
+    FMT_FLAG_ARG_CONVERT|FMT_FLAG_DOLLAR_MULTIPLE|FMT_FLAG_USE_DOLLAR|FMT_FLAG_EMPTY_PREC_OK|FMT_FLAG_NULL_FORMAT_OK,
+    'w', 0, 'p', 0, 'L',
+    &integer_type_node, &integer_type_node
   }
 };
 
@@ -1283,6 +1311,15 @@
 
   if (integer_zerop (format_tree))
     {
+      /* FIXME: this warning should go away once Marc Espie's
+	 __attribute__((nonnull)) patch is in.  Instead, checking for
+	 nonnull attributes should probably change this function to act
+	 specially if info == NULL and add a res->number_null entry for
+	 that case, or maybe add a function pointer to be called at
+	 the end instead of hardcoding check_format_info_main.  */
+      if (!(format_types[info->format_type].flags & FMT_FLAG_NULL_FORMAT_OK))
+	warning (OPT_Wformat, "null format string");
+
       /* Skip to first argument to check, so we can see if this format
 	 has any arguments (it shouldn't).  */
       while (arg_num + 1 < info->first_arg_num)
@@ -1735,6 +1772,14 @@
 	{
 	  while (fli->name != 0 && fli->name[0] != *format_chars)
 	    fli++;
+	  /*
+	   * Make sure FreeBSD's D format char takes preference
+	   * over new DD length specifier if FreeBSD format
+	   * extensions are requested.
+	   */
+	  if (fli->index == FMT_LEN_D && flag_format_extensions
+	    && fki->conversion_specs == print_char_table)
+	  	while (fli->name != 0) fli++;
 	  if (fli->name != 0)
 	    {
 	      format_chars++;
@@ -1818,6 +1863,14 @@
       while (fci->format_chars != 0
 	     && strchr (fci->format_chars, format_char) == 0)
 	  ++fci;
+      if (fci->format_chars == 0 && flag_format_extensions
+	  && fki->conversion_specs == print_char_table)
+	{
+	  fci = fbsd_print_char_table;
+	  while (fci->format_chars != 0
+	         && strchr (fci->format_chars, format_char) == 0)
+	     ++fci;
+	}
       if (fci->format_chars == 0)
 	{
 	  if (ISGRAPH (format_char))
@@ -1935,7 +1988,7 @@
 	    y2k_level = 2;
 	  if (y2k_level == 3)
 	    warning (OPT_Wformat_y2k, "%<%%%c%> yields only last 2 digits of "
-		     "year in some locales", format_char);
+		     "year in some locales on non-BSD systems", format_char);
 	  else if (y2k_level == 2)
 	    warning (OPT_Wformat_y2k, "%<%%%c%> yields only last 2 digits of "
 		     "year", format_char);
Index: version.c
===================================================================
RCS file: /home/cvs/src/contrib/gcc4/version.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L contrib/gcc4/version.c -L contrib/gcc4/version.c -u -r1.1.1.1 -r1.2
--- contrib/gcc4/version.c
+++ contrib/gcc4/version.c
@@ -1,3 +1,4 @@
+/* $FreeBSD: src/contrib/gcc/version.c,v 1.16 2007/08/14 03:04:42 kan Exp $ */
 #include "version.h"
 
 /* This is the trailing component of the string reported as the
@@ -8,7 +9,7 @@
    in parentheses.  You may also wish to include a number indicating
    the revision of your modified compiler.  */
 
-#define VERSUFFIX ""
+#define VERSUFFIX " [FreeBSD]"
 
 /* This is the location of the online document giving instructions for
    reporting bugs.  If you distribute a modified version of GCC,
Index: toplev.c
===================================================================
RCS file: /home/cvs/src/contrib/gcc4/toplev.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L contrib/gcc4/toplev.c -L contrib/gcc4/toplev.c -u -r1.1.1.1 -r1.2
--- contrib/gcc4/toplev.c
+++ contrib/gcc4/toplev.c
@@ -20,6 +20,8 @@
 Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
 02110-1301, USA.  */
 
+/* $FreeBSD: src/contrib/gcc/toplev.c,v 1.27 2007/05/19 02:12:19 kan Exp $ */
+
 /* This is the top level of cc1/c++.
    It parses command args, opens files, invokes the various passes
    in the proper order, and counts the time used by each.
Index: c-opts.c
===================================================================
RCS file: /home/cvs/src/contrib/gcc4/c-opts.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L contrib/gcc4/c-opts.c -L contrib/gcc4/c-opts.c -u -r1.1.1.1 -r1.2
--- contrib/gcc4/c-opts.c
+++ contrib/gcc4/c-opts.c
@@ -20,6 +20,8 @@
 Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
 02110-1301, USA.  */
 
+/* $FreeBSD: src/contrib/gcc/c-opts.c,v 1.4 2007/05/19 02:12:19 kan Exp $ */
+
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
Index: i386.c
===================================================================
RCS file: /home/cvs/src/contrib/gcc4/config/i386/i386.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L contrib/gcc4/config/i386/i386.c -L contrib/gcc4/config/i386/i386.c -u -r1.1.1.1 -r1.2
--- contrib/gcc4/config/i386/i386.c
+++ contrib/gcc4/config/i386/i386.c
@@ -19,6 +19,8 @@
 the Free Software Foundation, 51 Franklin Street, Fifth Floor,
 Boston, MA 02110-1301, USA.  */
 
+/* $FreeBSD: src/contrib/gcc/config/i386/i386.c,v 1.25 2007/08/14 03:04:42 kan Exp $ */
+
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
@@ -13957,6 +13959,7 @@
 	return 128;
     }
   else if (!optimize_size && TREE_CODE (exp) == STRING_CST
+      	   && !TARGET_NO_ALIGN_LONG_STRINGS
 	   && TREE_STRING_LENGTH (exp) >= 31 && align < BITS_PER_WORD)
     return BITS_PER_WORD;
 
Index: freebsd64.h
===================================================================
RCS file: /home/cvs/src/contrib/gcc4/config/i386/freebsd64.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L contrib/gcc4/config/i386/freebsd64.h -L contrib/gcc4/config/i386/freebsd64.h -u -r1.1.1.1 -r1.2
--- contrib/gcc4/config/i386/freebsd64.h
+++ contrib/gcc4/config/i386/freebsd64.h
@@ -19,10 +19,23 @@
 the Free Software Foundation, 51 Franklin Street, Fifth Floor,
 Boston, MA 02110-1301, USA.  */
 
+/* $FreeBSD: src/contrib/gcc/config/i386/freebsd64.h,v 1.10 2007/05/19 02:30:20 kan Exp $ */
+
 
 #undef  TARGET_VERSION
 #define TARGET_VERSION fprintf (stderr, " (FreeBSD/x86-64 ELF)");
 
+#undef  FBSD_TARGET_CPU_CPP_BUILTINS
+#define FBSD_TARGET_CPU_CPP_BUILTINS()		\
+  do						\
+    {						\
+      if (TARGET_64BIT)				\
+	{					\
+	  builtin_define ("__LP64__");		\
+	}					\
+    }						\
+  while (0)
+
 #define SUBTARGET_EXTRA_SPECS \
   { "fbsd_dynamic_linker", FBSD_DYNAMIC_LINKER }
 
Index: freebsd.h
===================================================================
RCS file: /home/cvs/src/contrib/gcc4/config/i386/freebsd.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L contrib/gcc4/config/i386/freebsd.h -L contrib/gcc4/config/i386/freebsd.h -u -r1.1.1.1 -r1.2
--- contrib/gcc4/config/i386/freebsd.h
+++ contrib/gcc4/config/i386/freebsd.h
@@ -22,95 +22,145 @@
 the Free Software Foundation, 51 Franklin Street, Fifth Floor,
 Boston, MA 02110-1301, USA.  */
 
+/* $FreeBSD: src/contrib/gcc/config/i386/freebsd.h,v 1.73 2007/05/19 02:30:20 kan Exp $ */
 
-#define TARGET_VERSION fprintf (stderr, " (i386 FreeBSD/ELF)");
+#undef  CC1_SPEC
+#define CC1_SPEC "%(cc1_cpu) %{profile:-p}"
 
-/* Override the default comment-starter of "/".  */
-#undef  ASM_COMMENT_START
-#define ASM_COMMENT_START "#"
+/* Provide a LINK_SPEC appropriate for FreeBSD.  Here we provide support
+   for the special GCC options -static and -shared, which allow us to
+   link things in one of these three modes by applying the appropriate
+   combinations of options at link-time. We like to support here for
+   as many of the other GNU linker options as possible. But I don't
+   have the time to search for those flags. I am sure how to add
+   support for -soname shared_object_name. H.J.
 
-#undef  ASM_APP_ON
-#define ASM_APP_ON "#APP\n"
+   When the -shared link option is used a final link is not being
+   done.  */
 
-#undef  ASM_APP_OFF
-#define ASM_APP_OFF "#NO_APP\n"
+#undef	LINK_SPEC
+#define LINK_SPEC "\
+ %{p:%nconsider using `-pg' instead of `-p' with gprof(1) } \
+    %{v:-V} \
+    %{assert*} %{R*} %{rpath*} %{defsym*} \
+    %{shared:-Bshareable %{h*} %{soname*}} \
+    %{!shared: \
+      %{!static: \
+	%{rdynamic: -export-dynamic} \
+	%{!dynamic-linker:-dynamic-linker %(fbsd_dynamic_linker) }} \
+      %{static:-Bstatic}} \
+    %{symbolic:-Bsymbolic}"
 
-#undef  DBX_REGISTER_NUMBER
-#define DBX_REGISTER_NUMBER(n) \
-  (TARGET_64BIT ? dbx64_register_map[n] : svr4_dbx_register_map[n])
+/* Reset our STARTFILE_SPEC which was properly set in config/freebsd.h
+   but trashed by config/<cpu>/<file.h>. */
 
-#undef  NO_PROFILE_COUNTERS
-#define NO_PROFILE_COUNTERS	1
+#undef STARTFILE_SPEC
+#define STARTFILE_SPEC FBSD_STARTFILE_SPEC
 
-/* Tell final.c that we don't need a label passed to mcount.  */
+/* Provide an ENDFILE_SPEC appropriate for FreeBSD/i386.  */
 
-#undef  MCOUNT_NAME
-#define MCOUNT_NAME ".mcount"
+#undef  ENDFILE_SPEC
+#define ENDFILE_SPEC FBSD_ENDFILE_SPEC
 
-/* Make gcc agree with <machine/ansi.h>.  */
+
+/************************[  Target stuff  ]***********************************/
+
+/* Define the actual types of some ANSI-mandated types.
+   Needs to agree with <machine/ansi.h>.  GCC defaults come from c-decl.c,
+   c-common.c, and config/<arch>/<arch>.h.  */
 
 #undef  SIZE_TYPE
 #define SIZE_TYPE	(TARGET_64BIT ? "long unsigned int" : "unsigned int")
- 
+
 #undef  PTRDIFF_TYPE
 #define PTRDIFF_TYPE	(TARGET_64BIT ? "long int" : "int")
-  
+
 #undef  WCHAR_TYPE_SIZE
 #define WCHAR_TYPE_SIZE	(TARGET_64BIT ? 32 : BITS_PER_WORD)
 
-#undef  SUBTARGET_EXTRA_SPECS	/* i386.h bogusly defines it.  */
+#undef  SUBTARGET_EXTRA_SPECS  /* i386.h bogusly defines it.  */
 #define SUBTARGET_EXTRA_SPECS \
   { "fbsd_dynamic_linker", FBSD_DYNAMIC_LINKER }
-    
-/* Provide a STARTFILE_SPEC appropriate for FreeBSD.  Here we add
-   the magical crtbegin.o file (see crtstuff.c) which provides part 
-	of the support for getting C++ file-scope static object constructed 
-	before entering `main'.  */
-   
-#undef	STARTFILE_SPEC
-#define STARTFILE_SPEC \
-  "%{!shared: \
-     %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} \
-		       %{!p:%{profile:gcrt1.o%s} \
-			 %{!profile:crt1.o%s}}}} \
-   crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
-
-/* Provide a ENDFILE_SPEC appropriate for FreeBSD.  Here we tack on
-   the magical crtend.o file (see crtstuff.c) which provides part of 
-	the support for getting C++ file-scope static object constructed 
-	before entering `main', followed by a normal "finalizer" file, 
-	`crtn.o'.  */
-
-#undef	ENDFILE_SPEC
-#define ENDFILE_SPEC \
-  "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s"
 
-/* Provide a LINK_SPEC appropriate for FreeBSD.  Here we provide support
-   for the special GCC options -static and -shared, which allow us to
-   link things in one of these three modes by applying the appropriate
-   combinations of options at link-time. We like to support here for
-   as many of the other GNU linker options as possible. But I don't
-   have the time to search for those flags. I am sure how to add
-   support for -soname shared_object_name. H.J.
+#define TARGET_VERSION	fprintf (stderr, " (i386 FreeBSD/ELF)");
 
-   I took out %{v:%{!V:-V}}. It is too much :-(. They can use
-   -Wl,-V.
+#define TARGET_ELF			1
 
-   When the -shared link option is used a final link is not being
-   done.  */
+/* This goes away when the math emulator is fixed.  */
+#undef  TARGET_SUBTARGET_DEFAULT
+#define TARGET_SUBTARGET_DEFAULT \
+  (MASK_80387 | MASK_IEEE_FP | MASK_FLOAT_RETURNS | MASK_NO_FANCY_MATH_387)
 
-#undef	LINK_SPEC
-#define LINK_SPEC "\
-  %{p:%nconsider using `-pg' instead of `-p' with gprof(1)} \
-  %{v:-V} \
-  %{assert*} %{R*} %{rpath*} %{defsym*} \
-  %{shared:-Bshareable %{h*} %{soname*}} \
-    %{!shared: \
-      %{!static: \
-        %{rdynamic:-export-dynamic} \
-        %{!dynamic-linker:-dynamic-linker %(fbsd_dynamic_linker) }} \
-    %{static:-Bstatic}} \
-  %{symbolic:-Bsymbolic}"
+/* Don't default to pcc-struct-return, we want to retain compatibility with
+   older gcc versions AND pcc-struct-return is nonreentrant.
+   (even though the SVR4 ABI for the i386 says that records and unions are
+   returned in memory).  */
+
+#undef  DEFAULT_PCC_STRUCT_RETURN
+#define DEFAULT_PCC_STRUCT_RETURN 0
+
+/* FreeBSD sets the rounding precision of the FPU to 53 bits.  Let the
+   compiler get the contents of <float.h> and std::numeric_limits correct.  */
+#undef TARGET_96_ROUND_53_LONG_DOUBLE
+#define TARGET_96_ROUND_53_LONG_DOUBLE (!TARGET_64BIT)
+
+/* Tell final.c that we don't need a label passed to mcount.  */
+#define NO_PROFILE_COUNTERS	1
+
+/* Output assembler code to FILE to begin profiling of the current function.
+   LABELNO is an optional label.  */
+
+#undef MCOUNT_NAME
+#define MCOUNT_NAME ".mcount"
+
+/* Output assembler code to FILE to end profiling of the current function.  */
+
+#undef  FUNCTION_PROFILER_EPILOGUE	/* BDE will need to fix this. */
+
+
+/************************[  Assembler stuff  ]********************************/
+
+/* Override the default comment-starter of "/" from unix.h.  */
+#undef  ASM_COMMENT_START
+#define ASM_COMMENT_START "#"
+
+/* Override the default comment-starter of "/APP" from unix.h.  */
+#undef  ASM_APP_ON
+#define ASM_APP_ON	"#APP\n"
+#undef  ASM_APP_OFF
+#define ASM_APP_OFF	"#NO_APP\n"
+
+/* XXX:DEO do we still need this override to defaults.h ?? */
+/* This is how to output a reference to a user-level label named NAME.  */
+#undef  ASM_OUTPUT_LABELREF
+#define ASM_OUTPUT_LABELREF(FILE, NAME)					\
+  do {									\
+    const char *xname = (NAME);						\
+    /* Hack to avoid writing lots of rtl in				\
+       FUNCTION_PROFILER_EPILOGUE ().  */				\
+    if (*xname == '.' && strcmp(xname + 1, "mexitcount") == 0)		\
+      {									\
+	if (flag_pic)							\
+	  fprintf ((FILE), "*%s at GOT(%%ebx)", xname);			\
+	else								\
+	  fprintf ((FILE), "%s", xname);				\
+      }									\
+    else 								\
+      {									\
+	  if (xname[0] == '%')						\
+	    xname += 2;							\
+	  if (xname[0] == '*')						\
+	    xname += 1;							\
+	  else								\
+	    fputs (user_label_prefix, FILE);				\
+	  fputs (xname, FILE);						\
+      }									\
+} while (0)
+
+/* This is how to hack on the symbol code of certain relcalcitrant
+   symbols to modify their output in output_pic_addr_const ().  */
+
+#undef  ASM_HACK_SYMBOLREF_CODE	/* BDE will need to fix this. */
 
 /* A C statement to output to the stdio stream FILE an assembler
    command to advance the location counter to a multiple of 1<<LOG
@@ -118,24 +168,79 @@
 
    This is used to align code labels according to Intel recommendations.  */
 
+/* XXX configuration of this is broken in the same way as HAVE_GAS_SHF_MERGE,
+   but it is easier to fix in an MD way.  */
+
 #ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
 #undef  ASM_OUTPUT_MAX_SKIP_ALIGN
-#define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE, LOG, MAX_SKIP)					\
-  if ((LOG) != 0) {														\
-    if ((MAX_SKIP) == 0) fprintf ((FILE), "\t.p2align %d\n", (LOG));	\
-    else fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP));	\
-  }
+#define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE, LOG, MAX_SKIP)			\
+  do {									\
+    if ((LOG) != 0) {							\
+      if ((MAX_SKIP) == 0)						\
+	fprintf ((FILE), "\t.p2align %d\n", (LOG));			\
+      else								\
+	fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP));	\
+    }									\
+  } while (0)
 #endif
 
-/* Don't default to pcc-struct-return, we want to retain compatibility with
-   older gcc versions AND pcc-struct-return is nonreentrant.
-   (even though the SVR4 ABI for the i386 says that records and unions are
-   returned in memory).  */
+/* If defined, a C expression whose value is a string containing the
+   assembler operation to identify the following data as
+   uninitialized global data.  If not defined, and neither
+   `ASM_OUTPUT_BSS' nor `ASM_OUTPUT_ALIGNED_BSS' are defined,
+   uninitialized global data will be output in the data section if
+   `-fno-common' is passed, otherwise `ASM_OUTPUT_COMMON' will be
+   used.  */
+#undef BSS_SECTION_ASM_OP
+#define BSS_SECTION_ASM_OP "\t.section\t.bss"
+
+/* Like `ASM_OUTPUT_BSS' except takes the required alignment as a
+   separate, explicit argument.  If you define this macro, it is used
+   in place of `ASM_OUTPUT_BSS', and gives you more flexibility in
+   handling the required alignment of the variable.  The alignment is
+   specified as the number of bits.
+
+   Try to use function `asm_output_aligned_bss' defined in file
+   `varasm.c' when defining this macro.  */
+#undef ASM_OUTPUT_ALIGNED_BSS
+#define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \
+  asm_output_aligned_bss (FILE, DECL, NAME, SIZE, ALIGN)
 
-#undef  DEFAULT_PCC_STRUCT_RETURN
-#define DEFAULT_PCC_STRUCT_RETURN 0
+/************************[  Debugger stuff  ]*********************************/
 
-/* FreeBSD sets the rounding precision of the FPU to 53 bits.  Let the
-   compiler get the contents of <float.h> and std::numeric_limits correct.  */
-#undef TARGET_96_ROUND_53_LONG_DOUBLE
-#define TARGET_96_ROUND_53_LONG_DOUBLE (!TARGET_64BIT)
+#undef  DBX_REGISTER_NUMBER
+#define DBX_REGISTER_NUMBER(n)	(TARGET_64BIT ? dbx64_register_map[n]	\
+				: (write_symbols == DWARF2_DEBUG)	\
+				  ? svr4_dbx_register_map[(n)]		\
+				  : dbx_register_map[(n)])
+
+/* The same functions are used to creating the DWARF2 debug info and C++
+   unwind info (except.c).  Regardless of the debug format requested, the
+   register numbers used in exception unwinding sections still have to be
+   DWARF compatible.  IMO the GCC folks may be abusing the DBX_REGISTER_NUMBER
+   macro to mean too much.  */
+#define DWARF_FRAME_REGNUM(n)	(TARGET_64BIT ? dbx64_register_map[n]	\
+				: svr4_dbx_register_map[(n)])
+
+/* stabs-in-elf has offsets relative to function beginning */
+#undef  DBX_OUTPUT_LBRAC
+#define DBX_OUTPUT_LBRAC(FILE, NAME)					\
+  do {									\
+    fprintf (asm_out_file, "%s %d,0,0,", ASM_STABN_OP, N_LBRAC);	\
+    assemble_name (asm_out_file, NAME);					\
+        fputc ('-', asm_out_file);					\
+        assemble_name (asm_out_file,					\
+	      	 XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0));	\
+    fprintf (asm_out_file, "\n");					\
+  } while (0)
+
+#undef  DBX_OUTPUT_RBRAC
+#define DBX_OUTPUT_RBRAC(FILE, NAME)					\
+  do {									\
+    fprintf (asm_out_file, "%s %d,0,0,", ASM_STABN_OP, N_RBRAC);	\
+    assemble_name (asm_out_file, NAME);					\
+        fputc ('-', asm_out_file);					\
+        assemble_name (asm_out_file,					\
+		 XSTR (XEXP (DECL_RTL (current_function_decl), 0), 0));	\
+    fprintf (asm_out_file, "\n");					\
+  } while (0)
Index: x86-64.h
===================================================================
RCS file: /home/cvs/src/contrib/gcc4/config/i386/x86-64.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L contrib/gcc4/config/i386/x86-64.h -L contrib/gcc4/config/i386/x86-64.h -u -r1.1.1.1 -r1.2
--- contrib/gcc4/config/i386/x86-64.h
+++ contrib/gcc4/config/i386/x86-64.h
@@ -19,6 +19,8 @@
 the Free Software Foundation, 51 Franklin Street, Fifth Floor,
 Boston, MA 02110-1301, USA.  */
 
+/* $FreeBSD: src/contrib/gcc/config/i386/x86-64.h,v 1.5 2007/05/19 02:12:20 kan Exp $ */
+
 #undef ASM_COMMENT_START
 #define ASM_COMMENT_START "#"
 
Index: i386.h
===================================================================
RCS file: /home/cvs/src/contrib/gcc4/config/i386/i386.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L contrib/gcc4/config/i386/i386.h -L contrib/gcc4/config/i386/i386.h -u -r1.1.1.1 -r1.2
--- contrib/gcc4/config/i386/i386.h
+++ contrib/gcc4/config/i386/i386.h
@@ -387,8 +387,8 @@
       else if (TARGET_ATHLON)					\
 	{							\
 	  builtin_define ("__tune_athlon__");			\
-	  /* Only plain "athlon" lacks SSE.  */			\
-	  if (last_tune_char != 'n')				\
+	  /* Plain "athlon" & "athlon-tbird" lacks SSE.  */	\
+	  if (last_tune_char != 'n' && last_tune_char != 'd')	\
 	    builtin_define ("__tune_athlon_sse__");		\
 	}							\
       else if (TARGET_K8)					\
@@ -451,8 +451,8 @@
 	{							\
 	  builtin_define ("__athlon");				\
 	  builtin_define ("__athlon__");			\
-	  /* Only plain "athlon" lacks SSE.  */			\
-	  if (last_arch_char != 'n')				\
+	  /* Plain "athlon" & "athlon-tbird" lacks SSE.  */	\
+	  if (last_tune_char != 'n' && last_tune_char != 'd')	\
 	    builtin_define ("__athlon_sse__");			\
 	}							\
       else if (ix86_arch == PROCESSOR_K8)			\
@@ -536,7 +536,9 @@
 #define SHORT_TYPE_SIZE 16
 #define INT_TYPE_SIZE 32
 #define FLOAT_TYPE_SIZE 32
+#ifndef LONG_TYPE_SIZE
 #define LONG_TYPE_SIZE BITS_PER_WORD
+#endif
 #define DOUBLE_TYPE_SIZE 64
 #define LONG_LONG_TYPE_SIZE 64
 
Index: freebsd.h
===================================================================
RCS file: /home/cvs/src/contrib/gcc4/config/rs6000/freebsd.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L contrib/gcc4/config/rs6000/freebsd.h -L contrib/gcc4/config/rs6000/freebsd.h -u -r1.1.1.1 -r1.2
--- contrib/gcc4/config/rs6000/freebsd.h
+++ contrib/gcc4/config/rs6000/freebsd.h
@@ -24,6 +24,11 @@
 #undef	CPP_OS_DEFAULT_SPEC
 #define CPP_OS_DEFAULT_SPEC "%(cpp_os_freebsd)"
 
+#undef	CPP_OS_FREEBSD_SPEC
+#define CPP_OS_FREEBSD_SPEC	"\
+  -D__PPC__ -D__ppc__ -D__PowerPC__ -D__powerpc__ \
+  -Acpu=powerpc -Amachine=powerpc "
+
 #undef	STARTFILE_DEFAULT_SPEC
 #define STARTFILE_DEFAULT_SPEC "%(startfile_freebsd)"
 
Index: freebsd.h
===================================================================
RCS file: /home/cvs/src/contrib/gcc4/config/arm/freebsd.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L contrib/gcc4/config/arm/freebsd.h -L contrib/gcc4/config/arm/freebsd.h -u -r1.1.1.1 -r1.2
--- contrib/gcc4/config/arm/freebsd.h
+++ contrib/gcc4/config/arm/freebsd.h
@@ -19,13 +19,25 @@
    the Free Software Foundation, 51 Franklin Street, Fifth Floor,
    Boston, MA 02110-1301, USA.  */
 
+#undef  SUBTARGET_CPP_SPEC
+#define SUBTARGET_CPP_SPEC FBSD_CPP_SPEC
 
 #undef  SUBTARGET_EXTRA_SPECS
 #define SUBTARGET_EXTRA_SPECS \
+  { "subtarget_extra_asm_spec",	SUBTARGET_EXTRA_ASM_SPEC }, \
+  { "subtarget_asm_float_spec", SUBTARGET_ASM_FLOAT_SPEC }, \
   { "fbsd_dynamic_linker", FBSD_DYNAMIC_LINKER }
 
-#undef  SUBTARGET_CPP_SPEC
-#define SUBTARGET_CPP_SPEC FBSD_CPP_SPEC
+#undef SUBTARGET_EXTRA_ASM_SPEC
+#define SUBTARGET_EXTRA_ASM_SPEC	\
+  "-matpcs %{fpic|fpie:-k} %{fPIC|fPIE:-k}"
+
+/* Default to full FPA if -mhard-float is specified. */
+#undef SUBTARGET_ASM_FLOAT_SPEC
+#define SUBTARGET_ASM_FLOAT_SPEC		\
+  "%{mhard-float:-mfpu=fpa}			\
+   %{mfloat-abi=hard:{!mfpu=*:-mfpu=fpa}}	\
+   %{!mhard-float: %{msoft-float:-mfpu=softvfp;:-mfpu=softvfp}}"
 
 #undef	LINK_SPEC
 #define LINK_SPEC "							\
@@ -38,12 +50,28 @@
       %{rdynamic:-export-dynamic}					\
       %{!dynamic-linker:-dynamic-linker %(fbsd_dynamic_linker) }}	\
     %{static:-Bstatic}}							\
-  %{symbolic:-Bsymbolic}"
-
+  %{symbolic:-Bsymbolic}						\
+  -X %{mbig-endian:-EB} %{mlittle-endian:-EL}"
 
 /************************[  Target stuff  ]***********************************/
 
-/* Define the actual types of some ANSI-mandated types.  
+#undef  TARGET_VERSION
+#define TARGET_VERSION fprintf (stderr, " (FreeBSD/StrongARM ELF)");
+
+#ifndef TARGET_ENDIAN_DEFAULT
+#define TARGET_ENDIAN_DEFAULT 0
+#endif
+
+/* Default it to use ATPCS with soft-VFP.  */
+#undef TARGET_DEFAULT
+#define TARGET_DEFAULT			\
+  (MASK_APCS_FRAME			\
+   | TARGET_ENDIAN_DEFAULT)
+
+#undef ARM_DEFAULT_ABI
+#define ARM_DEFAULT_ABI ARM_ABI_ATPCS
+
+/* Define the actual types of some ANSI-mandated types.
    Needs to agree with <machine/ansi.h>.  GCC defaults come from c-decl.c,
    c-common.c, and config/<arch>/<arch>.h.  */
 
@@ -58,11 +86,40 @@
 /* We use the GCC defaults here.  */
 #undef WCHAR_TYPE
 
-#undef  WCHAR_TYPE_SIZE
-#define WCHAR_TYPE_SIZE 32
-
 #undef  SUBTARGET_CPU_DEFAULT
 #define SUBTARGET_CPU_DEFAULT	TARGET_CPU_strongarm
 
-#undef  TARGET_VERSION
-#define TARGET_VERSION fprintf (stderr, " (FreeBSD/StrongARM ELF)");
+/* FreeBSD does its profiling differently to the Acorn compiler. We
+   don't need a word following the mcount call; and to skip it
+   requires either an assembly stub or use of fomit-frame-pointer when
+   compiling the profiling functions.  Since we break Acorn CC
+   compatibility below a little more won't hurt.  */
+
+#undef ARM_FUNCTION_PROFILER
+#define ARM_FUNCTION_PROFILER(STREAM,LABELNO)		\
+{							\
+  asm_fprintf (STREAM, "\tmov\t%Rip, %Rlr\n");		\
+  asm_fprintf (STREAM, "\tbl\t__mcount%s\n",		\
+	       (TARGET_ARM && NEED_PLT_RELOC)		\
+	       ? "(PLT)" : "");				\
+}
+
+/* Clear the instruction cache from `BEG' to `END'.  This makes a
+   call to the ARM_SYNC_ICACHE architecture specific syscall.  */
+#define CLEAR_INSN_CACHE(BEG, END)					\
+do									\
+  {									\
+    extern int sysarch(int number, void *args);				\
+    struct								\
+      {									\
+	unsigned int addr;						\
+	int          len;						\
+      } s;								\
+    s.addr = (unsigned int)(BEG);					\
+    s.len = (END) - (BEG);						\
+    (void) sysarch (0, &s);						\
+  }									\
+while (0)
+
+#undef FPUTYPE_DEFAULT
+#define FPUTYPE_DEFAULT FPUTYPE_VFP
Index: freebsd.h
===================================================================
RCS file: /home/cvs/src/contrib/gcc4/config/sparc/freebsd.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L contrib/gcc4/config/sparc/freebsd.h -L contrib/gcc4/config/sparc/freebsd.h -u -r1.1.1.1 -r1.2
--- contrib/gcc4/config/sparc/freebsd.h
+++ contrib/gcc4/config/sparc/freebsd.h
@@ -19,6 +19,8 @@
 the Free Software Foundation, 51 Franklin Street, Fifth Floor,
 Boston, MA 02110-1301, USA.  */
 
+/* $FreeBSD: src/contrib/gcc/config/sparc/freebsd.h,v 1.10 2007/05/19 02:30:20 kan Exp $ */
+
 #undef  SUBTARGET_EXTRA_SPECS
 #define SUBTARGET_EXTRA_SPECS \
   { "fbsd_dynamic_linker", FBSD_DYNAMIC_LINKER }
@@ -28,7 +30,15 @@
 
 #undef  CPP_CPU64_DEFAULT_SPEC
 #define CPP_CPU64_DEFAULT_SPEC \
-  "-D__sparc64__ -D__sparc_v9__ -D__sparcv9 -D__arch64__"
+  "-D__sparc64__ -D__sparc_v9__ -D__sparcv9 -D__sparc__ -D__arch64__"
+
+#undef  FBSD_TARGET_CPU_CPP_BUILTINS
+#define FBSD_TARGET_CPU_CPP_BUILTINS()		\
+  do						\
+    {						\
+      builtin_define ("__LP64__");		\
+    }						\
+  while (0)
 
 #define LINK_SPEC "%(link_arch)						\
   %{!mno-relax:%{!r:-relax}}						\
Index: freebsd-spec.h
===================================================================
RCS file: /home/cvs/src/contrib/gcc4/config/freebsd-spec.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L contrib/gcc4/config/freebsd-spec.h -L contrib/gcc4/config/freebsd-spec.h -u -r1.1.1.1 -r1.2
--- contrib/gcc4/config/freebsd-spec.h
+++ contrib/gcc4/config/freebsd-spec.h
@@ -18,6 +18,8 @@
 the Free Software Foundation, 51 Franklin Street, Fifth Floor,
 Boston, MA 02110-1301, USA.  */
 
+/* $FreeBSD: src/contrib/gcc/config/freebsd-spec.h,v 1.23 2007/05/19 02:30:20 kan Exp $ */
+
 /* Common FreeBSD configuration. 
    All FreeBSD architectures should include this file, which will specify
    their commonalities.
@@ -57,6 +59,7 @@
 	builtin_assert ("system=unix");					\
 	builtin_assert ("system=bsd");					\
 	builtin_assert ("system=FreeBSD");				\
+	FBSD_NATIVE_TARGET_OS_CPP_BUILTINS();				\
 	FBSD_TARGET_CPU_CPP_BUILTINS();					\
     }									\
   while (0)
@@ -64,34 +67,54 @@
 /* Define the default FreeBSD-specific per-CPU hook code.  */
 #define FBSD_TARGET_CPU_CPP_BUILTINS() do {} while (0)
 
-/* Provide a CPP_SPEC appropriate for FreeBSD.  We just deal with the GCC 
-   option `-posix', and PIC issues.  */
+#ifdef FREEBSD_NATIVE
+#define FBSD_NATIVE_TARGET_OS_CPP_BUILTINS()				\
+  do {									\
+	builtin_define_with_int_value ("__FreeBSD_cc_version", FBSD_CC_VER); \
+  } while (0)
+#else
+#define FBSD_NATIVE_TARGET_OS_CPP_BUILTINS()				\
+  do {} while (0)
+#endif
+
+/* Provide a CPP_SPEC appropriate for FreeBSD.  We just deal with the GCC
+   option `-posix', and PIC issues.  Try to detect support for the
+   `long long' type.  Unfortunately the GCC spec parser will not allow us
+   to properly detect the "iso9899:1990" and "iso9899:199409" forms of
+   -std=c89.  Because of the ':' in the -std argument. :-(  I have left
+   them in the spec as a place holder in hopes someone knows a way to make
+   the detection of them work.  */
 
 #define FBSD_CPP_SPEC "							\
   %(cpp_cpu)								\
   %(cpp_arch)								\
+  %{!ansi:%{!std=c89:%{!std=iso9899.1990:%{!std=iso9899.199409:-D_LONGLONG}}}} \
   %{posix:-D_POSIX_SOURCE}"
 
-/* Provide a STARTFILE_SPEC appropriate for FreeBSD.  Here we add
-   the magical crtbegin.o file (see crtstuff.c) which provides part 
-	of the support for getting C++ file-scope static object constructed 
-	before entering `main'.  */
-   
-#define FBSD_STARTFILE_SPEC \
-  "%{!shared: \
-     %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} \
-		       %{!p:%{profile:gcrt1.o%s} \
-			 %{!profile:crt1.o%s}}}} \
-   crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
-
-/* Provide a ENDFILE_SPEC appropriate for FreeBSD.  Here we tack on
-   the magical crtend.o file (see crtstuff.c) which provides part of 
-	the support for getting C++ file-scope static object constructed 
-	before entering `main', followed by a normal "finalizer" file, 
-	`crtn.o'.  */
-
-#define FBSD_ENDFILE_SPEC \
-  "%{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s"
+/* Provide a STARTFILE_SPEC appropriate for FreeBSD.  Here we add the magical
+   crtbegin.o file (see crtstuff.c) which provides part of the support for
+   getting C++ file-scope static object constructed before entering `main'.  */
+
+#define FBSD_STARTFILE_SPEC "\
+  %{!shared: \
+    %{pg:gcrt1.o%s} \
+    %{!pg: \
+      %{p:gcrt1.o%s} \
+      %{!p: \
+	%{profile:gcrt1.o%s} \
+	%{!profile:crt1.o%s}}}} \
+  crti.o%s \
+  %{static:crtbeginT.o%s;shared:crtbeginS.o%s;:crtbegin.o%s}"
+
+/* Provide an ENDFILE_SPEC appropriate for FreeBSD/i386.  Here we tack on
+   our own magical crtend.o file (see crtstuff.c) which provides part of
+   the support for getting C++ file-scope static object constructed before
+   entering `main', followed by the normal "finalizer" file, `crtn.o'.  */
+
+#define FBSD_ENDFILE_SPEC "\
+  %{!shared:crtend.o%s} \
+  %{shared:crtendS.o%s} \
+  crtn.o%s "
 
 /* Provide a LIB_SPEC appropriate for FreeBSD as configured and as
    required by the user-land thread model.  Before __FreeBSD_version
@@ -120,7 +143,8 @@
     %{pg:  -lc_p}							\
   }"
 #else
-#if FBSD_MAJOR < 5
+#include <sys/param.h>
+#if __FreeBSD_version < 500016
 #define FBSD_LIB_SPEC "							\
   %{!shared:								\
     %{!pg:								\
@@ -130,17 +154,34 @@
       %{!pthread:-lc_p}							\
       %{pthread:-lc_r_p}}						\
   }"
-#else
+#elif __FreeBSD_version < 700022
 #define FBSD_LIB_SPEC "							\
   %{!shared:								\
     %{!pg: %{pthread:-lpthread} -lc}					\
     %{pg:  %{pthread:-lpthread_p} -lc_p}				\
   }"
+#else
+#define FBSD_LIB_SPEC "							\
+  %{!shared:								\
+    %{!pg: %{pthread:-lpthread} -lc}					\
+    %{pg:  %{pthread:-lpthread_p} -lc_p}}				\
+  %{shared:								\
+    %{pthread:-lpthread} -lc}						\
+  "
 #endif
 #endif
 
-#if FBSD_MAJOR < 6
+#if FBSD_MAJOR < 5
 #define FBSD_DYNAMIC_LINKER "/usr/libexec/ld-elf.so.1"
 #else
 #define FBSD_DYNAMIC_LINKER "/libexec/ld-elf.so.1"
 #endif
+
+#if defined(HAVE_LD_EH_FRAME_HDR)
+#define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
+#endif
+
+/* Use --as-needed -lgcc_s for eh support.  */
+#ifdef HAVE_LD_AS_NEEDED
+#define USE_LD_AS_NEEDED 1
+#endif
Index: freebsd.h
===================================================================
RCS file: /home/cvs/src/contrib/gcc4/config/freebsd.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L contrib/gcc4/config/freebsd.h -L contrib/gcc4/config/freebsd.h -u -r1.1.1.1 -r1.2
--- contrib/gcc4/config/freebsd.h
+++ contrib/gcc4/config/freebsd.h
@@ -1,5 +1,5 @@
 /* Base configuration file for all FreeBSD targets.
-   Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -26,6 +26,7 @@
    Further work by David O'Brien <obrien at FreeBSD.org> and
    Loren J. Rittle <ljrittle at acm.org>.  */
 
+/* $FreeBSD: src/contrib/gcc/config/freebsd.h,v 1.41 2007/05/19 02:30:20 kan Exp $ */
 
 /* In case we need to know.  */
 #define USING_CONFIG_FREEBSD 1
@@ -61,7 +62,7 @@
 
 /* All FreeBSD Architectures support the ELF object file format.  */
 #undef  OBJECT_FORMAT_ELF
-#define OBJECT_FORMAT_ELF
+#define OBJECT_FORMAT_ELF	1
 
 /* Don't assume anything about the header files.  */
 #undef  NO_IMPLICIT_EXTERN_C
@@ -72,16 +73,24 @@
 #undef  WCHAR_TYPE
 #define WCHAR_TYPE "int"
 
+#ifdef FREEBSD_NATIVE
+#define LIBSTDCXX_PROFILE       "-lstdc++_p"
+#endif
 #define MATH_LIBRARY_PROFILE    "-lm_p"
 
 /* Code generation parameters.  */
 
+/* Writing `int' for a bitfield forces int alignment for the structure.  */
+/* XXX: ok for Alpha??  */
+#undef  PCC_BITFIELD_TYPE_MATTERS
+#define PCC_BITFIELD_TYPE_MATTERS 1
+
 /* Use periods rather than dollar signs in special g++ assembler names.
    This ensures the configuration knows our system correctly so we can link
    with libraries compiled with the native cc.  */
 #undef NO_DOLLAR_IN_LABEL
 
-/* Used by libgcc2.c.  We support file locking with fcntl / F_SETLKW.
-   This enables the test coverage code to use file locking when exiting a
-   program, which avoids race conditions if the program has forked.  */
+/* Define this so we can compile MS code for use with WINE.  */
+#define HANDLE_PRAGMA_PACK_PUSH_POP
+
 #define TARGET_POSIX_IO
Index: ptree.c
===================================================================
RCS file: /home/cvs/src/contrib/gcc4/cp/ptree.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L contrib/gcc4/cp/ptree.c -L contrib/gcc4/cp/ptree.c -u -r1.1.1.1 -r1.2
--- contrib/gcc4/cp/ptree.c
+++ contrib/gcc4/cp/ptree.c
@@ -20,6 +20,7 @@
 the Free Software Foundation, 51 Franklin Street, Fifth Floor,
 Boston, MA 02110-1301, USA.  */
 
+/* $FreeBSD: src/contrib/gcc/cp/ptree.c,v 1.9 2007/05/19 02:12:20 kan Exp $ */
 
 #include "config.h"
 #include "system.h"


More information about the Midnightbsd-cvs mailing list