emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 5e1a8d5: Fix the unexec build on GNU/Linux


From: Eli Zaretskii
Subject: master 5e1a8d5: Fix the unexec build on GNU/Linux
Date: Wed, 19 May 2021 10:45:23 -0400 (EDT)

branch: master
commit 5e1a8d5654d97d2631ad67ebb88be4d2eec7d408
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>

    Fix the unexec build on GNU/Linux
    
    The unexec build on GNU/Linux must use HYBRID_MALLOC (gmalloc.c) and
    sheap.c.  This was inadvertently disabled because a configure-time
    test for 'sbrk' was moved as side effect of an unrelated change.
    
    * configure.ac: Test for 'sbrk' before using the result in the
    decision about SYSTEM_MALLOC and HYBRID_MALLOC.
    (HYBRID_MALLOC): Prevent Gnulib from redirecting 'free' to its
    replacement 'rpl_free'.
    
    * lib/Makefile.in (not_emacs_OBJECTS): Add mallooc/%.o and free.o.
---
 configure.ac    | 8 +++++++-
 lib/Makefile.in | 4 +++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 3df4359..d35ac6d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2273,6 +2273,9 @@ doug_lea_malloc=$emacs_cv_var_doug_lea_malloc
 hybrid_malloc=
 system_malloc=yes
 
+dnl This must be before the test of $ac_cv_func_sbrk below.
+AC_CHECK_FUNCS_ONCE([sbrk])
+
 test $with_unexec = yes &&
 case "$opsys" in
   ## darwin ld insists on the use of malloc routines in the System framework.
@@ -2306,6 +2309,9 @@ elif test "$hybrid_malloc" = yes; then
   GNU_MALLOC_reason=" (only before dumping)"
   GMALLOC_OBJ=gmalloc.o
   VMLIMIT_OBJ=
+  # FIXME: This is to prevent Gnulib from redirecting 'free' to its
+  # replacement, instead of 'hybrid_free' in gmalloc.c.
+  gl_cv_func_free_preserves_errno=yes
 else
   test "$doug_lea_malloc" != "yes" && GMALLOC_OBJ=gmalloc.o
   VMLIMIT_OBJ=vm-limit.o
@@ -4677,7 +4683,7 @@ AC_CHECK_HEADERS(valgrind/valgrind.h)
 
 AC_CHECK_MEMBERS([struct unipair.unicode], [], [], [[#include <linux/kd.h>]])
 
-AC_CHECK_FUNCS_ONCE([__lsan_ignore_object sbrk])
+AC_CHECK_FUNCS_ONCE([__lsan_ignore_object])
 
 AC_FUNC_FORK
 
diff --git a/lib/Makefile.in b/lib/Makefile.in
index 6c7a443..ec92f92 100644
--- a/lib/Makefile.in
+++ b/lib/Makefile.in
@@ -69,7 +69,9 @@ Makefile: ../config.status $(srcdir)/Makefile.in
 # Object modules that need not be built for Emacs.
 # Emacs does not need e-regex.o (it has its own regex-emacs.c),
 # and building it would just waste time.
-not_emacs_OBJECTS = regex.o
+# Emacs also doesn't need the dynarray-related files in malloc/ and
+# the replacement 'free'.
+not_emacs_OBJECTS = regex.o malloc/%.o free.o
 
 libgnu_a_OBJECTS = fingerprint.o $(gl_LIBOBJS) \
   $(patsubst %.c,%.o,$(filter %.c,$(libgnu_a_SOURCES)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]