Issue #2221 - Enable link-time optimization for Spidermonkey by default if building it shared.

Currently only Windows can take advantage of this.

The reason why the arrays of deunified sources are named like that in
Spidermonkey's moz.build is to avoid UnsortedErrors in python. There's probably
a better way to handle that, but I just want something that works for now.

And yes, the deunified sources will be reunified if LTO is disabled.
This commit is contained in:
Job Bautista 2023-04-22 10:39:55 +08:00 committed by roytam1
commit b592711bb2
6 changed files with 97 additions and 21 deletions

View file

@ -768,6 +768,26 @@ AC_SUBST(MOZILLA_UAVERSION_U)
MOZ_DOING_LTO(lto_is_enabled)
dnl ========================================================
dnl Spidermonkey link-time optimization support
dnl ========================================================
# We want LTO enabled by default in Spidermonkey if we're building it shared.
if test -n "$JS_SHARED_LIBRARY"; then
JS_LTO=1
fi
MOZ_ARG_DISABLE_BOOL(js-lto,
[ --disable-js-lto Disable link-time optimization for the Spidermonkey library],
JS_LTO=,
JS_LTO=1)
if test -n "$JS_LTO"; then
AC_DEFINE(JS_LTO)
fi
AC_SUBST(JS_LTO)
dnl ========================================================
dnl System overrides of the defaults for target
dnl ========================================================