aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf64-ppc.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2012-01-23 06:16:38 +0000
committerAlan Modra <amodra@gmail.com>2012-01-23 06:16:38 +0000
commit9f296da34f6b4357ce7528eeb2b29d9f8e50c71e (patch)
treeb030c6e6398786e9a3940724bf32fefe4738e057 /bfd/elf64-ppc.c
parent2d6bdbd03f55a040894b631c5e82dbd8db8cf31c (diff)
downloadgdb-9f296da34f6b4357ce7528eeb2b29d9f8e50c71e.zip
gdb-9f296da34f6b4357ce7528eeb2b29d9f8e50c71e.tar.gz
gdb-9f296da34f6b4357ce7528eeb2b29d9f8e50c71e.tar.bz2
* elf-bfd.h: Formatting.
(struct elf_backend_data): Add "maybe_function_sym". (_bfd_elf_maybe_function_sym): Declare. * elfxx-target.h (elf_backend_maybe_function_sym): Define. (elfNN_bed): Init new field. * elf.c (elf_find_function): Use maybe_function_sym. (_bfd_elf_maybe_function_sym): New function. * elf64-ppc.c (elf_backend_maybe_function_sym): Define. (ppc64_elf_maybe_function_sym): New function.
Diffstat (limited to 'bfd/elf64-ppc.c')
-rw-r--r--bfd/elf64-ppc.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index 7ffbe0e..a51115e 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -105,6 +105,7 @@ static bfd_vma opd_entry_value
#define elf_backend_gc_sweep_hook ppc64_elf_gc_sweep_hook
#define elf_backend_adjust_dynamic_symbol ppc64_elf_adjust_dynamic_symbol
#define elf_backend_hide_symbol ppc64_elf_hide_symbol
+#define elf_backend_maybe_function_sym ppc64_elf_maybe_function_sym
#define elf_backend_always_size_sections ppc64_elf_func_desc_adjust
#define elf_backend_size_dynamic_sections ppc64_elf_size_dynamic_sections
#define elf_backend_init_index_section _bfd_elf_init_2_index_sections
@@ -5528,7 +5529,8 @@ opd_entry_value (asection *opd_sec,
Elf_Internal_Rela *lo, *hi, *look;
bfd_vma val;
- /* No relocs implies we are linking a --just-symbols object. */
+ /* No relocs implies we are linking a --just-symbols object, or looking
+ at a final linked executable with addr2line or somesuch. */
if (opd_sec->reloc_count == 0)
{
char buf[8];
@@ -5631,6 +5633,23 @@ opd_entry_value (asection *opd_sec,
return val;
}
+/* Return TRUE iff the ELF symbol SYM might be a function. Set *CODE_SEC
+ and *CODE_OFF to the function's entry point. */
+
+static bfd_boolean
+ppc64_elf_maybe_function_sym (const elf_symbol_type *sym,
+ asection **code_sec, bfd_vma *code_off)
+{
+ if (_bfd_elf_maybe_function_sym (sym, code_sec, code_off))
+ {
+ if (strcmp (sym->symbol.section->name, ".opd") == 0)
+ opd_entry_value (sym->symbol.section, sym->symbol.value,
+ code_sec, code_off);
+ return TRUE;
+ }
+ return FALSE;
+}
+
/* Return true if symbol is defined in a regular object file. */
static bfd_boolean