This is the mail archive of the
elfutils-devel@sourceware.org
mailing list for the elfutils project.
Re: dwfl_module_addrinfo and @plt entries
- From: Mark Wielaard <mark at klomp dot org>
- To: Milian Wolff <mail at milianw dot de>
- Cc: elfutils-devel at sourceware dot org
- Date: Wed, 4 Jan 2017 14:42:23 +0100
- Subject: Re: dwfl_module_addrinfo and @plt entries
- Authentication-results: sourceware.org; auth=none
- References: <4389913.7LHyNoxDn3@agathebauer>
On Wed, Jan 04, 2017 at 01:41:26AM +0100, Milian Wolff wrote:
> how do I get symbol information for @plt entries?
Short answer. You cannot with the dwfl_module_getsym/addr*
functions. And we don't have accessors for "fake" symbols
(yet). Sorry.
Longer answer. An address pointing into the PLT does
really point to an ELF symbol. The PLT/GOT contains entries
that are architecture specific "jump targets" that contain
(self-modifying) code/data on first access. A PLT entry
is code that sets up the correct (absolute) address of
a function on first access. And on second access it fetches
that function address and jumps to it. Since this is
architecture specific we would need a backend function
that translates an address pointing into the PLT into
an actual function address. You would then be able to
fetch the actual ELF symbol that address is associated
with.
If we have such a backend function then we could even
do what BFD apparently does. Which is to then create a
"fake" symbol with as name real_function@plt. But I am
not sure such fake symbols are very useful (and will
quickly become confusing since they aren't real ELF
symbols).
Hope that helps. And maybe inspires someone (you?) to
write up such a backend function and corresponding
dwfl frontend function.
Cheers,
Mark