unity builds: Assembly and LLVM IR are incompatible

Can't just #include them and use them directly in unity builds. Inline
assembly is a thing, but it's not trivial and is deprecated with some
compilers. Just build them separately and link them in. Ideally the user
would then use LTO to ensure the same result.
pull/1095/head
Nirbheek Chauhan 8 years ago
parent 04c1909a4d
commit 70f39ee21e
  1. 4
      mesonbuild/backend/ninjabackend.py
  2. 5
      mesonbuild/compilers.py
  3. 3
      mesonbuild/environment.py

@ -257,10 +257,14 @@ int dummy;
# Languages that can mix with C or C++ but don't support unity builds yet
# because the syntax we use for unity builds is specific to C/++/ObjC/++.
# Assembly files cannot be unitified and neither can LLVM IR files
langs_cant_unity = ('d', 'fortran')
def get_target_source_can_unity(self, target, source):
if isinstance(source, File):
source = source.fname
if self.environment.is_llvm_ir(source) or \
self.environment.is_assembly(source):
return False
suffix = os.path.splitext(source)[1][1:]
for lang in self.langs_cant_unity:
if not lang in target.compilers:

@ -59,6 +59,11 @@ def is_source(fname):
suffix = fname.split('.')[-1]
return suffix in clike_suffixes
def is_assembly(fname):
if hasattr(fname, 'fname'):
fname = fname.fname
return fname.split('.')[-1].lower() == 's'
def is_llvm_ir(fname):
if hasattr(fname, 'fname'):
fname = fname.fname

@ -271,6 +271,9 @@ class Environment():
def is_source(self, fname):
return is_source(fname)
def is_assembly(self, fname):
return is_assembly(fname)
def is_llvm_ir(self, fname):
return is_llvm_ir(fname)

Loading…
Cancel
Save