зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1319222 - Add an SFLAGS ComputedFlags variable for compiling *.S; r=chmanchester
Both SFLAGS and ASFLAGS are used to compile assembly, but SFLAGS include DEFINES and LOCAL_INCLUDES whereas ASFLAGS do not. It seems easiest to just separate them into two different ComputedFlags values so that the backend can distinguish between the two types. MozReview-Commit-ID: Bkm3621ImJG --HG-- extra : rebase_source : 420204e37d591512f700d77b780939d20c2feeb0
This commit is contained in:
Родитель
29e2f8c259
Коммит
5e5570c9ca
|
@ -205,6 +205,7 @@ COMPILE_CXXFLAGS = $(COMPUTED_CXXFLAGS) $(PGO_CFLAGS) $(_DEPEND_CFLAGS) $(MK_COM
|
|||
COMPILE_CMFLAGS = $(OS_COMPILE_CMFLAGS) $(MOZBUILD_CMFLAGS)
|
||||
COMPILE_CMMFLAGS = $(OS_COMPILE_CMMFLAGS) $(MOZBUILD_CMMFLAGS)
|
||||
ASFLAGS = $(COMPUTED_ASFLAGS)
|
||||
SFLAGS = $(COMPUTED_SFLAGS)
|
||||
|
||||
HOST_CFLAGS = $(COMPUTED_HOST_CFLAGS) $(_DEPEND_CFLAGS)
|
||||
HOST_CXXFLAGS = $(COMPUTED_HOST_CXXFLAGS) $(_DEPEND_CFLAGS)
|
||||
|
|
|
@ -1022,7 +1022,7 @@ endif # HOST_RUST_PROGRAMS
|
|||
|
||||
$(SOBJS):
|
||||
$(REPORT_BUILD)
|
||||
$(AS) -o $@ $(DEFINES) $(ASFLAGS) $($(notdir $<)_FLAGS) $(LOCAL_INCLUDES) -c $<
|
||||
$(AS) -o $@ $(SFLAGS) $($(notdir $<)_FLAGS) -c $<
|
||||
|
||||
$(CPPOBJS):
|
||||
$(REPORT_BUILD_VERBOSE)
|
||||
|
|
|
@ -348,9 +348,12 @@ class AsmFlags(BaseCompileFlags):
|
|||
def __init__(self, context):
|
||||
self._context = context
|
||||
self.flag_variables = (
|
||||
('OS', context.config.substs.get('ASFLAGS'), ('ASFLAGS',)),
|
||||
('DEBUG', self._debug_flags(), ('ASFLAGS',)),
|
||||
('MOZBUILD', None, ('ASFLAGS',)),
|
||||
('DEFINES', None, ('SFLAGS',)),
|
||||
('LIBRARY_DEFINES', None, ('SFLAGS',)),
|
||||
('OS', context.config.substs.get('ASFLAGS'), ('ASFLAGS', 'SFLAGS')),
|
||||
('DEBUG', self._debug_flags(), ('ASFLAGS', 'SFLAGS')),
|
||||
('LOCAL_INCLUDES', None, ('SFLAGS',)),
|
||||
('MOZBUILD', None, ('ASFLAGS', 'SFLAGS')),
|
||||
)
|
||||
BaseCompileFlags.__init__(self, context)
|
||||
|
||||
|
|
|
@ -137,6 +137,7 @@ class TreeMetadataEmitter(LoggingMixin):
|
|||
self._rust_compile_dirs = set()
|
||||
self._asm_compile_dirs = set()
|
||||
self._compile_flags = dict()
|
||||
self._compile_as_flags = dict()
|
||||
self._linkage = []
|
||||
self._static_linking_shared = set()
|
||||
self._crate_verified_local = set()
|
||||
|
@ -278,9 +279,16 @@ class TreeMetadataEmitter(LoggingMixin):
|
|||
objdir_flags = self._compile_flags[lib.objdir]
|
||||
objdir_flags.resolve_flags('LIBRARY_DEFINES', lib_defines)
|
||||
|
||||
objdir_flags = self._compile_as_flags.get(lib.objdir)
|
||||
if objdir_flags:
|
||||
objdir_flags.resolve_flags('LIBRARY_DEFINES', lib_defines)
|
||||
|
||||
for flags_obj in self._compile_flags.values():
|
||||
yield flags_obj
|
||||
|
||||
for flags_obj in self._compile_as_flags.values():
|
||||
yield flags_obj
|
||||
|
||||
for obj in self._binaries.values():
|
||||
yield obj
|
||||
|
||||
|
@ -1025,8 +1033,8 @@ class TreeMetadataEmitter(LoggingMixin):
|
|||
generated_files.add(str(sub.relpath))
|
||||
yield sub
|
||||
|
||||
for defines_var, cls, backend_flags in (('DEFINES', Defines, computed_flags),
|
||||
('HOST_DEFINES', HostDefines, computed_host_flags)):
|
||||
for defines_var, cls, backend_flags in (('DEFINES', Defines, (computed_flags, computed_as_flags)),
|
||||
('HOST_DEFINES', HostDefines, (computed_host_flags,))):
|
||||
defines = context.get(defines_var)
|
||||
if defines:
|
||||
defines_obj = cls(context, defines)
|
||||
|
@ -1041,7 +1049,8 @@ class TreeMetadataEmitter(LoggingMixin):
|
|||
|
||||
defines_from_obj = list(defines_obj.get_defines())
|
||||
if defines_from_obj:
|
||||
backend_flags.resolve_flags(defines_var, defines_from_obj)
|
||||
for flags in backend_flags:
|
||||
flags.resolve_flags(defines_var, defines_from_obj)
|
||||
|
||||
simple_lists = [
|
||||
('GENERATED_EVENTS_WEBIDL_FILES', GeneratedEventWebIDLFile),
|
||||
|
@ -1069,6 +1078,7 @@ class TreeMetadataEmitter(LoggingMixin):
|
|||
yield include_obj
|
||||
|
||||
computed_flags.resolve_flags('LOCAL_INCLUDES', ['-I%s' % p for p in local_includes])
|
||||
computed_as_flags.resolve_flags('LOCAL_INCLUDES', ['-I%s' % p for p in local_includes])
|
||||
|
||||
for obj in self._handle_linkables(context, passthru, generated_files):
|
||||
yield obj
|
||||
|
@ -1230,7 +1240,7 @@ class TreeMetadataEmitter(LoggingMixin):
|
|||
yield computed_link_flags
|
||||
|
||||
if context.objdir in self._asm_compile_dirs:
|
||||
yield computed_as_flags
|
||||
self._compile_as_flags[context.objdir] = computed_as_flags
|
||||
|
||||
if context.objdir in self._host_compile_dirs:
|
||||
yield computed_host_flags
|
||||
|
|
|
@ -215,7 +215,7 @@ class TestEmitterBasic(unittest.TestCase):
|
|||
reader = self.reader('asflags', extra_substs={
|
||||
'ASFLAGS': ['-safeseh'],
|
||||
})
|
||||
as_sources, sources, ldflags, asflags, lib, flags = self.read_topsrcdir(reader)
|
||||
as_sources, sources, ldflags, lib, flags, asflags = self.read_topsrcdir(reader)
|
||||
self.assertIsInstance(asflags, ComputedFlags)
|
||||
self.assertEqual(asflags.flags['OS'], reader.config.substs['ASFLAGS'])
|
||||
self.assertEqual(asflags.flags['MOZBUILD'], ['-no-integrated-as'])
|
||||
|
@ -437,12 +437,12 @@ class TestEmitterBasic(unittest.TestCase):
|
|||
YASM_ASFLAGS='-foo',
|
||||
))
|
||||
|
||||
sources, passthru, ldflags, asflags, lib, flags = self.read_topsrcdir(reader)
|
||||
sources, passthru, ldflags, lib, flags, asflags = self.read_topsrcdir(reader)
|
||||
|
||||
self.assertIsInstance(passthru, VariablePassthru)
|
||||
self.assertIsInstance(ldflags, ComputedFlags)
|
||||
self.assertIsInstance(asflags, ComputedFlags)
|
||||
self.assertIsInstance(flags, ComputedFlags)
|
||||
self.assertIsInstance(asflags, ComputedFlags)
|
||||
|
||||
self.assertEqual(asflags.flags['OS'], reader.config.substs['YASM_ASFLAGS'])
|
||||
|
||||
|
@ -1027,13 +1027,13 @@ class TestEmitterBasic(unittest.TestCase):
|
|||
reader = self.reader('sources')
|
||||
objs = self.read_topsrcdir(reader)
|
||||
|
||||
computed_flags = objs.pop()
|
||||
self.assertIsInstance(computed_flags, ComputedFlags)
|
||||
# The second to last object is a Linkable.
|
||||
linkable = objs.pop()
|
||||
self.assertTrue(linkable.cxx_link)
|
||||
as_flags = objs.pop()
|
||||
self.assertIsInstance(as_flags, ComputedFlags)
|
||||
computed_flags = objs.pop()
|
||||
self.assertIsInstance(computed_flags, ComputedFlags)
|
||||
# The third to last object is a Linkable.
|
||||
linkable = objs.pop()
|
||||
self.assertTrue(linkable.cxx_link)
|
||||
ld_flags = objs.pop()
|
||||
self.assertIsInstance(ld_flags, ComputedFlags)
|
||||
self.assertEqual(len(objs), 6)
|
||||
|
@ -1062,9 +1062,11 @@ class TestEmitterBasic(unittest.TestCase):
|
|||
reader = self.reader('sources-just-c')
|
||||
objs = self.read_topsrcdir(reader)
|
||||
|
||||
as_flags = objs.pop()
|
||||
self.assertIsInstance(as_flags, ComputedFlags)
|
||||
flags = objs.pop()
|
||||
self.assertIsInstance(flags, ComputedFlags)
|
||||
# The second to last object is a Linkable.
|
||||
# The third to last object is a Linkable.
|
||||
linkable = objs.pop()
|
||||
self.assertFalse(linkable.cxx_link)
|
||||
|
||||
|
@ -1087,14 +1089,16 @@ class TestEmitterBasic(unittest.TestCase):
|
|||
reader = self.reader('generated-sources')
|
||||
objs = self.read_topsrcdir(reader)
|
||||
|
||||
as_flags = objs.pop()
|
||||
self.assertIsInstance(as_flags, ComputedFlags)
|
||||
flags = objs.pop()
|
||||
self.assertIsInstance(flags, ComputedFlags)
|
||||
# The second to last object is a Linkable.
|
||||
# The third to last object is a Linkable.
|
||||
linkable = objs.pop()
|
||||
self.assertTrue(linkable.cxx_link)
|
||||
flags = objs.pop()
|
||||
self.assertIsInstance(flags, ComputedFlags)
|
||||
self.assertEqual(len(objs), 7)
|
||||
self.assertEqual(len(objs), 6)
|
||||
|
||||
generated_sources = [o for o in objs if isinstance(o, GeneratedSources)]
|
||||
self.assertEqual(len(generated_sources), 6)
|
||||
|
|
Загрузка…
Ссылка в новой задаче