OSDN Git Service

* elf32-spu.c (spu_elf_relocate_section): Expand
authoramodra <amodra>
Mon, 21 Jul 2008 07:36:25 +0000 (07:36 +0000)
committeramodra <amodra>
Mon, 21 Jul 2008 07:36:25 +0000 (07:36 +0000)
RELOC_FOR_GLOBAL_SYMBOL.  Don't warn about undefined symbols for
R_SPU_PPU32 and R_SPU_PPU64 relocations.

bfd/ChangeLog
bfd/elf32-spu.c

index 429beb4..f00c73a 100644 (file)
@@ -1,3 +1,9 @@
+2008-07-21  Alan Modra  <amodra@bigpond.net.au>
+
+       * 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  <luisgpm@br.ibm.com>
 
        * 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  <bernd.schmidt@analog.com>
        (_bfd_mips_elf_fake_sections): Likewise.
        * compress.c: New file.
        (bfd_uncompress_section_contents): New function.
-       
+
 2008-07-07  Christophe Lyon  <christophe.lyon@st.com>
 
        * elf32-arm.c (arm_type_of_stub): Don't crash on local symbols in
 
 2008-06-18  M R Swami Reddy <MR.Swami.Reddy@nsc.com>
 
-        * 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  <Ralf.Wildenhues@gmx.de>
 
        (arm_map_one_stub): Define.
        (elf32_arm_output_arch_local_syms): Generate mapping symbols for
        long calls stubs.
-       
+
 2008-05-21  Nick Clifton  <nickc@redhat.com>
 
        * elf32-arm.c (group_sections): Reformat comments.
        from elf_link_hash_lookup.
 
 2008-05-21  Maxim Kuvyrkov  <maxim@codesourcery.com>
-       
+
        Add multi-GOT support for m68k.
        * elf32-m68k.c (struct elf_m68k_link_hash_entry: got_entry_key,
        glist): New fields.
        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.
index b41d35f..71fa925 100644 (file)
@@ -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;
        }