This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: [RFC PATCH] Fix PPC64 ELF ABI v2 symbol address retrieval
- From: Ulrich Weigand <Ulrich dot Weigand at de dot ibm dot com>
- To: Mark Wielaard <mjw at redhat dot com>
- Cc: anton at samba dot org, fche at redhat dot com, Hemant Kumar <hemant at linux dot vnet dot ibm dot com>, naveen dot n dot rao at linux dot vnet dot ibm dot com, systemtap at sourceware dot org, uweigand at gcc dot gnu dot org
- Date: Thu, 5 Feb 2015 16:50:29 +0100
- Subject: Re: [RFC PATCH] Fix PPC64 ELF ABI v2 symbol address retrieval
- Authentication-results: sourceware.org; auth=none
- References: <20150116115342 dot 1367 dot 96228 dot stgit at hemant-fedora> <1422021635 dot 4858 dot 12 dot camel at bordewijk dot wildebeest dot org> <OF31EE8E9A dot A63B95E2-ONC1257DD6 dot 00531428-C1257DD6 dot 0053F436 at de dot ibm dot com> <1422281348 dot 4858 dot 25 dot camel at bordewijk dot wildebeest dot org>
Mark Wielaard <mjw@redhat.com> wrote on 26.01.2015 15:09:08:
> That is a strict reading, but you are right. The execution can indeed
> start at either point. So an attribute on the subroutine might be the
> wrong thing to use. What about using a DW_TAG_entry_point (DWARF 3.3 "An
> alternate entry point") as child of the DW_TAG_subroutine to describe
> the local entry point?
Well, this DWARF feature also doesn't really match very well to the
PowerPC situation. DW_TAG_entry_point is supposed to be used for
languages (like some Fortran versions, I think) that support multiple
entry point *at the source level*, where the alternate entry point has
its own name and argument list. This is why DW_TAG_entry_point requires
its own DW_AT_name attribute, and needs to provide its own argument and
return type information ...
While of course it might be possible to create all that information for
an ELFv2 local entry point (synthesizing a name and duplicating the
type information), that seems needlessly complex.
As as I said before, I don't think there is any feature in DWARF4 that
is intended to allow specifying something like ELFv2 local entry points.
I guess there would be one way or another to do so by non-standard use
of some feature, or by making use of a platform-specific extension;
one relatively straightforward way would be to use a set of private
values of the DW_AT_calling_convention attribute to specify the entry
point offset values that can be encoded in st_other.
However, given that at this stage we already probably have on the order
of 100000 binaries in the field that were compiled without that
information, and none of the existing compilers in production use
(which is not just GCC, but at least also LLVM and XLC) produces that
information, I'm wondering how useful it would be to make such a change
at this stage. Tools would have to implement the fallback to look at the
symbol table anyway to cope with existing binaries, and once that is
implemented, having the information duplicated in DWARF doesn't really
buy you anything ...
> > Some few use cases (like yours) do require the local entry point, but
> > you can always find the local entry point via the symbol table if you
> > know the global entry point (but not necessarily vice versa).
>
> But I do think it is a fairly common use case. Users often want to make
> sure they can monitor all calls to a particular function. The lookup
> through the symbol table is possible, but not very efficient. Because
> there is no direct link between the two, just an indirect match by
> checking the sym value and name against the DIE low_pc and (mangled)
> name. Although I admit that is partly because elfutils doesn't provide
> an efficient symbol table search, just a linear one (I do have to fix
> that).
That would seem useful anyway, there's other interesting info in the
symbol table (like symbol visibility etc.).
Bye,
Ulrich