Commit Graph

1431 Commits

Author SHA1 Message Date
Hsin-Yi Chen
5e00b7aba7 Exclude version blocks by patterns
The version blocks ending with _PLATFORM and _PRIVATE are unstable ABIs.
To exclude them, header-abi-linker --exclude-symbol-version should
accept patterns like *_PLATFORM and *_PRIVATE.

Test: ANDROID_BUILD_TOP=`realpath .` \
      PATH=$PATH:`realpath out/soong/dist/bin` \
      development/vndk/tools/header-checker/tests/test.py
Test: LD_LIBRARY_PATH=out/soong/dist/lib64 \
      out/soong/host/linux-x86/nativetest64/header-checker-unittests/header-checker-unittests
Bug: 298626434
Change-Id: Id82bc013b8de62b5ba8e5bd29f399b1b72ab5d39
2023-09-15 05:13:51 +00:00
Hsin-Yi Chen
c0d2b6e79b Merge "Let build-prebuilts.sh compile unit tests" into main 2023-09-12 07:00:36 +00:00
Hsin-Yi Chen
9beee3bf06 Let build-prebuilts.sh compile unit tests
build-prebuilts.sh compiles header-checker-unittests by default. The
continuous builds ensure that the tests are compilable. The developers
can use the script to build the tests locally.

Test: OUT_DIR=out BUILD_BROKEN_DISABLE_BAZEL=1 \
      development/vndk/tools/header-checker/android/build-prebuilts.sh \
      header-checker-unittests
Test: OUT_DIR=out BUILD_BROKEN_DISABLE_BAZEL=1 DIST_DIR=/tmp/distdir \
      development/vndk/tools/header-checker/android/build-prebuilts.sh
Bug: 280008249
Change-Id: I32d6ade3c527785d68802c1737c94f963ead5b3c
2023-09-11 18:36:54 +08:00
Yi Kong
f8d367d015 Update to clang-r498229b
Bug: 293616148
Change-Id: Ic77a78f463691aa2c927cfa6bea009ef38e9f0d7
Test: presubmit
2023-09-07 10:48:55 +00:00
Hsin-Yi Chen
beda56ad5c Rename Target to Arch in header-checker utils.py
"target" refers to a target arch, a build target, or a make target.
This commit renames the class and the variables to avoid ambiguity.

Test: development/vndk/tools/header-checker/utils/create_reference_dumps.py \
      -products aosp_x86_64 -release trunk_staging
Bug: 297542516
Change-Id: Icfb06e18333d56af802c74494c1d158f367026c9
2023-08-29 08:58:49 +00:00
Hsin-Yi Chen
0433a86ffd Pass release configuration to create_reference_dumps.py
This commit adds -release as a parameter to create_reference_dumps.py.
It is currently optional. Developers can use it to try different
release configurations.

Test: development/vndk/tools/header-checker/utils/create_reference_dumps.py \
      -products aosp_x86_64 -release trunk_staging
Bug: 297542516
Change-Id: Ifb7001ed42dbb9f8d0dd8e6c9738be6d5ea2feca
2023-08-28 08:06:13 +00:00
Hsin-Yi Chen
7d300d7652 Merge "Handle lsdump paths containing soong config hash" into main 2023-07-28 03:20:47 +00:00
Matthew Maurer
6937e35e01 clang-tools: Re-enable bindgen prebuilt
We turned this off for a bit because not all deps were mapped in to the
clang-tools build. Re-enabling now to produce a fresh prebuilt.

Bug: 251506715
Test: ABTD aosp-clang-tools
Change-Id: Ia843be55894946ff0803c43057e58899f99b580f
2023-07-26 23:01:40 +00:00
Hsin-Yi Chen
04cf4d41e9 Handle lsdump paths containing soong config hash
An arch variant directory may contain a soong host config subdirectory.
The ABI dump script extracts the last two directory names from an
intermediate lsdump path. It builds the lsdump if any of the directory
names matches the variant.

Test: ./create_reference_dumps.py -libs libmemtrack \
      -products aosp_arm64
