Bug 1563204 - diagnose issues on Mac with cross-language LTO early; r=dmajor

...rather than people running into peculiar crashes running their tests
because functions are pointing at the wrong thing.

It would be more robust to version-check `ld`, but I figure people
wanting to do local cross-language LTO builds is rare enough that
setting an environment variable and rerunning configure is not a huge
hardship.

Differential Revision: https://phabricator.services.mozilla.com/D36742

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nathan Froyd 2019-07-25 13:16:59 +00:00
Родитель b7828720b0
Коммит 6112863ed7
1 изменённых файлов: 15 добавлений и 2 удалений

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

@ -1548,10 +1548,16 @@ js_option('--enable-lto',
choices=('full', 'thin', 'cross'),
help='Enable LTO')
js_option(env='MOZ_LD64_KNOWN_GOOD',
nargs=1,
help='Indicate that ld64 is free of symbol aliasing bugs.')
@depends('--enable-lto', 'MOZ_PGO', '--enable-profile-generate', c_compiler)
imply_option('MOZ_LD64_KNOWN_GOOD', depends_if('MOZ_AUTOMATION')(lambda _: True))
@depends('--enable-lto', 'MOZ_PGO', '--enable-profile-generate', c_compiler,
'MOZ_LD64_KNOWN_GOOD')
@imports('multiprocessing')
def lto(value, pgo, profile_generate, c_compiler):
def lto(value, pgo, profile_generate, c_compiler, ld64_known_good):
cflags = []
ldflags = []
enabled = None
@ -1572,6 +1578,13 @@ def lto(value, pgo, profile_generate, c_compiler):
rust_lto = True
value = ['thin']
if target.kernel == 'Darwin' and target.os == 'OSX' \
and value[0].lower() == 'cross' and not ld64_known_good:
die('The Mac linker is known to have a bug that affects cross-language '
'LTO. If you know that your linker is free from this bug, please '
'set the environment variable `MOZ_LD64_KNOWN_GOOD=1` and re-run '
'configure.')
if c_compiler.type == 'clang':
if len(value) and value[0].lower() == 'full':
cflags.append("-flto")