diff options
author | Nick Clifton <nickc@redhat.com> | 2003-08-20 08:37:19 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2003-08-20 08:37:19 +0000 |
commit | 560e09e9cc912370081be5cccb8d3179a78928b2 (patch) | |
tree | 9191f0c21af30761875fd1741d540eacdea7b88f /bfd/elf32-ppc.c | |
parent | 04d1ab347d16d701221fa1b49185d096e3158138 (diff) | |
download | gdb-560e09e9cc912370081be5cccb8d3179a78928b2.zip gdb-560e09e9cc912370081be5cccb8d3179a78928b2.tar.gz gdb-560e09e9cc912370081be5cccb8d3179a78928b2.tar.bz2 |
Better handking for unresolved symbols
Diffstat (limited to 'bfd/elf32-ppc.c')
-rw-r--r-- | bfd/elf32-ppc.c | 96 |
1 files changed, 16 insertions, 80 deletions
diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index b78a64c..3bffc70 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -4718,6 +4718,7 @@ ppc_elf_relocate_section (bfd *output_bfd, unresolved_reloc = FALSE; warned = FALSE; r_symndx = ELF32_R_SYM (rel->r_info); + if (r_symndx < symtab_hdr->sh_info) { sym = local_syms + r_symndx; @@ -4728,44 +4729,12 @@ ppc_elf_relocate_section (bfd *output_bfd, } else { - h = sym_hashes[r_symndx - symtab_hdr->sh_info]; - while (h->root.type == bfd_link_hash_indirect - || h->root.type == bfd_link_hash_warning) - h = (struct elf_link_hash_entry *) h->root.u.i.link; + RELOC_FOR_GLOBAL_SYMBOL (h, sym_hashes, r_symndx, + symtab_hdr, relocation, sec, + unresolved_reloc, info, + warned); + sym_name = h->root.root.string; - - relocation = 0; - if (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak) - { - sec = h->root.u.def.section; - /* Set a flag that will be cleared later if we find a - relocation value for this symbol. output_section - is typically NULL for symbols satisfied by a shared - library. */ - if (sec->output_section == NULL) - unresolved_reloc = TRUE; - else - relocation = (h->root.u.def.value - + sec->output_section->vma - + sec->output_offset); - } - else if (h->root.type == bfd_link_hash_undefweak) - ; - else if (!info->executable - && !info->no_undefined - && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT) - ; - else - { - if (! ((*info->callbacks->undefined_symbol) - (info, h->root.root.string, input_bfd, input_section, - rel->r_offset, (info->executable - || info->no_undefined - || ELF_ST_VISIBILITY (h->other))))) - return FALSE; - warned = TRUE; - } } /* TLS optimizations. Replace instruction sequences and relocs @@ -5500,49 +5469,16 @@ ppc_elf_relocate_section (bfd *output_bfd, } else { - long indx; - - indx = r_symndx - symtab_hdr->sh_info; - h = elf_sym_hashes (input_bfd)[indx]; - while (h->root.type == bfd_link_hash_indirect - || h->root.type == bfd_link_hash_warning) - h = (struct elf_link_hash_entry *) h->root.u.i.link; - - value = 0; - if (h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak) - { - sym_sec = h->root.u.def.section; - - /* Detect the cases that sym_sec->output_section is - expected to be NULL -- all cases in which the symbol - is defined in another shared module. This includes - PLT relocs for which we've created a PLT entry and - other relocs for which we're prepared to create - dynamic relocations. */ - /* ??? Just accept it NULL and continue. */ - - if (sym_sec->output_section != NULL) - { - value = (h->root.u.def.value - + sym_sec->output_section->vma - + sym_sec->output_offset); - } - } - else if (!info->executable - && !info->no_undefined - && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT) - ; - else - { - if (! ((*info->callbacks->undefined_symbol) - (info, h->root.root.string, input_bfd, - input_section, rel->r_offset, - (info->executable || info->no_undefined - || ELF_ST_VISIBILITY (h->other))))) - return FALSE; - continue; - } + bfd_boolean warned; + bfd_boolean unresolved_reloc; + + RELOC_FOR_GLOBAL_SYMBOL (h, elf_sym_hashes (input_bfd), + r_symndx, symtab_hdr, + value, sym_sec, + unresolved_reloc, info, + warned); + if (warned) + continue; } hit_addr = contents + rel->r_offset; value += rel->r_addend; |