* configure.ac (hybrid malloc): Simplify configuration.
(SHEAP_OBJ): Remove; no longer needed.
(HYBRID_MALLOC): New var. Subst it.
(HYBRID_MALLOC_LIB): New Automake conditional.
* lib/Makefile.am (noinst_LIBRARIES): Add libegnu.a only if
HYBRID_MALLOC_LIB.
(libegnu_a_CPPFLAGS): Omit AM_CPPFLAGS; not needed.
(MOSTLYCLEANFILES): Add libegnu.a.
* src/Makefile.in (SHEAP_OBJ): Remove.
(HYBRID_MALLOC): New macro.
(base_obj): Use it to conditionally add sheap.o.
(LIBEGNU_ARCHIVE): New macro.
($(LIBEGNU_ARCHIVE)): New rule, replacing $(lib)/libegnu.a.
All uses of the latter replaced by the former.
* src/alloc.c (USE_ALIGNED_ALLOC): Simplify configuration.
Correct misspelling ALIGNED_ALLOC to HAVE_ALIGNED_ALLOC.
* src/gmalloc.c: Update comment.
* src/lisp.h (aligned_alloc)
[!DOUG_LEA_MALLOC && !HYBRID_MALLOC && !SYSTEM_MALLOC]:
New decl.
(Bug#22086)
esac
if test "${system_malloc}" != yes && test "${doug_lea_malloc}" != yes \
- && test "${UNEXEC_OBJ}" = unexelf.o && test "${hybrid_malloc}" != no; then
+ && test "${UNEXEC_OBJ}" = unexelf.o; then
hybrid_malloc=yes
fi
GMALLOC_OBJ=
-SHEAP_OBJ=
+HYBRID_MALLOC=
if test "${system_malloc}" = "yes"; then
AC_DEFINE([SYSTEM_MALLOC], 1,
[Define to 1 to use the system memory allocator, even if it is not
elif test "$hybrid_malloc" = yes; then
AC_DEFINE(HYBRID_MALLOC, 1,
[Define to use gmalloc before dumping and the system malloc after.])
+ HYBRID_MALLOC=1
GNU_MALLOC=
GNU_MALLOC_reason="only before dumping"
GMALLOC_OBJ=gmalloc.o
- SHEAP_OBJ=sheap.o
VMLIMIT_OBJ=
else
test "$doug_lea_malloc" != "yes" && GMALLOC_OBJ=gmalloc.o
of the main data segment.])
fi
fi
+AC_SUBST([HYBRID_MALLOC])
+AM_CONDITIONAL([HYBRID_MALLOC_LIB], [test -n "$HYBRID_MALLOC"])
AC_SUBST(GMALLOC_OBJ)
-AC_SUBST(SHEAP_OBJ)
AC_SUBST(VMLIMIT_OBJ)
if test "$doug_lea_malloc" = "yes" && test "$hybrid_malloc" != yes; then
+# Copyright 2016 Free Software Foundation, Inc.
+
+# This file is part of GNU Emacs.
+
+# GNU Emacs is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# GNU Emacs is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
+
BUILT_SOURCES =
CLEANFILES =
EXTRA_DIST =
libgnu_a_SOURCES += openat-die.c save-cwd.c
endif
+if HYBRID_MALLOC_LIB
noinst_LIBRARIES += libegnu.a
+endif
libegnu_a_SOURCES = $(libgnu_a_SOURCES)
libegnu_a_LIBADD = $(patsubst %.o,e-%.o,$(libgnu_a_LIBADD))
EXTRA_libegnu_a_SOURCES = $(EXTRA_libgnu_a_SOURCES)
libegnu_a_SHORTNAME = e
-
-libegnu_a_CPPFLAGS = $(AM_CPPFLAGS) -Demacs
+libegnu_a_CPPFLAGS = -Demacs
+MOSTLYCLEANFILES += libegnu.a
.PHONY: bootstrap-clean
## widget.o if USE_X_TOOLKIT, otherwise empty.
WIDGET_OBJ=@WIDGET_OBJ@
-## sheap.o if HYBRID_MALLOC, otherwise empty.
-SHEAP_OBJ=@SHEAP_OBJ@
+HYBRID_MALLOC = @HYBRID_MALLOC@
## cygw32.o if CYGWIN, otherwise empty.
CYGWIN_OBJ=@CYGWIN_OBJ@
doprnt.o intervals.o textprop.o composite.o xml.o $(NOTIFY_OBJ) \
$(XWIDGETS_OBJ) \
profiler.o decompress.o \
+ $(if $(HYBRID_MALLOC),sheap.o) \
$(SHEAP_OBJ) \
$(MSDOS_OBJ) $(MSDOS_X_OBJ) $(NS_OBJ) $(CYGWIN_OBJ) $(FONT_OBJ) \
$(W32_OBJ) $(WINDOW_SYSTEM_OBJ) $(XGSELOBJ)
$(ALLOBJS): globals.h
-$(lib)/libegnu.a: $(config_h)
+LIBEGNU_ARCHIVE = $(lib)/lib$(if $(HYBRID_MALLOC),e)gnu.a
+
+$(LIBEGNU_ARCHIVE): $(config_h)
$(MAKE) -C $(lib) all
## We have to create $(etc) here because init_cmdargs tests its
## This goes on to affect various things, and the emacs binary fails
## to start if Vinstallation_directory has the wrong value.
temacs$(EXEEXT): $(LIBXMENU) $(ALLOBJS) \
- $(lib)/libegnu.a $(EMACSRES) ${charsets} ${charscript}
+ $(LIBEGNU_ARCHIVE) $(EMACSRES) ${charsets} ${charscript}
$(AM_V_CCLD)$(CC) $(ALL_CFLAGS) $(TEMACS_LDFLAGS) $(LDFLAGS) \
- -o temacs $(ALLOBJS) $(lib)/libegnu.a $(W32_RES_LINK) $(LIBES)
+ -o temacs $(ALLOBJS) $(LIBEGNU_ARCHIVE) $(W32_RES_LINK) $(LIBES)
$(MKDIR_P) $(etc)
ifneq ($(CANNOT_DUMP),yes)
$(PAXCTL_if_present) -r $@
clang 3.3 anyway. */
#if ! ADDRESS_SANITIZER
-# if !defined SYSTEM_MALLOC && !defined DOUG_LEA_MALLOC && !defined HYBRID_MALLOC
-# define USE_ALIGNED_ALLOC 1
-/* Defined in gmalloc.c. */
-void *aligned_alloc (size_t, size_t);
-# elif defined HYBRID_MALLOC
-# if defined ALIGNED_ALLOC || defined HAVE_POSIX_MEMALIGN
+# if defined HYBRID_MALLOC
+# if defined HAVE_ALIGNED_ALLOC || defined HAVE_POSIX_MEMALIGN
# define USE_ALIGNED_ALLOC 1
-# define aligned_alloc hybrid_aligned_alloc
-/* Defined in gmalloc.c. */
-void *aligned_alloc (size_t, size_t);
# endif
+# elif !defined SYSTEM_MALLOC && !defined DOUG_LEA_MALLOC
+# define USE_ALIGNED_ALLOC 1
# elif defined HAVE_ALIGNED_ALLOC
# define USE_ALIGNED_ALLOC 1
# elif defined HAVE_POSIX_MEMALIGN
however, will use the system malloc, realloc.... In other source
files, malloc, realloc... are renamed hybrid_malloc,
hybrid_realloc... via macros in conf_post.h. hybrid_malloc and
- friends are wrapper functions defined later in this file.
- aligned_alloc is defined as a macro only in alloc.c.
-
- As of this writing (August 2014), Cygwin is the only platform on
- which HYBRID_MACRO is defined. Any other platform that wants to
- define it will have to define the macros DUMPED and
- ALLOCATED_BEFORE_DUMPING, defined below for Cygwin. */
+ friends are wrapper functions defined later in this file. */
#undef malloc
#undef realloc
#undef calloc
#if !defined DOUG_LEA_MALLOC && !defined HYBRID_MALLOC && !defined SYSTEM_MALLOC
/* Defined in gmalloc.c. */
extern size_t __malloc_extra_blocks;
+extern void *aligned_alloc (size_t, size_t);
#endif
extern void malloc_enable_thread (void);