Bug 1378592 - Remove MOZ_REPLACE_MALLOC_LINKAGE. r?froydnj
MOZ_REPLACE_MALLOC_LINKAGE was added back when there were problems with
getting weak references working properly for replace-malloc.
Versions of OSX < 10.6 needed flat namespace, but aren't supported
anymore.
Versions of Xcode < 4.5 required flat namespace + a dummy library in
order to produce proper weak references. There is virtually nobody still
building with such an ancient toolchain.
Keeping those around doesn't /really/ hurt, except recent versions of
Xcode don't expose dyldinfo in /usr/bin, used for the configure test.
Consequently, MOZ_REPLACE_MALLOC_LINKAGE ended up being set to use the
dummy library setup, which, by using flat namespace, now causes harm in
bug 1356701, causing
bug 1378332.
--- a/config/recurse.mk
+++ b/config/recurse.mk
@@ -180,15 +180,12 @@ endif
# Note some others are hardcoded or "guessed" in recursivemake.py and emitter.py
ifeq ($(MOZ_WIDGET_TOOLKIT),gtk3)
toolkit/library/target: widget/gtk/mozgtk/gtk3/target
endif
ifdef MOZ_LDAP_XPCOM
ldap/target: security/target mozglue/build/target
toolkit/library/target: ldap/target
endif
-ifeq ($(MOZ_REPLACE_MALLOC_LINKAGE),dummy library)
-mozglue/build/target memory/replace/logalloc/replay/target: memory/replace/dummy/target
-endif
endif
# Most things are built during compile (target/host), but some things happen during export
# Those need to depend on config/export for system wrappers.
$(addprefix build/unix/stdc++compat/,target host) build/clang-plugin/target: config/export
deleted file mode 100644
--- a/memory/replace/dummy/dummy_replace_malloc.c
+++ /dev/null
@@ -1,15 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "mozilla/Types.h"
-
-/*
- * Dummy functions for linking purpose on OSX with older XCode.
- * See details in configure.in, under "Replace-malloc Mac linkage quirks"
- */
-#define MALLOC_FUNCS MALLOC_FUNCS_ALL
-#define MALLOC_DECL(name, ...) \
- MOZ_EXPORT void replace_ ## name() { }
-
-#include "malloc_decls.h"
deleted file mode 100644
--- a/memory/replace/dummy/moz.build
+++ /dev/null
@@ -1,14 +0,0 @@
-# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-DIST_INSTALL = False
-
-SOURCES += [
- 'dummy_replace_malloc.c',
-]
-
-SharedLibrary('dummy_replace_malloc')
-
-DISABLE_STL_WRAPPING = True
--- a/memory/replace/moz.build
+++ b/memory/replace/moz.build
@@ -4,13 +4,10 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
DIRS += [
'logalloc',
'replace',
]
-if CONFIG['MOZ_REPLACE_MALLOC_LINKAGE'] == 'dummy library':
- DIRS += ['dummy']
-
if CONFIG['MOZ_DMD']:
DIRS += ['dmd']
--- a/mozglue/build/replace_malloc.mk
+++ b/mozglue/build/replace_malloc.mk
@@ -17,17 +17,10 @@ OS_LDFLAGS += \
-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 \
$(NULL)
-ifneq ($(MOZ_REPLACE_MALLOC_LINKAGE),compiler support)
-OS_LDFLAGS += -flat_namespace
-endif
-ifeq ($(MOZ_REPLACE_MALLOC_LINKAGE),dummy library)
-OS_LDFLAGS += -Wl,-weak_library,$(DEPTH)/memory/replace/dummy/$(DLL_PREFIX)dummy_replace_malloc$(DLL_SUFFIX)
-endif
-
EXTRA_DEPS += $(topsrcdir)/mozglue/build/replace_malloc.mk
endif
--- a/old-configure.in
+++ b/old-configure.in
@@ -3998,71 +3998,16 @@ Android|WINNT|Darwin)
;;
*)
dnl On !Android !Windows !OSX, we only want to link executables against mozglue
MOZ_GLUE_IN_PROGRAM=1
AC_DEFINE(MOZ_GLUE_IN_PROGRAM)
;;
esac
-if test -n "$MOZ_REPLACE_MALLOC"; then
- dnl Replace-malloc Mac linkage quirks
- if test -n "$MACOSX_DEPLOYMENT_TARGET"; then
- AC_CACHE_CHECK([how to do weak dynamic linking],
- ac_cv_weak_dynamic_linking,
- [echo 'extern void foo() __attribute__((weak_import));int bar() { if (foo) foo(); return 0; }' > conftest.c
- if AC_TRY_COMMAND([${CC-cc} -o conftest${DLL_SUFFIX} $CFLAGS -dynamiclib $LDFLAGS -Wl,-U,_foo conftest.c $LIBS 1>&5]) &&
- test -s conftest${DLL_SUFFIX}; then
- dnl There are several ways the linker can put link edit rules in a binary:
- dnl - classic info only (for OSX < 10.6)
- dnl - dyld info only
- dnl - both
- if "$OTOOL" -l conftest${DLL_SUFFIX} 2> /dev/null | grep "LC_DYLD_INFO_ONLY" > /dev/null; then
- _CLASSIC_INFO=
- else
- _CLASSIC_INFO=1
- fi
- if "$OTOOL" -l conftest${DLL_SUFFIX} 2> /dev/null | grep "LC_DYLD_INFO" > /dev/null; then
- _DYLD_INFO=1
- else
- _DYLD_INFO=
- fi
- dnl With classic info, we need to build with -flat_namespace.
- dnl With dyld info, Xcode 4.5 does the right thing without additional flags,
- dnl but Xcode < 4.5 requires a dummy library and -flat_namespace because it
- dnl forgets to set the weak flag in the dyld info.
- dnl See http://glandium.org/blog/?p=2764 for more details.
- dnl
- dnl Values for ac_cv_weak_dynamic_linking, and subsequently
- dnl MOZ_REPLACE_MALLOC_LINKAGE are thus:
- dnl - "flat namespace" when -flat_namespace alone is needed
- dnl - "dummy library" when a dummy library and -flat_namespace are needed
- dnl - "compiler support" when nothing is needed
- if test -n "$_DYLD_INFO" && ${TOOLCHAIN_PREFIX}dyldinfo -bind conftest${DLL_SUFFIX} 2> /dev/null | grep "_foo (weak import)" > /dev/null; then
- if test -n "$_CLASSIC_INFO"; then
- ac_cv_weak_dynamic_linking="flat namespace"
- else
- ac_cv_weak_dynamic_linking="compiler support"
- fi
- else
- if test -n "$_DYLD_INFO"; then
- ac_cv_weak_dynamic_linking="dummy library"
- else
- ac_cv_weak_dynamic_linking="flat namespace"
- fi
- fi
- else
- AC_ERROR([couldn't compile a simple C file])
- fi
- rm -rf conftest*])
- MOZ_REPLACE_MALLOC_LINKAGE="$ac_cv_weak_dynamic_linking"
- fi
-fi
-AC_SUBST(MOZ_REPLACE_MALLOC_LINKAGE)
-
dnl ========================================================
dnl = Jemalloc build setup
dnl ========================================================
if test -z "$MOZ_MEMORY"; then
case "${target}" in
*-mingw*)
if test -z "$WIN32_REDIST_DIR" -a -z "$MOZ_DEBUG"; then
AC_MSG_WARN([When not building jemalloc, you need to set WIN32_REDIST_DIR to the path to the Visual C++ Redist (usually VCINSTALLDIR\redist\x86\Microsoft.VC80.CRT, for VC++ v8) if you intend to distribute your build.])