Bug 1315939 - Use FINAL_LIBRARY = 'memory' in jemalloc and mozjemalloc. r=glandium
authorEmanuel Hoogeveen <emanuel.hoogeveen@gmail.com>
Thu, 10 Nov 2016 06:57:00 -0500
changeset 348822 13ed22321146fa7779394fc20ddee89de631b5d1
parent 348821 bb4879b87c176f4d644cab920f41e7c430e7c484
child 348823 817c3befbadca4d6e9d8f0e25beeb7b964bb2224
push id10298
push userraliiev@mozilla.com
push dateMon, 14 Nov 2016 12:33:03 +0000
treeherdermozilla-aurora@7e29173b1641 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs1315939
milestone52.0a1
Bug 1315939 - Use FINAL_LIBRARY = 'memory' in jemalloc and mozjemalloc. r=glandium
memory/build/moz.build
memory/jemalloc/moz.build
memory/mozjemalloc/moz.build
memory/replace/jemalloc/moz.build
--- a/memory/build/moz.build
+++ b/memory/build/moz.build
@@ -4,17 +4,17 @@
 # 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/.
 
 EXPORTS += [
     'mozmemory.h',
     'mozmemory_wrap.h',
 ]
 
-DEFINES['MOZ_HAS_MOZGLUE'] = True
+LIBRARY_DEFINES['MOZ_HAS_MOZGLUE'] = True
 DEFINES['MOZ_MEMORY_IMPL'] = True
 
 if CONFIG['MOZ_REPLACE_MALLOC']:
     EXPORTS += [
         'malloc_decls.h',
         'replace_malloc.h',
         'replace_malloc_bridge.h',
     ]
@@ -36,26 +36,16 @@ if CONFIG['MOZ_JEMALLOC4']:
 
 if CONFIG['MOZ_REPLACE_MALLOC']:
     SOURCES += [
         'replace_malloc.c',
     ]
 
 Library('memory')
 
-if CONFIG['MOZ_JEMALLOC4']:
-    if not CONFIG['MOZ_SYSTEM_JEMALLOC']:
-        USE_LIBS += [
-            'jemalloc',
-        ]
-else:
-    USE_LIBS += [
-        'mozjemalloc',
-    ]
-
 if CONFIG['MOZ_GLUE_IN_PROGRAM']:
     SDK_LIBRARY = True
     DIST_INSTALL = True
 
 # Keep jemalloc separated when mozglue is statically linked
 if CONFIG['MOZ_MEMORY'] and (CONFIG['OS_TARGET'] in ('WINNT', 'Darwin', 'Android') or
                              CONFIG['MOZ_SYSTEM_JEMALLOC']):
     FINAL_LIBRARY = 'mozglue'
--- a/memory/jemalloc/moz.build
+++ b/memory/jemalloc/moz.build
@@ -41,19 +41,20 @@ SOURCES += [
 
 # Only OSX needs the zone allocation implementation,
 # but only if replace-malloc is not enabled.
 if CONFIG['OS_TARGET'] == 'Darwin' and not CONFIG['MOZ_REPLACE_MALLOC']:
     UNIFIED_SOURCES += [
         'src/src/zone.c',
     ]
 
-Library('jemalloc')
-
-FORCE_STATIC_LIB = True
+if CONFIG['MOZ_JEMALLOC4']:
+    FINAL_LIBRARY = 'memory'
+else:
+    FINAL_LIBRARY = 'replace_jemalloc'
 
 if CONFIG['MOZ_GLUE_IN_PROGRAM']:
     SDK_LIBRARY = True
     DIST_INSTALL = True
 
 if CONFIG['_MSC_VER']:
     DEFINES['DLLEXPORT'] = True
     LOCAL_INCLUDES += ['src/include/msvc_compat']
@@ -63,17 +64,16 @@ if CONFIG['_MSC_VER']:
 if CONFIG['OS_TARGET'] == 'Linux':
     # For mremap
     DEFINES['_GNU_SOURCE'] = True
 
 if CONFIG['GNU_CC']:
     CFLAGS += ['-std=gnu99']
 
 DEFINES['abort'] = 'moz_abort'
-DEFINES['MOZ_HAS_MOZGLUE'] = True
 
 LOCAL_INCLUDES += [
     '!src/include',
     'src/include',
 ]
 
 # We allow warnings for third-party code that can be updated from upstream.
 ALLOW_COMPILER_WARNINGS = True
--- a/memory/mozjemalloc/moz.build
+++ b/memory/mozjemalloc/moz.build
@@ -7,33 +7,30 @@
 EXPORTS += [
     'jemalloc_types.h',
 ]
 
 if not CONFIG['MOZ_JEMALLOC4']:
     SOURCES += [
         'jemalloc.c',
     ]
-    Library('mozjemalloc')
-    STATIC_LIBRARY_NAME = 'jemalloc'
-    FORCE_STATIC_LIB = True
+    FINAL_LIBRARY = 'memory'
 
     # See bug 422055.
     if CONFIG['OS_ARCH'] == 'SunOS' and not CONFIG['GNU_CC'] \
             and CONFIG['MOZ_OPTIMIZE']:
         CFLAGS += ['-xO5']
 
 # For non release/esr builds, enable (some) fatal jemalloc assertions.  This
 # helps us catch memory errors.
 if CONFIG['MOZ_UPDATE_CHANNEL'] not in ('release', 'esr'):
     DEFINES['MOZ_JEMALLOC_HARD_ASSERTS'] = True
 
 DEFINES['abort'] = 'moz_abort'
 
-DEFINES['MOZ_HAS_MOZGLUE'] = True
 DEFINES['MOZ_JEMALLOC_IMPL'] = True
 
 #XXX: PGO on Linux causes problems here
 # See bug 419470
 if CONFIG['OS_TARGET'] == 'Linux':
     NO_PGO = True
 
 LOCAL_INCLUDES += [
--- a/memory/replace/jemalloc/moz.build
+++ b/memory/replace/jemalloc/moz.build
@@ -14,20 +14,16 @@ SOURCES += [
 # Android.
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
     SOURCES += [
         'pthread_atfork.c',
     ]
 
 SharedLibrary('replace_jemalloc')
 
-USE_LIBS += [
-    'jemalloc',
-]
-
 DEFINES['MOZ_JEMALLOC4'] = True
 DEFINES['MOZ_REPLACE_JEMALLOC'] = True
 
 LOCAL_INCLUDES += ['!../../jemalloc/src/include']
 if CONFIG['_MSC_VER']:
     LOCAL_INCLUDES += ['/memory/jemalloc/src/include/msvc_compat']
     if not CONFIG['HAVE_INTTYPES_H']:
         LOCAL_INCLUDES += ['/memory/jemalloc/src/include/msvc_compat/C99']