Bug: 291850413
Change-Id: I3dafc68b0dc7bb7faf708e3adfd24082a12a691b
2023-07-25 17:33:29 +08:00
Yabin Cui
cc9c82d2c5 Update clang version to clang-r498229
Bug: 280683256
Test: OUT_DIR=out prebuilts/clang-tools/build-prebuilts.sh
Change-Id: Id1e6449e0792f3937298e0f47c6c0a9f9f8fd08e
2023-07-07 17:55:29 +00:00
Matthew Maurer
72fe590178 Unbreak build by removing bindgen temporarily
Bindgen has been updated in platform, but additional repos need to be
mapped into this build to work properly. Since changing manifests
requires special permissions, this unbreaks the build until we can get
the manifest fixed to re-add bindgen.

Test: TH
Change-Id: Idd7bf289212a2570e267eaab0e94d332ed8a44b2
2023-06-29 02:02:52 +00:00
Hsin-Yi Chen
57a28a1076 Merge "Check the state of ofstream" 2023-06-26 06:02:25 +00:00
Hsin-Yi Chen
e235d32717 Check the state of ofstream
This commit fixes the bug that causes the ABI tools to produce invalid
output but return success.

Bug: 288168134
Test: development/vndk/tools/header-checker/tests/test.py
Change-Id: Ifa94667e9d38eff65e943a1d277dd2c7b5493fe5
2023-06-26 11:00:41 +08:00
Hsin-Yi Chen
9d4a5a7248 Fix the link to Update-Opt_in-Reference-ABI-Dumps
Test: none
Change-Id: I759f825e213cd6dcb42f2b7b29c344a41691aeaf
2023-06-20 17:56:13 +08:00
Yi Kong
fda7cced69 Update clang version to clang-r487747c
Test: presubmit
Bug: 279955553
Change-Id: I8043ab75173420f60e828d973ba69d47011c2953
2023-05-13 18:11:44 +01:00
Hsin-Yi Chen
934663b2f0 Merge "Add README about opt-in ABI dumps" 2023-04-25 10:24:17 +00:00
Hsin-Yi Chen
35fabff46a Add README about opt-in ABI dumps
- Add the commands to write Android.bp, create reference dumps, and
  find the generated dumps.
- Remove "persistent-" from the repo command as it's internal only.

Test: None
Bug: 227282691
Change-Id: I07dc947c0436e2a0e7e5b3a4f812800bd7df2720
2023-04-14 19:31:49 +08:00
Hsin-Yi Chen
62081d11b4 Fix the internal type of enum values
EnumFieldIR has member functions that determine whether the enum value
is signed. The JSON dumper uses the functions to distinguish between
negative values and values >= (1 << 63).

Bug: 277299761
Test: ./test.py
Change-Id: If5f3a33aaf5f53f39019fdd10dde366d48a50340
2023-04-12 11:37:10 +00:00
Yi Kong
1784c71446 Merge "Revert^2 "Update clang version to clang-r487747"" 2023-03-24 13:19:52 +00:00
Hsin-Yi Chen
35fce6fed2 Collect libc++ headers that have no file name extensions
Test: LD_LIBRARY_PATH=prebuilts/clang/host/linux-x86/clang-r475365b/lib \
      out/soong/host/linux-x86/nativetest64/header-checker-unittests/header-checker-unittests
Bug: 271382846
Change-Id: Ica435ac635f6ab4f500e31ae1c38c2928b6dc6ac
2023-03-10 14:45:20 +08:00
Yi Kong
4476b23303 Revert^2 "Update clang version to clang-r487747"
78eb9e45d8

Change-Id: Iefe6911e88102848ef7185b6214020261f73e43e
2023-03-06 08:04:44 +00:00
Hsin-Yi Chen
0802314c7b Collect header files in subdirectories
Test: LD_LIBRARY_PATH=prebuilts/clang/host/linux-x86/clang-r487747/lib \
      out/soong/host/linux-x86/nativetest64/header-checker-unittests/header-checker-unittests
Bug: 271382846
Change-Id: I2f82c0d04870d31e29f854f5256a0d5a6b5455f0
2023-03-03 18:06:12 +08:00
Yi Kong
78eb9e45d8 Revert "Update clang version to clang-r487747"
Revert submission 2462733-fix-clang-tools-r487747

Rollback compiler update

Reverted changes: /q/submissionid:2462733-fix-clang-tools-r487747

