diff options
author | 2019-12-16 15:55:16 -0800 | |
---|---|---|
committer | 2020-09-22 18:55:11 +0800 | |
commit | 751a987bccc252b5b8855124d8a37cb660ead463 (patch) | |
tree | 63a4b9c15d10edb5b169bad4a47a29fb04051867 /tools/check_elf_file.py | |
parent | 4dc545879ef061de61c9728d6dc6fc529d96ac77 (diff) |
Exclude system shared libs from fix suggestion
This commit removes system shared libs (e.g. libc, libdl, or libm) from
the prebuilt ELF check fix suggestion.
Bug: 141925662
Test: Write a bad Android.mk module and check fix suggestions
Change-Id: I4a827d07b24a976c1910b814126790abbeccc793
Diffstat (limited to 'tools/check_elf_file.py')
-rwxr-xr-x | tools/check_elf_file.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/tools/check_elf_file.py b/tools/check_elf_file.py index 372404b90b..ca2b93fdae 100755 --- a/tools/check_elf_file.py +++ b/tools/check_elf_file.py @@ -397,7 +397,7 @@ class Checker(object): sys.exit(2) - def check_dt_needed(self): + def check_dt_needed(self, system_shared_lib_names): """Check whether all DT_NEEDED entries are specified in the build system.""" @@ -417,6 +417,11 @@ class Checker(object): dt_needed = sorted(set(self._file_under_test.dt_needed)) modules = [re.sub('\\.so$', '', lib) for lib in dt_needed] + # Remove system shared libraries from the suggestion since they are added + # by default. + modules = [name for name in modules + if name not in system_shared_lib_names] + self._note() self._note('Fix suggestions:') self._note( @@ -502,6 +507,11 @@ def _parse_args(): parser.add_argument('--shared-lib', action='append', default=[], help='Path to shared library dependencies') + # System Shared library names + parser.add_argument('--system-shared-lib', action='append', default=[], + help='System shared libraries to be hidden from fix ' + 'suggestions') + # Check options parser.add_argument('--skip-bad-elf-magic', action='store_true', help='Ignore the input file without the ELF magic word') @@ -535,7 +545,7 @@ def main(): if args.soname: checker.check_dt_soname(args.soname) - checker.check_dt_needed() + checker.check_dt_needed(args.system_shared_lib) if not args.allow_undefined_symbols: checker.check_symbols() |