Module: Mesa
Branch: master
Commit: c267f46ef2910cb72438bf6d9fe4de9fc33d6931
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c267f46ef2910cb72438bf6d9fe4de9fc33d6931

Author: Dylan Baker <dy...@pnwbakers.com>
Date:   Thu Jun  7 08:38:07 2018 -0700

meson: Clarify why asm cannot be used in cross compile

This makes the reasoning for why a cross compile is not using asm
clearer (hopefully).

v2: - fix typos

Signed-off-by: Dylan Baker <dylan.c.ba...@intel.com>
Reviewed-by: Eric Engestrom <eric.engest...@intel.com>

---

 meson.build | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/meson.build b/meson.build
index 4d4ca5d557..32ab30faa4 100644
--- a/meson.build
+++ b/meson.build
@@ -841,14 +841,24 @@ endif
 # TODO: powr8
 # TODO: shared/static? Is this even worth doing?
 
-# Building x86 assembly code requires running x86 binaries. It is possible for
-# x86_64 OSes to run x86 binaries, so don't disable asm in those cases
-# TODO: it should be possible to use an exe_wrapper to run the binary during
-# the build. 
+# When cross compiling we generally need to turn off the use of assembly,
+# because mesa's assembly relies on building an executable for the host system,
+# and running it to get information about struct sizes. There is at least one
+# case of cross compiling where we can use asm, and that's x86_64 -> x86 when
+# host OS == build OS, since in that case the build machine can run the host's
+# binaries.
 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()
+    # TODO: It may be possible to do this with an exe_wrapper (like wine).
+    message('Cross compiling from one OS to another, disabling assembly.')
+    with_asm = false
+  elif 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 to different architectures, and the host cannot run
+      the build machine's binaries. Disabling assembly.
+    ''')
     with_asm = false
   endif
 endif

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to