aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2016-01-30 14:20:57 -0800
committerPaul Eggert2016-01-30 15:26:08 -0800
commit7fdc3cf046ee112b883752ea15ca8cb05444d12f (patch)
tree3656fb91c2100d280d0a70d3b81ead2a63ed317e /src
parenta4817d834e7d125d31049dfb6fd0a0df4782bad0 (diff)
downloademacs-7fdc3cf046ee112b883752ea15ca8cb05444d12f.tar.gz
emacs-7fdc3cf046ee112b883752ea15ca8cb05444d12f.zip
Build lib/e-*.o only on platforms that need it
* 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)
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.in12
-rw-r--r--src/alloc.c13
-rw-r--r--src/gmalloc.c8
-rw-r--r--src/lisp.h1
4 files changed, 13 insertions, 21 deletions
diff --git a/src/Makefile.in b/src/Makefile.in
index e59d3b1568f..150575864da 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -254,8 +254,7 @@ XFIXES_CFLAGS = @XFIXES_CFLAGS@
254## widget.o if USE_X_TOOLKIT, otherwise empty. 254## widget.o if USE_X_TOOLKIT, otherwise empty.
255WIDGET_OBJ=@WIDGET_OBJ@ 255WIDGET_OBJ=@WIDGET_OBJ@
256 256
257## sheap.o if HYBRID_MALLOC, otherwise empty. 257HYBRID_MALLOC = @HYBRID_MALLOC@
258SHEAP_OBJ=@SHEAP_OBJ@
259 258
260## cygw32.o if CYGWIN, otherwise empty. 259## cygw32.o if CYGWIN, otherwise empty.
261CYGWIN_OBJ=@CYGWIN_OBJ@ 260CYGWIN_OBJ=@CYGWIN_OBJ@
@@ -400,6 +399,7 @@ base_obj = dispnew.o frame.o scroll.o xdisp.o menu.o $(XMENU_OBJ) window.o \
400 doprnt.o intervals.o textprop.o composite.o xml.o $(NOTIFY_OBJ) \ 399 doprnt.o intervals.o textprop.o composite.o xml.o $(NOTIFY_OBJ) \
401 $(XWIDGETS_OBJ) \ 400 $(XWIDGETS_OBJ) \
402 profiler.o decompress.o \ 401 profiler.o decompress.o \
402 $(if $(HYBRID_MALLOC),sheap.o) \
403 $(SHEAP_OBJ) \ 403 $(SHEAP_OBJ) \
404 $(MSDOS_OBJ) $(MSDOS_X_OBJ) $(NS_OBJ) $(CYGWIN_OBJ) $(FONT_OBJ) \ 404 $(MSDOS_OBJ) $(MSDOS_X_OBJ) $(NS_OBJ) $(CYGWIN_OBJ) $(FONT_OBJ) \
405 $(W32_OBJ) $(WINDOW_SYSTEM_OBJ) $(XGSELOBJ) 405 $(W32_OBJ) $(WINDOW_SYSTEM_OBJ) $(XGSELOBJ)
@@ -580,7 +580,9 @@ globals.h: gl-stamp; @true
580 580
581$(ALLOBJS): globals.h 581$(ALLOBJS): globals.h
582 582
583$(lib)/libegnu.a: $(config_h) 583LIBEGNU_ARCHIVE = $(lib)/lib$(if $(HYBRID_MALLOC),e)gnu.a
584
585$(LIBEGNU_ARCHIVE): $(config_h)
584 $(MAKE) -C $(lib) all 586 $(MAKE) -C $(lib) all
585 587
586## We have to create $(etc) here because init_cmdargs tests its 588## We have to create $(etc) here because init_cmdargs tests its
@@ -588,9 +590,9 @@ $(lib)/libegnu.a: $(config_h)
588## This goes on to affect various things, and the emacs binary fails 590## This goes on to affect various things, and the emacs binary fails
589## to start if Vinstallation_directory has the wrong value. 591## to start if Vinstallation_directory has the wrong value.
590temacs$(EXEEXT): $(LIBXMENU) $(ALLOBJS) \ 592temacs$(EXEEXT): $(LIBXMENU) $(ALLOBJS) \
591 $(lib)/libegnu.a $(EMACSRES) ${charsets} ${charscript} 593 $(LIBEGNU_ARCHIVE) $(EMACSRES) ${charsets} ${charscript}
592 $(AM_V_CCLD)$(CC) $(ALL_CFLAGS) $(TEMACS_LDFLAGS) $(LDFLAGS) \ 594 $(AM_V_CCLD)$(CC) $(ALL_CFLAGS) $(TEMACS_LDFLAGS) $(LDFLAGS) \
593 -o temacs $(ALLOBJS) $(lib)/libegnu.a $(W32_RES_LINK) $(LIBES) 595 -o temacs $(ALLOBJS) $(LIBEGNU_ARCHIVE) $(W32_RES_LINK) $(LIBES)
594 $(MKDIR_P) $(etc) 596 $(MKDIR_P) $(etc)
595ifneq ($(CANNOT_DUMP),yes) 597ifneq ($(CANNOT_DUMP),yes)
596 $(PAXCTL_if_present) -r $@ 598 $(PAXCTL_if_present) -r $@
diff --git a/src/alloc.c b/src/alloc.c
index 039b7285e39..b1d3f2e6511 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -1123,17 +1123,12 @@ lisp_free (void *block)
1123 clang 3.3 anyway. */ 1123 clang 3.3 anyway. */
1124 1124
1125#if ! ADDRESS_SANITIZER 1125#if ! ADDRESS_SANITIZER
1126# if !defined SYSTEM_MALLOC && !defined DOUG_LEA_MALLOC && !defined HYBRID_MALLOC 1126# if defined HYBRID_MALLOC
1127# define USE_ALIGNED_ALLOC 1 1127# if defined HAVE_ALIGNED_ALLOC || defined HAVE_POSIX_MEMALIGN
1128/* Defined in gmalloc.c. */
1129void *aligned_alloc (size_t, size_t);
1130# elif defined HYBRID_MALLOC
1131# if defined ALIGNED_ALLOC || defined HAVE_POSIX_MEMALIGN
1132# define USE_ALIGNED_ALLOC 1 1128# define USE_ALIGNED_ALLOC 1
1133# define aligned_alloc hybrid_aligned_alloc
1134/* Defined in gmalloc.c. */
1135void *aligned_alloc (size_t, size_t);
1136# endif 1129# endif
1130# elif !defined SYSTEM_MALLOC && !defined DOUG_LEA_MALLOC
1131# define USE_ALIGNED_ALLOC 1
1137# elif defined HAVE_ALIGNED_ALLOC 1132# elif defined HAVE_ALIGNED_ALLOC
1138# define USE_ALIGNED_ALLOC 1 1133# define USE_ALIGNED_ALLOC 1
1139# elif defined HAVE_POSIX_MEMALIGN 1134# elif defined HAVE_POSIX_MEMALIGN
diff --git a/src/gmalloc.c b/src/gmalloc.c
index 4feff83a2d1..ca862767bb2 100644
--- a/src/gmalloc.c
+++ b/src/gmalloc.c
@@ -65,13 +65,7 @@ extern void *__default_morecore (ptrdiff_t);
65 however, will use the system malloc, realloc.... In other source 65 however, will use the system malloc, realloc.... In other source
66 files, malloc, realloc... are renamed hybrid_malloc, 66 files, malloc, realloc... are renamed hybrid_malloc,
67 hybrid_realloc... via macros in conf_post.h. hybrid_malloc and 67 hybrid_realloc... via macros in conf_post.h. hybrid_malloc and
68 friends are wrapper functions defined later in this file. 68 friends are wrapper functions defined later in this file. */
69 aligned_alloc is defined as a macro only in alloc.c.
70
71 As of this writing (August 2014), Cygwin is the only platform on
72 which HYBRID_MACRO is defined. Any other platform that wants to
73 define it will have to define the macros DUMPED and
74 ALLOCATED_BEFORE_DUMPING, defined below for Cygwin. */
75#undef malloc 69#undef malloc
76#undef realloc 70#undef realloc
77#undef calloc 71#undef calloc
diff --git a/src/lisp.h b/src/lisp.h
index 4f4ec2c5fcc..cafcfdef438 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -3772,6 +3772,7 @@ INLINE void (check_cons_list) (void) { lisp_h_check_cons_list (); }
3772#if !defined DOUG_LEA_MALLOC && !defined HYBRID_MALLOC && !defined SYSTEM_MALLOC 3772#if !defined DOUG_LEA_MALLOC && !defined HYBRID_MALLOC && !defined SYSTEM_MALLOC
3773/* Defined in gmalloc.c. */ 3773/* Defined in gmalloc.c. */
3774extern size_t __malloc_extra_blocks; 3774extern size_t __malloc_extra_blocks;
3775extern void *aligned_alloc (size_t, size_t);
3775#endif 3776#endif
3776extern void malloc_enable_thread (void); 3777extern void malloc_enable_thread (void);
3777 3778