aboutsummaryrefslogtreecommitdiffstats
path: root/meta/lib/oe/qa.py
diff options
context:
space:
mode:
authorMark Hatle <mark.hatle@windriver.com>2011-03-01 12:42:28 -0600
committerSaul Wold <sgw@linux.intel.com>2011-03-02 09:48:53 -0800
commit17dae13fabe2932a47ecc86fcafb1d177226513f (patch)
tree086c230e019e031c1adada1f9f651038352b645c /meta/lib/oe/qa.py
parentb909f12a92c86fd2fe9348eeec455e2c9ef71f1a (diff)
downloadopenembedded-core-contrib-17dae13fabe2932a47ecc86fcafb1d177226513f.tar.gz
insane.bbclass: Fix ELF bitsize comparison
Fix the way the ELF size is compared to ensure that incorrectly sized ELF binaries are captured during the file scan. lib/oe/qa.py is changed to accept a bitsize as a parameter. Instead of previously defining true/false, it now takes "0" undefined, "32" 32-bit, and "64" 64-bit as the size argument. This allows us to preserve existing behavior of only loading one ELF type, while allowing the function to be able to discover the size on it's own. Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Diffstat (limited to 'meta/lib/oe/qa.py')
-rw-r--r--meta/lib/oe/qa.py21
1 files changed, 17 insertions, 4 deletions
diff --git a/meta/lib/oe/qa.py b/meta/lib/oe/qa.py
index 01813931bb..7adf4d03ae 100644
--- a/meta/lib/oe/qa.py
+++ b/meta/lib/oe/qa.py
@@ -25,9 +25,9 @@ class ELFFile:
#print "'%x','%x' %s" % (ord(expectation), ord(result), self.name)
raise Exception("This does not work as expected")
- def __init__(self, name, bits32):
+ def __init__(self, name, bits = 0):
self.name = name
- self.bits32 = bits32
+ self.bits = bits
def open(self):
self.file = file(self.name, "r")
@@ -38,10 +38,20 @@ class ELFFile:
self.my_assert(self.data[1], 'E')
self.my_assert(self.data[2], 'L')
self.my_assert(self.data[3], 'F')
- if self.bits32 :
+ if self.bits == 0:
+ if self.data[ELFFile.EI_CLASS] == chr(ELFFile.ELFCLASS32):
+ self.bits == 32
+ elif self.data[ELFFile.EI_CLASS] == chr(ELFFile.ELFCLASS64):
+ self.bits == 64
+ else:
+ # Not 32-bit or 64.. lets assert
+ raise Exception("ELF but not 32 or 64 bit.")
+ elif self.bits == 32:
self.my_assert(self.data[ELFFile.EI_CLASS], chr(ELFFile.ELFCLASS32))
- else:
+ elif self.bits == 64:
self.my_assert(self.data[ELFFile.EI_CLASS], chr(ELFFile.ELFCLASS64))
+ else:
+ raise Exception("Must specify unknown, 32 or 64 bit size.")
self.my_assert(self.data[ELFFile.EI_VERSION], chr(ELFFile.EV_CURRENT) )
self.sex = self.data[ELFFile.EI_DATA]
@@ -60,6 +70,9 @@ class ELFFile:
def abiVersion(self):
return ord(self.data[ELFFile.EI_ABIVERSION])
+ def abiSize(self):
+ return self.bits
+
def isLittleEndian(self):
return self.sex == "<"