mirror of
https://github.com/tobast/libunwind-eh_elf.git
synced 2024-12-22 11:33:43 +01:00
Pass relocated address to tdep_get_func_addr
The ppc64 implementation of tdep_get_func_addr would crash when attempting to retrieve the address of a function in a shared library. The problem was that it needs to dereference the function descriptor, but common code was passing the *unrelocated* adddress of the descriptor to the tdep_get_func_addr routine. Instead, common code would attempt to relocate the *result* of tdep_get_func_addr, which is also wrong: the ppc64 implementation reads the function address from the in-memory copy of the descriptor, which is already relocation and contains the final address. This patch fixes the problem by relocating the descriptor address before passing it to tdep_get_func_addr, instead of relocating the result of tdep_get_func_addr. Since ppc64 is the only non-trivial implementation of tdep_get_func_addr, this cannot affect any other platform. Signed-off-by: Ulrich Weigand <uweigand@de.ibm.com>
This commit is contained in:
parent
5710c98fbf
commit
844f1b84cc
1 changed files with 3 additions and 2 deletions
|
@ -128,10 +128,11 @@ elf_w (lookup_symbol) (unw_addr_space_t as,
|
|||
if (ELF_W (ST_TYPE) (sym->st_info) == STT_FUNC
|
||||
&& sym->st_shndx != SHN_UNDEF)
|
||||
{
|
||||
if (tdep_get_func_addr (as, sym->st_value, &val) < 0)
|
||||
continue;
|
||||
val = sym->st_value;
|
||||
if (sym->st_shndx != SHN_ABS)
|
||||
val += load_offset;
|
||||
if (tdep_get_func_addr (as, val, &val) < 0)
|
||||
continue;
|
||||
Debug (16, "0x%016lx info=0x%02x %s\n",
|
||||
(long) val, sym->st_info, strtab + sym->st_name);
|
||||
|
||||
|
|
Loading…
Reference in a new issue