Commit Graph

1373 Commits

Author SHA1 Message Date
Hsin-Yi Chen
f5b6ebad09 Filter global variables and functions by -ignore-linker-set-key
Test: ./test.py HeaderCheckerTest.test_libgolden_cpp_return_type_diff
Bug: 259148872
Change-Id: I81f672d650a93eee69107ade07fc660a64c38e45
2022-11-16 15:43:22 +08:00
Hsin-Yi Chen
393ba54671 Allow extending vtables
This commit adds VTableLayoutDiffIR::IsExtended() that determines
whether the difference is a pure extension, i.e., appending virtual
functions to vtables.

Test: ./test.py
Bug: 248418092
Change-Id: I339713c5fff1dfa50dc7875272c0e3a59f858f57
2022-11-07 14:51:13 +08:00
Hsin-Yi Chen
3776a20379 Add the instructions to resolve ABI difference
The instructions are organized into a section. The developers who need
to resolve ABI difference can easily find it.

Test: None
Bug: 244520027
Change-Id: I211de0e1f65eece093fe716122753ea795c43b3e
2022-10-24 16:41:14 +08:00
Pirama Arumuga Nainar
59eac68f50 [clang-tools] Symlink lib -> lib64 in prebuilts/clang-tools
Bug: http://b/241011085

Create symlink lib -> lib64 as toolchain libraries have a RUNPATH pointing
to $ORIGIN/../lib instead of lib64

Test: presubmit with new clang-tools prebuilts
Change-Id: I90973fc756b9489a16a0837473b86e728f50d8e0
2022-10-18 16:39:07 +00:00
Chih-Hung Hsieh
21b04bc844 Update clang-tools build to clang-r468909
Bug: 241011085
Test: presubmit
Change-Id: I969239931c07dd97ce0259a3766ae93d68b21927
2022-10-17 23:45:22 +00:00
Hsin-Yi Chen
959646a857 Fix the comparison of opaque types that have multiple definitions
The types defined in more than one source file are identified with
"#ODR:" and the source paths. The paths can be in intermediate
directories and differ between build targets. They cause ABI check
failure on opaque types. This commit fixes the bug by removing the
suffixes before the comparison.

Test: make libcamera2ndk
Bug: 253095767
Change-Id: I79e6e843460c981afcf2ce0e0d2ad9335d0b3e90
2022-10-14 14:33:00 +08:00
Hsin-Yi Chen
5cc255dee6 Fix the comparison between opaque parameters
Function parameters can be opaque and have no size information. For
example, __va_list in AArch64 ABI. header-abi-diff considers opaque
types compatible if their mangled names are the same.

The mangled name of __va_list can be _ZTI9__va_list or _ZTISt9__va_list.
They are also compatible.

Test: ./test.py
Bug: 248418092
Change-Id: I812abcabb620301eb575c54c7e3d2ff63dade488
2022-10-06 15:46:16 +08:00
Hsin-Yi Chen
f5f04a5b6c Simplify the error message for ABI check
- Remove "VNDK" from the message.
- Deprecate -elf-unreferenced-symbol-errors.
- Fix the status string for CompatibilityStatusIR::UnreferencedChanges.

Test: ./test.py
Bug: 249324120
Change-Id: I5a1fd64f9101caa29d87d9f65bd4d17b8bd77059
2022-10-05 10:13:41 +08:00
Hsin-Yi Chen
fc212f2a34 Merge "Do not allow extending pass-by-value parameters or return types" 2022-10-05 02:03:26 +00:00
Hsin-Yi Chen
9f22a276fd Allow adding class/struct members to padding space
This commit removes the comparison between class size and member offsets
from RecordTypeDiffIR::IsExtended. New members can be added to padding
space in a class without changing the existing members.

Test: ./test.py
Bug: 248418092
Change-Id: I34d002478f1dcfd3c183e76899917e602de2b4c1
2022-09-29 19:49:41 +08:00
Hsin-Yi Chen
d875d513f2 Do not allow extending pass-by-value parameters or return types
Resizing the parameters or return types changes the stack layout. It
is not an allowed extension to functions.
AbiDiffHelper::CompareFunctionTypes additionally checks the sizes of the
parameters and the return types. The difference cannot be ignored by
-allow-extensions. The user who intends to ignore the difference should
specify -ignore-symbols or -ignore-linker-set-key.

