Merge "Fix crash in check_elf_file.py"

This commit is contained in:
Treehugger Robot
2022-11-10 00:41:32 +00:00
committed by Gerrit Code Review

View File

@@ -407,8 +407,7 @@ class Checker(object):
# Chech whether all DT_NEEDED entries are specified. # Chech whether all DT_NEEDED entries are specified.
for lib in self._file_under_test.dt_needed: for lib in self._file_under_test.dt_needed:
if lib not in specified_sonames: if lib not in specified_sonames:
self._error('DT_NEEDED "{}" is not specified in shared_libs.' self._error(f'DT_NEEDED "{lib}" is not specified in shared_libs.')
.format(lib.decode('utf-8')))
missing_shared_libs = True missing_shared_libs = True
if missing_shared_libs: if missing_shared_libs:
@@ -471,16 +470,14 @@ class Checker(object):
if missing_symbols: if missing_symbols:
for sym, ver in sorted(missing_symbols): for sym, ver in sorted(missing_symbols):
sym = sym.decode('utf-8')
if ver: if ver:
sym += '@' + ver.decode('utf-8') sym += '@' + ver
self._error('Unresolved symbol: {}'.format(sym)) self._error(f'Unresolved symbol: {sym}')
self._note() self._note()
self._note('Some dependencies might be changed, thus the symbol(s) ' self._note('Some dependencies might be changed, thus the symbol(s) '
'above cannot be resolved.') 'above cannot be resolved.')
self._note('Please re-build the prebuilt file: "{}".' self._note(f'Please re-build the prebuilt file: "{self._file_path}".')
.format(self._file_path))
self._note() self._note()
self._note('If this is a new prebuilt file and it is designed to have ' self._note('If this is a new prebuilt file and it is designed to have '