Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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.

--HG--
extra : rebase_source : e3edc1f2cf905943c33fafeb631f2f88fc87167e
  • Loading branch information
glandium committed Jul 6, 2017
1 parent 3805d91 commit ed86325
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 97 deletions.
3 changes: 0 additions & 3 deletions config/recurse.mk
Expand Up @@ -185,9 +185,6 @@ 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.
Expand Down
15 changes: 0 additions & 15 deletions memory/replace/dummy/dummy_replace_malloc.c

This file was deleted.

14 changes: 0 additions & 14 deletions memory/replace/dummy/moz.build

This file was deleted.

3 changes: 0 additions & 3 deletions memory/replace/moz.build
Expand Up @@ -9,8 +9,5 @@ DIRS += [
'replace',
]

if CONFIG['MOZ_REPLACE_MALLOC_LINKAGE'] == 'dummy library':
DIRS += ['dummy']

if CONFIG['MOZ_DMD']:
DIRS += ['dmd']
7 changes: 0 additions & 7 deletions mozglue/build/replace_malloc.mk
Expand Up @@ -22,12 +22,5 @@ OS_LDFLAGS += \
-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
55 changes: 0 additions & 55 deletions old-configure.in
Expand Up @@ -4003,61 +4003,6 @@ Android|WINNT|Darwin)
;;
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 ========================================================
Expand Down

0 comments on commit ed86325

Please sign in to comment.