diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2016-11-23 23:16:46 +0530 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2016-12-11 14:54:30 +0530 |
commit | 70f39ee21ee632d1e23b8c3cdcd11817818b9495 (patch) | |
tree | 00d0b936f3ab989f0e9f5291f730a1756b07de60 /mesonbuild | |
parent | 04c1909a4dcc4f92c845eabab5515419f0881dc5 (diff) | |
download | meson-70f39ee21ee632d1e23b8c3cdcd11817818b9495.zip meson-70f39ee21ee632d1e23b8c3cdcd11817818b9495.tar.gz meson-70f39ee21ee632d1e23b8c3cdcd11817818b9495.tar.bz2 |
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.
Diffstat (limited to 'mesonbuild')
-rw-r--r-- | mesonbuild/backend/ninjabackend.py | 4 | ||||
-rw-r--r-- | mesonbuild/compilers.py | 5 | ||||
-rw-r--r-- | mesonbuild/environment.py | 3 |
3 files changed, 12 insertions, 0 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index 188823a..b002656 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.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: diff --git a/mesonbuild/compilers.py b/mesonbuild/compilers.py index 08ebbfb..e474d2e 100644 --- a/mesonbuild/compilers.py +++ b/mesonbuild/compilers.py @@ -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 diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index 0e8364c..44c5965 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -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) |