Skip to contentSkip to conversation

goarch.bbclass: rework mips architecture checks

PATCH Superseded Matt Madison 5 participants 7 messages Sep 27, 2017

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

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

Move the mips32r2->mips32 rewrite to an anonymous python function, and change the GOARCH setting to use just the passed-in architecture string, to avoid an unwanted variable dependency.

---
 meta/classes/goarch.bbclass | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)
meta/classes/goarch.bbclass +11 -9
index 9ed562d..7553987 100644
@@ -43,14 +43,10 @@ def go_map_arch(a, d):
         return 'mips64le'
     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 re.match('mipsel.*', a) and 'r6' not in a and '-nf' not in a and '-n32' not in a:
+        return 'mipsle'
+    elif re.match('mips', a) and 'r6' not in a and '-nf' not in a and '-n32' not in a:
+        return 'mipsle'
     elif re.match('p(pc|owerpc)(64)', a):
         return 'ppc64'
     elif re.match('p(pc|owerpc)(64el)', a):
@@ -74,4 +70,10 @@ def go_map_os(o, d):
         return 'linux'
     return o
 
-
+python __anonymous () {
+    tf = d.getVar('TUNE_FEATURES').split()
+    if 'mips32r2' in tf:
+        newtf = [t for t in tf if t != 'mips32r2']
+        newtf.append('mips32')
+        d.setVar('TUNE_FEATURES', ' '.join(newtf))
+}
Signature · 1 line
2.7.4
#1 lore raw

Another option is to use contains() for this. The signature generation code knows how to handle contains specially, only depending on the presence of the specified value in the list, rather than the entirety.

Quoted 56 lines · Matt Madison

Move the mips32r2->mips32 rewrite to an anonymous python function, and change the GOARCH setting to use just the passed-in architecture string, to avoid an unwanted variable dependency.

---
 meta/classes/goarch.bbclass | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)
meta/classes/goarch.bbclass +1 -8
index 9ed562d..7553987 100644
@@ -43,14 +43,10 @@ def go_map_arch(a, d):
         return 'mips64le'
     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 re.match('mipsel.*', a) and 'r6' not in a and '-nf' not in a and

'-n32' not in a:

meta/classes/goarch.bbclass +2 -0
+        return 'mipsle'
+    elif re.match('mips', a) and 'r6' not in a and '-nf' not in a and

'-n32' not in a:

meta/classes/goarch.bbclass +8 -2
+        return 'mipsle'
     elif re.match('p(pc|owerpc)(64)', a):
         return 'ppc64'
     elif re.match('p(pc|owerpc)(64el)', a):
@@ -74,4 +70,10 @@ def go_map_os(o, d):
         return 'linux'
     return o
 
-
+python __anonymous () {
+    tf = d.getVar('TUNE_FEATURES').split()
+    if 'mips32r2' in tf:
+        newtf = [t for t in tf if t != 'mips32r2']
+        newtf.append('mips32')
+        d.setVar('TUNE_FEATURES', ' '.join(newtf))
+}
--

2.7.4

--
_______________________________________________
Openembedded-core mailing list [email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Signature · 4 lines
Christopher Larson
kergoth at gmail dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Senior Software Engineer, Mentor Graphics
#2 lore raw
Quoted 4 lines · Christopher Larson

Another option is to use contains() for this. The signature generation code knows how to handle contains specially, only depending on the presence of the specified value in the list, rather than the entirety.

This approach seems better than anon python

Quoted 75 lines
Quoted 38 lines · Matt Madison

Move the mips32r2->mips32 rewrite to an anonymous python function, and change the GOARCH setting to use just the passed-in architecture string, to avoid an unwanted variable dependency.

---
 meta/classes/goarch.bbclass | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)
meta/classes/goarch.bbclass +1 -8
index 9ed562d..7553987 100644
@@ -43,14 +43,10 @@ def go_map_arch(a, d):
         return 'mips64le'
     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 re.match('mipsel.*', a) and 'r6' not in a and '-nf' not in a

and '-n32' not in a:

meta/classes/goarch.bbclass +2 -0
+        return 'mipsle'
+    elif re.match('mips', a) and 'r6' not in a and '-nf' not in a and

'-n32' not in a:

meta/classes/goarch.bbclass +1 -0
+        return 'mipsle'
     elif re.match('p(pc|owerpc)(64)', a):
         return 'ppc64'
     elif re.match('p(pc|owerpc)(64el)', a):
@@ -74,4 +70,10 @@ def go_map_os(o, d):
         return 'linux'

meta/classes/goarch.bbclass def go_map_os(o, d): · line 79

