[Dwarf-Discuss] compilers generating ABI non-compliant function calls?

David Blaikie dblaikie@gmail.com
Wed Mar 10 23:03:16 GMT 2021


On Wed, Mar 10, 2021 at 2:31 PM Michael Eager <eager at eagercon.com> wrote:

> On 3/10/21 1:28 PM, David Blaikie wrote:
> > On Wed, Mar 10, 2021 at 1:21 PM Cary Coutant <ccoutant at gmail.com
> > <mailto:ccoutant at gmail.com>> wrote:
> >
> >      > Speculation beyond the original question:
> >      > Given that it's a pretty common/core feature of a debugger to
> >     call functions, perhaps a start would be some way for the producer
> >     to communicate, via DWARF, that it has changed the ABI of a function
> >     and so the consumer should not try to synthesize calls to it.
> >     Providing much more functionality than that I think will amount to
> >     encoding the ad-hoc ABIs that compilers create in these situations
> >     (possible, but a fairly non-trivial proposal/enhancement to DWARF)
> >
> >     I believe that's what DW_AT_calling_convention and DW_CC_nocall are
> >     for (Section 3.3.1.1).
> >
> >
> > Oh, sweet - yep, that looks like the ticket indeed.
> >
> > "If the value of the calling convention attribute is the constant
> > DW_CC_nocall, the subroutine does not obey standard calling conventions,
> > and it may not be safe for the debugger to call this subroutine."
>
> All that says is that you can't call the function.  It doesn't
> describe how to call functions with non-ABI calling conventions.
>

Yep, but as I was saying, it seems like a minimum that - since we can't
describe how to call non-ABI-conforming functions, the least we could do is
flag them so the DWARF consumer can differentiate and not accidentally call
functions in a way that would produce problems.
So this'd at least address outright bugs/bogus behavior in DWARF consumers,
instead of calling a function expecting to use the ABI, they could tell the
user that that function can't be called.

but, yeah, the bigger puzzle is still unsolved, if consumers want to be
able to call such functions it'll take a fairly complicated/expensive
proposal, I expect

- Dave
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dwarfstd.org/pipermail/dwarf-discuss-dwarfstd.org/attachments/20210310/f032fe1b/attachment-0001.html>



More information about the Dwarf-discuss mailing list