summaryrefslogtreecommitdiffstats
path: root/meta/classes/insane.bbclass
diff options
context:
space:
mode:
authorMark Hatle <mark.hatle@windriver.com>2011-03-01 12:42:28 -0600
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-03-03 16:57:44 +0000
commit78c2b79d549ca5be29c096beca87c4bf9cf8d6bb (patch)
tree9dd173805b1e8d3d7cc65f68a24b2f894b71fdc3 /meta/classes/insane.bbclass
parent23ecbad5cd2b83263cdd79ddb31a7cd10f7ede7f (diff)
downloadpoky-78c2b79d549ca5be29c096beca87c4bf9cf8d6bb.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. (From OE-Core rev: 17dae13fabe2932a47ecc86fcafb1d177226513f) Signed-off-by: Mark Hatle <mark.hatle@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/insane.bbclass')
-rw-r--r--meta/classes/insane.bbclass84
1 files changed, 43 insertions, 41 deletions
diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass
index b376470bd7..812438494b 100644
--- a/meta/classes/insane.bbclass
+++ b/meta/classes/insane.bbclass
@@ -32,58 +32,58 @@ PACKAGEFUNCS += " do_package_qa "
32def package_qa_get_machine_dict(): 32def package_qa_get_machine_dict():
33 return { 33 return {
34 "darwin9" : { 34 "darwin9" : {
35 "arm" : (40, 0, 0, True, True), 35 "arm" : (40, 0, 0, True, 32),
36 }, 36 },
37 "linux" : { 37 "linux" : {
38 "arm" : (40, 97, 0, True, True), 38 "arm" : (40, 97, 0, True, 32),
39 "armeb": (40, 97, 0, False, True), 39 "armeb": (40, 97, 0, False, 32),
40 "powerpc": (20, 0, 0, False, True), 40 "powerpc": (20, 0, 0, False, 32),
41 "i386": ( 3, 0, 0, True, True), 41 "i386": ( 3, 0, 0, True, 32),
42 "i486": ( 3, 0, 0, True, True), 42 "i486": ( 3, 0, 0, True, 32),
43 "i586": ( 3, 0, 0, True, True), 43 "i586": ( 3, 0, 0, True, 32),
44 "i686": ( 3, 0, 0, True, True), 44 "i686": ( 3, 0, 0, True, 32),
45 "x86_64": (62, 0, 0, True, False), 45 "x86_64": (62, 0, 0, True, 64),
46 "ia64": (50, 0, 0, True, False), 46 "ia64": (50, 0, 0, True, 64),
47 "alpha": (36902, 0, 0, True, False), 47 "alpha": (36902, 0, 0, True, 64),
48 "hppa": (15, 3, 0, False, True), 48 "hppa": (15, 3, 0, False, 32),
49 "m68k": ( 4, 0, 0, False, True), 49 "m68k": ( 4, 0, 0, False, 32),
50 "mips": ( 8, 0, 0, False, True), 50 "mips": ( 8, 0, 0, False, 32),
51 "mipsel": ( 8, 0, 0, True, True), 51 "mipsel": ( 8, 0, 0, True, 32),
52 "s390": (22, 0, 0, False, True), 52 "s390": (22, 0, 0, False, 32),
53 "sh4": (42, 0, 0, True, True), 53 "sh4": (42, 0, 0, True, 32),
54 "sparc": ( 2, 0, 0, False, True), 54 "sparc": ( 2, 0, 0, False, 32),
55 }, 55 },
56 "linux-uclibc" : { 56 "linux-uclibc" : {
57 "arm" : ( 40, 97, 0, True, True), 57 "arm" : ( 40, 97, 0, True, 32),
58 "armeb": ( 40, 97, 0, False, True), 58 "armeb": ( 40, 97, 0, False, 32),
59 "powerpc": ( 20, 0, 0, False, True), 59 "powerpc": ( 20, 0, 0, False, 32),
60 "i386": ( 3, 0, 0, True, True), 60 "i386": ( 3, 0, 0, True, 32),
61 "i486": ( 3, 0, 0, True, True), 61 "i486": ( 3, 0, 0, True, 32),
62 "i586": ( 3, 0, 0, True, True), 62 "i586": ( 3, 0, 0, True, 32),
63 "i686": ( 3, 0, 0, True, True), 63 "i686": ( 3, 0, 0, True, 32),
64 "x86_64": ( 62, 0, 0, True, False), 64 "x86_64": ( 62, 0, 0, True, 64),
65 "mips": ( 8, 0, 0, False, True), 65 "mips": ( 8, 0, 0, False, 32),
66 "mipsel": ( 8, 0, 0, True, True), 66 "mipsel": ( 8, 0, 0, True, 32),
67 "avr32": (6317, 0, 0, False, True), 67 "avr32": (6317, 0, 0, False, 32),
68 "sh4": (42, 0, 0, True, True), 68 "sh4": (42, 0, 0, True, 32),
69 69
70 }, 70 },
71 "uclinux-uclibc" : { 71 "uclinux-uclibc" : {
72 "bfin": ( 106, 0, 0, True, True), 72 "bfin": ( 106, 0, 0, True, 32),
73 }, 73 },
74 "linux-gnueabi" : { 74 "linux-gnueabi" : {
75 "arm" : (40, 0, 0, True, True), 75 "arm" : (40, 0, 0, True, 32),
76 "armeb" : (40, 0, 0, False, True), 76 "armeb" : (40, 0, 0, False, 32),
77 }, 77 },
78 "linux-uclibcgnueabi" : { 78 "linux-uclibcgnueabi" : {
79 "arm" : (40, 0, 0, True, True), 79 "arm" : (40, 0, 0, True, 32),
80 "armeb" : (40, 0, 0, False, True), 80 "armeb" : (40, 0, 0, False, 32),
81 }, 81 },
82 "linux-gnuspe" : { 82 "linux-gnuspe" : {
83 "powerpc": (20, 0, 0, False, True), 83 "powerpc": (20, 0, 0, False, 32),
84 }, 84 },
85 "linux-uclibcspe" : { 85 "linux-uclibcspe" : {
86 "powerpc": (20, 0, 0, False, True), 86 "powerpc": (20, 0, 0, False, 32),
87 }, 87 },
88 88
89 } 89 }
@@ -243,7 +243,7 @@ def package_qa_check_arch(path,name,d, elf):
243 return True 243 return True
244 244
245 #if this will throw an exception, then fix the dict above 245 #if this will throw an exception, then fix the dict above
246 (machine, osabi, abiversion, littleendian, bits32) \ 246 (machine, osabi, abiversion, littleendian, bits) \
247 = package_qa_get_machine_dict()[target_os][target_arch] 247 = package_qa_get_machine_dict()[target_os][target_arch]
248 248
249 # Check the architecture and endiannes of the binary 249 # Check the architecture and endiannes of the binary
@@ -251,6 +251,10 @@ def package_qa_check_arch(path,name,d, elf):
251 error_msg = "Architecture did not match (%d to %d) on %s" % \ 251 error_msg = "Architecture did not match (%d to %d) on %s" % \
252 (machine, elf.machine(), package_qa_clean_path(path,d)) 252 (machine, elf.machine(), package_qa_clean_path(path,d))
253 sane = package_qa_handle_error(4, error_msg, name, path, d) 253 sane = package_qa_handle_error(4, error_msg, name, path, d)
254 elif not bits == elf.abiSize():
255 error_msg = "Bit size did not match (%d to %d) on %s" % \
256 (bits, elf.abiSize(), package_qa_clean_path(path,d))
257 sane = package_qa_handle_error(4, error_msg, name, path, d)
254 elif not littleendian == elf.isLittleEndian(): 258 elif not littleendian == elf.isLittleEndian():
255 error_msg = "Endiannes did not match (%d to %d) on %s" % \ 259 error_msg = "Endiannes did not match (%d to %d) on %s" % \
256 (littleendian, elf.isLittleEndian(), package_qa_clean_path(path,d)) 260 (littleendian, elf.isLittleEndian(), package_qa_clean_path(path,d))
@@ -445,14 +449,12 @@ def package_qa_walk(path, funcs, package,d):
445 #if this will throw an exception, then fix the dict above 449 #if this will throw an exception, then fix the dict above
446 target_os = bb.data.getVar('TARGET_OS', d, True) 450 target_os = bb.data.getVar('TARGET_OS', d, True)
447 target_arch = bb.data.getVar('TARGET_ARCH', d, True) 451 target_arch = bb.data.getVar('TARGET_ARCH', d, True)
448 (machine, osabi, abiversion, littleendian, bits32) \
449 = package_qa_get_machine_dict()[target_os][target_arch]
450 452
451 sane = True 453 sane = True
452 for root, dirs, files in os.walk(path): 454 for root, dirs, files in os.walk(path):
453 for file in files: 455 for file in files:
454 path = os.path.join(root,file) 456 path = os.path.join(root,file)
455 elf = oe.qa.ELFFile(path, bits32) 457 elf = oe.qa.ELFFile(path)
456 try: 458 try:
457 elf.open() 459 elf.open()
458 except: 460 except: