Commit fc41b061 authored by Andreas Schwab's avatar Andreas Schwab

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.
parent bff64115
Pipeline #2340 failed with stage
in 90 minutes
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment