Skip to contentSkip to conversation

Misc toolchain patches

PATCH New Mark Hatle 1 participant 4 messages Jul 31, 2014

lore
Share & tools
lore

Mark Hatle

author
#0 lore raw

cover Misc toolchain patches

A few misc toolchain fixes/patches. This serials corrects a couple of issues noticed when working with an external binary toolchain, as well as when generating an SDK.

The following changes since commit 7986adeac16550b33f65fded39a55f668e0e543f:

populate_sdk_base: Fix grep command usage on old hosts (2014-07-29 09:57:54 +0100)

are available in the git repository at:

git://git.yoctoproject.org/poky-contrib mhatle/tc
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=mhatle/tc

Mark Hatle (3):
gcc: Fix gcc-multilib-config comparison tune-mips*: Ensure tunes are inherited in order sanity.bbclass: Add ability to verify toolchain flags

 meta/classes/sanity.bbclass                       | 52 ++++++++++++++++++++---
 meta/conf/machine/include/tune-mips32r2.inc       |  2 +-
 meta/conf/machine/include/tune-mips64.inc         |  2 +-
 meta/recipes-devtools/gcc/gcc-multilib-config.inc |  2 +-
 4 files changed, 49 insertions(+), 9 deletions(-)
Signature · 1 line
1.9.3
author
#1 lore raw

PATCH 1/3 gcc: Fix gcc-multilib-config comparison

Fix an issue on a multilib configuration that contains more then 1 multilib.

I.e. on MIPS64:

DEFAULTTUNE = "mips64"
MULTILIBS = "lib32n:mips64_n32 lib32:mips32"

While normally you'd use 'libn32', the above is legal.

With the startswith code, the system will look to expand the 'lib32' element and find the 'lib32n' instead, and will result in a warning:

lib32 doesn't have a corresponding tune. Skipping...

---
 meta/recipes-devtools/gcc/gcc-multilib-config.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-devtools/gcc/gcc-multilib-config.inc +1 -1
