Skip to contentSkip to conversation

goarch.bbclass: rework mips architecture checks

PATCH New Matt Madison 1 participant 2 messages Sep 28, 2017

lore
Share & tools
lore
#0 lore raw

v2 cover goarch.bbclass: rework mips architecture checks

New in V2:

* Replaced the regex matches for mips with straight comparisons -- the only mips TUNE_ARCHs that map into Go support are 'mips' and 'mipsel'.

* Removed the anonymous python function, and dropped rewriting TUNE_FEATURES altogether. TUNE_CCARGS_remove (which had been used in the past) is used to handle the compiler flags conflict with cgo for mips.

* Fixed regexes for the mips64 checks, which I missed last time.

Matt Madison (1):
goarch.bbclass: rework mips architecture checks

 meta/classes/goarch.bbclass | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH v2 1/1 goarch.bbclass: rework mips architecture checks

Remove the TUNE_FEATURES references from go_map_arch, to avoid an unwanted variable dependency. Direct comparisons of the architecture name are sufficient for covering what Go currently supports, and using TUNE_CCARGS_remove adequately handles the conflict with the cgo-supplied flags for mips.

---
 meta/classes/goarch.bbclass | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)
meta/classes/goarch.bbclass +7 -10
index 9ed562d..659b26a 100644
@@ -28,6 +28,7 @@ COMPATIBLE_HOST_linux-muslx32 = "null"
 COMPATIBLE_HOST_powerpc = "null"
 COMPATIBLE_HOST_powerpc64 = "null"
 ARM_INSTRUCTION_SET = "arm"
+TUNE_CCARGS_remove = "-march=mips32r2"
 
 def go_map_arch(a, d):
     import re
@@ -39,18 +40,14 @@ def go_map_arch(a, d):
         return 'arm'
     elif re.match('aarch64.*', a):
         return 'arm64'
-    elif re.match('mips64el*', a):
+    elif re.match('mips64el.*', a):
         return 'mips64le'
-    elif re.match('mips64*', a):
+    elif re.match('mips64.*', a):
         return 'mips64'
-    elif re.match('mips.*', a):
-        tf = d.getVar('TUNE_FEATURES').split()
-        if 'fpu-hard' in tf and 'n32' not in tf:
-            if 'mips32r2' in tf:
-                newtf = [t for t in tf if t != 'mips32r2']
-                newtf.append('mips32')
-                d.setVar('TUNE_FEATURES', ' '.join(newtf))
-            return 'mips' if 'bigendian' in tf else 'mipsle'
+    elif a == 'mips':
+        return 'mips'
+    elif a == 'mipsel':
+        return 'mipsle'
     elif re.match('p(pc|owerpc)(64)', a):
         return 'ppc64'
     elif re.match('p(pc|owerpc)(64el)', a):
Signature · 1 line
2.7.4