+2013-12-18 Mark Wielaard <mjw@redhat.com>
+
+ * NEWS (libdwfl): Add dwfl_module_getsym_info and
+ dwfl_module_addrinfo.
+ (addr2line): Add -x option.
+
2013-12-17 Jan Kratochvil <jan.kratochvil@redhat.com>
* NEWS (Version 0.158) (libdwfl): Added Dwfl_Thread_Callbacks,
Version 0.158
libdwfl: dwfl_core_file_report has new parameter executable.
- New function dwfl_module_getsymtab_first_global.
+ New functions dwfl_module_getsymtab_first_global,
+ dwfl_module_getsym_info and dwfl_module_addrinfo.
Added unwinder with type Dwfl_Thread_Callbacks, opaque types
Dwfl_Thread and Dwfl_Frame and functions dwfl_attach_state,
dwfl_pid, dwfl_thread_dwfl, dwfl_thread_tid, dwfl_frame_thread,
dwfl_thread_state_registers, dwfl_thread_state_register_pc,
dwfl_getthreads, dwfl_thread_getframes and dwfl_frame_pc.
+addr2line: New option -x to show the section an address was found in.
+
Version 0.157
libdw: Add new functions dwarf_getlocations, dwarf_getlocation_attr
2013-12-18 Mark Wielaard <mjw@redhat.com>
+ * Makefile.am (ppc64_SRCS): Add ppc64_resolve_sym.c.
+ * ppc64_resolve_sym.c: New file.
+ * ppc64_init.c: Hook resolve_sym_value and find function descriptor
+ table.
+
+2013-12-18 Mark Wielaard <mjw@redhat.com>
+
* s390_initreg.c (s390_set_initial_registers_tid): Use union
to avoid type-punning when assigning a double to a Dwarf_Word.
ppc64_SRCS = ppc64_init.c ppc64_symbol.c ppc64_retval.c \
ppc64_corenote.c ppc_regs.c ppc_auxv.c ppc_attrs.c ppc_syscall.c \
- ppc_cfi.c ppc_initreg.c
+ ppc_cfi.c ppc_initreg.c ppc64_resolve_sym.c
libebl_ppc64_pic_a_SOURCES = $(ppc64_SRCS)
am_libebl_ppc64_pic_a_OBJECTS = $(ppc64_SRCS:.c=.os)
# include <config.h>
#endif
+#include <string.h>
+
#define BACKEND ppc64_
#define RELOC_PREFIX R_PPC64_
#include "libebl_CPU.h"
eh->frame_nregs = (114 - 1) + 32;
HOOK (eh, set_initial_registers_tid);
HOOK (eh, dwarf_to_regno);
+ HOOK (eh, resolve_sym_value);
+
+ /* Find the function descriptor .opd table for resolve_sym_value. */
+ if (elf != NULL)
+ {
+ GElf_Ehdr ehdr_mem, *ehdr = gelf_getehdr (elf, &ehdr_mem);
+ if (ehdr != NULL && ehdr->e_type != ET_REL)
+ {
+ /* We could also try through DT_PPC64_OPD and DT_PPC64_OPDSZ. */
+ GElf_Shdr opd_shdr_mem, *opd_shdr;
+ Elf_Scn *scn = NULL;
+ while ((scn = elf_nextscn (elf, scn)) != NULL)
+ {
+ opd_shdr = gelf_getshdr (scn, &opd_shdr_mem);
+ if (opd_shdr != NULL
+ && (opd_shdr->sh_flags & SHF_ALLOC) != 0
+ && opd_shdr->sh_type == SHT_PROGBITS
+ && opd_shdr->sh_size > 0
+ && strcmp (elf_strptr (elf, ehdr->e_shstrndx,
+ opd_shdr->sh_name), ".opd") == 0)
+ {
+ eh->fd_addr = opd_shdr->sh_addr;
+ eh->fd_data = elf_getdata (scn, NULL);
+ break;
+ }
+ }
+ }
+ }
return MODVERSION;
}
--- /dev/null
+/* Resolve symbol values through .opd function descriptors.
+ Copyright (C) 2013 Red Hat, Inc.
+ This file is part of elfutils.
+
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
+
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#define BACKEND ppc64_
+#include "libebl_CPU.h"
+
+/* Resolve a function descriptor if addr points into the .opd section.
+ The .opd section contains function descriptors consisting of 3 addresses.
+ function, toc and chain. We are just interested in the first.
+ http://refspecs.linuxfoundation.org/ELF/ppc64/PPC-elf64abi-1.9.html#FUNC-DES
+
+ Returns true if the given address could be resolved, false otherwise.
+*/
+bool
+ppc64_resolve_sym_value (Ebl *ebl, GElf_Addr *addr)
+{
+ if (ebl->fd_data != NULL && *addr >= ebl->fd_addr
+ && *addr + sizeof (Elf64_Addr) <= ebl->fd_addr + ebl->fd_data->d_size)
+ {
+ GElf_Ehdr ehdr_mem, *ehdr = gelf_getehdr (ebl->elf, &ehdr_mem);
+ if (ehdr != NULL)
+ {
+ Elf_Data opd_in, opd_out;
+ opd_in.d_buf = ebl->fd_data->d_buf + (*addr - ebl->fd_addr);
+ opd_out.d_buf = addr;
+ opd_out.d_size = opd_in.d_size = sizeof (Elf64_Addr);
+ opd_out.d_type = opd_in.d_type = ELF_T_ADDR;
+ if (elf64_xlatetom (&opd_out, &opd_in,
+ ehdr->e_ident[EI_DATA]) != NULL)
+ return true;
+ }
+ }
+ return false;
+}
+2013-12-18 Mark Wielaard <mjw@redhat.com>
+
+ * libdw.map (ELFUTILS_0.158): Remove dwfl_module_addrsym_elf and
+ dwfl_module_getsym_elf. Add dwfl_module_addrinfo and
+ dwfl_module_getsym_info.
+
2013-12-16 Mark Wielaard <mjw@redhat.com>
* libdw.map (ELFUTILS_0.158): Add dwfl_module_getsymtab_first_global.
dwfl_thread_getframes;
dwfl_frame_pc;
- dwfl_module_addrsym_elf;
- dwfl_module_getsym_elf;
dwfl_module_getsymtab_first_global;
+ dwfl_module_addrinfo;
+ dwfl_module_getsym_info;
} ELFUTILS_0.157;
+2013-12-18 Mark Wielaard <mjw@redhat.com>
+
+ * derelocate.c (__libdwfl_find_section_ndx): New internal function.
+ * dwfl_module_addrname.c (dwfl_module_addrname): Use
+ dwfl_module_addrinfo.
+ * dwfl_module_addrsym.c (dwfl_module_addrsym_elf): Replace with...
+ (__libdwfl_addrsym): ...this. Use __libdwfl_getsym, use value
+ for comparisons, not st_value. Fill in off. Search for both value
+ and the (adjusted) sym.st_value when different.
+ (dwfl_module_addrsym): Implement using __libdwfl_addrsym.
+ (dwfl_module_addrinfo): New function.
+ * dwfl_module_getsym.c (dwfl_module_getsym_elf): Replace with...
+ (__libdwfl_getsym): ...this. Use ebl_resolve_sym_value if requested
+ and possible. Adjust sym->st_value only when requested. Fill in addr
+ if available.
+ (dwfl_module_getsym_info): New function.
+ (dwfl_module_getsym): Use __libdwfl_getsym.
+ * libdwfl.h (dwfl_module_getsym_elf): Removed.
+ (dwfl_module_getsym_info): New function declaration.
+ (dwfl_module_addrinfo): Likewise.
+ (dwfl_module_addrsym): Add documentation describing differences
+ with addrinfo variants.
+ (dwfl_module_addrsym_elf): Removed.
+ * libdwflP.h (__libdwfl_getsym): New internal function declaration.
+ (__libdwfl_addrsym): Likewise.
+ (__libdwfl_find_section_ndx): Likewise.
+ (dwfl_module_addrinfo): New internal declaration.
+ (dwfl_module_getsym_info): Likewise.
+ (dwfl_module_addrsym_elf): Removed.
+ (dwfl_module_getsym_elf): Likewise.
+
2013-12-18 Jan Kratochvil <jan.kratochvil@redhat.com>
* argp-std.c (offline_find_elf): Remove.
/* Recover relocatibility for addresses computed from debug information.
- Copyright (C) 2005-2010 Red Hat, Inc.
+ Copyright (C) 2005-2010, 2013 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
return -1;
}
+size_t
+internal_function
+__libdwfl_find_section_ndx (Dwfl_Module *mod, Dwarf_Addr *addr)
+{
+ int idx = find_section (mod, addr);
+ if (unlikely (idx == -1))
+ return SHN_UNDEF;
+
+ return elf_ndxscn (mod->reloc_info->refs[idx].scn);
+}
+
int
dwfl_module_relocate_address (Dwfl_Module *mod, Dwarf_Addr *addr)
{
/* Find debugging and symbol information for a module in libdwfl.
- Copyright (C) 2005, 2006, 2007 Red Hat, Inc.
+ Copyright (C) 2005, 2006, 2007, 2013 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
const char *
dwfl_module_addrname (Dwfl_Module *mod, GElf_Addr addr)
{
+ GElf_Off off;
GElf_Sym sym;
- return INTUSE(dwfl_module_addrsym) (mod, addr, &sym, NULL);
+ return INTUSE(dwfl_module_addrinfo) (mod, addr, &off, &sym,
+ NULL, NULL, NULL);
}
/* Find debugging and symbol information for a module in libdwfl.
- Copyright (C) 2005-2012 Red Hat, Inc.
+ Copyright (C) 2005-2013 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
Never returns symbols at addresses above ADDR. */
const char *
-dwfl_module_addrsym_elf (Dwfl_Module *mod, GElf_Addr addr,
- GElf_Sym *closest_sym, GElf_Word *shndxp,
- Elf **elfp, Dwarf_Addr *biasp)
+internal_function
+__libdwfl_addrsym (Dwfl_Module *mod, GElf_Addr addr, GElf_Off *off,
+ GElf_Sym *closest_sym, GElf_Word *shndxp,
+ Elf **elfp, Dwarf_Addr *biasp, bool adjust_st_value)
{
int syments = INTUSE(dwfl_module_getsymtab) (mod);
if (syments < 0)
/* Return true iff we consider ADDR to lie in the same section as SYM. */
GElf_Word addr_shndx = SHN_UNDEF;
Elf *addr_symelf = NULL;
- inline bool same_section (const GElf_Sym *sym, Elf *symelf, GElf_Word shndx)
+ inline bool same_section (GElf_Addr value, Elf *symelf, GElf_Word shndx)
{
/* For absolute symbols and the like, only match exactly. */
if (shndx >= SHN_LORESERVE)
- return sym->st_value == addr;
+ return value == addr;
+
+ /* If value might not be st_value, the shndx of the symbol might
+ not match the section of the value. Explicitly look both up. */
+ if (! adjust_st_value)
+ {
+ Dwarf_Addr v;
+ if (addr_shndx == SHN_UNDEF)
+ {
+ v = addr;
+ addr_shndx = __libdwfl_find_section_ndx (mod, &v);
+ }
+
+ v = value;
+ return addr_shndx == __libdwfl_find_section_ndx (mod, &v);
+ }
/* Figure out what section ADDR lies in. */
if (addr_shndx == SHN_UNDEF || addr_symelf != symelf)
/* Keep track of the closest symbol we have seen so far.
Here we store only symbols with nonzero st_size. */
const char *closest_name = NULL;
+ GElf_Addr closest_value = 0;
GElf_Word closest_shndx = SHN_UNDEF;
Elf *closest_elf = NULL;
/* Keep track of an eligible symbol with st_size == 0 as a fallback. */
const char *sizeless_name = NULL;
GElf_Sym sizeless_sym = { 0, 0, 0, 0, 0, SHN_UNDEF };
+ GElf_Addr sizeless_value = 0;
GElf_Word sizeless_shndx = SHN_UNDEF;
Elf *sizeless_elf = NULL;
/* Keep track of the lowest address a relevant sizeless symbol could have. */
GElf_Addr min_label = 0;
+ /* Try one symbol and associated value from the search table. */
+ inline void try_sym_value (GElf_Addr value, GElf_Sym *sym,
+ const char *name, GElf_Word shndx,
+ Elf *elf, bool resolved)
+ {
+ /* Even if we don't choose this symbol, its existence excludes
+ any sizeless symbol (assembly label) that is below its upper
+ bound. */
+ if (value + sym->st_size > min_label)
+ min_label = value + sym->st_size;
+
+ if (sym->st_size == 0 || addr - value < sym->st_size)
+ {
+ /* Return GELF_ST_BIND as higher-is-better integer. */
+ inline int binding_value (const GElf_Sym *symp)
+ {
+ switch (GELF_ST_BIND (symp->st_info))
+ {
+ case STB_GLOBAL:
+ return 3;
+ case STB_WEAK:
+ return 2;
+ case STB_LOCAL:
+ return 1;
+ default:
+ return 0;
+ }
+ }
+
+ /* This symbol is a better candidate than the current one
+ if it's closer to ADDR or is global when it was local. */
+ if (closest_name == NULL
+ || closest_value < value
+ || binding_value (closest_sym) < binding_value (sym))
+ {
+ if (sym->st_size != 0)
+ {
+ *closest_sym = *sym;
+ closest_value = value;
+ closest_shndx = shndx;
+ closest_elf = elf;
+ closest_name = name;
+ }
+ else if (closest_name == NULL
+ && value >= min_label
+ && same_section (value,
+ resolved ? mod->main.elf : elf, shndx))
+ {
+ /* Handwritten assembly symbols sometimes have no
+ st_size. If no symbol with proper size includes
+ the address, we'll use the closest one that is in
+ the same section as ADDR. */
+ sizeless_sym = *sym;
+ sizeless_value = value;
+ sizeless_shndx = shndx;
+ sizeless_elf = elf;
+ sizeless_name = name;
+ }
+ }
+ /* When the beginning of its range is no closer,
+ the end of its range might be. Otherwise follow
+ GELF_ST_BIND preference. If all are equal prefer
+ the first symbol found. */
+ else if (sym->st_size != 0
+ && closest_value == value
+ && ((closest_sym->st_size > sym->st_size
+ && (binding_value (closest_sym)
+ <= binding_value (sym)))
+ || (closest_sym->st_size >= sym->st_size
+ && (binding_value (closest_sym)
+ < binding_value (sym)))))
+ {
+ *closest_sym = *sym;
+ closest_value = value;
+ closest_shndx = shndx;
+ closest_elf = elf;
+ closest_name = name;
+ }
+ }
+ }
+
/* Look through the symbol table for a matching symbol. */
inline void search_table (int start, int end)
{
for (int i = start; i < end; ++i)
{
GElf_Sym sym;
+ GElf_Addr value;
GElf_Word shndx;
Elf *elf;
- const char *name = INTUSE(dwfl_module_getsym_elf) (mod, i, &sym,
- &shndx, &elf,
- NULL);
+ bool resolved;
+ const char *name = __libdwfl_getsym (mod, i, &sym, &value,
+ &shndx, &elf, NULL,
+ &resolved, adjust_st_value);
if (name != NULL && name[0] != '\0'
&& sym.st_shndx != SHN_UNDEF
- && sym.st_value <= addr
+ && value <= addr
&& GELF_ST_TYPE (sym.st_info) != STT_SECTION
&& GELF_ST_TYPE (sym.st_info) != STT_FILE
&& GELF_ST_TYPE (sym.st_info) != STT_TLS)
{
- /* Even if we don't choose this symbol, its existence excludes
- any sizeless symbol (assembly label) that is below its upper
- bound. */
- if (sym.st_value + sym.st_size > min_label)
- min_label = sym.st_value + sym.st_size;
+ try_sym_value (value, &sym, name, shndx, elf, resolved);
- if (sym.st_size == 0 || addr - sym.st_value < sym.st_size)
+ /* If this is an addrinfo variant and the value could be
+ resolved then also try matching the (adjusted) st_value. */
+ if (resolved && mod->e_type != ET_REL)
{
- /* Return GELF_ST_BIND as higher-is-better integer. */
- inline int binding_value (const GElf_Sym *symp)
- {
- switch (GELF_ST_BIND (symp->st_info))
- {
- case STB_GLOBAL:
- return 3;
- case STB_WEAK:
- return 2;
- case STB_LOCAL:
- return 1;
- default:
- return 0;
- }
- }
- /* This symbol is a better candidate than the current one
- if it's closer to ADDR or is global when it was local. */
- if (closest_name == NULL
- || closest_sym->st_value < sym.st_value
- || binding_value (closest_sym) < binding_value (&sym))
- {
- if (sym.st_size != 0)
- {
- *closest_sym = sym;
- closest_shndx = shndx;
- closest_elf = elf;
- closest_name = name;
- }
- else if (closest_name == NULL
- && sym.st_value >= min_label
- && same_section (&sym, elf, shndx))
- {
- /* Handwritten assembly symbols sometimes have no
- st_size. If no symbol with proper size includes
- the address, we'll use the closest one that is in
- the same section as ADDR. */
- sizeless_sym = sym;
- sizeless_shndx = shndx;
- sizeless_elf = elf;
- sizeless_name = name;
- }
- }
- /* When the beginning of its range is no closer,
- the end of its range might be. Otherwise follow
- GELF_ST_BIND preference. If all are equal prefer
- the first symbol found. */
- else if (sym.st_size != 0
- && closest_sym->st_value == sym.st_value
- && ((closest_sym->st_size > sym.st_size
- && (binding_value (closest_sym)
- <= binding_value (&sym)))
- || (closest_sym->st_size >= sym.st_size
- && (binding_value (closest_sym)
- < binding_value (&sym)))))
- {
- *closest_sym = sym;
- closest_shndx = shndx;
- closest_elf = elf;
- closest_name = name;
- }
+ GElf_Addr adjusted_st_value;
+ adjusted_st_value = dwfl_adjusted_st_value (mod, elf,
+ sym.st_value);
+ if (value != adjusted_st_value && adjusted_st_value <= addr)
+ try_sym_value (adjusted_st_value, &sym, name, shndx,
+ elf, false);
}
}
}
/* If we found nothing searching the global symbols, then try the locals.
Unless we have a global sizeless symbol that matches exactly. */
if (closest_name == NULL && first_global > 1
- && (sizeless_name == NULL || sizeless_sym.st_value != addr))
+ && (sizeless_name == NULL || sizeless_value != addr))
search_table (1, first_global);
/* If we found no proper sized symbol to use, fall back to the best
candidate sizeless symbol we found, if any. */
if (closest_name == NULL
- && sizeless_name != NULL && sizeless_sym.st_value >= min_label)
+ && sizeless_name != NULL && sizeless_value >= min_label)
{
*closest_sym = sizeless_sym;
+ closest_value = sizeless_value;
closest_shndx = sizeless_shndx;
closest_elf = sizeless_elf;
closest_name = sizeless_name;
}
+ *off = addr - closest_value;
+
if (shndxp != NULL)
*shndxp = closest_shndx;
if (elfp != NULL)
*biasp = dwfl_adjusted_st_value (mod, closest_elf, 0);
return closest_name;
}
-INTDEF (dwfl_module_addrsym_elf)
const char *
dwfl_module_addrsym (Dwfl_Module *mod, GElf_Addr addr,
GElf_Sym *closest_sym, GElf_Word *shndxp)
{
- return INTUSE(dwfl_module_addrsym_elf) (mod, addr, closest_sym, shndxp,
- NULL, NULL);
+ GElf_Off off;
+ return __libdwfl_addrsym (mod, addr, &off, closest_sym, shndxp,
+ NULL, NULL, true);
}
INTDEF (dwfl_module_addrsym)
+
+const char
+*dwfl_module_addrinfo (Dwfl_Module *mod, GElf_Addr address,
+ GElf_Off *offset, GElf_Sym *sym,
+ GElf_Word *shndxp, Elf **elfp, Dwarf_Addr *bias)
+{
+ return __libdwfl_addrsym (mod, address, offset, sym, shndxp, elfp, bias,
+ false);
+}
+INTDEF (dwfl_module_addrinfo)
#include "libdwflP.h"
const char *
-dwfl_module_getsym_elf (Dwfl_Module *mod, int ndx,
- GElf_Sym *sym, GElf_Word *shndxp,
- Elf **elfp, Dwarf_Addr *biasp)
+internal_function
+__libdwfl_getsym (Dwfl_Module *mod, int ndx, GElf_Sym *sym, GElf_Addr *addr,
+ GElf_Word *shndxp, Elf **elfp, Dwarf_Addr *biasp,
+ bool *resolved, bool adjust_st_value)
{
if (unlikely (mod == NULL))
return NULL;
alloc = unlikely (shdr == NULL) || (shdr->sh_flags & SHF_ALLOC);
}
+ /* In case of an value in an allocated section the main Elf Ebl
+ might know where the real value is (e.g. for function
+ descriptors). */
+
+ char *ident;
+ GElf_Addr st_value = sym->st_value;
+ *resolved = false;
+ if (! adjust_st_value && mod->e_type != ET_REL && alloc
+ && (GELF_ST_TYPE (sym->st_info) == STT_FUNC
+ || (GELF_ST_TYPE (sym->st_info) == STT_GNU_IFUNC
+ && (ident = elf_getident (elf, NULL)) != NULL
+ && ident[EI_OSABI] == ELFOSABI_LINUX)))
+ {
+ if (likely (__libdwfl_module_getebl (mod) == DWFL_E_NOERROR))
+ {
+ if (elf != mod->main.elf)
+ {
+ st_value = dwfl_adjusted_st_value (mod, elf, st_value);
+ st_value = dwfl_deadjust_st_value (mod, mod->main.elf, st_value);
+ }
+
+ *resolved = ebl_resolve_sym_value (mod->ebl, &st_value);
+ if (! *resolved)
+ st_value = sym->st_value;
+ }
+ }
+
if (shndxp != NULL)
/* Yield -1 in case of a non-SHF_ALLOC section. */
*shndxp = alloc ? shndx : (GElf_Word) -1;
size_t symshstrndx = SHN_UNDEF;
Dwfl_Error result = __libdwfl_relocate_value (mod, elf,
&symshstrndx,
- shndx, &sym->st_value);
+ shndx, &st_value);
if (unlikely (result != DWFL_E_NOERROR))
{
__libdwfl_seterrno (result);
}
else if (alloc)
/* Apply the bias to the symbol value. */
- sym->st_value = dwfl_adjusted_st_value (mod, elf, sym->st_value);
+ st_value = dwfl_adjusted_st_value (mod,
+ *resolved ? mod->main.elf : elf,
+ st_value);
break;
}
+ if (adjust_st_value)
+ sym->st_value = st_value;
+
+ if (addr != NULL)
+ *addr = st_value;
+
if (unlikely (sym->st_name >= symstrdata->d_size))
{
__libdwfl_seterrno (DWFL_E_BADSTROFF);
*biasp = dwfl_adjusted_st_value (mod, elf, 0);
return (const char *) symstrdata->d_buf + sym->st_name;
}
-INTDEF (dwfl_module_getsym_elf)
+
+const char *
+dwfl_module_getsym_info (Dwfl_Module *mod, int ndx,
+ GElf_Sym *sym, GElf_Addr *addr,
+ GElf_Word *shndxp,
+ Elf **elfp, Dwarf_Addr *bias)
+{
+ bool resolved;
+ return __libdwfl_getsym (mod, ndx, sym, addr, shndxp, elfp, bias,
+ &resolved, false);
+}
+INTDEF (dwfl_module_getsym_info)
const char *
dwfl_module_getsym (Dwfl_Module *mod, int ndx,
GElf_Sym *sym, GElf_Word *shndxp)
{
- return dwfl_module_getsym_elf (mod, ndx, sym, shndxp, NULL, NULL);
+ bool resolved;
+ return __libdwfl_getsym (mod, ndx, sym, NULL, shndxp, NULL, NULL,
+ &resolved, true);
}
INTDEF (dwfl_module_getsym)
Note that since symbols can come from either the main, debug or auxiliary
ELF symbol file (either dynsym or symtab) the section index can only
be reliably used to compare against special section constants like
- SHN_UNDEF or SHN_ABS. */
+ SHN_UNDEF or SHN_ABS. It is recommended to use dwfl_module_getsym_info
+ which doesn't have these deficiencies. */
extern const char *dwfl_module_getsym (Dwfl_Module *mod, int ndx,
GElf_Sym *sym, GElf_Word *shndxp)
__nonnull_attribute__ (3);
-/* Same as dwfl_module_getsym but also returns the ELF file, if not NULL,
- that the symbol came from so the section index can be reliably used.
- Fills in *BIAS, if not NULL, with the difference between addresses
- within the loaded module and those in symbol tables of the ELF file. */
-extern const char *dwfl_module_getsym_elf (Dwfl_Module *mod, int ndx,
- GElf_Sym *sym, GElf_Word *shndxp,
- Elf **elfp, Dwarf_Addr *bias)
- __nonnull_attribute__ (3);
+/* Fetch one entry from the module's symbol table and the associated
+ address value. On errors, returns NULL. If successful, fills in
+ *SYM, *ADDR and returns the string for st_name. This works like
+ gelf_getsym. *ADDR is set to the st_value adjusted to an absolute
+ value based on the module's location, when the symbol is in an
+ SHF_ALLOC section. For non-ET_REL files, if the arch uses function
+ descriptors, and the st_value points to one, *ADDR will be resolved
+ to the actual function entry address. The SYM->ST_VALUE itself
+ isn't adjusted in any way. Fills in ELFP, if not NULL, with the
+ ELF file the symbol originally came from. Note that symbols can
+ come from either the main, debug or auxiliary ELF symbol file
+ (either dynsym or symtab). If SHNDXP is non-null, it's set with
+ the section index (whether from st_shndx or extended index table);
+ in case of a symbol in a non-allocated section, *SHNDXP is instead
+ set to -1. Fills in BIAS, if not NULL, with the difference between
+ addresses within the loaded module and those in symbol table of the
+ ELF file. Note that the address associated with the symbol might
+ be in a different section than the returned symbol. The section in
+ the main elf file in which returned ADDR falls can be found with
+ dwfl_module_address_section. */
+extern const char *dwfl_module_getsym_info (Dwfl_Module *mod, int ndx,
+ GElf_Sym *sym, GElf_Addr *addr,
+ GElf_Word *shndxp,
+ Elf **elfp, Dwarf_Addr *bias)
+ __nonnull_attribute__ (3, 4);
/* Find the symbol that ADDRESS lies inside, and return its name. */
extern const char *dwfl_module_addrname (Dwfl_Module *mod, GElf_Addr address);
+/* Find the symbol associated with ADDRESS. Return its name or NULL
+ when nothing was found. If the architecture uses function
+ descriptors, and symbol st_value points to one, ADDRESS wil be
+ matched against either the adjusted st_value or the associated
+ function entry value as described in dwfl_module_getsym_info. If
+ OFFSET is not NULL it will be filled in with the difference from
+ the start of the symbol (or function entry). If SYM is not NULL it
+ is filled in with the symbol associated with the matched ADDRESS.
+ The SYM->ST_VALUE itself isn't adjusted in any way. Fills in ELFP,
+ if not NULL, with the ELF file the symbol originally came from.
+ Note that symbols can come from either the main, debug or auxiliary
+ ELF symbol file (either dynsym or symtab). If SHNDXP is non-null,
+ it's set with the section index (whether from st_shndx or extended
+ index table). Fills in BIAS, if not NULL, with the difference
+ between addresses within the loaded module and those in symbol
+ table of the ELF file. Note that the address matched against the
+ symbol might be in a different section than the returned symbol.
+ The section in the main elf file in ADDRESS falls can be found with
+ dwfl_module_address_section. */
+extern const char *dwfl_module_addrinfo (Dwfl_Module *mod, GElf_Addr address,
+ GElf_Off *offset, GElf_Sym *sym,
+ GElf_Word *shndxp, Elf **elfp,
+ Dwarf_Addr *bias)
+ __nonnull_attribute__ (3);
+
/* Find the symbol that ADDRESS lies inside, and return detailed
- information as for dwfl_module_getsym (above). */
+ information as for dwfl_module_getsym (above). Note that like
+ dwfl_module_getsym this function also adjusts SYM->ST_VALUE to an
+ absolute value based on the module's location. ADDRESS is only
+ matched against this adjusted SYM->ST_VALUE. This means that
+ depending on architecture this might only match symbols that
+ represent function descriptor addresses (and not function entry
+ addresses). For these reasons it is recommended to use
+ dwfl_module_addrinfo instead. */
extern const char *dwfl_module_addrsym (Dwfl_Module *mod, GElf_Addr address,
GElf_Sym *sym, GElf_Word *shndxp)
__nonnull_attribute__ (3);
-/* Same as dwfl_module_addrsym but also returns the ELF file, if not NULL,
- that the symbol came from so the section index can be reliably used.
- Fills in *BIAS, if not NULL, with the difference between addresses
- within the loaded module and those in symbol tables of the ELF file. */
-extern const char *dwfl_module_addrsym_elf (Dwfl_Module *mod,
- GElf_Addr address, GElf_Sym *sym,
- GElf_Word *shndxp, Elf **elfp,
- Dwarf_Addr *bias)
- __nonnull_attribute__ (3);
-
/* Find the ELF section that *ADDRESS lies inside and return it.
On success, adjusts *ADDRESS to be relative to the section,
and sets *BIAS to the difference between addresses used in
};
+/* Internal wrapper for old dwfl_module_getsym and new dwfl_module_getsym_info.
+ adjust_st_value set to true returns adjusted SYM st_value, set to false
+ it will not adjust SYM at all, but does match against resolved *ADDR. */
+extern const char *__libdwfl_getsym (Dwfl_Module *mod, int ndx, GElf_Sym *sym,
+ GElf_Addr *addr, GElf_Word *shndxp,
+ Elf **elfp, Dwarf_Addr *biasp,
+ bool *resolved, bool adjust_st_value)
+ internal_function;
+
+/* Internal wrapper for old dwfl_module_addrsym and new dwfl_module_addrinfo.
+ adjust_st_value set to true returns adjusted SYM st_value, set to false
+ it will not adjust SYM at all, but does match against resolved values. */
+extern const char *__libdwfl_addrsym (Dwfl_Module *mod, GElf_Addr addr,
+ GElf_Off *off, GElf_Sym *sym,
+ GElf_Word *shndxp, Elf **elfp,
+ Dwarf_Addr *bias,
+ bool adjust_st_value) internal_function;
extern void __libdwfl_module_free (Dwfl_Module *mod) internal_function;
extern Dwfl_Error __libdwfl_relocate (Dwfl_Module *mod, Elf *file, bool debug)
internal_function;
+/* Find the section index in mod->main.elf that contains the given
+ *ADDR. Adjusts *ADDR to be section relative on success, returns
+ SHN_UNDEF on failure. */
+extern size_t __libdwfl_find_section_ndx (Dwfl_Module *mod, Dwarf_Addr *addr)
+ internal_function;
+
/* Process (simple) relocations in arbitrary section TSCN of an ET_REL file.
RELOCSCN is SHT_REL or SHT_RELA and TSCN is its sh_info target section. */
extern Dwfl_Error __libdwfl_relocate_section (Dwfl_Module *mod, Elf *relocated,
INTDECL (dwfl_getmodules)
INTDECL (dwfl_module_addrdie)
INTDECL (dwfl_module_address_section)
+INTDECL (dwfl_module_addrinfo)
INTDECL (dwfl_module_addrsym)
-INTDECL (dwfl_module_addrsym_elf)
INTDECL (dwfl_module_build_id)
INTDECL (dwfl_module_getdwarf)
INTDECL (dwfl_module_getelf)
INTDECL (dwfl_module_getsym)
-INTDECL (dwfl_module_getsym_elf)
+INTDECL (dwfl_module_getsym_info)
INTDECL (dwfl_module_getsymtab)
INTDECL (dwfl_module_getsymtab_first_global)
INTDECL (dwfl_module_getsrc)
+2013-12-18 Mark Wielaard <mjw@redhat.com>
+
+ * Makefile.am (gen_SOURCES): Add eblresolvesym.c.
+ * ebl-hooks.h (resolve_sym_value): New entry.
+ * eblresolvesym.c: New file.
+ * libebl.h (ebl_resolve_sym_value): New definition.
+ * libeblP.h (fd_addr): New field.
+ (fd_data): Likewise.
+
2013-12-18 Jan Kratochvil <jan.kratochvil@redhat.com>
unwinder: s390 and s390x
eblsysvhashentrysize.c eblauxvinfo.c eblcheckobjattr.c \
ebl_check_special_section.c ebl_syscall_abi.c eblabicfi.c \
eblstother.c eblinitreg.c ebldwarftoregno.c eblnormalizepc.c \
- eblunwind.c
+ eblunwind.c eblresolvesym.c
libebl_a_SOURCES = $(gen_SOURCES)
ebl_pid_memory_read_t *readfunc, void *arg,
bool *signal_framep);
+/* Returns true if the value can be resolved to an address in an
+ allocated section, which will be returned in *SHNDXP.
+ (e.g. function descriptor resolving) */
+bool EBLHOOK(resolve_sym_value) (Ebl *ebl, GElf_Addr *addr);
+
/* Destructor for ELF backend handle. */
void EBLHOOK(destr) (struct ebl *);
--- /dev/null
+/* Resolve a symbol value to an allocated section of the Elf file.
+ Copyright (C) 2013 Red Hat, Inc.
+ This file is part of elfutils.
+
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
+
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <libeblP.h>
+#include <assert.h>
+
+bool
+ebl_resolve_sym_value (Ebl *ebl, GElf_Addr *addr)
+{
+ if (ebl == NULL || ebl->resolve_sym_value == NULL)
+ return false;
+
+ return ebl->resolve_sym_value (ebl, addr);
+}
bool *signal_framep)
__nonnull_attribute__ (1, 3, 4, 5, 7);
+/* Returns true if the value can be resolved to an address in an
+ allocated section, which will be returned in *ADDR
+ (e.g. function descriptor resolving) */
+extern bool ebl_resolve_sym_value (Ebl *ebl, GElf_Addr *addr)
+ __nonnull_attribute__ (2);
+
#ifdef __cplusplus
}
#endif
Ebl architecture can unwind iff FRAME_NREGS > 0. */
size_t frame_nregs;
+ /* Function descriptor load address and table as used by
+ ebl_resolve_sym_value if available for this arch. */
+ GElf_Addr fd_addr;
+ Elf_Data *fd_data;
+
/* Internal data. */
void *dlhandle;
};
+2013-12-18 Mark Wielaard <mjw@redhat.com>
+
+ * addr2line.c (options): Add symbol-sections, 'x'.
+ (show_symbol_sections): New static bool.
+ (parse_opt): Handle 'x'.
+ (print_addrsym): Use dwfl_module_addrinfo value.r
+ Also show section of address with show_symbol_sections.
+ (find_symbol): Use dwfl_module_getsym_info and set value.
+ (handle_address): Request value and use it instead of sym.st_value.
+ * readelf.c (format_dwarf_addr): Use dwfl_module_addrinfo to get
+ name and offset.
+
2013-12-17 Masatake YAMATO <yamato@redhat.com>
Mark Wielaard <mjw@redhat.com>
N_("Show absolute file names using compilation directory"), 0 },
{ "functions", 'f', NULL, 0, N_("Also show function names"), 0 },
{ "symbols", 'S', NULL, 0, N_("Also show symbol or section names"), 0 },
+ { "symbols-sections", 'x', NULL, 0, N_("Also show symbol and the section names"), 0 },
{ "flags", 'F', NULL, 0, N_("Also show line table flags"), 0 },
{ "section", 'j', "NAME", 0,
N_("Treat addresses as offsets relative to NAME section."), 0 },
/* True if ELF symbol or section info should be shown. */
static bool show_symbols;
+/* True if section associated with a symbol address should be shown. */
+static bool show_symbol_sections;
+
/* If non-null, take address parameters as relative to named section. */
static const char *just_section;
show_symbols = true;
break;
+ case 'x':
+ show_symbols = true;
+ show_symbol_sections = true;
+ break;
+
case 'j':
just_section = arg;
break;
print_addrsym (Dwfl_Module *mod, GElf_Addr addr)
{
GElf_Sym s;
- GElf_Word shndx;
- const char *name = dwfl_module_addrsym (mod, addr, &s, &shndx);
+ GElf_Off off;
+ const char *name = dwfl_module_addrinfo (mod, addr, &off, &s,
+ NULL, NULL, NULL);
if (name == NULL)
{
/* No symbol name. Get a section name instead. */
else
printf ("(%s)+%#" PRIx64 "\n", name, addr);
}
- else if (addr == s.st_value)
- puts (name);
else
- printf ("%s+%#" PRIx64 "\n", name, addr - s.st_value);
+ {
+ if (off == 0)
+ printf ("%s", name);
+ else
+ printf ("%s+%#" PRIx64 "", name, off);
+
+ // Also show section name for address.
+ if (show_symbol_sections)
+ {
+ Dwarf_Addr ebias;
+ Elf_Scn *scn = dwfl_module_address_section (mod, &addr, &ebias);
+ if (scn != NULL)
+ {
+ GElf_Shdr shdr_mem;
+ GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem);
+ if (shdr != NULL)
+ {
+ Elf *elf = dwfl_module_getelf (mod, &ebias);
+ GElf_Ehdr ehdr;
+ if (gelf_getehdr (elf, &ehdr) != NULL)
+ printf (" (%s)", elf_strptr (elf, ehdr.e_shstrndx,
+ shdr->sh_name));
+ }
+ }
+ }
+ puts ("");
+ }
}
static void
{
const char *looking_for = ((void **) arg)[0];
GElf_Sym *symbol = ((void **) arg)[1];
+ GElf_Addr *value = ((void **) arg)[2];
int n = dwfl_module_getsymtab (mod);
for (int i = 1; i < n; ++i)
{
- const char *symbol_name = dwfl_module_getsym (mod, i, symbol, NULL);
+ const char *symbol_name = dwfl_module_getsym_info (mod, i, symbol,
+ value, NULL, NULL,
+ NULL);
if (symbol_name == NULL || symbol_name[0] == '\0')
continue;
switch (GELF_ST_TYPE (symbol->st_info))
/* It was symbol[+offset]. */
GElf_Sym sym;
- void *arg[2] = { name, &sym };
+ GElf_Addr value = 0;
+ void *arg[3] = { name, &sym, &value };
(void) dwfl_getmodules (dwfl, &find_symbol, arg, 0);
if (arg[0] != NULL)
error (0, 0, gettext ("cannot find symbol '%s'"), name);
gettext ("offset %#" PRIxMAX " lies outside"
" contents of '%s'"),
addr, name);
- addr += sym.st_value;
+ addr += value;
parsed = true;
}
break;
{
/* See if there is a name we can give for this address. */
GElf_Sym sym;
+ GElf_Off off = 0;
const char *name = (print_address_names && ! print_unresolved_addresses)
- ? dwfl_module_addrsym (dwflmod, address, &sym, NULL) : NULL;
- if (name != NULL)
- sym.st_value = address - sym.st_value;
+ ? dwfl_module_addrinfo (dwflmod, address, &off, &sym, NULL, NULL, NULL)
+ : NULL;
const char *scn;
if (print_unresolved_addresses)
char *result;
if ((name != NULL
- ? (sym.st_value != 0
+ ? (off != 0
? (scn != NULL
? (address_size == 0
? asprintf (&result,
gettext ("%s+%#" PRIx64 " <%s+%#" PRIx64 ">"),
- scn, address, name, sym.st_value)
+ scn, address, name, off)
: asprintf (&result,
gettext ("%s+%#0*" PRIx64 " <%s+%#" PRIx64 ">"),
scn, 2 + address_size * 2, address,
- name, sym.st_value))
+ name, off))
: (address_size == 0
? asprintf (&result,
gettext ("%#" PRIx64 " <%s+%#" PRIx64 ">"),
- address, name, sym.st_value)
+ address, name, off)
: asprintf (&result,
gettext ("%#0*" PRIx64 " <%s+%#" PRIx64 ">"),
2 + address_size * 2, address,
- name, sym.st_value)))
+ name, off)))
: (scn != NULL
? (address_size == 0
? asprintf (&result,
2013-12-18 Jan Kratochvil <jan.kratochvil@redhat.com>
+ Mark Wielaard <mjw@redhat.com>
+
+ * Makefile.am (EXTRA_DIST): Add testfile66.bz2, testfile66.core.bz2
+ and testfilebaz*ppc64*.bz2 files.
+ * dwflsyms.c (list_syms): Remove unused from parameter mod_name. Print
+ error on dwfl_module_getsymtab error.
+ (list_syms): Use dwfl_module_getsym and dwfl_module_getsym_info.
+ Compare values for non-ET_REL. Use dwfl_module_addrinfo.
+ Also print section of actual value if different from sym.
+ * run-addrname-test.sh (testfile66, testfile66.core): New tests.
+ Test addr2line -x by showing different sections for address and
+ found name in testfile66.
+ * run-dwflsyms.sh (testfile66, testfile66.core, hello_ppc64.ko,
+ testfilebaz*ppc64): New tests.
+ * testfile66.bz2, testfile66.core.bz2, testfilebazdbgppc64.bz2,
+ testfilebazdbgppc64.debug.bz2, testfilebazdbgppc64_pl.bz2,
+ testfilebazdbgppc64_plr.bz2, testfilebazdynppc64.bz2,
+ testfilebazmdbppc64.bz2, testfilebazminppc64.bz2,
+ testfilebazminppc64_pl.bz2, testfilebazminppc64_plr.bz2,
+ testfilebaztabppc64.bz2: New test files.
+
+2013-12-18 Jan Kratochvil <jan.kratochvil@redhat.com>
unwinder: s390 and s390x
* Makefile.am (TESTS): Add run-backtrace-core-s390x.sh and
testfilebaztab.bz2 testfilebasmin.bz2 \
testfilebazdbg_pl.bz2 testfilebazmin_pl.bz2 \
testfilebazdbg_plr.bz2 testfilebazmin_plr.bz2 \
+ testfilebazdbgppc64.bz2 testfilebazdbgppc64.debug.bz2 \
+ testfilebazdbgppc64_pl.bz2 testfilebazdbgppc64_plr.bz2 \
+ testfilebazdynppc64.bz2 testfilebazmdbppc64.bz2 \
+ testfilebazminppc64.bz2 testfilebazminppc64_pl.bz2 \
+ testfilebazminppc64_plr.bz2 testfilebaztabppc64.bz2 \
run-dwflsyms.sh \
run-unstrip-n.sh testcore-rtlib.bz2 testcore-rtlib-ppc.bz2 \
run-low_high_pc.sh testfile_low_high_pc.bz2 \
backtrace-subr.sh backtrace.i386.core.bz2 backtrace.i386.exec.bz2 \
backtrace.x86_64.core.bz2 backtrace.x86_64.exec.bz2 \
backtrace.ppc.core.bz2 backtrace.ppc.exec.bz2 \
- run-backtrace-core-ppc.sh \
+ run-backtrace-core-ppc.sh testfile66.bz2 testfile66.core.bz2 \
backtrace.s390x.core.bz2 backtrace.s390x.exec.bz2 \
backtrace.s390.core.bz2 backtrace.s390.exec.bz2 \
run-backtrace-core-s390x.sh run-backtrace-core-s390.sh
static int
list_syms (struct Dwfl_Module *mod,
- void **user __attribute__ ((unused)),
- const char *mod_name __attribute__ ((unused)),
+ void **user __attribute__ ((unused)), const char *mod_name,
Dwarf_Addr low_addr __attribute__ ((unused)),
void *arg __attribute__ ((unused)))
{
int syms = dwfl_module_getsymtab (mod);
- assert (syms >= 0);
+ if (syms < 0)
+ {
+ printf ("%s: %s\n", mod_name, dwfl_errmsg (-1));
+ return DWARF_CB_OK;
+ }
for (int ndx = 0; ndx < syms; ndx++)
{
GElf_Word shndxp;
Elf *elf;
Dwarf_Addr bias;
- const char *name = dwfl_module_getsym_elf (mod, ndx, &sym, &shndxp,
- &elf, &bias);
+ const char *name = dwfl_module_getsym (mod, ndx, &sym, &shndxp);
+
printf("%4d: %s\t%s\t%s (%" PRIu64 ") %#" PRIx64,
ndx, gelf_type (&sym), gelf_bind (&sym), name,
sym.st_size, sym.st_value);
+ /* The info variant doesn't adjust st_value but returns the (possible)
+ adjusted value separately. */
+ GElf_Addr value;
+ GElf_Sym isym;
+ name = dwfl_module_getsym_info (mod, ndx, &isym, &value, &shndxp,
+ &elf, &bias);
+
+ GElf_Ehdr ehdr;
+ gelf_getehdr (elf, &ehdr);
+
+ // getsym st_values might or might not be adjusted depending on section.
+ // For ET_REL the adjustment is section relative.
+ assert (sym.st_value == isym.st_value
+ || sym.st_value == isym.st_value + bias
+ || ehdr.e_type == ET_REL);
+
/* And the reverse, which works for function symbols at least.
Note this only works because the st.value is adjusted by
dwfl_module_getsym (). */
/* Make sure the adjusted value really falls in the elf section. */
assert (addr_in_section (elf, shndxp, sym.st_value - bias));
- GElf_Addr addr = sym.st_value;
+ GElf_Addr addr = value;
GElf_Sym asym;
GElf_Word ashndxp;
Elf *aelf;
Dwarf_Addr abias;
- const char *aname = dwfl_module_addrsym_elf (mod, addr, &asym,
- &ashndxp, &aelf, &abias);
+ GElf_Off off;
+ const char *aname = dwfl_module_addrinfo (mod, addr, &off, &asym,
+ &ashndxp, &aelf, &abias);
/* Make sure the adjusted value really falls in the elf section. */
- assert (addr_in_section (aelf, ashndxp, asym.st_value - abias));
+ assert (addr_in_section (aelf, ashndxp, asym.st_value)
+ || ehdr.e_type == ET_REL);
/* Either they are the same symbol (name), the binding of
asym is "stronger" (or equal) to sym or asym is more specific
(has a lower address) than sym. */
assert ((strcmp (name, aname) == 0
|| gelf_bind_order (&asym) >= gelf_bind_order (&sym))
- && asym.st_value <= sym.st_value);
+ && value <= sym.st_value);
+ addr = sym.st_value;
int res = dwfl_module_relocate_address (mod, &addr);
assert (res != -1);
if (shndxp < SHN_LORESERVE)
elf_section_name (elf, shndxp));
else
printf(", rel: %#" PRIx64 "", addr);
+
+ /* Print the section of the actual value if different from sym. */
+ if (value != isym.st_value + bias && ehdr.e_type != ET_REL)
+ {
+ GElf_Addr ebias;
+ addr = value;
+ Elf_Scn *scn = dwfl_module_address_section (mod, &addr, &ebias);
+ GElf_Shdr shdr_mem;
+ GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem);
+ Elf *melf = dwfl_module_getelf (mod, &ebias);
+ gelf_getehdr (melf, &ehdr);
+ const char *sname = elf_strptr (melf, ehdr.e_shstrndx,
+ shdr->sh_name);
+ printf (" [%#" PRIx64 ", rel: %#" PRIx64 " (%s)]",
+ value, addr, sname);
+ }
+
}
printf ("\n");
}
??:0
EOF
+# .section ".text"
+# .globl _start
+# .section ".opd","aw"
+#_start: .quad .L._start,.TOC.@tocbase
+# .previous
+# .type _start, @function
+#.L._start:
+# .byte 0x7d, 0x82, 0x10, 0x08
+# .size _start,.-.L._start
+testfiles testfile66 testfile66.core
+testrun_compare ${abs_top_builddir}/src/addr2line -x -e testfile66 _start 0x2d8 0x2db 0x2dc 0x103d0 0x103d3 0x103d4<<EOF
+_start (.text)
+??:0
+_start (.text)
+??:0
+_start+0x3 (.text)
+??:0
+()+0x2dc
+??:0
+_start (.opd)
+??:0
+_start+0x3 (.opd)
+??:0
+()+0x103d4
+??:0
+EOF
+testrun_compare ${abs_top_builddir}/src/addr2line -x -e testfile66 --core=testfile66.core _start 0x461b02d8 0x461c03d0<<\EOF
+_start (.text)
+??:0
+_start (.text)
+??:0
+_start (.opd)
+??:0
+EOF
+
testfiles testfile69.core testfile69.so
testrun_compare ${abs_top_builddir}/src/addr2line --core=./testfile69.core -S 0x7f0bc6a33535 0x7f0bc6a33546 <<\EOF
libstatic+0x9
8: FUNC GLOBAL bar (44) 0x40017a, rel: 0x40017a (.text)
EOF
+testfiles testfile66
+testrun_compare ${abs_builddir}/dwflsyms -e testfile66 <<\EOF
+ 0: NOTYPE LOCAL (0) 0
+ 1: SECTION LOCAL (0) 0x190
+ 2: SECTION LOCAL (0) 0x1a4
+ 3: SECTION LOCAL (0) 0x1c8
+ 4: SECTION LOCAL (0) 0x1f8
+ 5: SECTION LOCAL (0) 0x288
+ 6: SECTION LOCAL (0) 0x2a8
+ 7: SECTION LOCAL (0) 0x2d8
+ 8: SECTION LOCAL (0) 0x102e0
+ 9: SECTION LOCAL (0) 0x103d0
+ 10: SECTION LOCAL (0) 0x103e8
+ 11: SECTION LOCAL (0) 0x103e8
+ 12: OBJECT LOCAL _DYNAMIC (0) 0x102e0
+ 13: FUNC GLOBAL _start (4) 0x103d0, rel: 0x103d0 (.opd) [0x2d8, rel: 0 (.text)]
+ 14: NOTYPE GLOBAL __bss_start (0) 0x103f0
+ 15: NOTYPE GLOBAL _edata (0) 0x103f0
+ 16: NOTYPE GLOBAL _end (0) 0x103f0
+EOF
+
+testfiles testfile66.core
+testrun_compare ${abs_builddir}/dwflsyms -e testfile66 --core=testfile66.core <<\EOF
+ 0: NOTYPE LOCAL (0) 0
+ 1: SECTION LOCAL (0) 0xfffb1af0410
+ 2: NOTYPE GLOBAL __kernel_datapage_offset (0) 0xfffb1af05dc
+ 3: OBJECT GLOBAL LINUX_2.6.15 (0) 0
+ 4: NOTYPE GLOBAL __kernel_clock_getres (64) 0xfffb1af052c
+ 5: NOTYPE GLOBAL __kernel_get_tbfreq (24) 0xfffb1af0620
+ 6: NOTYPE GLOBAL __kernel_gettimeofday (84) 0xfffb1af0440
+ 7: NOTYPE GLOBAL __kernel_sync_dicache (20) 0xfffb1af06c4
+ 8: NOTYPE GLOBAL __kernel_sync_dicache_p5 (20) 0xfffb1af06c4
+ 9: NOTYPE GLOBAL __kernel_sigtramp_rt64 (12) 0xfffb1af0418
+ 10: NOTYPE GLOBAL __kernel_clock_gettime (152) 0xfffb1af0494
+ 11: NOTYPE GLOBAL __kernel_get_syscall_map (44) 0xfffb1af05f4
+ld64.so.1: Callback returned failure
+ 0: NOTYPE LOCAL (0) 0
+ 1: SECTION LOCAL (0) 0x461b0190
+ 2: SECTION LOCAL (0) 0x461b01a4
+ 3: SECTION LOCAL (0) 0x461b01c8
+ 4: SECTION LOCAL (0) 0x461b01f8
+ 5: SECTION LOCAL (0) 0x461b0288
+ 6: SECTION LOCAL (0) 0x461b02a8
+ 7: SECTION LOCAL (0) 0x461b02d8
+ 8: SECTION LOCAL (0) 0x461c02e0
+ 9: SECTION LOCAL (0) 0x461c03d0
+ 10: SECTION LOCAL (0) 0x461c03e8
+ 11: SECTION LOCAL (0) 0x461c03e8
+ 12: OBJECT LOCAL _DYNAMIC (0) 0x102e0
+ 13: FUNC GLOBAL _start (4) 0x461c03d0, rel: 0x103d0 (.opd) [0x461b02d8, rel: 0 (.text)]
+ 14: NOTYPE GLOBAL __bss_start (0) 0x103f0
+ 15: NOTYPE GLOBAL _edata (0) 0x103f0
+ 16: NOTYPE GLOBAL _end (0) 0x103f0
+EOF
+
+# Test the already present dot-prefixed names do not get duplicated.
+testfiles hello_ppc64.ko
+testrun_compare ${abs_builddir}/dwflsyms -e hello_ppc64.ko <<\EOF
+ 0: NOTYPE LOCAL (0) 0
+ 1: SECTION LOCAL (0) 0
+ 2: SECTION LOCAL (0) 0x94
+ 3: SECTION LOCAL (0) 0xba
+ 4: SECTION LOCAL (0) 0xd0
+ 5: SECTION LOCAL (0) 0x13a
+ 6: SECTION LOCAL (0) 0x13a
+ 7: SECTION LOCAL (0) 0x150
+ 8: SECTION LOCAL (0) 0x170
+ 9: SECTION LOCAL (0) 0x188
+ 10: SECTION LOCAL (0) 0x410
+ 11: SECTION LOCAL (0) 0x434
+ 12: SECTION LOCAL (0) 0x438
+ 13: SECTION LOCAL (0) 0x438
+ 14: SECTION LOCAL (0) 0
+ 15: SECTION LOCAL (0) 0
+ 16: SECTION LOCAL (0) 0
+ 17: SECTION LOCAL (0) 0
+ 18: SECTION LOCAL (0) 0
+ 19: SECTION LOCAL (0) 0
+ 20: SECTION LOCAL (0) 0
+ 21: SECTION LOCAL (0) 0
+ 22: SECTION LOCAL (0) 0
+ 23: SECTION LOCAL (0) 0
+ 24: FILE LOCAL init.c (0) 0
+ 25: FILE LOCAL exit.c (0) 0
+ 26: FILE LOCAL hello.mod.c (0) 0
+ 27: OBJECT LOCAL __mod_srcversion23 (35) 0xd0
+ 28: OBJECT LOCAL __module_depends (9) 0xf8
+ 29: OBJECT LOCAL __mod_vermagic5 (50) 0x108
+ 30: OBJECT GLOBAL __this_module (648) 0x188
+ 31: FUNC GLOBAL .cleanup_module (72) 0x4c, rel: 0x4c (.text)
+ 32: FUNC GLOBAL cleanup_module (24) 0x160, rel: 0x10 (.opd)
+ 33: NOTYPE GLOBAL .printk (0) 0
+ 34: FUNC GLOBAL init_module (24) 0x150, rel: 0 (.opd)
+ 35: NOTYPE GLOBAL ._mcount (0) 0
+ 36: FUNC GLOBAL .init_module (76) 0, rel: 0 (.text)
+ 37: NOTYPE GLOBAL _mcount (0) 0
+EOF
+
+# Same test files as above, but now generated on ppc64.
+# ppc64 uses function descriptors to make things more "interesting".
+
+testfiles testfilebaztabppc64
+testfiles testfilebazdbgppc64 testfilebazdbgppc64.debug
+testfiles testfilebazdbgppc64_pl
+testfiles testfilebazdbgppc64_plr
+testfiles testfilebazdynppc64
+testfiles testfilebazmdbppc64
+testfiles testfilebazminppc64
+testfiles testfilebazminppc64_pl
+testfiles testfilebazminppc64_plr
+
+cat > testfile.symtab.in <<\EOF
+ 0: NOTYPE LOCAL (0) 0
+ 1: SECTION LOCAL (0) 0x238
+ 2: SECTION LOCAL (0) 0x24c
+ 3: SECTION LOCAL (0) 0x26c
+ 4: SECTION LOCAL (0) 0x290
+ 5: SECTION LOCAL (0) 0x2c0
+ 6: SECTION LOCAL (0) 0x3e0
+ 7: SECTION LOCAL (0) 0x488
+ 8: SECTION LOCAL (0) 0x4a0
+ 9: SECTION LOCAL (0) 0x4c0
+ 10: SECTION LOCAL (0) 0x820
+ 11: SECTION LOCAL (0) 0x850
+ 12: SECTION LOCAL (0) 0x8a0
+ 13: SECTION LOCAL (0) 0xd30
+ 14: SECTION LOCAL (0) 0xd4c
+ 15: SECTION LOCAL (0) 0xd50
+ 16: SECTION LOCAL (0) 0xd70
+ 17: SECTION LOCAL (0) 0x1fde0
+ 18: SECTION LOCAL (0) 0x1fde8
+ 19: SECTION LOCAL (0) 0x1fdf0
+ 20: SECTION LOCAL (0) 0x1fdf8
+ 21: SECTION LOCAL (0) 0x1fe20
+ 22: SECTION LOCAL (0) 0x20000
+ 23: SECTION LOCAL (0) 0x20010
+ 24: SECTION LOCAL (0) 0x200d8
+ 25: SECTION LOCAL (0) 0x20110
+ 26: SECTION LOCAL (0) 0x20158
+ 27: SECTION LOCAL (0) 0
+ 28: SECTION LOCAL (0) 0
+ 29: SECTION LOCAL (0) 0
+ 30: SECTION LOCAL (0) 0
+ 31: SECTION LOCAL (0) 0
+ 32: SECTION LOCAL (0) 0
+ 33: SECTION LOCAL (0) 0
+ 34: FILE LOCAL crtstuff.c (0) 0
+ 35: OBJECT LOCAL __JCR_LIST__ (0) 0x1fdf0
+ 36: FUNC LOCAL deregister_tm_clones (0) 0x20040, rel: 0x20040 (.opd) [0x910, rel: 0x70 (.text)]
+ 37: FUNC LOCAL register_tm_clones (0) 0x20050, rel: 0x20050 (.opd) [0x980, rel: 0xe0 (.text)]
+ 38: FUNC LOCAL __do_global_dtors_aux (0) 0x20060, rel: 0x20060 (.opd) [0x9f0, rel: 0x150 (.text)]
+ 39: OBJECT LOCAL completed.7711 (1) 0x20158
+ 40: OBJECT LOCAL __do_global_dtors_aux_fini_array_entry (0) 0x1fde8
+ 41: FUNC LOCAL frame_dummy (0) 0x20070, rel: 0x20070 (.opd) [0xa50, rel: 0x1b0 (.text)]
+ 42: OBJECT LOCAL __frame_dummy_init_array_entry (0) 0x1fde0
+ 43: FILE LOCAL foo.c (0) 0
+ 44: FILE LOCAL bar.c (0) 0
+ 45: OBJECT LOCAL b1 (4) 0x20004
+ 46: FUNC LOCAL foo (76) 0x20090, rel: 0x20090 (.opd) [0xb34, rel: 0x294 (.text)]
+ 47: FILE LOCAL crtstuff.c (0) 0
+ 48: OBJECT LOCAL __FRAME_END__ (0) 0xe18
+ 49: OBJECT LOCAL __JCR_END__ (0) 0x1fdf0
+ 50: FILE LOCAL (0) 0
+ 51: NOTYPE LOCAL __glink_PLTresolve (0) 0xce8
+ 52: NOTYPE LOCAL 00000011.plt_call.__libc_start_main@@GLIBC_2.3 (0) 0x8a0
+ 53: NOTYPE LOCAL 00000011.plt_call.__cxa_finalize@@GLIBC_2.3 (0) 0x8b4
+ 54: NOTYPE LOCAL __init_array_end (0) 0x1fde8
+ 55: OBJECT LOCAL _DYNAMIC (0) 0x1fe20
+ 56: NOTYPE LOCAL __init_array_start (0) 0x1fde0
+ 57: FUNC GLOBAL __libc_csu_fini (16) 0x200c0, rel: 0x200c0 (.opd) [0xcd0, rel: 0x430 (.text)]
+ 58: FUNC GLOBAL __libc_start_main@@GLIBC_2.3 (0) 0
+ 59: NOTYPE WEAK _ITM_deregisterTMCloneTable (0) 0
+ 60: NOTYPE WEAK data_start (0) 0x20000
+ 61: NOTYPE GLOBAL _edata (0) 0x20110
+ 62: FUNC GLOBAL bar (116) 0x200a0, rel: 0x200a0 (.opd) [0xb80, rel: 0x2e0 (.text)]
+ 63: FUNC GLOBAL _fini (0) 0x20030, rel: 0x20030 (.opd) [0xd30, rel: 0 (.fini)]
+ 64: NOTYPE GLOBAL __data_start (0) 0x20000
+ 65: NOTYPE WEAK __gmon_start__ (0) 0
+ 66: OBJECT GLOBAL __dso_handle (0) 0x1fe18
+ 67: OBJECT GLOBAL _IO_stdin_used (4) 0xd4c
+ 68: OBJECT GLOBAL b2 (4) 0x20008
+ 69: FUNC WEAK __cxa_finalize@@GLIBC_2.3 (0) 0
+ 70: FUNC GLOBAL __libc_csu_init (204) 0x200b0, rel: 0x200b0 (.opd) [0xc00, rel: 0x360 (.text)]
+ 71: NOTYPE GLOBAL _end (0) 0x20160
+ 72: FUNC GLOBAL _start (60) 0x20010, rel: 0x20010 (.opd) [0x8c8, rel: 0x28 (.text)]
+ 73: NOTYPE GLOBAL __bss_start (0) 0x20110
+ 74: FUNC GLOBAL main (128) 0x20080, rel: 0x20080 (.opd) [0xab4, rel: 0x214 (.text)]
+ 75: NOTYPE WEAK _Jv_RegisterClasses (0) 0
+ 76: OBJECT GLOBAL __TMC_END__ (0) 0x20010
+ 77: NOTYPE WEAK _ITM_registerTMCloneTable (0) 0
+ 78: FUNC GLOBAL _init (0) 0x20020, rel: 0x20020 (.opd) [0x850, rel: 0 (.init)]
+EOF
+
+cat > testfile.symtab_pl.in <<\EOF
+ 0: NOTYPE LOCAL (0) 0
+ 1: SECTION LOCAL (0) 0x8001000238
+ 2: SECTION LOCAL (0) 0x800100024c
+ 3: SECTION LOCAL (0) 0x800100026c
+ 4: SECTION LOCAL (0) 0x8001000290
+ 5: SECTION LOCAL (0) 0x80010002c0
+ 6: SECTION LOCAL (0) 0x80010003e0
+ 7: SECTION LOCAL (0) 0x8001000488
+ 8: SECTION LOCAL (0) 0x80010004a0
+ 9: SECTION LOCAL (0) 0x80010004c0
+ 10: SECTION LOCAL (0) 0x8001000820
+ 11: SECTION LOCAL (0) 0x8001000850
+ 12: SECTION LOCAL (0) 0x80010008a0
+ 13: SECTION LOCAL (0) 0x8001000d30
+ 14: SECTION LOCAL (0) 0x8001000d4c
+ 15: SECTION LOCAL (0) 0x8001000d50
+ 16: SECTION LOCAL (0) 0x8001000d70
+ 17: SECTION LOCAL (0) 0x800101fde0
+ 18: SECTION LOCAL (0) 0x800101fde8
+ 19: SECTION LOCAL (0) 0x800101fdf0
+ 20: SECTION LOCAL (0) 0x800101fdf8
+ 21: SECTION LOCAL (0) 0x800101fe20
+ 22: SECTION LOCAL (0) 0x8001020000
+ 23: SECTION LOCAL (0) 0x8001020010
+ 24: SECTION LOCAL (0) 0x80010200d8
+ 25: SECTION LOCAL (0) 0x8001020110
+ 26: SECTION LOCAL (0) 0x8001020158
+ 27: SECTION LOCAL (0) 0
+ 28: SECTION LOCAL (0) 0
+ 29: SECTION LOCAL (0) 0
+ 30: SECTION LOCAL (0) 0
+ 31: SECTION LOCAL (0) 0
+ 32: SECTION LOCAL (0) 0
+ 33: SECTION LOCAL (0) 0
+ 34: FILE LOCAL crtstuff.c (0) 0
+ 35: OBJECT LOCAL __JCR_LIST__ (0) 0x800101fdf0
+ 36: FUNC LOCAL deregister_tm_clones (0) 0x8001020040, rel: 0x20040 (.opd) [0x8001000910, rel: 0x70 (.text)]
+ 37: FUNC LOCAL register_tm_clones (0) 0x8001020050, rel: 0x20050 (.opd) [0x8001000980, rel: 0xe0 (.text)]
+ 38: FUNC LOCAL __do_global_dtors_aux (0) 0x8001020060, rel: 0x20060 (.opd) [0x80010009f0, rel: 0x150 (.text)]
+ 39: OBJECT LOCAL completed.7711 (1) 0x8001020158
+ 40: OBJECT LOCAL __do_global_dtors_aux_fini_array_entry (0) 0x800101fde8
+ 41: FUNC LOCAL frame_dummy (0) 0x8001020070, rel: 0x20070 (.opd) [0x8001000a50, rel: 0x1b0 (.text)]
+ 42: OBJECT LOCAL __frame_dummy_init_array_entry (0) 0x800101fde0
+ 43: FILE LOCAL foo.c (0) 0
+ 44: FILE LOCAL bar.c (0) 0
+ 45: OBJECT LOCAL b1 (4) 0x8001020004
+ 46: FUNC LOCAL foo (76) 0x8001020090, rel: 0x20090 (.opd) [0x8001000b34, rel: 0x294 (.text)]
+ 47: FILE LOCAL crtstuff.c (0) 0
+ 48: OBJECT LOCAL __FRAME_END__ (0) 0x8001000e18
+ 49: OBJECT LOCAL __JCR_END__ (0) 0x800101fdf0
+ 50: FILE LOCAL (0) 0
+ 51: NOTYPE LOCAL __glink_PLTresolve (0) 0x8001000ce8
+ 52: NOTYPE LOCAL 00000011.plt_call.__libc_start_main@@GLIBC_2.3 (0) 0x80010008a0
+ 53: NOTYPE LOCAL 00000011.plt_call.__cxa_finalize@@GLIBC_2.3 (0) 0x80010008b4
+ 54: NOTYPE LOCAL __init_array_end (0) 0x800101fde8
+ 55: OBJECT LOCAL _DYNAMIC (0) 0x800101fe20
+ 56: NOTYPE LOCAL __init_array_start (0) 0x800101fde0
+ 57: FUNC GLOBAL __libc_csu_fini (16) 0x80010200c0, rel: 0x200c0 (.opd) [0x8001000cd0, rel: 0x430 (.text)]
+ 58: FUNC GLOBAL __libc_start_main@@GLIBC_2.3 (0) 0
+ 59: NOTYPE WEAK _ITM_deregisterTMCloneTable (0) 0
+ 60: NOTYPE WEAK data_start (0) 0x8001020000
+ 61: NOTYPE GLOBAL _edata (0) 0x8001020110
+ 62: FUNC GLOBAL bar (116) 0x80010200a0, rel: 0x200a0 (.opd) [0x8001000b80, rel: 0x2e0 (.text)]
+ 63: FUNC GLOBAL _fini (0) 0x8001020030, rel: 0x20030 (.opd) [0x8001000d30, rel: 0 (.fini)]
+ 64: NOTYPE GLOBAL __data_start (0) 0x8001020000
+ 65: NOTYPE WEAK __gmon_start__ (0) 0
+ 66: OBJECT GLOBAL __dso_handle (0) 0x800101fe18
+ 67: OBJECT GLOBAL _IO_stdin_used (4) 0x8001000d4c
+ 68: OBJECT GLOBAL b2 (4) 0x8001020008
+ 69: FUNC WEAK __cxa_finalize@@GLIBC_2.3 (0) 0
+ 70: FUNC GLOBAL __libc_csu_init (204) 0x80010200b0, rel: 0x200b0 (.opd) [0x8001000c00, rel: 0x360 (.text)]
+ 71: NOTYPE GLOBAL _end (0) 0x8001020160
+ 72: FUNC GLOBAL _start (60) 0x8001020010, rel: 0x20010 (.opd) [0x80010008c8, rel: 0x28 (.text)]
+ 73: NOTYPE GLOBAL __bss_start (0) 0x8001020110
+ 74: FUNC GLOBAL main (128) 0x8001020080, rel: 0x20080 (.opd) [0x8001000ab4, rel: 0x214 (.text)]
+ 75: NOTYPE WEAK _Jv_RegisterClasses (0) 0
+ 76: OBJECT GLOBAL __TMC_END__ (0) 0x8001020010
+ 77: NOTYPE WEAK _ITM_registerTMCloneTable (0) 0
+ 78: FUNC GLOBAL _init (0) 0x8001020020, rel: 0x20020 (.opd) [0x8001000850, rel: 0 (.init)]
+EOF
+
+cat > testfile.dynsym.in <<\EOF
+ 0: NOTYPE LOCAL (0) 0
+ 1: SECTION LOCAL (0) 0x238
+ 2: SECTION LOCAL (0) 0x1fdf0
+ 3: FUNC GLOBAL __libc_start_main (0) 0
+ 4: NOTYPE WEAK _ITM_deregisterTMCloneTable (0) 0
+ 5: NOTYPE WEAK __gmon_start__ (0) 0
+ 6: FUNC WEAK __cxa_finalize (0) 0
+ 7: NOTYPE WEAK _Jv_RegisterClasses (0) 0
+ 8: NOTYPE WEAK _ITM_registerTMCloneTable (0) 0
+ 9: NOTYPE GLOBAL _edata (0) 0x20110
+ 10: NOTYPE GLOBAL _end (0) 0x20160
+ 11: NOTYPE GLOBAL __bss_start (0) 0x20110
+EOF
+
+cat > testfile.minsym.in <<\EOF
+ 0: NOTYPE LOCAL (0) 0
+ 1: SECTION LOCAL (0) 0x238
+ 2: SECTION LOCAL (0) 0x1fdf0
+ 3: OBJECT LOCAL __do_global_dtors_aux_fini_array_entry (0) 0x1fde8
+ 4: OBJECT LOCAL __frame_dummy_init_array_entry (0) 0x1fde0
+ 5: NOTYPE LOCAL __glink_PLTresolve (0) 0xce8
+ 6: NOTYPE LOCAL 00000011.plt_call.__libc_start_main@@GLIBC_2.3 (0) 0x8a0
+ 7: NOTYPE LOCAL 00000011.plt_call.__cxa_finalize@@GLIBC_2.3 (0) 0x8b4
+ 8: NOTYPE LOCAL __init_array_end (0) 0x1fde8
+ 9: NOTYPE LOCAL __init_array_start (0) 0x1fde0
+ 10: SECTION LOCAL (0) 0x238
+ 11: SECTION LOCAL (0) 0x24c
+ 12: SECTION LOCAL (0) 0x26c
+ 13: SECTION LOCAL (0) 0x290
+ 14: SECTION LOCAL (0) 0x2c0
+ 15: SECTION LOCAL (0) 0x3e0
+ 16: SECTION LOCAL (0) 0x488
+ 17: SECTION LOCAL (0) 0x4a0
+ 18: SECTION LOCAL (0) 0x4c0
+ 19: SECTION LOCAL (0) 0x820
+ 20: SECTION LOCAL (0) 0x850
+ 21: SECTION LOCAL (0) 0x8a0
+ 22: SECTION LOCAL (0) 0xd30
+ 23: SECTION LOCAL (0) 0xd4c
+ 24: SECTION LOCAL (0) 0xd50
+ 25: SECTION LOCAL (0) 0xd70
+ 26: SECTION LOCAL (0) 0x1fde0
+ 27: SECTION LOCAL (0) 0x1fde8
+ 28: SECTION LOCAL (0) 0x1fdf0
+ 29: SECTION LOCAL (0) 0x1fdf8
+ 30: SECTION LOCAL (0) 0x1fe20
+ 31: SECTION LOCAL (0) 0x20000
+ 32: SECTION LOCAL (0) 0x20010
+ 33: SECTION LOCAL (0) 0x200d8
+ 34: SECTION LOCAL (0) 0x20110
+ 35: SECTION LOCAL (0) 0x20158
+ 36: FUNC GLOBAL __libc_start_main (0) 0
+ 37: NOTYPE WEAK _ITM_deregisterTMCloneTable (0) 0
+ 38: NOTYPE WEAK __gmon_start__ (0) 0
+ 39: FUNC WEAK __cxa_finalize (0) 0
+ 40: NOTYPE WEAK _Jv_RegisterClasses (0) 0
+ 41: NOTYPE WEAK _ITM_registerTMCloneTable (0) 0
+ 42: NOTYPE GLOBAL _edata (0) 0x20110
+ 43: NOTYPE GLOBAL _end (0) 0x20160
+ 44: NOTYPE GLOBAL __bss_start (0) 0x20110
+EOF
+
+cat > testfile.minsym_pl.in <<\EOF
+ 0: NOTYPE LOCAL (0) 0
+ 1: SECTION LOCAL (0) 0x8001000238
+ 2: SECTION LOCAL (0) 0x800101fdf0
+ 3: OBJECT LOCAL __do_global_dtors_aux_fini_array_entry (0) 0x800101fde8
+ 4: OBJECT LOCAL __frame_dummy_init_array_entry (0) 0x800101fde0
+ 5: NOTYPE LOCAL __glink_PLTresolve (0) 0x8001000ce8
+ 6: NOTYPE LOCAL 00000011.plt_call.__libc_start_main@@GLIBC_2.3 (0) 0x80010008a0
+ 7: NOTYPE LOCAL 00000011.plt_call.__cxa_finalize@@GLIBC_2.3 (0) 0x80010008b4
+ 8: NOTYPE LOCAL __init_array_end (0) 0x800101fde8
+ 9: NOTYPE LOCAL __init_array_start (0) 0x800101fde0
+ 10: SECTION LOCAL (0) 0x8001000238
+ 11: SECTION LOCAL (0) 0x800100024c
+ 12: SECTION LOCAL (0) 0x800100026c
+ 13: SECTION LOCAL (0) 0x8001000290
+ 14: SECTION LOCAL (0) 0x80010002c0
+ 15: SECTION LOCAL (0) 0x80010003e0
+ 16: SECTION LOCAL (0) 0x8001000488
+ 17: SECTION LOCAL (0) 0x80010004a0
+ 18: SECTION LOCAL (0) 0x80010004c0
+ 19: SECTION LOCAL (0) 0x8001000820
+ 20: SECTION LOCAL (0) 0x8001000850
+ 21: SECTION LOCAL (0) 0x80010008a0
+ 22: SECTION LOCAL (0) 0x8001000d30
+ 23: SECTION LOCAL (0) 0x8001000d4c
+ 24: SECTION LOCAL (0) 0x8001000d50
+ 25: SECTION LOCAL (0) 0x8001000d70
+ 26: SECTION LOCAL (0) 0x800101fde0
+ 27: SECTION LOCAL (0) 0x800101fde8
+ 28: SECTION LOCAL (0) 0x800101fdf0
+ 29: SECTION LOCAL (0) 0x800101fdf8
+ 30: SECTION LOCAL (0) 0x800101fe20
+ 31: SECTION LOCAL (0) 0x8001020000
+ 32: SECTION LOCAL (0) 0x8001020010
+ 33: SECTION LOCAL (0) 0x80010200d8
+ 34: SECTION LOCAL (0) 0x8001020110
+ 35: SECTION LOCAL (0) 0x8001020158
+ 36: FUNC GLOBAL __libc_start_main (0) 0
+ 37: NOTYPE WEAK _ITM_deregisterTMCloneTable (0) 0
+ 38: NOTYPE WEAK __gmon_start__ (0) 0
+ 39: FUNC WEAK __cxa_finalize (0) 0
+ 40: NOTYPE WEAK _Jv_RegisterClasses (0) 0
+ 41: NOTYPE WEAK _ITM_registerTMCloneTable (0) 0
+ 42: NOTYPE GLOBAL _edata (0) 0x8001020110
+ 43: NOTYPE GLOBAL _end (0) 0x8001020160
+ 44: NOTYPE GLOBAL __bss_start (0) 0x8001020110
+EOF
+
+cat testfile.symtab.in \
+ | testrun_compare ${abs_builddir}/dwflsyms -e testfilebaztabppc64
+
+cat testfile.symtab.in \
+ | testrun_compare ${abs_builddir}/dwflsyms -e testfilebazdbgppc64
+
+cat testfile.symtab_pl.in \
+ | testrun_compare ${abs_builddir}/dwflsyms -e testfilebazdbgppc64_pl
+
+sed s/0x8001/0x4200/g testfile.symtab_pl.in \
+ | testrun_compare ${abs_builddir}/dwflsyms -e testfilebazdbgppc64_plr
+
+cat testfile.dynsym.in \
+ | testrun_compare ${abs_builddir}/dwflsyms -e testfilebazdynppc64
+
+cat testfile.symtab.in \
+ | testrun_compare ${abs_builddir}/dwflsyms -e testfilebazmdbppc64
+
+cat testfile.minsym.in \
+ | testrun_compare ${abs_builddir}/dwflsyms -e testfilebazminppc64
+
+cat testfile.minsym_pl.in \
+ | testrun_compare ${abs_builddir}/dwflsyms -e testfilebazminppc64_pl
+
+sed s/0x8001/0x4200/g testfile.minsym_pl.in \
+ | testrun_compare ${abs_builddir}/dwflsyms -e testfilebazminppc64_plr
+
exit 0