[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master fc41b06: Make fingerprint handling compatible with
From: |
Andreas Schwab |
Subject: |
[Emacs-diffs] master fc41b06: Make fingerprint handling compatible with LTO |
Date: |
Tue, 9 Jul 2019 15:41:52 -0400 (EDT) |
branch: master
commit fc41b0610e5bb204dd9905f89e235ea801e7a4ea
Author: Andreas Schwab <address@hidden>
Commit: Andreas Schwab <address@hidden>
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.
---
lib-src/make-fingerprint.c | 3 ++-
lib/fingerprint.c | 2 +-
lib/fingerprint.h | 2 +-
src/pdumper.c | 8 +++++---
4 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/lib-src/make-fingerprint.c b/lib-src/make-fingerprint.c
index 5779e0d..2417548 100644
--- a/lib-src/make-fingerprint.c
+++ b/lib-src/make-fingerprint.c
@@ -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
diff --git a/lib/fingerprint.c b/lib/fingerprint.c
index e55de9c..2cc1973 100644
--- a/lib/fingerprint.c
+++ b/lib/fingerprint.c
@@ -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,
diff --git a/lib/fingerprint.h b/lib/fingerprint.h
index 0b195fd..ba2e740 100644
--- a/lib/fingerprint.h
+++ b/lib/fingerprint.h
@@ -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
diff --git a/src/pdumper.c b/src/pdumper.c
index 8b630d2..7d29d3c 100644
--- a/src/pdumper.c
+++ b/src/pdumper.c
@@ -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;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master fc41b06: Make fingerprint handling compatible with LTO,
Andreas Schwab <=