[PATCH] ir, dwarf-reader: Peel const-qualifier from const this pointers

Dodji Seketeli dodji@redhat.com
Wed Mar 6 13:09:45 GMT 2024


Hello,

In DWARF, it appears that the this pointer of a concrete instance of
method is sometimes represented as a const pointer, whereas the this
pointer of the abstract instance (or interface) of that same method
has the this pointer represented as a non-const pointer.  That
difference often causes some spurious const-ness change reports on the
this pointer when doing comparisons.

This patch thus trims of the const-qualifier off of the this pointer
of methods.

	* include/abg-fwd.h (is_const_qualified_type)
	(peel_const_qualified_type): Declare ...
	* src/abg-ir.cc (is_const_qualified_type)
	(peel_const_qualified_type): ... new functions.
	* src/abg-dwarf-reader.cc (build_function_type): Trim the const
	qualifier off of the this pointer representation if present.
	* tests/data/test-annotate/test1.abi: Adjust.
	* tests/data/test-annotate/test14-pr18893.so.abi: Likewise.
	* tests/data/test-annotate/test15-pr18892.so.abi: Likewise.
	* tests/data/test-annotate/test17-pr19027.so.abi: Likewise.
	* tests/data/test-annotate/test18-pr19037-libvtkRenderingLIC-6.1.so.abi:
	Likewise.
	* tests/data/test-annotate/test19-pr19023-libtcmalloc_and_profiler.so.abi:
	Likewise.
	* tests/data/test-annotate/test2.so.abi: Likewise.
	* tests/data/test-annotate/test20-pr19025-libvtkParallelCore-6.1.so.abi:
	Likewise.
	* tests/data/test-annotate/test6.so.abi: Likewise.
	* tests/data/test-annotate/test8-qualified-this-pointer.so.abi:
	Likewise.
	* tests/data/test-diff-dwarf-abixml/test0-pr19026-libvtkIOSQL-6.1.so.1.abi:
	Likewise.
	* tests/data/test-diff-dwarf/test0-report.txt: Likewise.
	* tests/data/test-diff-dwarf/test28-vtable-changes-report-0.txt:
	Likewise.
	* tests/data/test-diff-dwarf/test29-vtable-changes-report-0.txt:
	Likewise.
	* tests/data/test-diff-dwarf/test30-vtable-changes-report-0.txt:
	Likewise.
	* tests/data/test-diff-dwarf/test31-vtable-changes-report-0.txt:
	Likewise.
	* tests/data/test-diff-dwarf/test36-ppc64-aliases-report-0.txt:
	Likewise.
	* tests/data/test-diff-dwarf/test41-PR20476-hidden-report-0.txt:
	Likewise.
	* tests/data/test-diff-dwarf/test42-PR21296-clanggcc-report0.txt:
	Likewise.
	* tests/data/test-diff-dwarf/test5-report.txt: Likewise.
	* tests/data/test-diff-dwarf/test8-report.txt: Likewise.
	* tests/data/test-diff-filter/test0-report.txt: Likewise.
	* tests/data/test-diff-filter/test01-report.txt: Likewise.
	* tests/data/test-diff-filter/test10-report.txt: Likewise.
	* tests/data/test-diff-filter/test13-report.txt: Likewise.
	* tests/data/test-diff-filter/test2-report.txt: Likewise.
	* tests/data/test-diff-filter/test28-redundant-and-filtered-children-nodes-report-1.txt:
	Likewise.
	* tests/data/test-diff-filter/test30-pr18904-rvalueref-report0.txt:
	Likewise.
	* tests/data/test-diff-filter/test30-pr18904-rvalueref-report1.txt:
	Likewise.
	* tests/data/test-diff-filter/test30-pr18904-rvalueref-report2.txt:
	Likewise.
	* tests/data/test-diff-filter/test35-pr18754-no-added-syms-report-0.txt:
	Likewise.
	* tests/data/test-diff-filter/test41-report-0.txt: Likewise.
	* tests/data/test-diff-filter/test9-report.txt: Likewise.
	* tests/data/test-diff-pkg/libsigc++-2.0-0c2a_2.4.0-1_amd64--libsigc++-2.0-0v5_2.4.1-1ubuntu2_amd64-report-0.txt:
	Likewise.
	* tests/data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-0.txt:
	Likewise.
	* tests/data/test-diff-pkg/tbb-4.1-9.20130314.fc22.x86_64--tbb-4.3-3.20141204.fc23.x86_64-report-1.txt:
	Likewise.
	* tests/data/test-diff-suppr/test24-soname-report-1.txt: Likewise.
	* tests/data/test-diff-suppr/test24-soname-report-10.txt: Likewise.
	* tests/data/test-diff-suppr/test24-soname-report-12.txt: Likewise.
	* tests/data/test-diff-suppr/test24-soname-report-14.txt: Likewise.
	* tests/data/test-diff-suppr/test24-soname-report-16.txt:
	Likewise.
	* tests/data/test-diff-suppr/test24-soname-report-4.txt: Likewise.
	* tests/data/test-diff-suppr/test31-report-1.txt: Likewise.
	* tests/data/test-read-dwarf/test1.abi: Likewise.
	* tests/data/test-read-dwarf/test1.hash.abi: Likewise.
	* tests/data/test-read-dwarf/test10-pr18818-gcc.so.abi: Likewise.
	* tests/data/test-read-dwarf/test11-pr18828.so.abi: Likewise.
	* tests/data/test-read-dwarf/test14-pr18893.so.abi: Likewise.
	* tests/data/test-read-dwarf/test15-pr18892.so.abi: Likewise.
	* tests/data/test-read-dwarf/test16-pr18904.so.abi: Likewise.
	* tests/data/test-read-dwarf/test17-pr19027.so.abi: Likewise.
	* tests/data/test-read-dwarf/test18-pr19037-libvtkRenderingLIC-6.1.so.abi:
	Likewise.
	* tests/data/test-read-dwarf/test19-pr19023-libtcmalloc_and_profiler.so.abi:
	Likewise.
	* tests/data/test-read-dwarf/test2.so.abi: Likewise.
	* tests/data/test-read-dwarf/test2.so.hash.abi: Likewise.
	* tests/data/test-read-dwarf/test20-pr19025-libvtkParallelCore-6.1.so.abi:
	Likewise.
	* tests/data/test-read-dwarf/test22-pr19097-libstdc++.so.6.0.17.so.abi:
	Likewise.
	* tests/data/test-read-dwarf/test6.so.abi: Likewise.
	* tests/data/test-read-dwarf/test6.so.hash.abi: Likewise.
	* tests/data/test-read-dwarf/test8-qualified-this-pointer.so.abi:
	Likewise.
	* tests/data/test-read-dwarf/test8-qualified-this-pointer.so.hash.abi:
	Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Applying to master.
