public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: Ilya Leoshkevich <iii@linux.ibm.com>
To: Mark Wielaard <mark@klomp.org>
Cc: elfutils-devel@sourceware.org
Subject: Re: [PATCH v2 4/7] x86_64_return_value_location: Support lvalue and rvalue references
Date: Fri, 10 Feb 2023 02:20:39 +0100	[thread overview]
Message-ID: <2292f8459429df853955d044b01d47e73f2e7d49.camel@linux.ibm.com> (raw)
In-Reply-To: <2c67601b72f61c1394e1248aaeecc8c403692dca.camel@klomp.org>

On Thu, 2023-02-09 at 14:45 +0100, Mark Wielaard wrote:
> Hi Ilya,
> 
> On Wed, 2023-02-08 at 20:52 +0100, Ilya Leoshkevich wrote:
> > On the low level, they are the same as pointers.
> 
> Yes, I can see how that would work for return types.
> Do you happen to have a testcase for this?

You can trigger the issue by compiling the following:

$ cat 1.cpp
int &foo() { throw; }
int &&bar() { throw; }

$ g++ -g 1.cpp -c

and then running

$ LD_LIBRARY_PATH=../libelf:../libdw ./funcretval -e 1.o

What would be a good way to integrate such a testcase?
Currently all tests are built with gcc, is it okay to add one
built with g++? If not, I guess the alternative would be to check in
multiple compressed object files built for different platforms?

> Right below this code is a check whether the type has a
> DW_AT_byte_size, and if not we'll assume 8 as (address) size if the
> type is either DW_TAG_pointer_type or DW_TAG_ptr_to_member_type.
> Should the same be done for DW_TAG_reference_type and
> DW_TAG_rvalue_reference_type?

Sounds reasonable. Here is what I have on x86_64:

 <1><5a>: Abbrev Number: 1 (DW_TAG_reference_type)
    <5b>   DW_AT_byte_size   : 8
 <1><80>: Abbrev Number: 7 (DW_TAG_rvalue_reference_type)
    <81>   DW_AT_byte_size   : 8

IIUC these checks handle weird compilers that do not emit
DW_AT_byte_size.

> This doesn't seem x86_64 specific, other backends have similar code,
> I
> assume they all need a similar update?

Oh, right, this issue seems to affect all of them.

> Thanks,
> 
> Mark
> 
> > Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
> > ---
> >  backends/x86_64_retval.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/backends/x86_64_retval.c b/backends/x86_64_retval.c
> > index f9114cb1..e668eacc 100644
> > --- a/backends/x86_64_retval.c
> > +++ b/backends/x86_64_retval.c
> > @@ -106,6 +106,8 @@ x86_64_return_value_location (Dwarf_Die
> > *functypedie, const Dwarf_Op **locp)
> >      case DW_TAG_enumeration_type:
> >      case DW_TAG_pointer_type:
> >      case DW_TAG_ptr_to_member_type:
> > +    case DW_TAG_reference_type:
> > +    case DW_TAG_rvalue_reference_type:
> >        {
> >         Dwarf_Attribute attr_mem;
> >         if (dwarf_formudata (dwarf_attr_integrate (typedie,
> > DW_AT_byte_size,
> 


  reply	other threads:[~2023-02-10  1:21 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-08 19:52 [PATCH v2 0/7] Add Memory Sanitizer support Ilya Leoshkevich
2023-02-08 19:52 ` [PATCH v2 1/7] libasm: Fix xdefault_pattern initialization Ilya Leoshkevich
2023-02-09 13:14   ` Mark Wielaard
2023-02-08 19:52 ` [PATCH v2 2/7] printversion: Fix unused variable Ilya Leoshkevich
2023-02-08 19:52 ` [PATCH v2 3/7] readelf: Fix set but not used parameter Ilya Leoshkevich
2023-02-09 13:17   ` Mark Wielaard
2023-02-08 19:52 ` [PATCH v2 4/7] x86_64_return_value_location: Support lvalue and rvalue references Ilya Leoshkevich
2023-02-09 13:45   ` Mark Wielaard
2023-02-10  1:20     ` Ilya Leoshkevich [this message]
2023-02-10 16:22       ` Frank Ch. Eigler
2023-02-08 19:52 ` [PATCH v2 5/7] configure: Use -fno-addrsig if possible Ilya Leoshkevich
2023-02-09 13:28   ` Mark Wielaard
2023-02-08 19:52 ` [PATCH v2 6/7] configure: Add --disable-demangler Ilya Leoshkevich
2023-02-09 13:40   ` Mark Wielaard
2023-02-08 19:52 ` [PATCH v2 7/7] configure: Add --enable-sanitize-memory Ilya Leoshkevich

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=2292f8459429df853955d044b01d47e73f2e7d49.camel@linux.ibm.com \
    --to=iii@linux.ibm.com \
    --cc=elfutils-devel@sourceware.org \
    --cc=mark@klomp.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).