index b8c705a..6134097 100644
@@ -152,7 +152,7 @@ python gcc_multilib_setup() {
     if mlprefix:
         mlindex = 0
         for ml in multilibs:
-            if mlprefix.startswith(ml):
+            if mlprefix == ml + '-':
                 break
             mlindex += 1
 
Signature · 1 line
1.9.3
author
#2 lore raw

PATCH 2/3 tune-mips*: Ensure tunes are inherited in order

In reply to Mark Hatle

Without this, you are not able to use mips32r2 on a mips64 based tune.

We want to be able to do a tri-lib system of mips64, mips64-n32 and mips32r2.

---
 meta/conf/machine/include/tune-mips32r2.inc | 2 +-
 meta/conf/machine/include/tune-mips64.inc   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
meta/conf/machine/include/tune-mips32r2.inc +1 -1
index fb60592..c9deff8 100644
@@ -1,6 +1,6 @@
 DEFAULTTUNE ?= "mips32r2"
 
-require conf/machine/include/mips/arch-mips.inc
+require conf/machine/include/tune-mips32.inc
 
 TUNEVALID[mips32r2] = "Enable mips32r2 specific processor optimizations"
 TUNECONFLICTS[mips32r2] = "n64 n32"
meta/conf/machine/include/tune-mips64.inc +1 -1
index ba79e2b..9be0e0f 100644
@@ -1,3 +1,3 @@
 DEFAULTTUNE ?= "mips64"
 
-require conf/machine/include/mips/arch-mips.inc
+require conf/machine/include/tune-mips32r2.inc
Signature · 1 line
1.9.3
author
#3 lore raw

PATCH 3/3 sanity.bbclass: Add ability to verify toolchain flags

In reply to Mark Hatle

When attempting to use a binary toolchain, such as meta-mentor, we want the ability to verify that the CCARGS, ASARGS and LDARGS contain the necessary and appropriate flags.

This change specifically verifies, if set:
TUNEABI_REQUIRED_CCARGS_tune-<tune>
TUNEABI_REQUIRED_ASARGS_tune-<tune>
TUNEABI_REQUIRED_LDARGS_tune-<tune>

Each of these, will be processed by the class and verified that the selected tune's CCARGS, ASARGS, and LDARGS contains the listed item. This can be used to validate that the user has not accidently or otherwise missed an argument. Note, conflicting arguments are not verified.

Without verification it's possible for a misconfiguration to go undetected, presenting runtime and debugging errors.

---
 meta/classes/sanity.bbclass | 52 +++++++++++++++++++++++++++++++++++++++------
 1 file changed, 46 insertions(+), 6 deletions(-)
meta/classes/sanity.bbclass +46 -6
index 1ad663a..b5fab6a 100644
@@ -87,17 +87,54 @@ def raise_sanity_error(msg, d, network_error=False):
     
     %s""" % msg)
 
+# Check flags associated with a tuning.
+def check_toolchain_tune_args(data, tune, multilib, errs):
+    found_errors = False
+    if check_toolchain_args_present(data, tune, multilib, errs, 'CCARGS'):
+        found_errors = True
+    if check_toolchain_args_present(data, tune, multilib, errs, 'ASARGS'):
+        found_errors = True
+    if check_toolchain_args_present(data, tune, multilib, errs, 'LDARGS'):
+        found_errors = True
+
+    return found_errors
+
+def check_toolchain_args_present(data, tune, multilib, tune_errors, which):
+    args_set = (data.getVar("TUNE_%s" % which, True) or "").split()
+    args_wanted = (data.getVar("TUNEABI_REQUIRED_%s_tune-%s" % (which, tune), True) or "").split()
+    args_missing = []
+
+    # If no args are listed/required, we are done.
+    if not args_wanted:
+        return
+    for arg in args_wanted:
+        if arg not in args_set:
+            args_missing.append(arg)
+
+    found_errors = False
+    if args_missing:
+        found_errors = True
+        tune_errors.append("TUNEABI for %s requires '%s' in TUNE_%s (%s)." %
+                       (tune, ' '.join(args_missing), which, ' '.join(args_set)))
+    return found_errors
+
 # Check a single tune for validity.
 def check_toolchain_tune(data, tune, multilib):
     tune_errors = []
     if not tune:
         return "No tuning found for %s multilib." % multilib
+    localdata = bb.data.createCopy(data)
+    if multilib != "default":
+        # Apply the overrides so we can look at the details.
+        overrides = localdata.getVar("OVERRIDES", False) + ":virtclass-multilib-" + multilib
+        localdata.setVar("OVERRIDES", overrides)
+    bb.data.update_data(localdata)
     bb.debug(2, "Sanity-checking tuning '%s' (%s) features:" % (tune, multilib))
-    features = (data.getVar("TUNE_FEATURES_tune-%s" % tune, True) or "").split()
+    features = (localdata.getVar("TUNE_FEATURES_tune-%s" % tune, True) or "").split()
     if not features:
         return "Tuning '%s' has no defined features, and cannot be used." % tune
-    valid_tunes = data.getVarFlags('TUNEVALID') or {}
-    conflicts = data.getVarFlags('TUNECONFLICTS') or {}
+    valid_tunes = localdata.getVarFlags('TUNEVALID') or {}
+    conflicts = localdata.getVarFlags('TUNECONFLICTS') or {}
     # [doc] is the documentation for the variable, not a real feature
     if 'doc' in valid_tunes:
         del valid_tunes['doc']
@@ -113,15 +150,18 @@ def check_toolchain_tune(data, tune, multilib):
             bb.debug(2, "  %s: %s" % (feature, valid_tunes[feature]))
         else:
             tune_errors.append("Feature '%s' is not defined." % feature)
-    whitelist = data.getVar("TUNEABI_WHITELIST", True) or ''
-    override = data.getVar("TUNEABI_OVERRIDE", True) or ''
+    whitelist = localdata.getVar("TUNEABI_WHITELIST", True) or ''
+    override = localdata.getVar("TUNEABI_OVERRIDE", True) or ''
     if whitelist:
-        tuneabi = data.getVar("TUNEABI_tune-%s" % tune, True) or ''
+        tuneabi = localdata.getVar("TUNEABI_tune-%s" % tune, True) or ''
         if not tuneabi:
             tuneabi = tune
         if True not in [x in whitelist.split() for x in tuneabi.split()]:
             tune_errors.append("Tuning '%s' (%s) cannot be used with any supported tuning/ABI." %
                 (tune, tuneabi))
+        else:
+            if not check_toolchain_tune_args(localdata, tuneabi, multilib, tune_errors):
+                bb.debug(2, "Sanity check: Compiler args OK for %s." % tune)
     if tune_errors:
         return "Tuning '%s' has the following errors:\n" % tune + '\n'.join(tune_errors)
 
Signature · 1 line
1.9.3