Exclude system shared libs from fix suggestion am: 751a987bcc
am: 8abf06faa4
Original change: https://android-review.googlesource.com/c/platform/build/+/1190333 Change-Id: I1615ca636f1e09468a4eea39bd80125c03a50916
This commit is contained in:
commit
f4dd14c323
2 changed files with 15 additions and 2 deletions
|
@ -14,12 +14,14 @@
|
||||||
# - my_installed_module_stem
|
# - my_installed_module_stem
|
||||||
# - my_prebuilt_src_file
|
# - my_prebuilt_src_file
|
||||||
# - my_check_elf_file_shared_lib_files
|
# - my_check_elf_file_shared_lib_files
|
||||||
|
# - my_system_shared_libraries
|
||||||
|
|
||||||
ifndef LOCAL_IS_HOST_MODULE
|
ifndef LOCAL_IS_HOST_MODULE
|
||||||
ifneq ($(filter $(LOCAL_MODULE_CLASS),SHARED_LIBRARIES EXECUTABLES NATIVE_TESTS),)
|
ifneq ($(filter $(LOCAL_MODULE_CLASS),SHARED_LIBRARIES EXECUTABLES NATIVE_TESTS),)
|
||||||
check_elf_files_stamp := $(intermediates)/check_elf_files.timestamp
|
check_elf_files_stamp := $(intermediates)/check_elf_files.timestamp
|
||||||
$(check_elf_files_stamp): PRIVATE_SONAME := $(if $(filter $(LOCAL_MODULE_CLASS),SHARED_LIBRARIES),$(my_installed_module_stem))
|
$(check_elf_files_stamp): PRIVATE_SONAME := $(if $(filter $(LOCAL_MODULE_CLASS),SHARED_LIBRARIES),$(my_installed_module_stem))
|
||||||
$(check_elf_files_stamp): PRIVATE_ALLOW_UNDEFINED_SYMBOLS := $(LOCAL_ALLOW_UNDEFINED_SYMBOLS)
|
$(check_elf_files_stamp): PRIVATE_ALLOW_UNDEFINED_SYMBOLS := $(LOCAL_ALLOW_UNDEFINED_SYMBOLS)
|
||||||
|
$(check_elf_files_stamp): PRIVATE_SYSTEM_SHARED_LIBRARIES := $(my_system_shared_libraries)
|
||||||
# PRIVATE_SHARED_LIBRARY_FILES are file paths to built shared libraries.
|
# PRIVATE_SHARED_LIBRARY_FILES are file paths to built shared libraries.
|
||||||
# In addition to $(my_check_elf_file_shared_lib_files), some file paths are
|
# In addition to $(my_check_elf_file_shared_lib_files), some file paths are
|
||||||
# added by `resolve-shared-libs-for-elf-file-check` from `core/main.mk`.
|
# added by `resolve-shared-libs-for-elf-file-check` from `core/main.mk`.
|
||||||
|
@ -33,6 +35,7 @@ $(check_elf_files_stamp): $(my_prebuilt_src_file) $(my_check_elf_file_shared_lib
|
||||||
--skip-unknown-elf-machine \
|
--skip-unknown-elf-machine \
|
||||||
$(if $(PRIVATE_SONAME),--soname $(PRIVATE_SONAME)) \
|
$(if $(PRIVATE_SONAME),--soname $(PRIVATE_SONAME)) \
|
||||||
$(foreach l,$(PRIVATE_SHARED_LIBRARY_FILES),--shared-lib $(l)) \
|
$(foreach l,$(PRIVATE_SHARED_LIBRARY_FILES),--shared-lib $(l)) \
|
||||||
|
$(foreach l,$(PRIVATE_SYSTEM_SHARED_LIBRARIES),--system-shared-lib $(l)) \
|
||||||
$(if $(PRIVATE_ALLOW_UNDEFINED_SYMBOLS),--allow-undefined-symbols) \
|
$(if $(PRIVATE_ALLOW_UNDEFINED_SYMBOLS),--allow-undefined-symbols) \
|
||||||
--llvm-readobj=$(LLVM_READOBJ) \
|
--llvm-readobj=$(LLVM_READOBJ) \
|
||||||
$<
|
$<
|
||||||
|
|
|
@ -397,7 +397,7 @@ class Checker(object):
|
||||||
sys.exit(2)
|
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
|
"""Check whether all DT_NEEDED entries are specified in the build
|
||||||
system."""
|
system."""
|
||||||
|
|
||||||
|
@ -417,6 +417,11 @@ class Checker(object):
|
||||||
dt_needed = sorted(set(self._file_under_test.dt_needed))
|
dt_needed = sorted(set(self._file_under_test.dt_needed))
|
||||||
modules = [re.sub('\\.so$', '', lib) for lib in 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()
|
||||||
self._note('Fix suggestions:')
|
self._note('Fix suggestions:')
|
||||||
self._note(
|
self._note(
|
||||||
|
@ -502,6 +507,11 @@ def _parse_args():
|
||||||
parser.add_argument('--shared-lib', action='append', default=[],
|
parser.add_argument('--shared-lib', action='append', default=[],
|
||||||
help='Path to shared library dependencies')
|
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
|
# Check options
|
||||||
parser.add_argument('--skip-bad-elf-magic', action='store_true',
|
parser.add_argument('--skip-bad-elf-magic', action='store_true',
|
||||||
help='Ignore the input file without the ELF magic word')
|
help='Ignore the input file without the ELF magic word')
|
||||||
|
@ -535,7 +545,7 @@ def main():
|
||||||
if args.soname:
|
if args.soname:
|
||||||
checker.check_dt_soname(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:
|
if not args.allow_undefined_symbols:
|
||||||
checker.check_symbols()
|
checker.check_symbols()
|
||||||
|
|
Loading…
Reference in a new issue