[Mesa-dev] [PATCH] meson: Allow use of ASM for x86 host with x86_64 build machine

Dylan Baker dylan at pnwbakers.com
Thu Jun 7 16:19:29 UTC 2018

The reason we restrict the use of ASM when cross compiling is that there
is a C based generator (mtypes) that must be run as part of the build
process, and it must be built for the host architecture. In the case of
an x86 host and an x86_64 build machine this is possible as long as the
host and build OSes are the same (ie, not Windows -> Linux).

This also makes the commit message a bit more generic than it previously

CC: Mike Lothian <mike at fireburn.co.uk>
Fixes: 2d62fc06465281d3d45b8a7c7fd2b17ef718448c
       ("meson: disable x86 asm in fewer cases.")
Signed-off-by: Dylan Baker <dylan.c.baker at intel.com>

I've convinced myself this is correct, but it's a lot of logic to hold in my
head at 9am...

 meson.build | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/meson.build b/meson.build
index 4d4ca5d5578..31557d095dc 100644
--- a/meson.build
+++ b/meson.build
@@ -846,9 +846,15 @@ endif
 # TODO: it should be possible to use an exe_wrapper to run the binary during
 # the build. 
 if meson.is_cross_build() 
-  if not (build_machine.cpu_family() == 'x86_64' and host_machine.cpu_family() == 'x86'
-          and build_machine.system() == host_machine.system())
-    message('Cross compiling to x86 from non-x86, disabling asm')
+  if (build_machine.system() != host_machine.system() or
+      not (build_machine.cpu_family() == 'x86_64' and host_machine.cpu_family() == 'x86'))
+    # TODO: There may be other cases where the 64 bit version of the
+    # architecture can run 32 bit binaries (aarch64 and armv7 for example)
+    message('''
+      Cross compiling with non-binary compatible host and build systems.
+      Either with a non-binary compatible architecture pair, or with different
+      host and build OSes.'''
+    )
     with_asm = false

More information about the mesa-dev mailing list