Test: ./test.py
Bug: 248418092
Change-Id: Ibef3b9260504afff3fc0260b0565736133b8e0dc
2022-09-28 10:59:51 +00:00
Hsin-Yi Chen
efd3826863 Merge "Allow appending members to structs and classes" 2022-09-28 09:18:15 +00:00
Hsin-Yi Chen
e0d81eed8f Merge "Delete VNDK definition tools" 2022-09-28 04:24:25 +00:00
Hsin-Yi Chen
cdf49db15c Allow appending members to structs and classes
This commit adds RecordTypeDiffIR::IsExtended() that determines whether
the difference is a pure extension, i.e., appending members and
increasing the size. The extensions are stored in
record_type_extension_diffs in abi_diff messages. They can be ignored by
specifying -allow-extensions.

Test: ./test.py
Bug: 248418092
Change-Id: Ibdef042c6176dc84d2dd61f71a3f88035e943dd4
2022-09-28 12:18:01 +08:00
Hsin-Yi Chen
adc960d590 Merge "Filter added or removed types by -ignore-linker-set-key" 2022-09-23 03:31:49 +00:00
Hsin-Yi Chen
cc90871286 Merge "Add linker_set_key to RecordTypeDiff and EnumTypeDiff" 2022-09-22 07:00:47 +00:00
Hsin-Yi Chen
37792200d3 Filter added or removed types by -ignore-linker-set-key
Test: development/vndk/tools/header-checker/tests/test.py
Bug: 243903630
Change-Id: I103779591cf8f52f9178d33ad5a205ca4eaaba2f
2022-09-21 09:00:40 +00:00
Hsin-Yi Chen
00d8159166 Add linker_set_key to RecordTypeDiff and EnumTypeDiff
RecordTypeDiff and EnumTypeDiff in abi_diff.proto contain linker set
keys. The developers can copy them to the ignore list. The other Diff
messages do not need the field because it's in the messages imported
from abi_dump.proto.

Test: Update prebuilts/clang-tools; make libz
Bug: 243903630
Change-Id: I1e90d3c6cbfd09d72b3fdb244a4079ae899630aa
2022-09-21 16:50:58 +08:00
Pirama Arumuga Nainar
dafc6d0793 Merge "Update clang-tools build to clang-r458507" 2022-09-19 20:02:41 +00:00
Pirama Arumuga Nainar
2e6f159eae Update clang-tools build to clang-r458507
Bug: http://b/236798112
Bug: http://b/244486343
Test: presubmit
Change-Id: Icff1712b289925901582f5429bfea3fde1834eec
2022-09-19 05:16:10 +00:00
Krzysztof Kosiński
45c7ebda06 Remove Python enables identical to global defaults.
Bug: 245854393
Test: presubmit
Change-Id: I9bb5cbd972432a26afcb13d7c2a6bbc73fb0991f
2022-09-17 11:33:50 +00:00
Hsin-Yi Chen
f38939ac24 Delete VNDK definition tools
The tools have not been maintained since Android 11.
vndk-lib-extra-list-*.txt are not deleted because VTS depends on them.

Test: make
Bug: 247032590
Change-Id: Iafaf98d13e77edea34a45c84ac44804703aa6d24
2022-09-16 14:37:04 +08:00
Mu-Le Lee
3ccbbe8717 Merge "Update README in header checker for option ignored_linker_set_keys" 2022-09-05 08:13:48 +00:00
Mu-Le Lee
a008152637 Merge "Add option to ignore some specific LinkerSetKeys in header-abi-diff" 2022-09-05 07:37:06 +00:00
Mu-Le Lee
d93d4de71f Add option to ignore some specific LinkerSetKeys in header-abi-diff
Sometimes developers may want to ignore some incompatible changes in ABI
because it is safe for some reason. An option should be added to
header-abi-diff so it ignores these LinkerSetKeys passed from cli or
config file.

Test: perform abi diff on libz with abi-dump version 33 with the LinkerSetKey _ZTI14internal_stat is specified.
Bug: 243903630
Change-Id: Iccc79d648ae17634a987faac32a2a7cbaa784e5c
2022-09-01 08:08:13 +00:00
Mu-Le Lee
173a9dd208 Update README in header checker for option ignored_linker_set_keys
NDK and platform Libraries are required to ensure the compatibility
across SDK version. However, some changes of a library that break its
ABI compatibility are necessary. Thus a ignored_linker_set_keys option
is added to let developers to skip some symobls.

Test: no need
Bug: 243903630
Change-Id: If6ca665189fdeec7c3e735a0f691dffd180ddc63
2022-08-31 09:08:44 +00:00
Mu-Le Lee
d8fdf8bc91 Merge "Update README in header checker for header-abi-diff configuration" 2022-08-26 12:59:18 +00:00
Mu-Le Lee
06f41abd76 Update README in header checker for header-abi-diff configuration
Add description of the config format and logic for developer to add
flags to header-abi-diff in Cross-Version ABI Check.

