[Dwarf-Discuss] compilers generating ABI non-compliant function calls?
Jakub Jelinek
jakub@redhat.com
Tue Mar 9 23:40:47 GMT 2021
On Tue, Mar 09, 2021 at 03:22:35PM -0800, David Blaikie wrote:
> So, when the consumer evaluates DW_OP_GNU_parameter_ref, it handles it
> > similarly to DW_OP_entry_value, unwinds to caller if it can identify it,
> > and just looks up if some value is specified for it in that particular
> > caller.
> >
>
> Could you help me understand more how DW_OP_GNU_parameter_ref
> works/differently from DW_OP_entry_value?
DW_OP_entry_value refers to a register or memory in which a parameter
is passed. When a parameter is not passed at all, there is no register or
memory to which it can refer to. So, DW_OP_GNU_parameter_ref instead
refers to the DW_TAG_formal_parameter DIE and the consumer needs to find
a DW_TAG_call_site_parameter that refers to the same DIE.
> > I think GCC doesn't do that, instead it would if considered beneficial
> > copy the function to a non-exported one and optimize away the parameters in
> > there (etc.).
>
>
> Ah, OK - in which case there would be no DWARF for the copy? And the
> original function would look as though it were "optimized away" (ie: not
> have any DW_AT_low/high_pc, etc)?
No, there is DWARF for the copy. The original user function is the abstract
origin and then it has two (or more) DW_TAG_subprogram DIEs that refer to
that (and refer to DW_TAG_formal_parameter and DW_TAG_variable etc.) in it.
Jakub
More information about the Dwarf-discuss
mailing list