diff options
Diffstat (limited to 'meta/lib')
-rw-r--r-- | meta/lib/oe/qa.py | 21 |
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: | |||
25 | #print "'%x','%x' %s" % (ord(expectation), ord(result), self.name) | 25 | #print "'%x','%x' %s" % (ord(expectation), ord(result), self.name) |
26 | raise Exception("This does not work as expected") | 26 | raise Exception("This does not work as expected") |
27 | 27 | ||
28 | def __init__(self, name, bits32): | 28 | def __init__(self, name, bits = 0): |
29 | self.name = name | 29 | self.name = name |
30 | self.bits32 = bits32 | 30 | self.bits = bits |
31 | 31 | ||
32 | def open(self): | 32 | def open(self): |
33 | self.file = file(self.name, "r") | 33 | self.file = file(self.name, "r") |
@@ -38,10 +38,20 @@ class ELFFile: | |||
38 | self.my_assert(self.data[1], 'E') | 38 | self.my_assert(self.data[1], 'E') |
39 | self.my_assert(self.data[2], 'L') | 39 | self.my_assert(self.data[2], 'L') |
40 | self.my_assert(self.data[3], 'F') | 40 | self.my_assert(self.data[3], 'F') |
41 | if self.bits32 : | 41 | if self.bits == 0: |
42 | if self.data[ELFFile.EI_CLASS] == chr(ELFFile.ELFCLASS32): | ||
43 | self.bits == 32 | ||
44 | elif self.data[ELFFile.EI_CLASS] == chr(ELFFile.ELFCLASS64): | ||
45 | self.bits == 64 | ||
46 | else: | ||
47 | # Not 32-bit or 64.. lets assert | ||
48 | raise Exception("ELF but not 32 or 64 bit.") | ||
49 | elif self.bits == 32: | ||
42 | self.my_assert(self.data[ELFFile.EI_CLASS], chr(ELFFile.ELFCLASS32)) | 50 | self.my_assert(self.data[ELFFile.EI_CLASS], chr(ELFFile.ELFCLASS32)) |
43 | else: | 51 | elif self.bits == 64: |
44 | self.my_assert(self.data[ELFFile.EI_CLASS], chr(ELFFile.ELFCLASS64)) | 52 | self.my_assert(self.data[ELFFile.EI_CLASS], chr(ELFFile.ELFCLASS64)) |
53 | else: | ||
54 | raise Exception("Must specify unknown, 32 or 64 bit size.") | ||
45 | self.my_assert(self.data[ELFFile.EI_VERSION], chr(ELFFile.EV_CURRENT) ) | 55 | self.my_assert(self.data[ELFFile.EI_VERSION], chr(ELFFile.EV_CURRENT) ) |
46 | 56 | ||
47 | self.sex = self.data[ELFFile.EI_DATA] | 57 | self.sex = self.data[ELFFile.EI_DATA] |
@@ -60,6 +70,9 @@ class ELFFile: | |||
60 | def abiVersion(self): | 70 | def abiVersion(self): |
61 | return ord(self.data[ELFFile.EI_ABIVERSION]) | 71 | return ord(self.data[ELFFile.EI_ABIVERSION]) |
62 | 72 | ||
73 | def abiSize(self): | ||
74 | return self.bits | ||
75 | |||
63 | def isLittleEndian(self): | 76 | def isLittleEndian(self): |
64 | return self.sex == "<" | 77 | return self.sex == "<" |
65 | 78 | ||