Test: no need
Bug: 239790286
Change-Id: I5b8fbe57aaafd1357495395a416a5d6b51f0ff3f
2022-08-26 11:19:46 +00:00
Mu-Le Lee
3bf758113b Merge "Fix header-abi-diff skips diff when config.json is not found" 2022-08-22 15:09:09 +00:00
Mu-Le Lee
82c4dd2bc7 Fix header-abi-diff skips diff when config.json is not found
Skip loading config.json when the config.json is not found so the
header-abi-diff will still perform abi diff.

Test: preform abi diff without config.json
Bug: 243328443
Change-Id: I92ebf7e7bfe6abb57bdefa211eaf604efaee517e
2022-08-22 08:32:57 +00:00
Mu-Le Lee
7b72a4f5f1 Merge "Implement the Cross-Version ABI diff configuration" 2022-08-19 08:25:45 +00:00
Mu-Le Lee
2ce72d8673 Implement the Cross-Version ABI diff configuration
Enable the Cross-Version ABI diff configuration so developers can
specify different flags for current and previous version ABI Check. The
-target-version flag were added to determine the config section to be
selected. The details of this configuration logic could be found in
go/cross-version-abi-diff-configuration.

Test: preform abi diff with config.json
Bug: 239792343
Change-Id: I8fdad2d18096cfa7866183ecc2d7826682c85eb6
2022-08-19 04:42:03 +00:00
Mu-Le Lee
e43c2bc9a7 Merge "Change the format of header-abi-diff config from .ini to .json" 2022-08-17 05:58:15 +00:00
Mu-Le Lee
c2ebbbfec5 Change the format of header-abi-diff config from .ini to .json
Since Cross-Version ABI Check is introduced, the flags could be
different when diffing with previous or current dumps. The structure and
format of the newly proposed config are changed so users can configure
flags for different diff targets. This CL changes the config format from
.ini to .json with the same features the format of the json is described
in go/cross-version-abi-diff-configuration.

Test: preform abi diff with config.json
Bug: 239792343
Change-Id: I731bafbfdacd2a780c5f7a27997893cecb2eb1f3
2022-08-11 06:35:33 +00:00
Treehugger Robot
5fcc737b41 Merge "Set ALLOW_UNKNOWN_WARNING_OPTION" am: 5a5aa3357a
Original change: https://android-review.googlesource.com/c/platform/development/+/2161662

Change-Id: If7f0dd37bed7d027c3aecee9c20fd3426de8b8b7
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-21 22:29:58 +00:00
Yi Kong
7549a9f9a6 Set ALLOW_UNKNOWN_WARNING_OPTION
header-checker build may use an older version of clang than the platform
version, causing errors for unknown cflags. Setting the env var allows
these errors to be suppressed.

Test: presubmit
Change-Id: Icf08ec5913f5608ffc1e14daf3e6ed71610f733a
2022-07-21 17:45:07 +08:00
Steven Moreland
d3e6c8e283 Merge "Create a module for create_reference_dumps.py" am: ba781b8eac
Original change: https://android-review.googlesource.com/c/platform/development/+/2157919

Change-Id: I3032e52c529a9661ff5da8e60a2b9b60b4572839
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-19 16:02:08 +00:00
Hsin-Yi Chen
f4f89e7224 Create a module for create_reference_dumps.py
The module is a host python binary with embedded launcher. It is
independent of the python runtime installed on the OS.

Test: m create_reference_dumps && \
      create_reference_dumps -products aosp_x86_64 -libs libc
Bug: 238984913
Change-Id: Ie84ef5c78cec978f83a2bddb370978fb962de4bd
2022-07-18 16:58:10 +08:00
Mu-Le Lee
00e22d110d Merge changes If1ccc3d9,I198bf3e1,I0d903c16 am: a12115812c
Original change: https://android-review.googlesource.com/c/platform/development/+/2152453

Change-Id: I8587548ab48c84f4cd5bd5a6f3eb71f656738a2e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-15 16:47:02 +00:00
Mu-Le Lee
a12115812c Merge changes If1ccc3d9,I198bf3e1,I0d903c16
* changes:
  Refactor GetRefDumpDirStem to avoid excessive arguments passing
  Generate dumps for non-VNDK into folder that matches Cross-Version ABI Check mechanism
  Generate LLNDK ABI dumps to platform/ instead of vndk/
2022-07-15 16:25:59 +00:00
Mu-Le Lee
aee4dbfae4 Refactor GetRefDumpDirStem to avoid excessive arguments passing
The arguments required by function get_ref_dump_dir_stem() would be
carried all the way to get_ref_dump_dir_stem(). In this CL, the logic
of get_ref_dump_dir_stem() would be wrapped into a class so that the
other functions can be cleaner.

