Commit Graph

16 Commits

Author SHA1 Message Date
Jayant Chowdhary
e90b33a9d9 header-abi-diff: Add a flag to consider opaque types with different names structurally unequal.
Bug: 79576032

Test: tests/test.py

Change-Id: I28cb7a2676a1e85e4ef1d2faaf6684d7c1824370
2018-06-04 11:50:05 -07:00
Jayant Chowdhary
b31dbb37f6 header-abi-diff: Fix omission of warning message for extensions.
Test: Without change : extend libjpeg; build breaks without warning message
      specifying extension

Test: With change : extend libjpeg; build breaks with warning message specifying
      extension

Test: tests/test.py

Change-Id: I1653a977d0945810b4b9dc4ec9923b12c4f5dc36
2018-05-24 18:12:55 -07:00
Jayant Chowdhary
da3d352ffd header-abi-diff: -allow-unreferenced-elf-symbol-changes will suppress warnings as well.
Bug:79928919

Test: tests/test.py

Change-Id: Icec65e5e18987fd60fb8e5532983947b335b6951
2018-05-18 15:38:54 -07:00
Jayant Chowdhary
8be19f1718 Fix false compatibility return status on extension.
Also, don't diff unreferenced anonymous records.

Bug: 64267858
Bug: 72697345

Test: Extend libjpeg by adding an exported function, also add an unused struct;
      Without this change: build shows an 'error' message, but does not fail.
      With this change in prebuilts : build shows 'error' message and
      fails.

Test: tests/test.py passes.

Change-Id: Ief7ed90715a9c1a25736c10449833650c73d3db3
2018-03-29 20:19:00 -07:00
Logan Chien
7a66e787b6 header-checker: Suppress extension warning
This commit suppresses extension warning if --allow-extensions is
specified.

Test: Run header-abi-diff with --allow-extensions
Change-Id: I76a868aea239e5ce6f8213c12282c946d28f2ab5
2018-01-10 09:32:03 +08:00
Logan Chien
a907adb574 header-checker: Change extensions from warning to error
This commit changes API extensions from warning to error if the command
line option `--allow-extensions` is not specified.

Test: Run header-abi-diff without --allow-extensions and see the error
Change-Id: If3cf659246e78409ec64ce68dfa885ab4808b50b
2018-01-10 09:32:03 +08:00
Logan Chien
f7b388328b header-checker: Code cleanup
Test: None (No functionality changes)
Change-Id: I18078a5465d4d93bacc8ba381d3ca727ea423ef7
2018-01-09 18:17:08 +08:00
Jayant Chowdhary
33ea1d01eb Add command line option(s) to chose text format.
Added command line options to header-abi-dumper and header-abi-diff to
support multiple text formats.

Bug: 63865902

Test: BOARD_VNDK_VERSION=current mm -j64 in
      frameworks/compile/libbcc/bcinfo produces libbcinfo.so.lsdump
      successfully.

Test: tests/test.py; all tests pass.

Change-Id: I291d3af16e90b12ee131bb864f90a5b96189db13
2017-11-20 11:16:38 -08:00
Jayant Chowdhary
1fdab142f7 Add options to make elf symbol changes as warnings.
Some elf symbols in the .dynsym table of an .so file may not be present
in the headers exported by a shared library. We must still know about
these changes. Therefore, add options to make notifications about
these changes warnings instead of errors.

Bug: 62060883

Test: tests/test.py pass

Change-Id: Ic0cbad3370597c251f9e2c0f2b8cbb089aed155f
2017-08-24 23:41:04 -07:00
Jayant Chowdhary
83fc92bb30 Introduce recursive dumping/diffing of types.
1) Types are now quantifed into one of the following:
	a) RecordType - structures/ unions/ classes.
	b) EnumType - enumerated types.
	c) QualifiedType - types with qualifiers intact.
	d) PointerType - pointer to a type.
	e) LvalueReferenceType
	f) RvalueReferenceType
	g) ArrayType

2) ABI diffing now diffs based on types directly / indirectly reachable
by function signatures / global variable types by default. Also added an option
to header-abi-diff:

-check-all-apis : Include changes to all APIs exported via exported
headers whether directly / indirectly used by function signatures /
global variable types or not.

3) Introduced an internal representation of abi information. This
enables us to switch formats of abi-dumps / abi-diffs more easily
without changing the AST parsing code. For example: In the future, if we
wanted to add options to view the abi-dumps in html / xml we could just
add classes which extended IRDumper and implement dumping methods.

4) The linked ABI dump of a shared library also includes a list of the
exported functions and objects collected from the .dynsym table. This makes it
possible to avoid false reports of ABI breakages when functions/ global
variables are moved to assembly files.

Test: abi-dumping and linking: make -j64 from ToT
      abi_diffing: change parameter types directly, indirectly.
      Ran tests/test.py with soong running the built tool, all tests passed.