Quoted 10 lines
meta/classes/goarch.bbclass +7 -1
     return o
 
-
+python __anonymous () {
+    tf = d.getVar('TUNE_FEATURES').split()
+    if 'mips32r2' in tf:
+        newtf = [t for t in tf if t != 'mips32r2']
+        newtf.append('mips32')
+        d.setVar('TUNE_FEATURES', ' '.join(newtf))
+}

--

Quoted 8 lines

2.7.4

--
_______________________________________________
Openembedded-core mailing list [email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

--
Christopher Larson
kergoth at gmail dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Senior Software Engineer, Mentor Graphics
--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

#3 lore raw
Quoted 11 lines · Khem Raj
Quoted 4 lines · Christopher Larson

Another option is to use contains() for this. The signature generation code knows how to handle contains specially, only depending on the presence of the specified value in the list, rather than the entirety.

This approach seems better than anon python

Yes, agreed.

Ross

#4 lore raw
Quoted 11 lines · Ross
Quoted 10 lines · Khem Raj
Quoted 4 lines · Christopher Larson

Another option is to use contains() for this. The signature generation code knows how to handle contains specially, only depending on the presence of the specified value in the list, rather than the entirety.

Quoted 4 lines
Quoted 1 line

This approach seems better than anon python

Yes, agreed.

I didn't know about the special handling for contains. I'll see if I can rework the patch to
avoid the anonymous python, although it may be tricky since there's some rewriting
involved to force mips32r2 -> mips32.

Thanks,
-Matt

Quoted 2 lines

Ross

#5 lore raw
In reply to Matt Madison
Quoted 20 lines · Matt Madison

Move the mips32r2->mips32 rewrite to an anonymous python function, and change the GOARCH setting to use just the passed-in architecture string, to avoid an unwanted variable dependency.

---
 meta/classes/goarch.bbclass | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)
meta/classes/goarch.bbclass +0 -2
index 9ed562d..7553987 100644
@@ -43,14 +43,10 @@ def go_map_arch(a, d):
         return 'mips64le'
     elif re.match('mips64*', a):
         return 'mips64'
-    elif re.match('mips.*', a):
-        tf = d.getVar('TUNE_FEATURES').split()

meta/classes/goarch.bbclass def go_map_arch(a, d): · line 49

Quoted 10 lines
meta/classes/goarch.bbclass +4 -6
-        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 re.match('mipsel.*', a) and 'r6' not in a and '-nf' not in a and '-n32' not in a:
+        return 'mipsle'
+    elif re.match('mips', a) and 'r6' not in a and '-nf' not in a and '-n32' not in a:
+        return 'mipsle'

Should that be "mips" rather than "mipsle" ?

Quoted 7 lines
meta/classes/goarch.bbclass +0 -0
     elif re.match('p(pc|owerpc)(64)', a):
         return 'ppc64'
     elif re.match('p(pc|owerpc)(64el)', a):
@@ -74,4 +70,10 @@ def go_map_os(o, d):
         return 'linux'
     return o
 
#6 lore raw
Quoted 25 lines · Andre McCurdy
Quoted 24 lines · Matt Madison

Move the mips32r2->mips32 rewrite to an anonymous python function, and change the GOARCH setting to use just the passed-in architecture string, to avoid an unwanted variable dependency.

---
 meta/classes/goarch.bbclass | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)
meta/classes/goarch.bbclass +0 -6
index 9ed562d..7553987 100644
@@ -43,14 +43,10 @@ def go_map_arch(a, d):
         return 'mips64le'
     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')
Quoted 8 lines

meta/classes/goarch.bbclass def go_map_arch(a, d): · line 49

Quoted 6 lines
meta/classes/goarch.bbclass +4 -2
-                d.setVar('TUNE_FEATURES', ' '.join(newtf))
-            return 'mips' if 'bigendian' in tf else 'mipsle'
+    elif re.match('mipsel.*', a) and 'r6' not in a and '-nf' not in a and '-n32' not in a:
+        return 'mipsle'
+    elif re.match('mips', a) and 'r6' not in a and '-nf' not in a and '-n32' not in a:
+        return 'mipsle'

Should that be "mips" rather than "mipsle" ?

Yep, thanks!

-Matt

Quoted 8 lines
Quoted 8 lines
meta/classes/goarch.bbclass +0 -0
     elif re.match('p(pc|owerpc)(64)', a):
         return 'ppc64'
     elif re.match('p(pc|owerpc)(64el)', a):
@@ -74,4 +70,10 @@ def go_map_os(o, d):
         return 'linux'
     return o