Commit graph

7 commits

Author SHA1 Message Date
Logan Chien
751a987bcc 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
2020-09-22 18:55:11 +08:00
Dan Willemsen
17315c2eda Remove empty rules for check_elf_files.timestamp
If we don't have any new dependencies, or we never set up the
check_elf_files.timestamp rule, don't create an empty one now.

There were >7000 of these unused and empty rules in my AOSP
aosp_cf_x86_phone build.

This was initially brought to my attention by the new checks in
https://github.com/google/kati/pull/189

Test: diff out/build-aosp_cf_x86_phone.ninja, only removed phony rules
Change-Id: Ia43cbbd04df4a01d2182b14e3ccbe5d5ecbcabad
2020-04-28 14:56:06 -07:00
Logan Chien
1429291d9f Enable prebuilt ELF check for all targets
This commit enables prebuilt ELF checks on ALL targets.

If this commit breaks your target, you may triage the breakage by adding
the following setting to your `BoardConfig.mk`:

    BUILD_BROKEN_PREBUILT_ELF_FILES := true

And then fix the problem with the instructions:

    https://source.android.com/devices/architecture/vndk/abi-use-check

Bug: 141176116
Bug: 145925470
Test: for t in ${ALL_TARGETS}; do lunch $t; make check-elf-files; done
Change-Id: I62e0269074afe1d685cb63d5f8953a2acf03f03e
2019-12-09 14:00:25 -08:00
Logan Chien
2a88075617 Always check ELF files for check-elf-files
With this commit, the build system always checks ELF files when
`check-elf-files` is one of the make goals regardless
`PRODUCT_CHECK_ELF_FILES` is specified or not.

This commit also adds `BUILD_BROKEN_PREBUILT_ELF_FILES` for targets that
haven't been cleared.

If this commit breaks your target (usually breaks the targets running
`make checkbuild`), you may triage the breakage by adding the following
setting to your `BoardConfig.mk`:

    BUILD_BROKEN_PREBUILT_ELF_FILES := true

Bug: 141176116
Test: lunch aosp_crosshatch-userdebug && make check-elf-files
Change-Id: Ibe65c977a4ab3d40ba35892ed177eca62c837c35
2019-09-20 10:08:08 -07:00
Logan Chien
b1c11de3c1 Fix check_elf_file with LOCAL_SDK_VERSION and NDK libs
This commit fixes prebuilt ELF checker for modules with
LOCAL_SDK_VERSIONS and depend on NDK shared libraries. This fix is
required because dynamic_binary.mk filters out NDK libraries thus those
libraries do not show up in DEPENDENCIES_ON_SHARED_LIBRARIES.

Bug: 119084334
Test: Create a prebuilt module with LOCAL_SDK_VERSION and check whether
      the NDK libs in LOCAL_SHARED_LIBRARIES are passed to
      check_elf_file.py.
Change-Id: I0f72ae1b0edc3e8d7e43eb70829e74d606564966
2019-03-01 10:25:25 +08:00
Logan Chien
e87ff2d85f Strip LOCAL_CHECK_ELF_FILES
This commit strips LOCAL_CHECK_ELF_FILES before comparing it with
`false` so that developers can add comments after LOCAL_CHECK_ELF_FILES.
For example:

    LOCAL_CHECK_ELF_FILES := false  # disable checks due to ...

Bug: 119084334
Test: Add some spaces after LOCAL_CHECK_ELF_FILES and run
      CHECK_ELF_FILES=true make check-elf-files
Change-Id: I2bfaff4807aeeea6c7af0b9d7d716742b6764cd0
2019-02-14 14:30:09 +08:00
Logan Chien
0e53d887d6 Add prebuilt ELF binaries checker
This commit introduces a prebuilt ELF binaries checker.  The checker
will check:

1. Whether all DT_NEEDED shared libraries are specified in
   `shared_libs` (Android.bp) or `LOCAL_SHARED_LIBRARIES` (Android.mk).

2. Whether all undefined symbols in the prebuilt binary can be resolved
   to defined symbols exported by its dependencies.

This ensures that prebuilt binaries won't silently become ABI
incompatible.

To check the prebuilt binaries, all of the dependencies must be
specified in `shared_libs` (Android.bp) or `LOCAL_SHARED_LIBRARIES`
(Android.mk).

If your prebuilt binaries cannot be checked for some reason, you may add
the following property to Android.bp:

    check_elf_files: false,

Or, add the following setting to Android.mk:

    LOCAL_CHECK_ELF_FILES := false

Bug: 119084334
Test: CHECK_ELF_FILES=true make check-elf-files
Change-Id: I523d3083f22fd4053c096d26f61f8375800281c8
2019-01-21 21:35:01 +08:00