Bug 1501796 - Add USE_NASM mozbuild option. r=firefox-build-system-reviewers,mshal

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Thomas Daede 2018-11-07 00:26:07 +00:00
Родитель ede80683a6
Коммит d8bea75863
2 изменённых файлов: 26 добавлений и 0 удалений

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

@ -372,6 +372,12 @@ class AsmFlags(BaseCompileFlags):
debug_flags += ['-g', 'cv8']
elif self._context.config.substs.get('OS_ARCH') != 'Darwin':
debug_flags += ['-g', 'dwarf2']
elif self._context.get('USE_NASM'):
if (self._context.config.substs.get('OS_ARCH') == 'WINNT' and
not self._context.config.substs.get('GNU_CC')):
debug_flags += ['-F', 'cv8']
elif self._context.config.substs.get('OS_ARCH') != 'Darwin':
debug_flags += ['-F', 'dwarf']
elif (self._context.config.substs.get('OS_ARCH') == 'WINNT' and
self._context.config.substs.get('CPU_ARCH') == 'aarch64'):
# armasm64 accepts a paucity of options compared to ml/ml64.
@ -2143,6 +2149,17 @@ VARIABLES = {
corresponding XPCOMBinaryComponent.
"""),
'USE_NASM': (bool, bool,
"""Use the nasm assembler to assemble assembly files from SOURCES.
By default, the build will use the toolchain assembler, $(AS), to
assemble source files in assembly language (.s or .asm files). Setting
this value to ``True`` will cause it to use nasm instead.
If nasm is not available on this system, or does not support the
current target architecture, an error will be raised.
"""),
'USE_YASM': (bool, bool,
"""Use the yasm assembler to assemble assembly files from SOURCES.

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

@ -1322,6 +1322,15 @@ class TreeMetadataEmitter(LoggingMixin):
computed_as_flags.resolve_flags('MOZBUILD',
context.get('ASFLAGS'))
if context.get('USE_NASM') is True:
nasm = context.config.substs.get('NASM')
if not nasm:
raise SandboxValidationError('nasm is not available', context)
passthru.variables['AS'] = nasm
passthru.variables['AS_DASH_C_FLAG'] = ''
passthru.variables['ASOUTOPTION'] = '-o '
computed_as_flags.resolve_flags('OS',
context.config.substs.get('NASM_ASFLAGS', []))
if context.get('USE_YASM') is True:
yasm = context.config.substs.get('YASM')
if not yasm: