mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-06 06:20:55 -08:00
Make fingerprint handling compatible with LTO
Tell the compiler that the fingerprint variable is modified unpredictably. * lib/fingerprint.h (fingerprint): Remove const. * lib/fingerprint.c (fingerprint): Likewise. * src/pdumper.c (Fdump_emacs_portable): Cast fingerprint variable. (pdumper_load): Likewise. * lib-src/make-fingerprint.c (main): Likewise.
This commit is contained in:
parent
bff64115a0
commit
fc41b0610e
4 changed files with 9 additions and 6 deletions
|
|
@ -144,7 +144,8 @@ main (int argc, char **argv)
|
|||
|
||||
for (char *finger = buf;
|
||||
(finger = memmem (finger, buf + chunksz - finger,
|
||||
fingerprint, sizeof fingerprint));
|
||||
(unsigned char *) fingerprint,
|
||||
sizeof fingerprint));
|
||||
finger++)
|
||||
{
|
||||
if (! (fseeko (f, finger - buf, SEEK_SET) == 0
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
|
|||
by a fingerprint of the temporary Emacs executable that was built
|
||||
along the way. */
|
||||
|
||||
unsigned char const fingerprint[] =
|
||||
volatile unsigned char fingerprint[] =
|
||||
{
|
||||
0xDE,
|
||||
0x86,
|
||||
|
|
|
|||
|
|
@ -24,6 +24,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
|
|||
Emacs. This way, we have a unique value that we can use to pair
|
||||
data files (like a portable dump image) with a specific build of
|
||||
Emacs. */
|
||||
extern unsigned char const fingerprint[32];
|
||||
extern volatile unsigned char fingerprint[32];
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -4101,7 +4101,8 @@ types. */)
|
|||
ctx->header.magic[0] = '!'; /* Note that dump is incomplete. */
|
||||
|
||||
verify (sizeof (fingerprint) == sizeof (ctx->header.fingerprint));
|
||||
memcpy (ctx->header.fingerprint, fingerprint, sizeof (fingerprint));
|
||||
memcpy (ctx->header.fingerprint, (unsigned char *) fingerprint,
|
||||
sizeof (fingerprint));
|
||||
|
||||
const dump_off header_start = ctx->offset;
|
||||
dump_fingerprint ("dumping fingerprint", ctx->header.fingerprint);
|
||||
|
|
@ -5359,9 +5360,10 @@ pdumper_load (const char *dump_filename)
|
|||
|
||||
err = PDUMPER_LOAD_VERSION_MISMATCH;
|
||||
verify (sizeof (header->fingerprint) == sizeof (fingerprint));
|
||||
if (memcmp (header->fingerprint, fingerprint, sizeof (fingerprint)) != 0)
|
||||
if (memcmp (header->fingerprint, (unsigned char *) fingerprint,
|
||||
sizeof (fingerprint)) != 0)
|
||||
{
|
||||
dump_fingerprint ("desired fingerprint", fingerprint);
|
||||
dump_fingerprint ("desired fingerprint", (unsigned char *) fingerprint);
|
||||
dump_fingerprint ("found fingerprint", header->fingerprint);
|
||||
goto out;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue