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]

Re: PR/15448: add a compiler timestamp to PCH files (take 3)


On Sat, 2005-02-19 at 18:58 -0800, Geoff Keating wrote:
> The proper solution is to implement a validation check that actually 
> does check that the executable is the same.  For instance, create a 
> small C file that contains a checksum of the executable, initially
> all 
> zeros, and link (possibly with -s to strip) the executable with that 
> file; then checksum the result, create a new C file that has the 
> correct checksum, and link again.  (You could avoid the double link, 
> but doing so portably would be inelegant, and linking doesn't take
> very 
> long.)

Why not simply generate a md5sum of all the relevant compiler source
files as a magic number and integrate that into the PCH file.
Surely an overkill that is much more strict than necessary (any comment
change will affect the number), but simple, very fast both at write and
read times, compact and sure...


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