From 81aa10d16de939070a3796a5e1ec383d8ef3260e Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Mon, 21 Jul 2008 07:36:25 +0000 Subject: [PATCH] * elf32-spu.c (spu_elf_relocate_section): Expand RELOC_FOR_GLOBAL_SYMBOL. Don't warn about undefined symbols for R_SPU_PPU32 and R_SPU_PPU64 relocations. --- bfd/ChangeLog | 18 ++++++++++++------ bfd/elf32-spu.c | 49 +++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 57 insertions(+), 10 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 429beb428b..f00c73a6c6 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2008-07-21 Alan Modra + + * elf32-spu.c (spu_elf_relocate_section): Expand + RELOC_FOR_GLOBAL_SYMBOL. Don't warn about undefined symbols for + R_SPU_PPU32 and R_SPU_PPU64 relocations. + 2008-07-21 Luis Machado * elf-bfd.h: Declare elfcore_write_ppc_vsx. @@ -71,7 +77,7 @@ * pe-mips.c: Likewise. * pe-ppc.c: Likewise. * peXXigen.c: Likewise. - * pei-ppc.c: Likewise. + * pei-ppc.c: Likewise. * libcoff.h: Regenerate. 2008-07-16 Bernd Schmidt @@ -182,7 +188,7 @@ (_bfd_mips_elf_fake_sections): Likewise. * compress.c: New file. (bfd_uncompress_section_contents): New function. - + 2008-07-07 Christophe Lyon * elf32-arm.c (arm_type_of_stub): Don't crash on local symbols in @@ -254,7 +260,7 @@ 2008-06-18 M R Swami Reddy - * elf32-cr16.c (ELF_MACHINE_ALT1): Define to EM_CR16_OLD. + * elf32-cr16.c (ELF_MACHINE_ALT1): Define to EM_CR16_OLD. 2008-06-17 Ralf Wildenhues @@ -360,7 +366,7 @@ (arm_map_one_stub): Define. (elf32_arm_output_arch_local_syms): Generate mapping symbols for long calls stubs. - + 2008-05-21 Nick Clifton * elf32-arm.c (group_sections): Reformat comments. @@ -374,7 +380,7 @@ from elf_link_hash_lookup. 2008-05-21 Maxim Kuvyrkov - + Add multi-GOT support for m68k. * elf32-m68k.c (struct elf_m68k_link_hash_entry: got_entry_key, glist): New fields. @@ -390,7 +396,7 @@ struct elf_m68k_link_hash_table. (elf_m68k_link_hash_table_free): New static function implementing hook. (elf_m68k_init_got, elf_m68k_clear_got, elf_m68k_create_empty_got): New - static functions for struct elf_m68k_got. + static functions for struct elf_m68k_got. (elf_m68k_init_got_entry_key, elf_m68k_got_entry_hash, elf_m68k_got_entry_eq): New static functions for struct elf_m68k_got_entry. diff --git a/bfd/elf32-spu.c b/bfd/elf32-spu.c index b41d35f46d..71fa925a84 100644 --- a/bfd/elf32-spu.c +++ b/bfd/elf32-spu.c @@ -3966,10 +3966,51 @@ spu_elf_relocate_section (bfd *output_bfd, } else { - RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel, - r_symndx, symtab_hdr, sym_hashes, - h, sec, relocation, - unresolved_reloc, warned); + if (sym_hashes == NULL) + return FALSE; + + 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; + + relocation = 0; + if (h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak) + { + sec = h->root.u.def.section; + if (sec == NULL + || sec->output_section == NULL) + /* 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. */ + 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->unresolved_syms_in_objects == RM_IGNORE + && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT) + ; + else if (!info->relocatable + && !(r_type == R_SPU_PPU32 || r_type == R_SPU_PPU64)) + { + bfd_boolean err; + err = (info->unresolved_syms_in_objects == RM_GENERATE_ERROR + || ELF_ST_VISIBILITY (h->other) != STV_DEFAULT); + if (!info->callbacks->undefined_symbol (info, + h->root.root.string, + input_bfd, + input_section, + rel->r_offset, err)) + return FALSE; + warned = TRUE; + } sym_name = h->root.root.string; } -- 2.11.0