Commit graph

10 commits

Author SHA1 Message Date
Cole Faust
7a48527b95 Fix crash in check_elf_file.py
`lib` is already a string and doesn't need to be decoded.

Bug: 258395719
Test: On internal master: build/soong/soong_ui.bash --make-mode --bazel-mode-staging TARGET_PRODUCT=aosp_coral TARGET_BUILD_VARIANT=userdebug droid dist device-tests platform_tests
Change-Id: I83ff35339bea9f01c61d953e251788e0894005dc
2022-11-09 12:50:35 -08:00
Spandan Das
60b8195c83 Migrate check_elf_file.py to python3
Also, create a python_binary_host so that it runs using the hermetic
python toolchain.

Test: m check-elf-files
Bug: 203436762
Change-Id: I964342a27f6b6c9dcdbbe910d4dc6c9ec00c2213
2022-10-27 02:08:23 +00:00
jiajia tang
7e0c12b1ba Fix potential error for sys.platform
This CL is to fix gap between python2.x and 3.x.
For python2.x: sys.platform returns 'linux2'
For python3.x: sys.platform returns 'linux'

python3.x(https://docs.python.org/3.6/library/sys.html#sys.platform)
python2.x(https://docs.python.org/2.7/library/sys.html#sys.platform)
Both 2.x and 3.x recommend to use 'startswith' to identify sys.platform.

Change-Id: Id5a0a007518b329d1320baf96ecf1164cd3ebec1
Signed-off-by: jiajia tang <tangjiajia@xiaomi.com>
2022-06-15 15:06:38 +00:00
Yi Kong
8b50dea627 Fix arguments passed to llvm-readobj
Upstream llvm-readobj no longer accepts single dash prefix for long
options. Changed to double dash.

Also let the script to raise exception if rc is non-zero, to avoid
getting confusing error later in the program.

Test: build
Bug: 197230471
Change-Id: I364f51322904431d430549f79af58f455f47e028
2021-09-10 21:17:45 +08:00
Logan Chien
8abf06faa4 Exclude system shared libs from fix suggestion am: 751a987bcc
Original change: https://android-review.googlesource.com/c/platform/build/+/1190333

Change-Id: Ie9ff04af02f76aa0aafd934aa1cb8d13b041bdd0
2020-09-28 04:13:26 +00:00
Stephen Hines
7f5d326ce2 Fix ordering of checks based on llvm-readobj output.
llvm-readobj has reordered some of its output, causing issues when
checking for DT_SONAME and other fields.

Bug: http://b/169195129
Test: m for a failing target
Change-Id: Ifbc120b703ec47b52e77c2baf0e4d080960e9ef9
2020-09-22 20:54:21 -07:00
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
Yo Chiang
1237c1f577 Update language to comply with Android's inclusive language guidance
See https://source.android.com/setup/contribute/respectful-code for
reference

Bug: 161896447
Test: TH
Change-Id: I2a93e520120fa52a190a445b4d4c417c299b9727
2020-07-29 01:20:01 +08:00
Logan Chien
99cdf5385d Update check_elf_file.py for clang-r353983
This commit updates how `check_elf_file.py` parses the symbol name
because the `llvm-readobj` (from clang-r353983) does not print "@" if
the symbol is not versioned.

See also. https://reviews.llvm.org/D56319

Bug: 128959554
Test: CHECK_ELF_FILES=true make check-elf-files
Change-Id: I0dee5e505225e57750a2c86cf0d25a151c218eb1
2019-03-20 15:24:00 +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