PR/15448: add a compiler timestamp to PCH files

Mike Stump mrs@apple.com
Fri Feb 18 21:02:00 GMT 2005


On Feb 17, 2005, at 11:22 AM, Mike Stump wrote:

> On Feb 17, 2005, at 8:12 AM, Paolo Bonzini wrote:
>> The thing I don't like about that approach is that doing the check 
>> in gt_pch_restore would be too late to stop using the PCH, and we 
>> would have to fail with a hard error.
>
> If there is a way to do it at c_common_valid_pch time, that would be 
> best.

If someone really wants a sketch for an awesome validator...

mrs $ mkdiff Makefile.~1~
Doing diffs in Makefile.~1~:
--- Makefile.~1~        2005-02-14 13:48:54.000000000 -0800
+++ Makefile    2005-02-17 21:54:24.000000000 -0800
@@ -1237,9 +1237,11 @@ gcc-cross: xgcc$(exeext)
         cp xgcc$(exeext) gcc-cross$(exeext)

# APPLE LOCAL order files  --ilr
-cc1$(exeext): $(C_OBJS) $(BACKEND) $(LIBDEPS)
+gch-cksum.c cc1$(exeext): $(C_OBJS) $(BACKEND) $(LIBDEPS) gch-cksum.c
         $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o cc1$(exeext) \
-               $(C_OBJS) $(BACKEND) $(LIBS) $(CC1_ORDER_FLAGS)
+               $(C_OBJS) $(BACKEND) $(LIBS) $(CC1_ORDER_FLAGS) 
gch-cksum.c
+       echo 'char gch_cksum[] = "'`nm cc1$(exeext) | cksum` `nm 
cc1$(exeext) | md5`'";' >tmp-gch-cksum.c
+       $(SHELL) $(srcdir)/../move-if-change tmp-gch-cksum.c gch-cksum.c

# Build the version of limits.h that we will install.
xlimits.h: glimits.h limitx.h limity.h
--------------

Then, just strcmp them at validation time.  This is stable (if PCH is 
going to work) and validates a slight superset of what needs checking...



More information about the Gcc-patches mailing list