Bug: 62060883

Bug: 63865902

Change-Id: Id9ef757165a1669049fde20bda4147d5074cc191
2017-08-16 19:26:08 -07:00
Jayant Chowdhary
e6a88775e9 Add more flexibility to abi checking.
1) Marking a field "required" robs us of flexibility. Make fields optional
allows us to update the message format without needing to necessarily
update the reference abi-dumps.

2) Allow local warnings with the invocation of header-abi-diff.

Test: Added a function to libjpeg, got a warning claiming abi extended.

3) Introduce a flag which allows us to not filter any abi. This is
useful for cases when libraries do not include what they export. eg :
libsqlite.

Test: abi-dump size of libsqlite:
	without no-filter : 0
	with no-filter : ~9M

Change-Id: I6cfeacc8711f6df7a4136c2a27b5638988a2c54b
2017-05-23 18:07:03 -07:00
Jayant Chowdhary
eb755c1323 Merge abi diffs, improve linking performance.
Bug: 38325544

Test:
As shown by out/build.trace.gz when using built header-abi-linker to
link .sdump files produced by header-abi-linker.

Without fix:
Time taken to produce libc.so.lsdump by header-abi-linker => ~51 sec
With fix:
Time taken to produce libc.so.lsdump by header-abi-linker => ~3 sec

Bug: 38325929

Test: merged abiff reports of libjpeg, libc.

Change-Id: Iae54f4754d8b0407fabdb8bc8550a7f7b3479f8f
2017-05-19 09:40:15 -07:00
Jayant Chowdhary
51406197dd C/C++ adjustments and bug fixes.
Bug: 37751376

Test: dumped the abi of libminijail, removed the "struct" keyword from
the abi-dump and confirmed that this did not result in an abi breakage
getting reported.

Bug: 37749718

Test: manually invoked header-abi-diff with file containing a list of
symbols to omit abi checks on from libminijail after changing sizes and
alignments of those symbols from libminijail's abi dumps. Diffs were not
reported.

Bug: 37918686

Test: dumped the abi of libbcinfo, it contains records as well as
symbols which adhere to the regex in the symbol file.

Also make function signature diffing independent of C++ name mangling.

Change-Id: Id34209ef24d1202745ca69765a4e2a96d1a05c2a
2017-05-04 19:54:51 -07:00
Jayant Chowdhary
0f82afef85 Add option to parse version script during linking.
1) Add option to parse version script file specifying exported symbols and
variables during link time.
2) Added test version script file.
3) Minor style cleanup.
4) Remove HandleVTable as it is no longer needed.
5) header-abi-diff has a mode to enable advice-only mode. This means no
failures on abi extensions / incompatiblity. Only report generation.
5) Seperate out functionality into util lib.

Test: 1) header-abi-dumper -o example1.dump tests/input/example1.cpp -I
tests -- -x c++ -std=c++11 -I . -I
~/android/aosp/external/clang/lib/Headers

2) header-abi-linker -o test.lsdump example1.dump -v
tests/input/test_version_script.map -arch arm64 -api 24,
test.lsdump has only the symbols specified by test_version_script.amp

Change-Id: Ib539db4a886abe4917e09cd8643ab35ffecb0df1
2017-04-12 21:16:17 -07:00
Jayant Chowdhary
ee0a448f4a Added More Abi information.
Make Messages mirror clang Types better.
Added type size and alignments for independent and complete types.
Added vtable layout for CXXRecordDecls.
Added abi information for variables with global storage.
Added new return status to signify abi extension.
Added checks for access specifier downgrades.
Removed repeated code from header-abi-diff.

Test: header-abi-dumper -o example1.dump tests/input/example1.cpp -I
tests -- -x c++ -std=c++11 -I . -I
~/android/aosp/external/clang/lib/Headers

Change-Id: I21b5a8ef6dff92ecae47a0b1c46342862c5e0ebd
2017-03-16 08:47:24 -07:00
Jayant Chowdhary
064e7d8291 Added header-abi-diff.
header-abi-diff takes two input dumps produced by header-abi-dumper and
produces an abi compatiblity report.

header-abi-dumper, header-abi-linker now produce dumps formatted only in
protobuf TextFormat.

Test: Dump the abi exposed by test/input/example1.cpp. Add fields, change
      return types of functions and dump the abi of this version. Produce the
      compatibility report by: header-abi-diff -old <ver1-dump> -new <ver2-dump>
      -o <compatibility-report>.
      Also tested changing the abi of libjpeg, and comparing a reference
      dump with the new dump. An Abi breakage is reported.

Bug: 32750600

Change-Id: I5444912d84de726aaa18977ca9162162aa13b760
2017-02-15 18:26:20 -08:00