+2014-06-17 Mark Wielaard <mjw@redhat.com>
+
+ * arm_init.c (arm_init): Set func_addr_mask.
+
2014-06-20 Petr Machata <pmachata@redhat.com>
* alpha_retval.c (alpha_return_value_location): Call
eh->frame_nregs = 16;
HOOK (eh, set_initial_registers_tid);
+ /* Bit zero encodes whether an function address is THUMB or ARM. */
+ eh->func_addr_mask = ~(GElf_Addr)1;
+
return MODVERSION;
}
+2014-06-17 Mark Wielaard <mjw@redhat.com>
+
+ * frame_unwind.c (handle_cfi): Use ebl_func_addr_mask.
+ * dwfl_module_getsym.c (__libdwfl_getsym): Likewise.
+
2014-06-15 Mark Wielaard <mjw@redhat.com>
* linux-core-attach.c (core_memory_read): Use libdw/memory-access.h
/* Find debugging and symbol information for a module in libdwfl.
- Copyright (C) 2006-2013 Red Hat, Inc.
+ Copyright (C) 2006-2014 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
descriptors). */
char *ident;
- GElf_Addr st_value = sym->st_value;
+ GElf_Addr st_value = sym->st_value & ebl_func_addr_mask (mod->ebl);
*resolved = false;
if (! adjust_st_value && mod->e_type != ET_REL && alloc
&& (GELF_ST_TYPE (sym->st_info) == STT_FUNC
/* Get previous frame state for an existing frame state.
- Copyright (C) 2013 Red Hat, Inc.
+ Copyright (C) 2013, 2014 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
continue;
}
+ /* Some architectures encode some extra info in the return address. */
+ if (regno == frame->fde->cie->return_address_register)
+ regval &= ebl_func_addr_mask (ebl);
+
/* This is another strange PPC[64] case. There are two
registers numbers that can represent the same DWARF return
register number. We only want one to actually set the return
+2014-06-17 Mark Wielaard <mjw@redhat.com>
+
+ * eblinitreg.c (ebl_func_addr_mask): New function.
+ * libebl.h (ebl_func_addr_mask): Define.
+ * libeblP.h (struct ebl): Add func_addr_mask.
+
2014-05-19 Mark Wielaard <mjw@redhat.com>
* Makefile.am (gen_SOURCES): Add eblcheckreloctargettype.c.
bool *signal_framep);
/* Returns true if the value can be resolved to an address in an
- allocated section, which will be returned in *SHNDXP.
+ allocated section, which will be returned in *ADDR.
(e.g. function descriptor resolving) */
bool EBLHOOK(resolve_sym_value) (Ebl *ebl, GElf_Addr *addr);
/* Fetch live process Dwfl_Frame from PID.
- Copyright (C) 2013 Red Hat, Inc.
+ Copyright (C) 2013, 2014 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
{
return ebl == NULL ? 0 : ebl->frame_nregs;
}
+
+GElf_Addr
+ebl_func_addr_mask (Ebl *ebl)
+{
+ return ((ebl == NULL || ebl->func_addr_mask == 0)
+ ? ~(GElf_Addr)0 : ebl->func_addr_mask);
+}
/* Interface for libebl.
- Copyright (C) 2000-2010, 2013 Red Hat, Inc.
+ Copyright (C) 2000-2010, 2013, 2014 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
extern size_t ebl_frame_nregs (Ebl *ebl)
__nonnull_attribute__ (1);
+/* Mask to use for function symbol or unwind return addresses in case
+ the architecture adds some extra non-address bits to it. This is
+ different from ebl_resolve_sym_value which only works for actual
+ symbol addresses (in non-ET_REL files) that might resolve to an
+ address in a different section. ebl_func_addr_mask is called to
+ turn a given function value into the a real address or offset (the
+ original value might not be a real address). This works for all
+ cases where an actual function address (or offset in ET_REL symbol
+ tables) is needed. */
+extern GElf_Addr ebl_func_addr_mask (Ebl *ebl);
+
/* Convert *REGNO as is in DWARF to a lower range suitable for
Dwarf_Frame->REGS indexing. */
extern bool ebl_dwarf_to_regno (Ebl *ebl, unsigned *regno)
/* Internal definitions for interface for libebl.
- Copyright (C) 2000-2009, 2013 Red Hat, Inc.
+ Copyright (C) 2000-2009, 2013, 2014 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
Ebl architecture can unwind iff FRAME_NREGS > 0. */
size_t frame_nregs;
+ /* Mask to use to turn a function value into a real function address
+ in case the architecture adds some extra non-address bits to it.
+ If not initialized (0) then ebl_func_addr_mask will return ~0,
+ otherwise it should be the actual mask to use. */
+ GElf_Addr func_addr_mask;
+
/* Function descriptor load address and table as used by
ebl_resolve_sym_value if available for this arch. */
GElf_Addr fd_addr;
+2014-06-14 Mark Wielaard <mjw@redhat.com>
+
+ * elflint (check_symtab): Use ebl_func_addr_mask on st_value.
+
2014-05-27 Mark Wielaard <mjw@redhat.com>
* readelf.c (print_debug): Skip section if name is NULL.
{
GElf_Addr sh_addr = (ehdr->e_type == ET_REL ? 0
: destshdr->sh_addr);
+ GElf_Addr st_value;
+ if (GELF_ST_TYPE (sym->st_info) == STT_FUNC
+ || (GELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC))
+ st_value = sym->st_value & ebl_func_addr_mask (ebl);
+ else
+ st_value = sym->st_value;
if (GELF_ST_TYPE (sym->st_info) != STT_TLS)
{
if (! ebl_check_special_symbol (ebl, ehdr, sym, name,
destshdr))
{
- if (sym->st_value - sh_addr > destshdr->sh_size)
+ if (st_value - sh_addr > destshdr->sh_size)
{
/* GNU ld has severe bugs. When it decides to remove
empty sections it leaves symbols referencing them
section [%2d] '%s': symbol %zu: st_value out of bounds\n"),
idx, section_name (ebl, idx), cnt);
}
- else if ((sym->st_value - sh_addr
+ else if ((st_value - sh_addr
+ sym->st_size) > destshdr->sh_size)
ERROR (gettext ("\
section [%2d] '%s': symbol %zu does not fit completely in referenced section [%2d] '%s'\n"),
{
/* For object files the symbol value must fall
into the section. */
- if (sym->st_value > destshdr->sh_size)
+ if (st_value > destshdr->sh_size)
ERROR (gettext ("\
section [%2d] '%s': symbol %zu: st_value out of bounds of referenced section [%2d] '%s'\n"),
idx, section_name (ebl, idx), cnt,
(int) xndx, section_name (ebl, xndx));
- else if (sym->st_value + sym->st_size
+ else if (st_value + sym->st_size
> destshdr->sh_size)
ERROR (gettext ("\
section [%2d] '%s': symbol %zu does not fit completely in referenced section [%2d] '%s'\n"),
}
else
{
- if (sym->st_value
+ if (st_value
< destshdr->sh_offset - phdr->p_offset)
ERROR (gettext ("\
section [%2d] '%s': symbol %zu: st_value short of referenced section [%2d] '%s'\n"),
idx, section_name (ebl, idx), cnt,
(int) xndx, section_name (ebl, xndx));
- else if (sym->st_value
+ else if (st_value
> (destshdr->sh_offset - phdr->p_offset
+ destshdr->sh_size))
ERROR (gettext ("\
section [%2d] '%s': symbol %zu: st_value out of bounds of referenced section [%2d] '%s'\n"),
idx, section_name (ebl, idx), cnt,
(int) xndx, section_name (ebl, xndx));
- else if (sym->st_value + sym->st_size
+ else if (st_value + sym->st_size
> (destshdr->sh_offset - phdr->p_offset
+ destshdr->sh_size))
ERROR (gettext ("\