mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-19 08:15:31 +00:00
Bug 1546438 - add a cross
option to MOZ_LTO
for cross-language LTO; r=mshal
This option is for performing LTO between C++ code and Rust code. The actual build pieces for Rust code are coming in the next patch. Differential Revision: https://phabricator.services.mozilla.com/D28508 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
ae023b43de
commit
f104ce2b4a
@ -1496,7 +1496,7 @@ set_config('PGO_JARLOG_PATH', depends_if('--with-pgo-jarlog')(lambda p: p))
|
||||
js_option('--enable-lto',
|
||||
env='MOZ_LTO',
|
||||
nargs='?',
|
||||
choices=('full', 'thin'),
|
||||
choices=('full', 'thin', 'cross'),
|
||||
help='Enable LTO')
|
||||
|
||||
|
||||
@ -1506,6 +1506,7 @@ def lto(value, pgo, c_compiler):
|
||||
cflags = []
|
||||
ldflags = []
|
||||
enabled = None
|
||||
rust_lto = False
|
||||
|
||||
# MSVC's implementation of PGO implies LTO. Make clang-cl match this.
|
||||
if c_compiler.type == 'clang-cl' and pgo and value.origin == 'default':
|
||||
@ -1513,6 +1514,15 @@ def lto(value, pgo, c_compiler):
|
||||
|
||||
if value:
|
||||
enabled = True
|
||||
# `cross` implies `thin`, but with Rust code participating in LTO
|
||||
# as well. Make that a little more explicit.
|
||||
if len(value) and value[0].lower() == 'cross':
|
||||
if c_compiler.type == 'gcc':
|
||||
die('Cross-language LTO is not supported with GCC.')
|
||||
|
||||
rust_lto = True
|
||||
value = ['thin']
|
||||
|
||||
if c_compiler.type == 'clang':
|
||||
if len(value) and value[0].lower() == 'full':
|
||||
cflags.append("-flto")
|
||||
@ -1539,7 +1549,8 @@ def lto(value, pgo, c_compiler):
|
||||
return namespace(
|
||||
enabled=enabled,
|
||||
cflags=cflags,
|
||||
ldflags=ldflags
|
||||
ldflags=ldflags,
|
||||
rust_lto=rust_lto,
|
||||
)
|
||||
|
||||
|
||||
@ -1548,6 +1559,7 @@ 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)
|
||||
set_config('MOZ_LTO_RUST', lto.rust_lto)
|
||||
add_old_configure_assignment('MOZ_LTO_CFLAGS', lto.cflags)
|
||||
add_old_configure_assignment('MOZ_LTO_LDFLAGS', lto.ldflags)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user