Bug 1847958 - Use -Oz for optimize option on GeckoView all channels. r=firefox-build-system-reviewers,glandium

Due to size limit of APK, we should use `-Oz` instead of `-O2` even if Nightly.
Actually, Nightly is `-O2` and Others (Beta and Release) are `-Oz`.

As long as I look perf data (bug 1831935 etc) after testing -O2, improvement is still
small (It seems to be small improvement of AndroidStartup only).

Also, this fix removes gcc support of GeckoView build since NDK removes gcc now.

Differential Revision: https://phabricator.services.mozilla.com/D185817
This commit is contained in:
Makoto Kato 2023-08-10 04:36:33 +00:00
Родитель 418d7539b2
Коммит 0a24df1b97
1 изменённых файлов: 17 добавлений и 25 удалений

Просмотреть файл

@ -369,31 +369,23 @@ case "$target" in
;;
*-android*|*-linuxandroid*)
if test -z "$CLANG_CC"; then
MOZ_OPTIMIZE_FLAGS="-freorder-blocks -fno-reorder-functions -Os"
else
if test -n "$NIGHTLY_BUILD"; then
MOZ_OPTIMIZE_FLAGS="-O2"
else
# From https://github.com/android-ndk/ndk/issues/133#issuecomment-308549264
# -Oz is smaller than -Os on clang.
MOZ_OPTIMIZE_FLAGS="-Oz"
# Disable the outliner, which causes performance regressions, and is
# enabled on some platforms at -Oz.
if test -z "$MOZ_LTO"; then
DISABLE_OUTLINER="-mno-outline"
_SAVE_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS $DISABLE_OUTLINER"
AC_TRY_COMPILE(,,[MOZ_OPTIMIZE_FLAGS="$MOZ_OPTIMIZE_FLAGS $DISABLE_OUTLINER"])
CFLAGS="$_SAVE_CFLAGS"
else
DISABLE_OUTLINER="-Wl,-plugin-opt=-enable-machine-outliner=never"
_SAVE_LDFLAGS=$LDFLAGS
LDFLAGS="$LDFLAGS $MOZ_LTO_LDFLAGS $DISABLE_OUTLINER"
AC_TRY_LINK(,,[MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS $DISABLE_OUTLINER"])
LDFLAGS="$_SAVE_LDFLAGS"
fi
fi
# From https://github.com/android-ndk/ndk/issues/133#issuecomment-308549264
# -Oz is smaller than -Os on clang.
MOZ_OPTIMIZE_FLAGS="-Oz"
# Disable the outliner, which causes performance regressions, and is
# enabled on some platforms at -Oz.
if test -z "$MOZ_LTO"; then
DISABLE_OUTLINER="-mno-outline"
_SAVE_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS $DISABLE_OUTLINER"
AC_TRY_COMPILE(,,[MOZ_OPTIMIZE_FLAGS="$MOZ_OPTIMIZE_FLAGS $DISABLE_OUTLINER"])
CFLAGS="$_SAVE_CFLAGS"
else
DISABLE_OUTLINER="-Wl,-plugin-opt=-enable-machine-outliner=never"
_SAVE_LDFLAGS=$LDFLAGS
LDFLAGS="$LDFLAGS $MOZ_LTO_LDFLAGS $DISABLE_OUTLINER"
AC_TRY_LINK(,,[MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS $DISABLE_OUTLINER"])
LDFLAGS="$_SAVE_LDFLAGS"
fi
;;