mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-09 22:51:29 +08:00
dummy-checksum.c: New.
2005-05-18 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-18 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-18 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-18 Geoffrey Keating <geoffk@apple.com> * Make-lang.in (cc1objplus-dummy): New. (cc1objplus-checksum.c): New. (cc1objplus-checksum.o): New. (cc1objplus): Add cc1objplus-checksum.o. From-SVN: r99928
This commit is contained in:
parent
045a8eb388
commit
3fd30b88df
@ -1,5 +1,40 @@
|
||||
2005-05-18 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.
|
||||
|
||||
* rs6000/predicates.md (fix_trunc_dest_operand): New.
|
||||
* rs6000/rs6000.md (fix_truncdfsi2): Use fix_trunc_dest_operand.
|
||||
Check that a memory operand is valid before trying to use it.
|
||||
|
@ -983,12 +983,12 @@ STAGECOPYSTUFF = insn-flags.h insn-config.h insn-codes.h \
|
||||
|
||||
# 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) $(SYSTEM_H) coretypes.h $(TM_H) $(GCC_H)
|
||||
|
||||
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-rtl.o gensupport.o genattrtab.o \
|
||||
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 fastcompare-lean fastcompare3-lean fastcom
|
||||
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; \
|
||||
|
@ -859,6 +859,10 @@ extern void c_common_read_pch (cpp_reader *pfile, const char *name, int fd,
|
||||
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);
|
||||
|
@ -863,6 +863,11 @@ c_common_handle_option (size_t scode, const char *arg, int value)
|
||||
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 ();
|
||||
|
129
gcc/c-pch.c
129
gcc/c-pch.c
@ -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);
|
||||
gcc_assert (memcmp (executable_checksum, no_checksum, 16) != 0);
|
||||
|
||||
v.host_machine_length = strlen (host_machine);
|
||||
v.target_machine_length = strlen (target_machine);
|
||||
v.version_length = strlen (version_string);
|
||||
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, const char *name, int fd)
|
||||
{
|
||||
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, const char *name, int fd)
|
||||
}
|
||||
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, const char *name, int fd)
|
||||
/* 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);
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -1,3 +1,10 @@
|
||||
2005-05-18 Geoffrey Keating <geoffk@apple.com>
|
||||
|
||||
* Make-lang.in (cc1plus-dummy): New.
|
||||
(cc1plus-checksum.c): New.
|
||||
(cc1plus-checksum.o): New.
|
||||
(cc1plus): Add cc1plus-checksum.o.
|
||||
|
||||
2005-05-17 H.J. Lu <hongjiu.lu@intel.com>
|
||||
|
||||
PR C++/19664
|
||||
|
@ -91,9 +91,18 @@ CXX_OBJS = cp/cp-lang.o stub-objc.o $(CXX_AND_OBJCXX_OBJS)
|
||||
# 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
|
||||
|
@ -12941,13 +12941,6 @@ build the project. To make builds faster, GCC allows users to
|
||||
`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 a C precompiled header for a C++
|
||||
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 which are not; the safest choice
|
||||
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
|
||||
|
||||
|
1
gcc/dummy-checksum.c
Normal file
1
gcc/dummy-checksum.c
Normal file
@ -0,0 +1 @@
|
||||
const unsigned char executable_checksum[16] = { 0 };
|
77
gcc/genchecksum.c
Normal file
77
gcc/genchecksum.c
Normal file
@ -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;
|
||||
}
|
@ -1,3 +1,10 @@
|
||||
2005-05-18 Geoffrey Keating <geoffk@apple.com>
|
||||
|
||||
* Make-lang.in (cc1obj-dummy): New.
|
||||
(cc1obj-checksum.c): New.
|
||||
(cc1obj-checksum.o): New.
|
||||
(cc1obj): Add cc1obj-checksum.o.
|
||||
|
||||
2005-05-18 Mike Stump <mrs@apple.com>
|
||||
|
||||
PR objc/21641
|
||||
|
@ -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.
|
||||
|
||||
|
@ -1,3 +1,10 @@
|
||||
2005-05-18 Geoffrey Keating <geoffk@apple.com>
|
||||
|
||||
* Make-lang.in (cc1objplus-dummy): New.
|
||||
(cc1objplus-checksum.c): New.
|
||||
(cc1objplus-checksum.o): New.
|
||||
(cc1objplus): Add cc1objplus-checksum.o.
|
||||
|
||||
2005-05-17 Mike Stump <mrs@apple.com>
|
||||
|
||||
Yet more Objective-C++...
|
||||
|
@ -51,9 +51,19 @@ objcp-warn = $(STRICT_WARN) -DOBJCPLUS -I$(srcdir)/objc -I$(srcdir)/cp
|
||||
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.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user