summaryrefslogtreecommitdiffstats
path: root/meta/lib/oe/qa.py
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@intel.com>2016-10-11 13:19:43 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-10-11 22:17:48 +0100
commit72336003741fb16a7ecdd6b753eae56310413ff7 (patch)
tree36a3bfa226cba437062c20e19f30c927568d0df7 /meta/lib/oe/qa.py
parent70b9b1f5bbc07d97f90b62793bf2c5aa01884436 (diff)
downloadopenembedded-core-contrib-72336003741fb16a7ecdd6b753eae56310413ff7.tar.gz
lib/oe/qa: add ELF machine to string function
Add a function (and test suite) to turn the ELF machine field (e_machine) into a string, so we can tell the user "x86-64" instead of 0x3E. Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oe/qa.py')
-rw-r--r--meta/lib/oe/qa.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/meta/lib/oe/qa.py b/meta/lib/oe/qa.py
index 75e7df8546..fbe719d8ec 100644
--- a/meta/lib/oe/qa.py
+++ b/meta/lib/oe/qa.py
@@ -144,6 +144,26 @@ class ELFFile:
bb.note("%s %s %s failed: %s" % (objdump, cmd, self.name, e))
return ""
+def elf_machine_to_string(machine):
+ """
+ Return the name of a given ELF e_machine field or the hex value as a string
+ if it isn't recognised.
+ """
+ try:
+ return {
+ 0x02: "SPARC",
+ 0x03: "x86",
+ 0x08: "MIPS",
+ 0x14: "PowerPC",
+ 0x28: "ARM",
+ 0x2A: "SuperH",
+ 0x32: "IA-64",
+ 0x3E: "x86-64",
+ 0xB7: "AArch64"
+ }[machine]
+ except:
+ return "Unknown (%s)" % repr(machine)
+
if __name__ == "__main__":
import sys
elf = ELFFile(sys.argv[1])