Bug 1484872 - Move LTO flags to python configure. r=froydnj
authorMike Hommey <mh+mozilla@glandium.org>
Fri, 17 Aug 2018 09:05:27 +0900
changeset 432497 dac6d9ce5eecf27103122c663356df17b1b67cbe
parent 432496 5a64b929a12201d978d98ede8e7a483b86a0d116
child 432498 990f081377eecb483bb6a637908aae855dbe739e
push id106756
push usermh@glandium.org
push dateMon, 20 Aug 2018 23:42:45 +0000
treeherdermozilla-inbound@dac6d9ce5eec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1484872
milestone63.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1484872 - Move LTO flags to python configure. r=froydnj
build/autoconf/sanitize.m4
build/moz.configure/toolchain.configure
build/unix/elfhack/inject/moz.build
build/unix/elfhack/moz.build
config/config.mk
--- a/build/autoconf/sanitize.m4
+++ b/build/autoconf/sanitize.m4
@@ -1,27 +1,15 @@
 dnl This Source Code Form is subject to the terms of the Mozilla Public
 dnl License, v. 2.0. If a copy of the MPL was not distributed with this
 dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 AC_DEFUN([MOZ_CONFIG_SANITIZE], [
 
 dnl ========================================================
-dnl = Link Time Optimization (LTO)
-dnl ========================================================
-if test -n "$MOZ_LTO"; then
-    AC_DEFINE(MOZ_LTO)
-    CFLAGS="$CFLAGS $MOZ_LTO_CFLAGS"
-    CPPFLAGS="$CPPFLAGS $MOZ_LTO_CFLAGS"
-    CXXFLAGS="$CXXFLAGS $MOZ_LTO_CFLAGS"
-    LDFLAGS="$LDFLAGS $MOZ_LTO_LDFLAGS"
-fi
-AC_SUBST(MOZ_LTO)
-
-dnl ========================================================
 dnl = Use Address Sanitizer
 dnl ========================================================
 if test -n "$MOZ_ASAN"; then
     if test -n "$CLANG_CL"; then
         # Look for the ASan runtime binary
         if test "$CPU_ARCH" = "x86_64"; then
           MOZ_CLANG_RT_ASAN_LIB=clang_rt.asan_dynamic-x86_64.dll
         else
--- a/build/moz.configure/toolchain.configure
+++ b/build/moz.configure/toolchain.configure
@@ -1397,19 +1397,20 @@ def lto(value, pgo, c_compiler):
 
     return namespace(
         enabled=enabled,
         cflags=cflags,
         ldflags=ldflags
     )
 
 
-add_old_configure_assignment('MOZ_LTO', lto.enabled)
-add_old_configure_assignment('MOZ_LTO_CFLAGS', lto.cflags)
-add_old_configure_assignment('MOZ_LTO_LDFLAGS', lto.ldflags)
+set_config('MOZ_LTO', lto.enabled)
+set_define('MOZ_LTO', lto.enabled)
+set_config('MOZ_LTO_CFLAGS', lto.cflags)
+set_config('MOZ_LTO_LDFLAGS', lto.ldflags)
 
 # ASAN
 # ==============================================================
 
 js_option('--enable-address-sanitizer', help='Enable Address Sanitizer')
 
 
 @depends_if('--enable-address-sanitizer')
--- a/build/unix/elfhack/inject/moz.build
+++ b/build/unix/elfhack/inject/moz.build
@@ -33,12 +33,12 @@ for v in ('OS_CPPFLAGS', 'OS_CFLAGS', 'D
     for flag in COMPILE_FLAGS[v]:
         if flag == '-isystem':
             flags.append(''.join(COMPILE_FLAGS[v][idx:idx + 2]))
         elif flag.startswith(('-m', '-I', '-isystem')):
             flags.append(flag)
         idx += 1
     COMPILE_FLAGS[v] = flags
 
-COMPILE_FLAGS['OS_CFLAGS'] += ['-O2', '-fno-stack-protector']
+COMPILE_FLAGS['OS_CFLAGS'] += ['-O2', '-fno-stack-protector', '-fno-lto']
 
 AllowCompilerWarnings()
 NoVisibilityFlags()
--- a/build/unix/elfhack/moz.build
+++ b/build/unix/elfhack/moz.build
@@ -9,21 +9,19 @@ DIRS += ['inject']
 
 if not CONFIG['CROSS_COMPILE']:
     SOURCES += [
         'dummy.c',
         'test-array.c',
         'test-ctors.c',
     ]
 
-    for f in CONFIG['OS_CFLAGS']:
-        if f.startswith('-flto'):
-            SOURCES['dummy.c'].flags += ['-fno-lto']
-            SOURCES['test-array.c'].flags += ['-fno-lto']
-            SOURCES['test-ctors.c'].flags += ['-fno-lto']
+    SOURCES['dummy.c'].flags += ['-fno-lto']
+    SOURCES['test-array.c'].flags += ['-fno-lto']
+    SOURCES['test-ctors.c'].flags += ['-fno-lto']
 
 HOST_SOURCES += [
     'elf.cpp',
     'elfhack.cpp',
 ]
 
 HostProgram('elfhack')
 
--- a/config/config.mk
+++ b/config/config.mk
@@ -194,22 +194,22 @@ INCLUDES = \
   -I$(srcdir) \
   -I$(CURDIR) \
   $(LOCAL_INCLUDES) \
   -I$(ABS_DIST)/include \
   $(NULL)
 
 include $(MOZILLA_DIR)/config/static-checking-config.mk
 
-LDFLAGS		= $(COMPUTED_LDFLAGS) $(PGO_LDFLAGS) $(MK_LDFLAGS)
+LDFLAGS		= $(MOZ_LTO_LDFLAGS) $(COMPUTED_LDFLAGS) $(PGO_LDFLAGS) $(MK_LDFLAGS)
 
-COMPILE_CFLAGS	= $(COMPUTED_CFLAGS) $(PGO_CFLAGS) $(_DEPEND_CFLAGS) $(MK_COMPILE_DEFINES)
-COMPILE_CXXFLAGS = $(COMPUTED_CXXFLAGS) $(PGO_CFLAGS) $(_DEPEND_CFLAGS) $(MK_COMPILE_DEFINES)
-COMPILE_CMFLAGS = $(OS_COMPILE_CMFLAGS) $(MOZBUILD_CMFLAGS)
-COMPILE_CMMFLAGS = $(OS_COMPILE_CMMFLAGS) $(MOZBUILD_CMMFLAGS)
+COMPILE_CFLAGS	= $(MOZ_LTO_CFLAGS) $(COMPUTED_CFLAGS) $(PGO_CFLAGS) $(_DEPEND_CFLAGS) $(MK_COMPILE_DEFINES)
+COMPILE_CXXFLAGS = $(MOZ_LTO_CFLAGS) $(COMPUTED_CXXFLAGS) $(PGO_CFLAGS) $(_DEPEND_CFLAGS) $(MK_COMPILE_DEFINES)
+COMPILE_CMFLAGS = $(MOZ_LTO_CFLAGS) $(OS_COMPILE_CMFLAGS) $(MOZBUILD_CMFLAGS)
+COMPILE_CMMFLAGS = $(MOZ_LTO_CFLAGS) $(OS_COMPILE_CMMFLAGS) $(MOZBUILD_CMMFLAGS)
 ASFLAGS = $(COMPUTED_ASFLAGS)
 SFLAGS = $(COMPUTED_SFLAGS)
 
 HOST_CFLAGS = $(COMPUTED_HOST_CFLAGS) $(_DEPEND_CFLAGS)
 HOST_CXXFLAGS = $(COMPUTED_HOST_CXXFLAGS) $(_DEPEND_CFLAGS)
 HOST_C_LDFLAGS = $(COMPUTED_HOST_C_LDFLAGS)
 HOST_CXX_LDFLAGS = $(COMPUTED_HOST_CXX_LDFLAGS)