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


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

PCH checksums, bootstrap comparison warnings


This patch puts executable checksums in the PCH validation data, so
ensuring that the executable that built the PCH is also the one using
the PCH.

This doesn't add a significant amount of time to the build, at least
not on my systems.  The extra link takes less time than the checksum,
and the checksum takes 1-2 seconds for 3 languages.

I've bootstrapped & tested a previous version of the patch on
powerpc-darwin8, and will run one more bootstrap before committing.  I
also checked that if you change the checksum files a 'make quickstrap'
prints warnings but does not fail, which should replicate the
situation on HPUX and other systems with broken assemblers.

-- 
- Geoffrey Keating <geoffk@apple.com>

===File ~/patches/gcc-pchchecksum.patch=====================
2005-05-17  Geoffrey Keating  <geoffk@apple.com>

	* dummy-checksum.c: New.
	* genchecksum.c: New.
	* c.opt (print_pch_checksum): New flag.
	* c-pch.c (struct c_pch_validity): Make much shorter.
	(no_checksum): New.
	(host_machine): Remove.
	(target_machine): Remove.
	(get_ident): Change PCH version number.
	(pch_init): When -fverbose-asm, print out the compiler fingerprint.
	Don't put triplets or version string in PCH validity data.
	Do put the compiler checksum in the validity data.
	(c_common_valid_pch): Don't check triplets or version string.  Do
	check checksum.
	(c_common_print_pch_checksum): New.
	* c-opts.c (c_common_handle_option): Add OPT_print_pch_checksum.
	Print fingerprint with -v.
	* c-common.h (c_common_print_pch_checksum): New.
	(executable_checksum): New.
	* Makefile.in (STAGEMOVESTUFF): Add cc1*-dummy, *-checksum.c.
	(cc1-dummy): New rule.
	(cc1-checksum.c): New rule.
	(cc1-checksum.o): New rule.
	(cc1): Add checksum support.
	(build/genchecksum): New.
	(build/genchecksum.o): New.
	(dummy-checksum.o): New.
	(genobjnames): Add genchecksum.o.
	(mostlyclean): Remove *-checksum.c.
	(gnucompare): Add libgcc to list of directories checked.
	Make comparison problems in libgcc/ and with checksum files only
	be warnings.
	* doc/invoke.texi (Precompiled Headers): Remove caution.
	Document that it must be the exact same binary.  Add a few
	known-safe flags to the list.
	
In cp/:
2005-05-17  Geoffrey Keating  <geoffk@apple.com>

	* Make-lang.in (cc1plus-dummy): New.
	(cc1plus-checksum.c): New.
	(cc1plus-checksum.o): New.
	(cc1plus): Add cc1plus-checksum.o.

In objc/:
2005-05-17  Geoffrey Keating  <geoffk@apple.com>

	* Make-lang.in (cc1obj-dummy): New.
	(cc1obj-checksum.c): New.
	(cc1obj-checksum.o): New.
	(cc1obj): Add cc1obj-checksum.o.

In objcp/:
2005-05-17  Geoffrey Keating  <geoffk@apple.com>

	* Make-lang.in (cc1objplus-dummy): New.
	(cc1objplus-checksum.c): New.
	(cc1objplus-checksum.o): New.
	(cc1objplus): Add cc1objplus-checksum.o.

Index: Makefile.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Makefile.in,v
retrieving revision 1.1487
diff -u -p -u -p -r1.1487 Makefile.in
--- Makefile.in	17 May 2005 16:27:43 -0000	1.1487
+++ Makefile.in	17 May 2005 22:26:10 -0000
@@ -983,12 +983,12 @@ STAGECOPYSTUFF = insn-flags.h insn-confi
 
 # Files to be moved away after each stage in building.
 STAGEMOVESTUFF = *$(objext) s-* \
- xgcc$(exeext) cpp$(exeext) cc1$(exeext) $(EXTRA_PASSES) \
+ xgcc$(exeext) cpp$(exeext) cc1$(exeext) cc1*-dummy$(exeext) $(EXTRA_PASSES) \
  $(EXTRA_PARTS) $(EXTRA_PROGRAMS) gcc-cross$(exeext) \
  protoize$(exeext) unprotoize$(exeext) \
  $(SPECS) collect2$(exeext) \
  gcov-iov$(build_exeext) gcov$(exeext) gcov-dump$(exeext) \
