From 2cb309a670cc0862460c6333172728a2c2002c5d Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Tue, 19 Sep 2017 16:09:56 +0900 Subject: [PATCH] Bug 1401118 - Avoid having to modify replace-malloc.mk every time we add an allocator API entry point. r=froydnj For obscure linkage reasons, we need all the replace-malloc symbols being passed to the linker to tell it to allow them being undefined. That list actually duplicates what's in malloc_decls.h somehow, and every time we add an entry point, we end up having to modify those two files (and others, addressed in different bugs), which is suboptimal. So we generate the list of those symbols from malloc_decls.h. --HG-- extra : rebase_source : 50156c6dda5601a6437f94a753400ec4ed9c8343 --- mozglue/build/replace_malloc.mk | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/mozglue/build/replace_malloc.mk b/mozglue/build/replace_malloc.mk index 000d621015ee..e154a59ea24d 100644 --- a/mozglue/build/replace_malloc.mk +++ b/mozglue/build/replace_malloc.mk @@ -3,25 +3,11 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. ifeq (Darwin_1,$(OS_TARGET)_$(MOZ_REPLACE_MALLOC)) +# Technically, ) is not a necessary delimiter in the awk call, but make +# doesn't like the opening ( there being alone... OS_LDFLAGS += \ - -Wl,-U,_replace_init \ - -Wl,-U,_replace_get_bridge \ - -Wl,-U,_replace_malloc \ - -Wl,-U,_replace_posix_memalign \ - -Wl,-U,_replace_aligned_alloc \ - -Wl,-U,_replace_calloc \ - -Wl,-U,_replace_realloc \ - -Wl,-U,_replace_free \ - -Wl,-U,_replace_memalign \ - -Wl,-U,_replace_valloc \ - -Wl,-U,_replace_malloc_usable_size \ - -Wl,-U,_replace_malloc_good_size \ - -Wl,-U,_replace_jemalloc_stats \ - -Wl,-U,_replace_jemalloc_purge_freed_pages \ - -Wl,-U,_replace_jemalloc_free_dirty_pages \ - -Wl,-U,_replace_jemalloc_thread_local_arena \ - -Wl,-U,_replace_jemalloc_ptr_info \ + $(shell awk -F'[(),]' '/^MALLOC_DECL/{print "-Wl,-U,_replace_" $$2}' $(topsrcdir)/memory/build/malloc_decls.h) \ $(NULL) -EXTRA_DEPS += $(topsrcdir)/mozglue/build/replace_malloc.mk +EXTRA_DEPS += $(topsrcdir)/memory/build/malloc_decls.h endif