2009-09-16 18:41:21 +02:00
|
|
|
--- BinariesCheck.py
|
2008-04-21 18:36:30 +02:00
|
|
|
+++ BinariesCheck.py
|
2009-09-16 18:41:21 +02:00
|
|
|
@@ -39,6 +39,8 @@
|
2009-08-28 22:12:54 +02:00
|
|
|
debug_file_regex = re.compile('\.debug$')
|
2009-03-13 16:06:45 +01:00
|
|
|
exit_call_regex = re.compile('\s+FUNC\s+.*?\s+(_?exit(?:@\S+)?)(?:\s|$)')
|
|
|
|
fork_call_regex = re.compile('\s+FUNC\s+.*?\s+(fork(?:@\S+)?)(?:\s|$)')
|
2008-04-21 18:36:30 +02:00
|
|
|
+ debuginfo_regex=re.compile('^\s+\[\s*\d+\]\s+\.debug_.*\s+')
|
|
|
|
+ symtab_regex=re.compile('^\s+\[\s*\d+\]\s+\.symtab\s+')
|
|
|
|
|
2009-03-13 16:06:45 +01:00
|
|
|
def __init__(self, pkg, path, file, is_ar, is_shlib):
|
2009-09-16 18:41:21 +02:00
|
|
|
self.readelf_error = False
|
|
|
|
@@ -53,6 +55,8 @@
|
|
|
|
self.exec_stack = False
|
2009-03-13 16:06:45 +01:00
|
|
|
self.exit_calls = []
|
2009-09-16 18:41:21 +02:00
|
|
|
fork_called = False
|
2009-03-13 16:06:45 +01:00
|
|
|
+ self.debuginfo = 0
|
2008-04-21 18:36:30 +02:00
|
|
|
+ self.symtab=0
|
2009-03-13 16:06:45 +01:00
|
|
|
self.tail = ''
|
2008-04-21 18:36:30 +02:00
|
|
|
|
2009-08-28 22:12:54 +02:00
|
|
|
is_debug = BinaryInfo.debug_file_regex.search(path)
|
2009-09-16 18:41:21 +02:00
|
|
|
@@ -105,6 +109,14 @@
|
|
|
|
fork_called = True
|
2009-03-13 16:06:45 +01:00
|
|
|
continue
|
2008-06-25 19:08:32 +02:00
|
|
|
|
|
|
|
+ if BinaryInfo.debuginfo_regex.search(l):
|
|
|
|
+ self.debuginfo=1
|
|
|
|
+ continue
|
|
|
|
+
|
|
|
|
+ if BinaryInfo.symtab_regex.search(l):
|
|
|
|
+ self.symtab=1
|
|
|
|
+ continue
|
|
|
|
+
|
2008-04-21 18:36:30 +02:00
|
|
|
if self.non_pic:
|
2009-08-28 22:12:54 +02:00
|
|
|
self.non_pic = BinaryInfo.non_pic_regex.search(res[1])
|
2009-03-13 16:06:45 +01:00
|
|
|
|
2009-09-16 18:41:21 +02:00
|
|
|
@@ -260,6 +272,17 @@
|
2009-08-28 22:12:54 +02:00
|
|
|
bin_info = BinaryInfo(
|
|
|
|
pkg, pkgfile.path, fname, is_ar, is_shlib)
|
2008-06-25 19:08:32 +02:00
|
|
|
|
2008-04-21 18:36:30 +02:00
|
|
|
+ # stripped static library
|
|
|
|
+ if is_ar:
|
2009-03-13 16:06:45 +01:00
|
|
|
+ if bin_info.readelf_error:
|
2008-04-21 18:36:30 +02:00
|
|
|
+ pass
|
|
|
|
+ elif not bin_info.symtab:
|
2009-10-01 15:55:52 +02:00
|
|
|
+ printError(pkg, 'static-library-without-symtab', fname)
|
2008-04-21 18:36:30 +02:00
|
|
|
+ elif not bin_info.debuginfo and \
|
|
|
|
+ (os.environ.get('BUILD_IS_RUNNING', None) == None or \
|
|
|
|
+ os.environ.get('BUILD_DEBUG_FLAGS','').find('-g') != -1):
|
2009-10-01 15:55:52 +02:00
|
|
|
+ printWarning(pkg, 'static-library-without-debuginfo', fname)
|
2008-06-25 19:08:32 +02:00
|
|
|
+
|
2008-04-21 18:36:30 +02:00
|
|
|
# so name in library
|
2009-03-13 16:06:45 +01:00
|
|
|
if is_shlib:
|
2009-08-28 22:12:54 +02:00
|
|
|
has_lib = True
|
2009-09-16 18:41:21 +02:00
|
|
|
@@ -491,6 +514,14 @@
|
2008-04-21 18:36:30 +02:00
|
|
|
'ldd-failed',
|
|
|
|
'''Executing ldd on this file failed, all checks could not be run.''',
|
2008-06-25 19:08:32 +02:00
|
|
|
|
2008-04-21 18:36:30 +02:00
|
|
|
+'static-library-without-symtab',
|
|
|
|
+'''The static library doesn't contain any symbols and therefore can't be linked
|
|
|
|
+against. This may indicated that it was strip.''',
|
|
|
|
+
|
|
|
|
+'static-library-without-debuginfo',
|
|
|
|
+'''The static library doesn't contain any debuginfo. Binaries linking against
|
|
|
|
+this static library can't be properly debugged.''',
|
2008-06-25 19:08:32 +02:00
|
|
|
+
|
|
|
|
'executable-stack',
|
|
|
|
'''The binary declares the stack as executable. Executable stack is usually an
|
|
|
|
error as it is only needed if the code contains GCC trampolines or similar
|