- *.[0-9][0-9].* *.[si] libbackend.a libgcc.mk \
+ *.[0-9][0-9].* *.[si] *-checksum.c libbackend.a libgcc.mk \
  $(LANG_STAGESTUFF)
 
 # Defined in libgcc2.c, included only in the static library.
@@ -1213,9 +1213,18 @@ $(SPECS): xgcc$(exeext)
 gcc-cross: xgcc$(exeext)
 	cp xgcc$(exeext) gcc-cross$(exeext)
 
-cc1$(exeext): $(C_OBJS) $(BACKEND) $(LIBDEPS)
-	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o cc1$(exeext) \
-		$(C_OBJS) $(BACKEND) $(LIBS)
+cc1-dummy$(exeext): $(C_OBJS) dummy-checksum.o $(BACKEND) $(LIBDEPS)
+	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(C_OBJS) dummy-checksum.o \
+	  $(BACKEND) $(LIBS)
+
+cc1-checksum.c : cc1-dummy$(exeext) build/genchecksum$(exeext)
+	build/genchecksum$(exeext) cc1-dummy$(exeext) > $@
+
+cc1-checksum.o : cc1-checksum.c
+
+cc1$(exeext): $(C_OBJS) cc1-checksum.o $(BACKEND) $(LIBDEPS)
+	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(C_OBJS) cc1-checksum.o \
+	  $(BACKEND) $(LIBS)
 
 # Build the version of limits.h that we will install.
 xlimits.h: glimits.h limitx.h limity.h
@@ -1532,6 +1541,14 @@ gccspec.o: gccspec.c $(CONFIG_H) $(SYSTE
 
 cppspec.o: cppspec.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(GCC_H)
 
+build/genchecksum$(build_exeext) : build/genchecksum.o $(BUILD_LIBDEPS)
+	$(CC_FOR_BUILD) $(BUILD_CFLAGS) $(BUILD_LDFLAGS) -o $@ \
+	 build/genchecksum.o $(BUILD_LIBS)
+
+build/genchecksum.o : genchecksum.c $(BCONFIG_H) $(SYSTEM_H) $(MD5_H)
+
+dummy-checksum.o : dummy-checksum.c
+
 tree-check.h: s-check ; @true
 s-check : build/gencheck$(build_exeext)
 	$(RUN_GEN) build/gencheck$(build_exeext) > tmp-check.h
@@ -2668,7 +2685,8 @@ genobjnames=$(genprognames:%=%.o) read-r
 	genconstants.o gen-protos.o scan.o fix-header.o scan-decls.o \
 	gencheck.o dummy-conditions.o genconditions.o errors.o ggc-none.o \
 	min-insn-modes.o rtl.o print-rtl.o varray.o gcov-iov.o \
-	insn-conditions.o gengtype-lex.o gengtype-yacc.o genmddeps.o
+	insn-conditions.o gengtype-lex.o gengtype-yacc.o genmddeps.o \
+	genchecksum.o
 
 genobjs=$(genobjnames:%=build/%)
 
@@ -3300,6 +3318,8 @@ mostlyclean: lang.mostlyclean
 # Delete files generated by gengtype.c
 	-rm -f gtype-*
 	-rm -f gt-*
+# Delete genchecksum outputs
+	-rm -f *-checksum.c
 
 # Delete all files made by compilation
 # that don't exist in the distribution.
@@ -4068,23 +4088,32 @@ fastcompare fastcompare3 fastcompare4 fa
  gnucompare  gnucompare3  gnucompare4  gnucompare-lean  gnucompare3-lean  gnucompare4-lean: force
 	-rm -f .bad_compare
 	case "$@" in *compare | *compare-lean ) stage=2 ;; * ) stage=`echo $@ | sed -e 's,^[a-z]*compare\([0-9][0-9]*\).*,\1,'` ;; esac; \