Change-Id: I728d075c70c1a9938475069643c62a2cdf2a968f
2023-03-02 08:36:20 +00:00
Yi Kong
c08ebcfe53 Update clang version to clang-r487747
Change-Id: I254e4e31244599c7931a169a571f56b44d34b801
Test: presubmit
Bug: 264965700
2023-03-01 16:45:59 +09:00
Hsin-Yi Chen
feab6687e7 Merge "Convert type_queue to a member of AbiDiffHelper" 2023-02-23 05:04:56 +00:00
Hsin-Yi Chen
3b7728c88b Convert type_queue to a member of AbiDiffHelper
Test: ./test.py
Bug: 255702405
Change-Id: Ic1561812fe2b456b8c21440ef8a2439b0545f874
2023-02-22 13:44:09 +08:00
Hsin-Yi Chen
9a0530cb9b Link clang tools' lib directory before copying clang libraries
This commit restores lib/libc++.so.1 and lib/libclang-cpp.so.16 which
are indirect dependencies of clang tools.

Bug: 218706358
Test: out/soong/dist/bin/versioner -h
Change-Id: I3b9414645dc5b56d322d21e082feca260519d053
2023-02-21 08:26:14 +00:00
Hsin-Yi Chen
78562c0157 Merge "Replace TypeQueueCheckAndPushBack with TypeStackGuard" 2023-02-21 03:10:18 +00:00
Hsin-Yi Chen
4602059a36 Merge "Return DiffStatus from FilterOutRenamedRecordFields" 2023-02-20 08:24:42 +00:00
Hsin-Yi Chen
16e50ed2a6 Merge "Simplify the return value of CompareCommonRecordFields" 2023-02-16 02:32:37 +00:00
Yi Kong
f30be10e46 Merge "Migrate to the new clang lib dir" 2023-02-15 10:05:52 +00:00
Hsin-Yi Chen
033af47aa6 Replace TypeQueueCheckAndPushBack with TypeStackGuard
A followup commit will rename type_queue to type_stack.

Test: ./test.py
Bug: 255702405
Change-Id: Ie5c21b0883f08386d30b80ca955708aa7f4bdb16
2023-02-15 16:48:19 +08:00
Hsin-Yi Chen
17d6299cae Return DiffStatus from FilterOutRenamedRecordFields
The status of the filtered out fields is either kNoDiff or
kIndirectDiff. It does not affect the diff report, but makes
ModuleMerger determine redefined types more accurately.

Test: ./test.py ; update the prebuilt clang tools and build
Bug: 255702405
Change-Id: Ia94225d25e00597affa8b1e01a7c9de592bf5b05
2023-02-15 16:44:32 +08:00
Hsin-Yi Chen
3417140281 Simplify the return value of CompareCommonRecordFields
Before this commit, the function returns
(kDirectDiff, RecordFieldDiffIR *) or (kIndirectDiff/kNoDiff, nullptr).
The commit changes the return value to a DiffStatus. The caller decides
whether to create a RecordFieldDiffIR by the DiffStatus.

Test: ./test.py
Bug: 255702405
Change-Id: If2bfd5bca78e9d924be34ad5c522db9b91382cde
2023-02-15 16:44:18 +08:00
Yi Kong
7daeb1f361 Migrate to the new clang lib dir
Test: presubmit
Bug: 218706358
Change-Id: I6825f7c1f4340a30a14d9d8ce0fb5a3caf813f9e
2023-02-15 16:50:07 +09:00
Hsin-Yi Chen
08e0ce1066 Diff the fields located at the same offset in a class
- Rewrite the diff algorithm to handle multiple fields located at the
  same offset in a class, struct or union.
- Allow renaming a field if its (offset, type) pair is unique.

Bug: 255702405
Test: ./test.py
Change-Id: I79ebe9a827822b0f89d95952fa7d8c30499ca680
2023-02-13 10:23:02 +08:00
Hsin-Yi Chen
9b286a1967 Merge "Diff array types" 2023-02-02 08:27:42 +00:00
Hsin-Yi Chen
6ecc9e3997 Merge "Rename GenericFieldDiffInfo to RecordFieldDiffResult" 2023-02-02 06:31:49 +00:00
Hsin-Yi Chen
64930c428f Diff array types
This commit implements the function that compares array size, alignment,
and element type.