---
 include/abg-fwd.h                             |     9 +
 src/abg-dwarf-reader.cc                       |    17 +
 src/abg-ir.cc                                 |    49 +
 tests/data/test-annotate/test1.abi            |    38 +-
 .../data/test-annotate/test14-pr18893.so.abi  |  5184 +--
 .../data/test-annotate/test15-pr18892.so.abi  | 10940 +++---
 .../data/test-annotate/test17-pr19027.so.abi  | 11084 +++---
 ...st18-pr19037-libvtkRenderingLIC-6.1.so.abi | 11952 +++---
 ...19-pr19023-libtcmalloc_and_profiler.so.abi | 10178 ++---
 tests/data/test-annotate/test2.so.abi         |    22 +-
 ...st20-pr19025-libvtkParallelCore-6.1.so.abi | 13572 +++----
 tests/data/test-annotate/test6.so.abi         |     6 +-
 .../test8-qualified-this-pointer.so.abi       |     6 +-
 .../test0-pr19026-libvtkIOSQL-6.1.so.1.abi    | 17627 ++-------
 tests/data/test-diff-dwarf/test0-report.txt   |    32 +-
 .../test28-vtable-changes-report-0.txt        |     3 -
 .../test29-vtable-changes-report-0.txt        |    20 +-
 .../test30-vtable-changes-report-0.txt        |    20 +-
 .../test31-vtable-changes-report-0.txt        |    20 +-
 .../test36-ppc64-aliases-report-0.txt         |    21 +-
 .../test41-PR20476-hidden-report-0.txt        |    54 +-
 .../test42-PR21296-clanggcc-report0.txt       |     9 +-
 tests/data/test-diff-dwarf/test5-report.txt   |    11 +-
 tests/data/test-diff-dwarf/test8-report.txt   |    38 +-
 tests/data/test-diff-filter/test0-report.txt  |    36 +-
 tests/data/test-diff-filter/test01-report.txt |    36 +-
 tests/data/test-diff-filter/test10-report.txt |    11 +-
 tests/data/test-diff-filter/test13-report.txt |    23 +-
 tests/data/test-diff-filter/test2-report.txt  |    11 +-
 ...t-and-filtered-children-nodes-report-1.txt |    10 +-
 .../test30-pr18904-rvalueref-report0.txt      |   230 +-
 .../test30-pr18904-rvalueref-report1.txt      |   230 +-
 .../test30-pr18904-rvalueref-report2.txt      |   230 +-
 .../test35-pr18754-no-added-syms-report-0.txt |   230 +-
 .../data/test-diff-filter/test41-report-0.txt |    87 +-
 tests/data/test-diff-filter/test9-report.txt  |    11 +-
 ...-2.0-0v5_2.4.1-1ubuntu2_amd64-report-0.txt |    82 +-
 ...bb-4.3-3.20141204.fc23.x86_64-report-0.txt |   369 +-
 ...bb-4.3-3.20141204.fc23.x86_64-report-1.txt |    99 +-
 .../test24-soname-report-1.txt                |    13 +-
 .../test24-soname-report-10.txt               |    13 +-
 .../test24-soname-report-12.txt               |    13 +-
 .../test24-soname-report-14.txt               |    13 +-
 .../test24-soname-report-16.txt               |    13 +-
 .../test24-soname-report-4.txt                |    13 +-
 .../data/test-diff-suppr/test31-report-1.txt  |    11 +-
 tests/data/test-read-dwarf/test1.abi          |    28 +-
 tests/data/test-read-dwarf/test1.hash.abi     |    10 +-
 .../test-read-dwarf/test10-pr18818-gcc.so.abi |  2966 +-
 .../test-read-dwarf/test11-pr18828.so.abi     |   654 +-
 .../test-read-dwarf/test14-pr18893.so.abi     |  4744 +--
 .../test-read-dwarf/test15-pr18892.so.abi     | 10402 ++---
 .../test-read-dwarf/test16-pr18904.so.abi     | 11286 +++---
 .../test-read-dwarf/test17-pr19027.so.abi     |  9810 ++---
 ...st18-pr19037-libvtkRenderingLIC-6.1.so.abi | 10790 ++---
 ...19-pr19023-libtcmalloc_and_profiler.so.abi |  8844 ++---
 tests/data/test-read-dwarf/test2.so.abi       |    14 +-
 tests/data/test-read-dwarf/test2.so.hash.abi  |     8 +-
 ...st20-pr19025-libvtkParallelCore-6.1.so.abi | 12218 +++---
 .../test22-pr19097-libstdc++.so.6.0.17.so.abi | 32770 ++++++++--------
 tests/data/test-read-dwarf/test6.so.abi       |     4 +-
 tests/data/test-read-dwarf/test6.so.hash.abi  |     2 +-
 .../test8-qualified-this-pointer.so.abi       |     4 +-
 .../test8-qualified-this-pointer.so.hash.abi  |     2 +-
 64 files changed, 89021 insertions(+), 98231 deletions(-)

The patch is too big for the mailing list so I am attaching it in a
gzip'ed format.


Cheers,

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-ir-dwarf-reader-Peel-const-qualifier-from-const-this.patch.gz
Type: application/gzip
Size: 1781272 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/libabigail/attachments/20240306/9c578af0/attachment-0001.gz>
-------------- next part --------------


-- 
		Dodji


More information about the Libabigail mailing list