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
This commit is contained in:
Mike Hommey 2017-09-19 16:09:56 +09:00
parent 6a9067d75f
commit 2cb309a670

View File

@ -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