-	for dir in . $(SUBDIRS); do \
+	for dir in . $(SUBDIRS) libgcc; do \
 	  if [ "`echo $$dir/*$(objext)`" != "$$dir/*$(objext)" ] ; then \
 	    for file in $$dir/*$(objext); do \
-	      case "$@" in \
-		slowcompare* ) \
-		  tail +16c ./$$file > tmp-foo1; \
-		  tail +16c stage$$stage/$$file > tmp-foo2 \
-		    && (cmp tmp-foo1 tmp-foo2 > /dev/null 2>&1 || echo $$file differs >> .bad_compare) || true; \
-		  ;; \
-		fastcompare* ) \
-		  cmp $$file stage$$stage/$$file 16 16 > /dev/null 2>&1; \
-		  test $$? -eq 1 && echo $$file differs >> .bad_compare || true; \
-		  ;; \
-		gnucompare* ) \
-		  cmp --ignore-initial=16 $$file stage$$stage/$$file > /dev/null 2>&1; \
-		  test $$? -eq 1 && echo $$file differs >> .bad_compare || true; \
+	      case $$file in \
+		./cc*-checksum$(objext) | libgcc/* ) \
+		    tail +16c ./$$file > tmp-foo1 \
+		    && tail +16c stage$$stage/$$file > tmp-foo2 \
+		    && ( cmp tmp-foo1 tmp-foo2 > /dev/null 2>&1 \
+			 || echo warning: $$file differs || true ) \
 		  ;; \
+		*)  case "$@" in \
+		  slowcompare* ) \
+		    tail +16c ./$$file > tmp-foo1; \
+		    tail +16c stage$$stage/$$file > tmp-foo2 \
+		      && (cmp tmp-foo1 tmp-foo2 > /dev/null 2>&1 \
+			  || echo $$file differs >> .bad_compare) || true; \
+		    ;; \
+		  fastcompare* ) \
+		    cmp $$file stage$$stage/$$file 16 16 > /dev/null 2>&1; \
+		    test $$? -eq 1 && echo $$file differs >> .bad_compare || true; \
+		    ;; \
+		  gnucompare* ) \
+		    cmp --ignore-initial=16 $$file stage$$stage/$$file > /dev/null 2>&1; \
+		    test $$? -eq 1 && echo $$file differs >> .bad_compare || true; \
+		    ;; \
+	        esac ; \
 	      esac ; \
 	    done; \
 	  else true; fi; \
Index: c-common.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-common.h,v
retrieving revision 1.291
diff -u -p -u -p -r1.291 c-common.h
--- c-common.h	17 May 2005 20:11:34 -0000	1.291
+++ c-common.h	17 May 2005 22:26:10 -0000
@@ -859,6 +859,10 @@ extern void c_common_read_pch (cpp_reade
 extern void c_common_write_pch (void);
 extern void c_common_no_more_pch (void);
 extern void c_common_pch_pragma (cpp_reader *pfile);
+extern void c_common_print_pch_checksum (FILE *f);
+
+/* In *-checksum.c */
+extern const unsigned char executable_checksum[16];
 
 extern void builtin_define_with_value (const char *, const char *, int);
 extern void c_stddef_cpp_builtins (void);