Test: $ANDROID_BUILD_TOP/development/vndk/tools/header-checker/utils/create_reference_dumps.py --llndk -l libvndksupport -l libbinder_ndk -l libprocinfo
Bug: 238828401
Change-Id: If1ccc3d9de0408c5e1ef252412630df341d38e14
2022-07-15 05:45:22 +00:00
Mu-Le Lee
ec18592802 Generate dumps for non-VNDK into folder that matches Cross-Version ABI Check mechanism
The dumps of non-VNDK was generated to PLATFORM_SDK_VERSION. To enable
the Cross-Version ABI Check, before finalization (when
PLATFORM_VERSION_CODENAME is not REL), dumps should be generate to
current/ no matter what PLATFORM_SDK_VERSION is; After finalization,
dumps should be generate to PLATFORM_SDK_VERSION/.

Test: $ANDROID_BUILD_TOP/development/vndk/tools/header-checker/utils/create_reference_dumps.py \
      --llndk -l libvndksupport -l libbinder_ndk -l libprocinfo
Bug: 238573414
Change-Id: I198bf3e1fb1382a9378dcde16deb9262f0eb9f64
2022-07-14 09:46:38 +00:00
Mu-Le Lee
1a4fb95440 Generate LLNDK ABI dumps to platform/ instead of vndk/
Since vndk libraries don't need to maintain Cross-Version abi
compatibility. The newly proposed Cross-Version ABi checking mechanism
is applied to only ndk/ and platform/. The dumps of LLNDK libraries
should be generated to platform/ to be benefited from this checking
mechanism.

Test: $ANDROID_BUILD_TOP/development/vndk/tools/header-checker/utils/create_reference_dumps.py \
      --llndk -l libvndksupport
Bug: 238383972
Change-Id: I0d903c16eecfd57001a539c14bd4d6945c148e3c
2022-07-09 06:13:33 +00:00
Hsin-Yi Chen
ae48bf1087 Merge "Remove MIPS data from ABI unit tests" am: cd2a609c4e
Original change: https://android-review.googlesource.com/c/platform/development/+/2147663

Change-Id: Ic054d06952f07ad9d5de4129f665a998f23566c8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-07 09:35:30 +00:00
Hsin-Yi Chen
a923b62fe5 Remove MIPS data from ABI unit tests
Test: PATH=$PATH:$ANDROID_BUILD_TOP/out/soong/dist/bin \
      development/vndk/tools/header-checker/tests/test.py
Bug: 237966264
Change-Id: If6c7e0fe297f384a703f0a45727618518062363e
2022-07-07 11:01:42 +08:00
Hsin-Yi Chen
232ac91360 Merge "Generate only the necessary data for ABI unit tests" am: bd1460dca5
Original change: https://android-review.googlesource.com/c/platform/development/+/2145588

Change-Id: I43695a24b948c096112f22a059af897937feaa83
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-07 02:55:48 +00:00
Hsin-Yi Chen
c1965c3600 Generate only the necessary data for ABI unit tests
This commit configures "has_reference_dump" for the modules in ABI unit
tests. gen_all.py refers to the flag to creates reference dumps.

Test: PATH=$PATH:$ANDROID_BUILD_TOP/out/soong/dist/bin \
      development/vndk/tools/header-checker/tests/gen_all.py
Test: PATH=$PATH:$ANDROID_BUILD_TOP/out/soong/dist/bin \
      development/vndk/tools/header-checker/tests/test.py
Bug: 237966264
Change-Id: I35d5c43a20533cc71470b02919258dd883b40241
2022-07-05 18:34:24 +08:00
Hsin-Yi Chen
32b7f690af Merge "Remove -suppress-errors from header-abi-dumper" am: 871a22ffae
Original change: https://android-review.googlesource.com/c/platform/development/+/2145581

Change-Id: Ia0344d169b8c67350658784e1bfbfd4c0cdba835
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-05 08:35:09 +00:00
Hsin-Yi Chen
93be04bf1f Remove -suppress-errors from header-abi-dumper
The purpose of the option was to parse individual header files. It's not
an effective solution to the headers that are not self-contained.

Test: PATH=$PATH:$ANDROID_BUILD_TOP/out/soong/dist/bin \
      development/vndk/tools/header-checker/tests/test.py
Bug: 237966264
Change-Id: Id7321d7feb0bb28f6e0da39bc9d6a4348e038149
2022-07-05 11:33:38 +08:00
Mu-Le Lee
cff9bcf5ae Merge "Create a cli option to build only the specified target rather than the whole package." am: 59b0ddfffd
Original change: https://android-review.googlesource.com/c/platform/development/+/2136832

Change-Id: I3db3e75ee1620e5cbf539966b0cddef35c7838cd
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-01 05:04:11 +00:00