+2003-10-22 Mark Mitchell <mark@codesourcery.com>
+
+ * c-pch.c (struct c_pch_validity): Add pch_init field.
+ (pch_init): Set it.
+ (c_common_valid_pch): Check it.
+ (get_ident): Bump the PCH version number.
+
2003-10-22 David Taylor <dtaylor@emc.com>
PR debug/12500
unsigned char target_machine_length;
unsigned char version_length;
unsigned char debug_info_type;
+ void (*pch_init) (void);
};
struct c_pch_header
v.version_length = strlen (version_string);
v.debug_info_type = write_symbols;
+ v.pch_init = &pch_init;
if (fwrite (get_ident(), IDENT_LENGTH, 1, f) != 1
|| fwrite (&v, sizeof (v), 1, f) != 1
|| fwrite (host_machine, v.host_machine_length, 1, f) != 1
return 2;
}
+ /* 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. */
+ if (v.pch_init != &pch_init)
+ {
+ if (cpp_get_options (pfile)->warn_invalid_pch)
+ cpp_error (pfile, DL_WARNING,
+ "%s: had text segment at different address", name);
+ return 2;
+ }
+
/* Check the preprocessor macros are the same as when the PCH was
generated. */