Bug 1480004 - Normalize optimization level passed to the linker when doing LTO with clang. r=froydnj

This commit is contained in:
Mike Hommey 2018-08-10 14:51:28 +09:00
Родитель 370eb66bdb
Коммит f6560362a9
2 изменённых файлов: 22 добавлений и 0 удалений

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

@ -1420,6 +1420,17 @@ if test -n "$MOZ_OPTIMIZE"; then
AC_MSG_ERROR([These compiler flags are invalid: $MOZ_OPTIMIZE_FLAGS])
fi
CFLAGS=$_SAVE_CFLAGS
if test -n "$MOZ_LTO" -a -n "$CLANG_CC"; then
# When using llvm-based LTO, non numeric optimization levels are
# not supported by the linker, so force the linker to use -O2 (
# which doesn't influence the level compilation units are actually
# compiled at).
case " $MOZ_OPTIMIZE_FLAGS " in
*\ -Os\ *|*\ -Oz\ *)
MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -O2"
;;
esac
fi
fi
fi # COMPILE_ENVIRONMENT

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

@ -3469,6 +3469,17 @@ if test -n "$MOZ_OPTIMIZE"; then
AC_MSG_ERROR([These compiler flags for C are invalid: $MOZ_OPTIMIZE_FLAGS])
fi
CFLAGS=$_SAVE_CFLAGS
if test -n "$MOZ_LTO" -a -n "$CLANG_CC"; then
# When using llvm-based LTO, non numeric optimization levels are
# not supported by the linker, so force the linker to use -O2 (
# which doesn't influence the level compilation units are actually
# compiled at).
case " $MOZ_OPTIMIZE_FLAGS " in
*\ -Os\ *|*\ -Oz\ *)
MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -O2"
;;
esac
fi
fi
fi # COMPILE_ENVIRONMENT