diff --git a/config/autoconf.mk.in b/config/autoconf.mk.in index a2e60fc3e30..d3eb8e85239 100644 --- a/config/autoconf.mk.in +++ b/config/autoconf.mk.in @@ -298,6 +298,7 @@ WARNINGS_AS_ERRORS = @WARNINGS_AS_ERRORS@ MOZ_OPTIMIZE = @MOZ_OPTIMIZE@ MOZ_OPTIMIZE_FLAGS = @MOZ_OPTIMIZE_FLAGS@ MOZ_OPTIMIZE_LDFLAGS = @MOZ_OPTIMIZE_LDFLAGS@ +MOZ_OPTIMIZE_SIZE_TWEAK = @MOZ_OPTIMIZE_SIZE_TWEAK@ MOZ_RTTI_FLAGS_ON = @_MOZ_RTTI_FLAGS_ON@ MOZ_EXCEPTIONS_FLAGS_ON = @_MOZ_EXCEPTIONS_FLAGS_ON@ diff --git a/configure.in b/configure.in index 9f01855f956..ec747afca06 100644 --- a/configure.in +++ b/configure.in @@ -2188,7 +2188,12 @@ ia64*-hpux*) MOZ_DEBUG_FLAGS="-g" elif test "$GNU_CC" -o "$GNU_CXX"; then GCC_VERSION=`$CC -v 2>&1 | awk '/^gcc version/ { print $3 }'` - MOZ_OPTIMIZE_FLAGS="-O3 -fomit-frame-pointer" + case $GCC_VERSION in + 4.1.*|4.2.*|4.5.*) + # -Os is broken on gcc 4.1.x 4.2.x, 4.5.x we need to tweak it to get good results. + MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50" + esac + MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fomit-frame-pointer $MOZ_OPTIMIZE_SIZE_TWEAK" MOZ_DEBUG_FLAGS="-g" fi @@ -7117,6 +7122,7 @@ fi # COMPILE_ENVIRONMENT AC_SUBST(MOZ_OPTIMIZE) AC_SUBST(MOZ_OPTIMIZE_FLAGS) AC_SUBST(MOZ_OPTIMIZE_LDFLAGS) +AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK) dnl ======================================================== dnl = (Deprecated) generation of debugger info for specific modules diff --git a/js/src/Makefile.in b/js/src/Makefile.in index 069cc2d11e7..1a61d3bdd86 100644 --- a/js/src/Makefile.in +++ b/js/src/Makefile.in @@ -88,7 +88,7 @@ MODULE_OPTIMIZE_FLAGS = -O2 -ip #XXX: do we want different INTERP_OPTIMIZER flags here? endif else # not INTEL_CXX -MODULE_OPTIMIZE_FLAGS = -O3 -fstrict-aliasing -fomit-frame-pointer +MODULE_OPTIMIZE_FLAGS = -O3 -fstrict-aliasing -fomit-frame-pointer $(MOZ_OPTIMIZE_SIZE_TWEAK) # Special optimization flags for jsinterp.c INTERP_OPTIMIZER = -O3 -fstrict-aliasing endif diff --git a/js/src/config/autoconf.mk.in b/js/src/config/autoconf.mk.in index 5f6945b7afc..5f9103e2b48 100644 --- a/js/src/config/autoconf.mk.in +++ b/js/src/config/autoconf.mk.in @@ -146,6 +146,7 @@ WARNINGS_AS_ERRORS = @WARNINGS_AS_ERRORS@ MOZ_OPTIMIZE = @MOZ_OPTIMIZE@ MOZ_OPTIMIZE_FLAGS = @MOZ_OPTIMIZE_FLAGS@ MOZ_OPTIMIZE_LDFLAGS = @MOZ_OPTIMIZE_LDFLAGS@ +MOZ_OPTIMIZE_SIZE_TWEAK = @MOZ_OPTIMIZE_SIZE_TWEAK@ MOZ_RTTI_FLAGS_ON = @_MOZ_RTTI_FLAGS_ON@ MOZ_EXCEPTIONS_FLAGS_ON = @_MOZ_EXCEPTIONS_FLAGS_ON@ diff --git a/js/src/configure.in b/js/src/configure.in index e1be8a25263..a280c28b059 100644 --- a/js/src/configure.in +++ b/js/src/configure.in @@ -1880,7 +1880,12 @@ ia64*-hpux*) MOZ_DEBUG_FLAGS="-g" elif test "$GNU_CXX"; then GCC_VERSION=`$CXX -v 2>&1 | awk '/^gcc version/ { print $3 }'` - MOZ_OPTIMIZE_FLAGS="-O3 -fomit-frame-pointer" + case $GCC_VERSION in + 4.1.*|4.2.*|4.5.*) + # -Os is broken on gcc 4.1.x 4.2.x, 4.5.x we need to tweak it to get good results. + MOZ_OPTIMIZE_SIZE_TWEAK="-finline-limit=50" + esac + MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions -fomit-frame-pointer $MOZ_OPTIMIZE_SIZE_TWEAK" MOZ_DEBUG_FLAGS="-g" fi @@ -4193,6 +4198,7 @@ fi # COMPILE_ENVIRONMENT AC_SUBST(MOZ_OPTIMIZE) AC_SUBST(MOZ_OPTIMIZE_FLAGS) AC_SUBST(MOZ_OPTIMIZE_LDFLAGS) +AC_SUBST(MOZ_OPTIMIZE_SIZE_TWEAK) dnl ======================================================== dnl = (Deprecated) generation of debugger info for specific modules diff --git a/xpcom/io/Makefile.in b/xpcom/io/Makefile.in index 3d7751b8bad..baa53d0e20a 100644 --- a/xpcom/io/Makefile.in +++ b/xpcom/io/Makefile.in @@ -51,7 +51,7 @@ MOZILLA_INTERNAL_API = 1 # work around bug 408258 ifdef GNU_CC ifneq ($(OS_ARCH), Darwin) -MODULE_OPTIMIZE_FLAGS = -Os -fno-strict-aliasing +MODULE_OPTIMIZE_FLAGS = -Os -fno-strict-aliasing $(MOZ_OPTIMIZE_SIZE_TWEAK) endif endif