Test: ./test.py ; update prebuilts/clang-tools and build
Bug: 255702405

Change-Id: I4f25d22f060cfda04bbd88b9c2521461b95e6829
2023-02-02 12:58:35 +08:00
Hsin-Yi Chen
eb5797a263 Rename GenericFieldDiffInfo to RecordFieldDiffResult
Test: ./test.py
Bug: 255702405
Change-Id: I7e1112697f75b0a93ab821a128054e7e80acd6e1
2023-02-01 16:22:31 +08:00
Yabin Cui
7d47151afb Merge "Update clang-tools build to clang-r475365b" 2023-01-19 20:42:44 +00:00
Yabin Cui
deddd88b27 Update clang-tools build to clang-r475365b
Also remove -std=c++14 flag. Because clang 16 uses c++17
by default. And some headers don't compile with c++14.

Bug: 253033919
Test: run build-prebuilts.sh
Change-Id: Ia76c227831ed62a9de190fb1d816f23d7c92fad2
2023-01-18 10:27:50 -08:00
Hsin-Yi Chen
3a51bf53f1 Add a field for arrays of unknown bound
The ABI tools do not diff the array length. They cannot distinguish
between arrays of unknown bound (e.g., int foo[]) and arrays of zero
length (e.g., int bar[0]). To implement array diff, this commit adds
"is_of_unknown_bound" field to the ABI dumps. It defaults to false so
that it can be omitted for common cases.

Test: ./test.py ; update prebuilts/clang-tools and build
Bug: 255702405
Change-Id: I5db163eb62e95fa01377ef7202e70cc2a0e89524
2023-01-16 17:36:38 +08:00
Hsin-Yi Chen
e07e343451 Merge "Fix the bug that generates multiple definition of references" 2023-01-10 03:08:11 +00:00
Hsin-Yi Chen
6e5894f6a2 Fix the bug that generates multiple definition of references
If a type ID is persent in local_to_global_type_id_map,
ModuleMerger functions should report that was_newly_added_ = false.

Test: ./test.py ; update prebuilts/clang-tools and build
Bug: 255702405
Change-Id: I0fbe68ebbc6b8df3ea4ae36a017d0bb61bc7d553
2023-01-07 16:24:43 +08:00
Hsin-Yi Chen
a062a6cf35 Determine struct extensions before calling IRDiffDumper
This commit moves the functions that determine struct extensions from
ir_diff_representation.cpp to abi_diff_helpers.cpp. The functions
are called before IRDiffDumper so that the IR and the dumper do not
include the diff logic.

Test: ./test.py
Bug: 259148872
Change-Id: I93aaa3028bf6a30312f0b0e5b1ef5f6ae1041f21
2022-12-30 16:33:48 +08:00
Hsin-Yi Chen
82b8191b50 Merge "Allow extending qualifiers of function parameters and return values" 2022-12-28 09:31:24 +00:00
Hsin-Yi Chen
e77c10f563 Allow extending qualifiers of function parameters and return values
`header-abi-diff --allow-extensions` allows function parameters to be
more qualified, and return types to be less qualified. The ABI tools
follows the qualifier conversion rules in C++.

The ABI tool only allows extending the qualifiers of the functions that
have corresponding symbols. The qualifiers of the other types, such as
function pointers, class members, and global variables, must be
identical between the old and new ABIs.

Test: ./test.py
Bug: 259148872
Change-Id: I227f6ed774cc88009713acce955e35f1c3cff1ca
2022-12-28 10:19:00 +08:00
Yu Liu
0d3029fb87 Explicitly search header files in abi dumper.
Bug: None
Test: Manual
Change-Id: Ie72e0c4490ab9e29152fcdc45e48ca9724e31f7d
2022-12-15 21:48:11 -08:00
Hsin-Yi Chen
4a0b74b22a Refactor DiffStatus into a class
DiffStatus is a class that exposes constants and member functions.
AbiDiffHelper calls the member functions to determine how to report the
diff. The actual value of a DiffStatus object is encapsulated so that
developers can define new status without changing existing logic.

Test: ./test.py
Bug: 259148872
Change-Id: I2c3be62046aa01d68c84690cb158f8fc7a5b474b
2022-12-14 10:06:13 +08:00