[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master ebecafb: Port new fingerprinting scheme to clang +
From: |
Paul Eggert |
Subject: |
[Emacs-diffs] master ebecafb: Port new fingerprinting scheme to clang + LTO |
Date: |
Sat, 4 May 2019 16:16:20 -0400 (EDT) |
branch: master
commit ebecafbd19e2ba55ba90bfc9f7de88f4742479ad
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>
Port new fingerprinting scheme to clang + LTO
* lib-src/make-fingerprint.c (main): Don't consider multiple
instances of the fingerprint to be an error, as this can
happen with clang and -flto. Instead, replace all instances
of the fingerprint. There is a tiny chance that this will
silently corrupt the Emacs executable.
This patch suggests that we should go back to fingerprinting
the inputs to the linker instead of its output, as the new
fingerprinting scheme is unnecessarily complicated and this
complexity reduces reliability. The old scheme (i.e., before
commit 2019-05-14T23:31:address@hidden) was simpler
and more portable and good enough, and it's looking like it
would be less trouble in practice than the new scheme.
---
lib-src/make-fingerprint.c | 32 ++++++++++++++------------------
1 file changed, 14 insertions(+), 18 deletions(-)
diff --git a/lib-src/make-fingerprint.c b/lib-src/make-fingerprint.c
index 79bd007..5779e0d 100644
--- a/lib-src/make-fingerprint.c
+++ b/lib-src/make-fingerprint.c
@@ -140,29 +140,25 @@ main (int argc, char **argv)
}
else
{
- char *finger = memmem (buf, chunksz, fingerprint, sizeof fingerprint);
- if (!finger)
- {
- fprintf (stderr, "%s: %s: missing fingerprint\n", prog, file);
- return EXIT_FAILURE;
- }
- else if (memmem (finger + 1, buf + chunksz - (finger + 1),
- fingerprint, sizeof fingerprint))
- {
- fprintf (stderr, "%s: %s: two occurrences of fingerprint\n",
- prog, file);
- return EXIT_FAILURE;
- }
+ bool fingered = false;
- if (fseeko (f, finger - buf, SEEK_SET) != 0)
+ for (char *finger = buf;
+ (finger = memmem (finger, buf + chunksz - finger,
+ fingerprint, sizeof fingerprint));
+ finger++)
{
- perror (file);
- return EXIT_FAILURE;
+ if (! (fseeko (f, finger - buf, SEEK_SET) == 0
+ && fwrite (digest, 1, sizeof digest, f) == sizeof digest))
+ {
+ perror (file);
+ return EXIT_FAILURE;
+ }
+ fingered = true;
}
- if (fwrite (digest, 1, sizeof digest, f) != sizeof digest)
+ if (!fingered)
{
- perror (file);
+ fprintf (stderr, "%s: %s: missing fingerprint\n", prog, file);
return EXIT_FAILURE;
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master ebecafb: Port new fingerprinting scheme to clang + LTO,
Paul Eggert <=