Index: c-opts.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-opts.c,v
retrieving revision 1.144
diff -u -p -u -p -r1.144 c-opts.c
--- c-opts.c	17 May 2005 20:11:38 -0000	1.144
+++ c-opts.c	17 May 2005 22:26:10 -0000
@@ -863,6 +863,11 @@ c_common_handle_option (size_t scode, co
       print_struct_values = 1;
       break;
 
+    case OPT_print_pch_checksum:
+      c_common_print_pch_checksum (stdout);
+      exit_after_options = true;
+      break;
+
     case OPT_remap:
       cpp_opts->remap = 1;
       break;
@@ -1066,6 +1071,9 @@ c_common_init (void)
      are known.  */
   cpp_init_iconv (parse_in);
 
+  if (version_flag)
+    c_common_print_pch_checksum (stderr);
+
   if (flag_preprocess_only)
     {
       finish_options ();
Index: c-pch.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-pch.c,v
retrieving revision 1.30
diff -u -p -u -p -r1.30 c-pch.c
--- c-pch.c	9 Nov 2004 10:12:15 -0000	1.30
+++ c-pch.c	17 May 2005 22:26:10 -0000
@@ -52,22 +52,17 @@ enum {
   MATCH_SIZE = ARRAY_SIZE (pch_matching)
 };
 
-/* This structure is read very early when validating the PCH, and
-   might be read for a PCH which is for a completely different compiler
-   for a different operating system.  Thus, it should really only contain
-   'unsigned char' entries, at least in the initial entries.  
+/* The value of the checksum in the dummy compiler that is actually
+   checksummed.  That compiler should never be run.  */
+static const char no_checksum[16] = { 0 };
 
-   If you add or change entries before version_length, you should increase
-   the version number in get_ident().  
+/* Information about flags and suchlike that affect PCH validity.
 
-   There are a bunch of fields named *_length; those are lengths of data that
-   follows this structure in the same order as the fields in the structure.  */
+   Before this structure is read, both an initial 8-character identification
+   string, and a 16-byte checksum, have been read and validated.  */
 
 struct c_pch_validity
 {
-  unsigned char host_machine_length;
-  unsigned char target_machine_length;
-  unsigned char version_length;
   unsigned char debug_info_type;
   signed char match[MATCH_SIZE];
   void (*pch_init) (void);
@@ -87,10 +82,6 @@ static FILE *pch_outfile;
 /* The position in the assembler output file when pch_init was called.  */
 static long asm_file_startpos;
 
-/* The host and target machines.  */
-static const char host_machine[] = HOST_MACHINE;
-static const char target_machine[] = TARGET_MACHINE;
-
 static const char *get_ident (void);
 
 /* Compute an appropriate 8-byte magic number for the PCH file, so that
@@ -102,7 +93,7 @@ static const char *
 get_ident (void)
 {
   static char result[IDENT_LENGTH];
-  static const char template[IDENT_LENGTH] = "gpch.012";
+  static const char template[IDENT_LENGTH] = "gpch.013";
   static const char c_language_chars[] = "Co+O";
   
   memcpy (result, template, IDENT_LENGTH);
@@ -111,8 +102,10 @@ get_ident (void)
   return result;
 }
 
-/* Prepare to write a PCH file.  This is called at the start of 
-   compilation.  */
+/* Prepare to write a PCH file, if one is being written.  This is
+   called at the start of compilation.  
+
+   Also, print out the executable checksum if -fverbose-asm is in effect.  */
 
 void
 pch_init (void)
@@ -122,6 +115,15 @@ pch_init (void)
   void *target_validity;
   static const char partial_pch[IDENT_LENGTH] = "gpcWrite";
   
+#ifdef ASM_COMMENT_START
+  if (flag_verbose_asm)
+    {
+      fprintf (asm_out_file, "%s ", ASM_COMMENT_START);
+      c_common_print_pch_checksum (asm_out_file);
+      fputc ('\n', asm_out_file);
+    }
+#endif
+  
   if (!pch_file)
     return;
   
@@ -130,13 +132,8 @@ pch_init (void)
     fatal_error ("can%'t create precompiled header %s: %m", pch_file);
   pch_outfile = f;
 
-  gcc_assert (strlen (host_machine) < 256
-	      && strlen (target_machine) < 256
-	      && strlen (version_string) < 256);
-  
-  v.host_machine_length = strlen (host_machine);
-  v.target_machine_length = strlen (target_machine);
-  v.version_length = strlen (version_string);
+  gcc_assert (memcmp (executable_checksum, no_checksum, 16) != 0);
+  
   v.debug_info_type = write_symbols;
   {
     size_t i;
@@ -150,10 +147,8 @@ pch_init (void)
   target_validity = targetm.get_pch_validity (&v.target_data_length);
   
   if (fwrite (partial_pch, IDENT_LENGTH, 1, f) != 1
+      || fwrite (executable_checksum, 16, 1, f) != 1
       || fwrite (&v, sizeof (v), 1, f) != 1
-      || fwrite (host_machine, v.host_machine_length, 1, f) != 1
-      || fwrite (target_machine, v.target_machine_length, 1, f) != 1
-      || fwrite (version_string, v.version_length, 1, f) != 1
       || fwrite (target_validity, v.target_data_length, 1, f) != 1)
     fatal_error ("can%'t write to %s: %m", pch_file);
 
@@ -234,20 +229,24 @@ c_common_valid_pch (cpp_reader *pfile, c
 {
   int sizeread;
   int result;
-  char ident[IDENT_LENGTH];
-  char short_strings[256 * 3];
-  int strings_length;
+  char ident[IDENT_LENGTH + 16];
   const char *pch_ident;
   struct c_pch_validity v;
 
   /* Perform a quick test of whether this is a valid
      precompiled header for the current language.  */
 
-  sizeread = read (fd, ident, IDENT_LENGTH);
+  gcc_assert (memcmp (executable_checksum, no_checksum, 16) != 0);
+
+  sizeread = read (fd, ident, IDENT_LENGTH + 16);
   if (sizeread == -1)
     fatal_error ("can%'t read %s: %m", name);
-  else if (sizeread != IDENT_LENGTH)
-    return 2;
+  else if (sizeread != IDENT_LENGTH + 16)
+    {
+      cpp_error (pfile, CPP_DL_WARNING, "%s: too short to be a PCH file",
+		 name);
+      return 2;
+    }
   
   pch_ident = get_ident();
   if (memcmp (ident, pch_ident, IDENT_LENGTH) != 0)
@@ -269,52 +268,20 @@ c_common_valid_pch (cpp_reader *pfile, c
 	}
       return 2;
     }
-
-  /* At this point, we know it's a PCH file, so it ought to be long enough
-     that we can read a c_pch_validity structure.  */
-  if (read (fd, &v, sizeof (v)) != sizeof (v))
-    fatal_error ("can%'t read %s: %m", name);
-
-  strings_length = (v.host_machine_length + v.target_machine_length 
-		    + v.version_length);
-  if (read (fd, short_strings, strings_length) != strings_length)
-    fatal_error ("can%'t read %s: %m", name);
-  if (v.host_machine_length != strlen (host_machine)
-      || memcmp (host_machine, short_strings, strlen (host_machine)) != 0)
-    {
-      if (cpp_get_options (pfile)->warn_invalid_pch)
-	cpp_error (pfile, CPP_DL_WARNING, 
-		   "%s: created on host '%.*s', but used on host '%s'", name,
-		   v.host_machine_length, short_strings, host_machine);
-      return 2;
-    }
-  if (v.target_machine_length != strlen (target_machine)
-      || memcmp (target_machine, short_strings + v.host_machine_length,
-		 strlen (target_machine)) != 0)
-    {
-      if (cpp_get_options (pfile)->warn_invalid_pch)
-	cpp_error (pfile, CPP_DL_WARNING, 
-		   "%s: created for target '%.*s', but used for target '%s'", 
-		   name, v.target_machine_length, 
-		   short_strings + v.host_machine_length, target_machine);
-      return 2;
-    }
-  if (v.version_length != strlen (version_string)
-      || memcmp (version_string, 
-		 (short_strings + v.host_machine_length 
-		  + v.target_machine_length),
-		 v.version_length) != 0)
+  if (memcmp (ident + IDENT_LENGTH, executable_checksum, 16) != 0)
     {
       if (cpp_get_options (pfile)->warn_invalid_pch)
 	cpp_error (pfile, CPP_DL_WARNING,
-		   "%s: created by version '%.*s', but this is version '%s'", 
-		   name, v.version_length, 
-		   (short_strings + v.host_machine_length 
-		    + v.target_machine_length), 
-		   version_string);
+		   "%s: created by a different GCC executable", name);
       return 2;
     }
 
+  /* At this point, we know it's a PCH file created by this
+     executable, so it ought to be long enough that we can read a
+     c_pch_validity structure.  */
+  if (read (fd, &v, sizeof (v)) != sizeof (v))
+    fatal_error ("can%'t read %s: %m", name);
+
   /* The allowable debug info combinations are that either the PCH file
      was built with the same as is being used now, or the PCH file was
      built for some kind of debug info but now none is in use.  */
@@ -346,7 +313,9 @@ c_common_valid_pch (cpp_reader *pfile, c
   /* If the text segment was not loaded at the same address as it was
      when the PCH file was created, function pointers loaded from the
      PCH will not be valid.  We could in theory remap all the function
-     pointers, but no support for that exists at present.  */
+     pointers, but no support for that exists at present.  
+     Since we have the same executable, it should only be necessary to
+     check one function.  */
   if (v.pch_init != &pch_init)
     {
       if (cpp_get_options (pfile)->warn_invalid_pch)
@@ -508,3 +477,15 @@ c_common_pch_pragma (cpp_reader *pfile)
   
   close (fd);
 }
+
+/* Print out executable_checksum[].  */
+
+void
+c_common_print_pch_checksum (FILE *f)
+{
+  int i;
+  fputs ("Compiler executable checksum: ", f);
+  for (i = 0; i < 16; i++)
+    fprintf (f, "%02x", executable_checksum[i]);
+  putc ('\n', f);
+}
Index: c.opt
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c.opt,v
retrieving revision 1.43
diff -u -p -u -p -r1.43 c.opt
--- c.opt	17 May 2005 20:11:41 -0000	1.43
+++ c.opt	17 May 2005 22:26:10 -0000
@@ -791,6 +791,10 @@ print-objc-runtime-info
 ObjC ObjC++
 Generate C header of platform-specific features
 
+print-pch-checksum
+C ObjC C++ ObjC++
+Print a checksum of the executable for PCH validity checking, and stop.
+
 remap
 C ObjC C++ ObjC++
 Remap file names when including files
Index: dummy-checksum.c
===================================================================
RCS file: dummy-checksum.c
diff -N dummy-checksum.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ dummy-checksum.c	17 May 2005 22:26:10 -0000
@@ -0,0 +1 @@
+const unsigned char executable_checksum[16] = { 0 };
Index: genchecksum.c
===================================================================
RCS file: genchecksum.c
diff -N genchecksum.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ genchecksum.c	17 May 2005 22:26:10 -0000
@@ -0,0 +1,77 @@
+/* Generate checksums of executables for PCH validation
+   Copyright (C) 2005
+   Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING.  If not, write to the Free
+Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA.  */
+
+#include "bconfig.h"
+#include "system.h"
+#include "md5.h"
+
+static void
+usage (void)
+{
+  fputs ("Usage: genchecksums <filename>\n", stderr);
+}
+
+static void
+dosum (const char *file)
+{
+  FILE *f;
+  unsigned char result[16];
+  int i;
+  
+  f = fopen (file, "rb");
+  if (!f)
+    {
+      fprintf (stderr, "opening %s: %s\n", file, xstrerror (errno));
+      exit (1);
+    }
+  
+  /* Some executable formats have timestamps in the first 16 bytes, yuck.  */
+  if (fseek (f, 16, SEEK_SET) != 0)
+     {
+      fprintf (stderr, "seeking in %s: %s\n", file, xstrerror (errno));
+      exit (1);
+    }
+  
+  if (md5_stream (f, result) != 0
+      || fclose (f) != 0)
+     {
+      fprintf (stderr, "reading %s: %s\n", file, xstrerror (errno));
+      exit (1);
+    }
+
+  fputs ("const unsigned char executable_checksum[16] = { ", stdout);
+  for (i = 0; i < 16; i++)
+    printf ("%#02x%s", result[i], i == 15 ? " };\n" : ", ");
+}
+
+int
+main (int argc, char ** argv)
+{
+  if (argc != 2)
+    {
+      usage ();
+      return 1;
+    }
+
+  dosum (argv[1]);
+
+  return 0;
+}
Index: tree-cfg.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-cfg.c,v
retrieving revision 2.192
diff -u -p -u -p -r2.192 tree-cfg.c
--- tree-cfg.c	17 May 2005 20:28:22 -0000	2.192
+++ tree-cfg.c	17 May 2005 22:26:11 -0000
@@ -1992,8 +1992,8 @@ struct tree_opt_pass pass_remove_useless
   NULL,					/* next */
   0,					/* static_pass_number */
   0,					/* tv_id */
-  PROP_gimple_any,			/* properties_required */
-  0,					/* properties_provided */
+  PROP_gimple_any | PROP_trees,		/* properties_required */
+  PROP_trees,				/* properties_provided */
   0,					/* properties_destroyed */
   0,					/* todo_flags_start */
   TODO_dump_func,			/* todo_flags_finish */
Index: config/rs6000/predicates.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/predicates.md,v
retrieving revision 1.14
diff -u -p -u -p -r1.14 predicates.md
--- config/rs6000/predicates.md	3 May 2005 11:48:26 -0000	1.14
+++ config/rs6000/predicates.md	17 May 2005 22:26:21 -0000
@@ -364,6 +364,15 @@
 		    || GET_CODE (XEXP (XEXP (op, 0), 1)) != CONST_INT
 		    || INTVAL (XEXP (XEXP (op, 0), 1)) % 4 == 0")))
 
+;; Used for the destination of the fix_truncdfsi2 expander.
+;; If stfiwx will be used, the result goes to memory; otherwise,
+;; we're going to emit a store and a load of a subreg, so the dest is a
+;; register.
+(define_predicate "fix_trunc_dest_operand"
+  (if_then_else (match_test "! TARGET_E500_DOUBLE && TARGET_PPC_GFXOPT")
+   (match_operand 0 "memory_operand")
+   (match_operand 0 "gpc_reg_operand")))
+
 ;; Return 1 if the operand is either a non-special register or can be used
 ;; as the operand of a `mode' add insn.
 (define_predicate "add_operand"
Index: config/rs6000/rs6000.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.md,v
retrieving revision 1.367
diff -u -p -u -p -r1.367 rs6000.md
--- config/rs6000/rs6000.md	9 May 2005 22:04:48 -0000	1.367
+++ config/rs6000/rs6000.md	17 May 2005 22:26:22 -0000
@@ -5329,10 +5329,8 @@
 }"
   [(set_attr "length" "20")])
 
-; In the TARGET_PPC_GFXOPT case, this could and probably should
-; take a memory destination; but actually making this work is hard.
 (define_expand "fix_truncdfsi2"
-  [(parallel [(set (match_operand:SI 0 "gpc_reg_operand" "")
+  [(parallel [(set (match_operand:SI 0 "fix_trunc_dest_operand" "")
 		   (fix:SI (match_operand:DF 1 "gpc_reg_operand" "")))
 	      (clobber (match_dup 2))
 	      (clobber (match_dup 3))])]
@@ -5349,7 +5347,7 @@
   if (TARGET_PPC_GFXOPT)
     {
       rtx orig_dest = operands[0];
-      if (GET_CODE (orig_dest) != MEM)
+      if (! memory_operand (orig_dest, GET_MODE (orig_dest)))
 	operands[0] = assign_stack_temp (SImode, GET_MODE_SIZE (SImode), 0);
       emit_insn (gen_fix_truncdfsi2_internal_gfxopt (operands[0], operands[1],
 						     operands[2]));
Index: cp/Make-lang.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/Make-lang.in,v
retrieving revision 1.202
diff -u -p -u -p -r1.202 Make-lang.in
--- cp/Make-lang.in	17 May 2005 20:04:57 -0000	1.202
+++ cp/Make-lang.in	17 May 2005 22:26:24 -0000
@@ -91,9 +91,18 @@ CXX_OBJS = cp/cp-lang.o stub-objc.o $(CX
 # Use strict warnings for this front end.
 cp-warn = $(STRICT_WARN)
 
-cc1plus$(exeext): $(CXX_OBJS) $(BACKEND) $(LIBDEPS)
+cc1plus-dummy$(exeext): $(CXX_OBJS) dummy-checksum.o $(BACKEND) $(LIBDEPS)
 	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
-	      $(CXX_OBJS) $(BACKEND) $(LIBS)
+	      $(CXX_OBJS) dummy-checksum.o $(BACKEND) $(LIBS)
+
+cc1plus-checksum.c : cc1plus-dummy$(exeext) build/genchecksum$(exeext)
+	build/genchecksum$(exeext) cc1plus-dummy$(exeext) > $@
+
+cc1plus-checksum.o : cc1plus-checksum.c
+
+cc1plus$(exeext): $(CXX_OBJS) cc1plus-checksum.o $(BACKEND) $(LIBDEPS)
+	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
+	      $(CXX_OBJS) cc1plus-checksum.o $(BACKEND) $(LIBS)
 
 # Special build rules.
 $(srcdir)/cp/cfns.h: $(srcdir)/cp/cfns.gperf
Index: doc/invoke.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/doc/invoke.texi,v
retrieving revision 1.621
diff -u -p -u -p -r1.621 invoke.texi
--- doc/invoke.texi	17 May 2005 20:11:44 -0000	1.621
+++ doc/invoke.texi	17 May 2005 22:26:25 -0000
@@ -12941,13 +12941,6 @@ build the project.  To make builds faste
 `precompile' a header file; then, if builds can use the precompiled
 header file they will be much faster.
 
-@strong{Caution:} There are a few known situations where GCC will
-crash when trying to use a precompiled header.  If you have trouble
-with a precompiled header, you should remove the precompiled header
-and compile without it.  In addition, please use GCC's on-line
-defect-tracking system to report any problems you encounter with
-precompiled headers.  @xref{Bugs}.
-
 To create a precompiled header file, simply compile it as you would any
 other file, if necessary using the @option{-x} option to make the driver
 treat it as a C or C++ header file.  You will probably want to use a
@@ -13012,10 +13005,8 @@ the current compilation.  You can't use 
 compilation.
 
 @item
-The precompiled header file must be produced by the same compiler
-version and configuration as the current compilation is using.
-The easiest way to guarantee this is to use the same compiler binary
-for creating and using precompiled headers.
+The precompiled header file must have been produced by the same compiler
+binary as the current compilation is using.
 
 @item
 Any macros defined before the precompiled header is included must
@@ -13052,7 +13043,10 @@ which options are safe to change and whi
 is to use exactly the same options when generating and using the
 precompiled header.  The following are known to be safe:
 
-@gccoptlist{-fpreprocessed -pedantic-errors}
+@gccoptlist{-fpreprocessed
+-fsched-interblock -fsched-spec -fsched-spec-load -fsched-spec-load-dangerous
+-fsched-verbose=<number> -fschedule-insns
+-pedantic-errors}
 
 @end itemize
 
Index: objc/Make-lang.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/objc/Make-lang.in,v
retrieving revision 1.78
diff -u -p -u -p -r1.78 Make-lang.in
--- objc/Make-lang.in	13 Apr 2005 19:28:25 -0000	1.78
+++ objc/Make-lang.in	17 May 2005 22:26:26 -0000
@@ -50,9 +50,20 @@ objc-warn = $(STRICT_WARN)
 # Language-specific object files for Objective C.
 OBJC_OBJS = objc/objc-lang.o objc/objc-act.o
 
-cc1obj$(exeext): $(OBJC_OBJS) $(C_AND_OBJC_OBJS) $(BACKEND) $(LIBDEPS)
+cc1obj-dummy$(exeext): $(OBJC_OBJS) $(C_AND_OBJC_OBJS) dummy-checksum.o $(BACKEND) $(LIBDEPS)
 	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
-		$(OBJC_OBJS) $(C_AND_OBJC_OBJS) $(BACKEND) $(LIBS)
+	      $(OBJC_OBJS) $(C_AND_OBJC_OBJS) dummy-checksum.o \
+	      $(BACKEND) $(LIBS)
+
+cc1obj-checksum.c : cc1obj-dummy$(exeext) build/genchecksum$(exeext)
+	build/genchecksum$(exeext) cc1obj-dummy$(exeext) > $@
+
+cc1obj-checksum.o : cc1obj-checksum.c
+
+cc1obj$(exeext): $(OBJC_OBJS) $(C_AND_OBJC_OBJS) cc1obj-checksum.o $(BACKEND) $(LIBDEPS)
+	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
+	      $(OBJC_OBJS) $(C_AND_OBJC_OBJS) cc1obj-checksum.o \
+	      $(BACKEND) $(LIBS)
 
 # Objective C language specific files.
 
Index: objcp/Make-lang.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/objcp/Make-lang.in,v
retrieving revision 1.3
diff -u -p -u -p -r1.3 Make-lang.in
--- objcp/Make-lang.in	17 May 2005 20:00:33 -0000	1.3
+++ objcp/Make-lang.in	17 May 2005 22:26:27 -0000
@@ -51,9 +51,19 @@ objcp-warn = $(STRICT_WARN) -DOBJCPLUS -
 OBJCXX_OBJS = objcp/objcp-act.o objcp/objcp-lang.o objcp/objcp-decl.o \
    $(CXX_AND_OBJCXX_OBJS)
 
-cc1objplus$(exeext): $(OBJCXX_OBJS) $(BACKEND) $(LIBDEPS)
+cc1objplus-dummy$(exeext): $(OBJCXX_OBJS) dummy-checksum.o $(BACKEND) \
+		$(LIBDEPS)
 	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
-		$(OBJCXX_OBJS) $(BACKEND) $(LIBS)
+		$(OBJCXX_OBJS) dummy-checksum.o $(BACKEND) $(LIBS)
+
+cc1objplus-checksum.c : cc1objplus-dummy$(exeext) build/genchecksum$(exeext)
+	build/genchecksum$(exeext) cc1objplus-dummy$(exeext) > $@
+
+cc1objplus-checksum.o : cc1objplus-checksum.c
+
+cc1objplus$(exeext): $(OBJCXX_OBJS) cc1objplus-checksum.o $(BACKEND) $(LIBDEPS)
+	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
+		$(OBJCXX_OBJS) cc1objplus-checksum.o $(BACKEND) $(LIBS)
 
 # Objective C++ language specific files.
 
============================================================


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