This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug runtime/17638] Symbol resolution broken for PPC64 ABIv2


https://sourceware.org/bugzilla/show_bug.cgi?id=17638

--- Comment #1 from Mark Wielaard <mjw at redhat dot com> ---
The following email on the GDB mailinglist explains the issue nicely:
https://sourceware.org/ml/gdb-patches/2014-01/msg01013.html

"In ELFv2, functions may provide both a global and a local entry point.
The global entry point (where the function symbol points to) is intended
to be used for function-pointer or cross-module (PLT) calls, and requires
r12 to be set up to the entry point address itself.   The local entry
point (which is found at a fixed offset after the global entry point,
as defined by bits in the symbol table entries' st_other field), instead
expects r2 to be set up to the current TOC.

Now, when setting a breakpoint on a function by name, you really want
that breakpoint to trigger either way, no matter whether the function
is called via its local or global entry point.  Since the global entry
point will always fall through into the local entry point, the way to
achieve that is to simply set the breakpoint at the local entry point."

The above also explain the correct way this should work. See if the address is
in the symbol table, if it is, check the st_other field and adjust the probe
address accordingly.

There doesn't seem to be a public copy of the Power Architecture 64-Bit ELF V2
ABI specification online that documents this though. So you'll have to figure
the correct rules out from the patches posted to gdb/binutils.

We could also do a hack like ftrace in kernel does (which is horrible, but
probably works in practice because the compiler/linker will only ever use on of
two pairs of instructions anyway):

commit c71b7eff426fa7d8fd33e0964a7f79a3b41faff9
Author: Anton Blanchard <anton@samba.org>
Date:   Tue Feb 4 16:09:15 2014 +1100

    powerpc: Add ABIv2 support to ppc_function_entry

    Skip over the well known global entry point code for ABIv2.

    Signed-off-by: Anton Blanchard <anton@samba.org>

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=c71b7eff426fa7d8fd33e0964a7f79a3b41faff9

We might also want to add some magic to elfutils dwfl_module_getsym_info () to
provide the local entry point as address associated with the symbol if
different from the global entry point address (st_value).

Or we might want to adjust the DWARF address as output by GCC as suggested in
the Description of this bug (but that won't work when the address comes
directly from the symbol table).

-- 
You are receiving this mail because:
You are the assignee for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]