diff options
| author | Paul Eggert | 2019-04-14 16:31:24 -0700 |
|---|---|---|
| committer | Paul Eggert | 2019-04-14 17:06:09 -0700 |
| commit | 5c2f94a182a1154766154040eb5b4b39275fd3b6 (patch) | |
| tree | 04ae030b12f1e993173fe33b34ea1975ec9340c7 /src | |
| parent | 661f44946d2bba21d16d718cf86372345c929a39 (diff) | |
| download | emacs-5c2f94a182a1154766154040eb5b4b39275fd3b6.tar.gz emacs-5c2f94a182a1154766154040eb5b4b39275fd3b6.zip | |
Replace executable’s fingerprint in place
* admin/merge-gnulib (GNULIB_MODULES): Add memmem-simple.
(AVOIDED_MODULES): Add memchr.
* configure.ac (HAVE_PDUMPER): AC_SUBST it, too, for use in makefiles.
* lib/Makefile.in (libgnu_a_OBJECTS): Add fingerprint.o.
* lib/fingerprint.c: New file.
* lib/memmem.c, lib/str-two-way.h, m4/memmem.m4: New files,
copied from Gnulib.
* lib/fingerprint.h: Rename from src/fingerprint.h.
* lib-src/make-fingerprint.c: Include limits.h, sys/stat.h,
fingerprint.h, intprops.h, min-max.h.
(SSIZE_MAX): New macro, if not already defined.
(main): Without -r, Replace the fingerprint in the input file
instead of generating a fingerprint.c.
* lib/Makefile.in (libgnu_a_OBJECTS): Add fingerprint.o.
* lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate.
* src/Makefile.in (HAVE_PDUMPER, MAKE_PDUMPER_FINGERPRINT):
New macros.
(temacs$(EXEEXT)): Use them to replace the fingerprint instead
of precalculating it.
(mostlyclean, ctagsfiles1): Do not worry about fingerprint.c.
Diffstat (limited to 'src')
| -rw-r--r-- | src/Makefile.in | 30 | ||||
| -rw-r--r-- | src/fingerprint.h | 29 |
2 files changed, 18 insertions, 41 deletions
diff --git a/src/Makefile.in b/src/Makefile.in index 2348c8dae4c..3aab5270a4a 100644 --- a/src/Makefile.in +++ b/src/Makefile.in | |||
| @@ -332,6 +332,7 @@ UNEXEC_OBJ = @UNEXEC_OBJ@ | |||
| 332 | 332 | ||
| 333 | DUMPING=@DUMPING@ | 333 | DUMPING=@DUMPING@ |
| 334 | CHECK_STRUCTS = @CHECK_STRUCTS@ | 334 | CHECK_STRUCTS = @CHECK_STRUCTS@ |
| 335 | HAVE_PDUMPER = @HAVE_PDUMPER@ | ||
| 335 | 336 | ||
| 336 | # 'make' verbosity. | 337 | # 'make' verbosity. |
| 337 | AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ | 338 | AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ |
| @@ -627,19 +628,25 @@ LIBEGNU_ARCHIVE = $(lib)/lib$(if $(HYBRID_MALLOC),e)gnu.a | |||
| 627 | $(LIBEGNU_ARCHIVE): $(config_h) | 628 | $(LIBEGNU_ARCHIVE): $(config_h) |
| 628 | $(MAKE) -C $(dir $@) all | 629 | $(MAKE) -C $(dir $@) all |
| 629 | 630 | ||
| 630 | FINGERPRINTED = $(LIBXMENU) $(ALLOBJS) $(LIBEGNU_ARCHIVE) $(EMACSRES) | 631 | ifeq ($(HAVE_PDUMPER),yes) |
| 631 | fingerprint.c: $(FINGERPRINTED) $(libsrc)/make-fingerprint$(EXEEXT) | 632 | MAKE_PDUMPER_FINGERPRINT = $(libsrc)/make-fingerprint$(EXEEXT) |
| 632 | $(AM_V_GEN)$(libsrc)/make-fingerprint$(EXEEXT) $(FINGERPRINTED) >$@.tmp | 633 | else |
| 633 | $(AM_V_at)mv $@.tmp $@ | 634 | MAKE_PDUMPER_FINGERPRINT = |
| 635 | endif | ||
| 634 | 636 | ||
| 635 | ## We have to create $(etc) here because init_cmdargs tests its | 637 | ## We have to create $(etc) here because init_cmdargs tests its |
| 636 | ## existence when setting Vinstallation_directory (FIXME?). | 638 | ## existence when setting Vinstallation_directory (FIXME?). |
| 637 | ## This goes on to affect various things, and the emacs binary fails | 639 | ## This goes on to affect various things, and the emacs binary fails |
| 638 | ## to start if Vinstallation_directory has the wrong value. | 640 | ## to start if Vinstallation_directory has the wrong value. |
| 639 | temacs$(EXEEXT): fingerprint.o $(charsets) $(charscript) | 641 | temacs$(EXEEXT): $(LIBXMENU) $(ALLOBJS) $(LIBEGNU_ARCHIVE) $(EMACSRES) \ |
| 640 | $(AM_V_CCLD)$(CC) -o $@ $(ALL_CFLAGS) $(TEMACS_LDFLAGS) $(LDFLAGS) \ | 642 | $(charsets) $(charscript) $(MAKE_PDUMPER_FINGERPRINT) |
| 641 | $(ALLOBJS) fingerprint.o \ | 643 | $(AM_V_CCLD)$(CC) -o $@.tmp \ |
| 642 | $(LIBEGNU_ARCHIVE) $(W32_RES_LINK) $(LIBES) | 644 | $(ALL_CFLAGS) $(TEMACS_LDFLAGS) $(LDFLAGS) \ |
| 645 | $(ALLOBJS) $(LIBEGNU_ARCHIVE) $(W32_RES_LINK) $(LIBES) | ||
| 646 | ifeq ($(HAVE_PDUMPER),yes) | ||
| 647 | $(AM_V_at)$(MAKE_PDUMPER_FINGERPRINT) $@.tmp | ||
| 648 | endif | ||
| 649 | $(AM_V_at)mv $@.tmp $@ | ||
| 643 | $(MKDIR_P) $(etc) | 650 | $(MKDIR_P) $(etc) |
| 644 | ifeq ($(DUMPING),unexec) | 651 | ifeq ($(DUMPING),unexec) |
| 645 | ifneq ($(PAXCTL_notdumped),) | 652 | ifneq ($(PAXCTL_notdumped),) |
| @@ -676,7 +683,7 @@ ns-app: emacs$(EXEEXT) $(pdmp) | |||
| 676 | 683 | ||
| 677 | mostlyclean: | 684 | mostlyclean: |
| 678 | rm -f temacs$(EXEEXT) core ./*.core \#* ./*.o | 685 | rm -f temacs$(EXEEXT) core ./*.core \#* ./*.o |
| 679 | rm -f dmpstruct.h fingerprint.c | 686 | rm -f dmpstruct.h |
| 680 | rm -f emacs.pdmp | 687 | rm -f emacs.pdmp |
| 681 | rm -f ../etc/DOC | 688 | rm -f ../etc/DOC |
| 682 | rm -f bootstrap-emacs$(EXEEXT) $(bootstrap_pdmp) | 689 | rm -f bootstrap-emacs$(EXEEXT) $(bootstrap_pdmp) |
| @@ -716,10 +723,9 @@ ETAGS = ../lib-src/etags${EXEEXT} | |||
| 716 | ${ETAGS}: FORCE | 723 | ${ETAGS}: FORCE |
| 717 | $(MAKE) -C $(dir $@) $(notdir $@) | 724 | $(MAKE) -C $(dir $@) $(notdir $@) |
| 718 | 725 | ||
| 719 | # Remove macuvs.h and fingerprint.c since they'd cause `src/emacs` | 726 | # Remove macuvs.h since it'd cause `src/emacs` |
| 720 | # to be built before we can get TAGS. | 727 | # to be built before we can get TAGS. |
| 721 | ctagsfiles1 = $(filter-out ${srcdir}/macuvs.h ${srcdir}/fingerprint.c, \ | 728 | ctagsfiles1 = $(filter-out ${srcdir}/macuvs.h, $(wildcard ${srcdir}/*.[hc])) |
| 722 | $(wildcard ${srcdir}/*.[hc])) | ||
| 723 | ctagsfiles2 = $(wildcard ${srcdir}/*.m) | 729 | ctagsfiles2 = $(wildcard ${srcdir}/*.m) |
| 724 | 730 | ||
| 725 | ## In out-of-tree builds, TAGS are generated in the build dir, like | 731 | ## In out-of-tree builds, TAGS are generated in the build dir, like |
diff --git a/src/fingerprint.h b/src/fingerprint.h deleted file mode 100644 index 0b195fd0ca7..00000000000 --- a/src/fingerprint.h +++ /dev/null | |||
| @@ -1,29 +0,0 @@ | |||
| 1 | /* Header file for the Emacs build fingerprint. | ||
| 2 | |||
| 3 | Copyright (C) 2016, 2018-2019 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | This file is part of GNU Emacs. | ||
| 6 | |||
| 7 | GNU Emacs is free software: you can redistribute it and/or modify | ||
| 8 | it under the terms of the GNU General Public License as published by | ||
| 9 | the Free Software Foundation, either version 3 of the License, or (at | ||
| 10 | your option) any later version. | ||
| 11 | |||
| 12 | GNU Emacs is distributed in the hope that it will be useful, | ||
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | GNU General Public License for more details. | ||
| 16 | |||
| 17 | You should have received a copy of the GNU General Public License | ||
| 18 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | ||
| 19 | |||
| 20 | #ifndef EMACS_FINGERPRINT_H | ||
| 21 | #define EMACS_FINGERPRINT_H | ||
| 22 | |||
| 23 | /* We generate fingerprint.c and fingerprint.o from all the sources in | ||
| 24 | Emacs. This way, we have a unique value that we can use to pair | ||
| 25 | data files (like a portable dump image) with a specific build of | ||
| 26 | Emacs. */ | ||
| 27 | extern unsigned char const fingerprint[32]; | ||
| 28 | |||
| 29 | #endif | ||