Index: BinariesCheck.py =================================================================== --- BinariesCheck.py.orig +++ BinariesCheck.py @@ -39,6 +39,8 @@ class BinaryInfo: debug_file_regex = re.compile('\.debug$') exit_call_regex = re.compile('\s+FUNC\s+.*?\s+(_?exit(?:@\S+)?)(?:\s|$)') fork_call_regex = re.compile('\s+FUNC\s+.*?\s+(fork(?:@\S+)?)(?:\s|$)') + debuginfo_regex=re.compile('^\s+\[\s*\d+\]\s+\.debug_.*\s+') + symtab_regex=re.compile('^\s+\[\s*\d+\]\s+\.symtab\s+') def __init__(self, pkg, path, file, is_ar, is_shlib): self.readelf_error = 0 @@ -53,6 +55,8 @@ class BinaryInfo: self.exec_stack = 0 self.exit_calls = [] fork_called = 0 + self.debuginfo = 0 + self.symtab=0 self.tail = '' is_debug = BinaryInfo.debug_file_regex.search(path) @@ -105,6 +109,14 @@ class BinaryInfo: fork_called = 1 continue + if BinaryInfo.debuginfo_regex.search(l): + self.debuginfo=1 + continue + + if BinaryInfo.symtab_regex.search(l): + self.symtab=1 + continue + if self.non_pic: self.non_pic = BinaryInfo.non_pic_regex.search(res[1]) @@ -260,6 +272,17 @@ class BinariesCheck(AbstractCheck.Abstra bin_info = BinaryInfo( pkg, pkgfile.path, fname, is_ar, is_shlib) + # stripped static library + if is_ar: + if bin_info.readelf_error: + pass + elif not bin_info.symtab: + printError(pkg, 'static-library-without-symtab', i[0]) + elif not bin_info.debuginfo and \ + (os.environ.get('BUILD_IS_RUNNING', None) == None or \ + os.environ.get('BUILD_DEBUG_FLAGS','').find('-g') != -1): + printWarning(pkg, 'static-library-without-debuginfo', i[0]) + # so name in library if is_shlib: has_lib = True @@ -488,6 +511,14 @@ with the intended shared libraries only. 'ldd-failed', '''Executing ldd on this file failed, all checks could not be run.''', +'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.''', + '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