public inbox for libabigail@sourceware.org
 help / color / mirror / Atom feed
From: "woodard at redhat dot com" <sourceware-bugzilla@sourceware.org>
To: libabigail@sourceware.org
Subject: [Bug default/28642] vtable offset position seems wrong
Date: Fri, 03 Dec 2021 22:42:01 +0000	[thread overview]
Message-ID: <bug-28642-9487-Ap81YGyfvE@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-28642-9487@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=28642

--- Comment #3 from Ben Woodard <woodard at redhat dot com> ---
it appears in the DWARF that clang explicitly provides the vtable offset using
the DW_AT_vtable_elem_location for the function but GCC relies on the C++ABI
rules to layout the vtable and so the element location in the vtable is
inferred rather than being specified.

So it appears like when libabigail doesn't get an explicit vtable_element it
sets its position to -1 which is 0xFFFF FFFF FFFF FFFF 18446744073709551615 for
a 64b int in twos compliment.

There is some trickiness to inferring the vtable position of a particular
function. It is by order of declaration in the class declaration. Quoting the
C++ABI section 2.5.2
http://itanium-cxx-abi.github.io/cxx-abi/abi.html#vtable-components

"The order of the virtual function pointers in a virtual table is the order of
declaration of the corresponding member functions in the class. If an
implicitly-declared copy assignment operator, move assignment operator, or
destructor is virtual, it is treated as if it were declared at the end of the
class, in that order. (Implicitly-declared assignment operators may be virtual
if a base class declares a virtual assignment operator taking a reference to a
derived class type.)" 

Unless I am missing something, it would seem like this logic would have to be
implemented in libabigail to ensure that the vtable order is right.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2021-12-03 22:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-02  0:21 [Bug default/28642] New: " woodard at redhat dot com
2021-12-02  0:30 ` [Bug default/28642] " woodard at redhat dot com
2021-12-02  0:36 ` woodard at redhat dot com
2021-12-03 22:42 ` woodard at redhat dot com [this message]
2021-12-03 23:19 ` woodard at redhat dot com
2021-12-07  0:53 ` woodard at redhat dot com
2021-12-09  0:52 ` woodard at redhat dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-28642-9487-Ap81YGyfvE@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=libabigail@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).