2002-05-02 Pierre Muller <muller@ics.u-strasbg.fr>
[deliverable/binutils-gdb.git] / bfd / elf32-sh.c
index 150d912b3ccb1b69870f154572477458b5b3b513..ef737b5132f4e74ba3b6512becf091cfd56de11c 100644 (file)
@@ -85,6 +85,9 @@ static boolean sh_elf_gc_sweep_hook
           const Elf_Internal_Rela *));
 static enum elf_reloc_type_class sh_elf_reloc_type_class
   PARAMS ((const Elf_Internal_Rela *));
+#ifdef INCLUDE_SHMEDIA
+inline static void movi_shori_putval PARAMS ((bfd *, unsigned long, char *));
+#endif
 
 /* The name of the dynamic interpreter.  This is put in the .interp
    section.  */
@@ -2066,7 +2069,8 @@ sh_elf_relax_section (abfd, sec, link_info, again)
          shndx = shndx_buf + (shndx_buf ? ELF32_R_SYM (irelfn->r_info) : 0);
          bfd_elf32_swap_symbol_in (abfd, esym, shndx, &isym);
 
-         if (isym.st_shndx != _bfd_elf_section_from_bfd_section (abfd, sec))
+         if (isym.st_shndx
+             != (unsigned int) _bfd_elf_section_from_bfd_section (abfd, sec))
            {
              ((*_bfd_error_handler)
               (_("%s: 0x%lx: warning: symbol in unexpected section"),
@@ -2807,10 +2811,10 @@ sh_elf_relax_delete_bytes (abfd, sec, addr, count)
 
 static boolean
 sh_elf_align_loads (abfd, sec, internal_relocs, contents, pswapped)
-     bfd *abfd;
+     bfd *abfd ATTRIBUTE_UNUSED;
      asection *sec;
      Elf_Internal_Rela *internal_relocs;
-     bfd_byte *contents;
+     bfd_byte *contents ATTRIBUTE_UNUSED;
      boolean *pswapped;
 {
   Elf_Internal_Rela *irel, *irelend;
@@ -3525,14 +3529,14 @@ sh_elf_link_hash_table_create (abfd)
   struct elf_sh_link_hash_table *ret;
   bfd_size_type amt = sizeof (struct elf_sh_link_hash_table);
 
-  ret = (struct elf_sh_link_hash_table *) bfd_alloc (abfd, amt);
+  ret = (struct elf_sh_link_hash_table *) bfd_malloc (amt);
   if (ret == (struct elf_sh_link_hash_table *) NULL)
     return NULL;
 
   if (! _bfd_elf_link_hash_table_init (&ret->root, abfd,
                                       sh_elf_link_hash_newfunc))
     {
-      bfd_release (abfd, ret);
+      free (ret);
       return NULL;
     }
 
@@ -3895,8 +3899,8 @@ sh_elf_size_dynamic_sections (output_bfd, info)
      will not fill them in in the relocate_section routine.  */
   if (info->shared && info->symbolic)
     sh_elf_link_hash_traverse (sh_elf_hash_table (info),
-                                sh_elf_discard_copies,
-                                (PTR) NULL);
+                              sh_elf_discard_copies,
+                              (PTR) NULL);
 
   /* The check_relocs and adjust_dynamic_symbol entry points have
      determined the sizes of the various dynamic sections.  Allocate
@@ -4034,6 +4038,9 @@ sh_elf_discard_copies (h, ignore)
 {
   struct elf_sh_pcrel_relocs_copied *s;
 
+  if (h->root.root.type == bfd_link_hash_warning)
+    h = (struct elf_sh_link_hash_entry *) h->root.root.u.i.link;
+
   /* We only discard relocs for symbols defined in a regular object.  */
   if ((h->root.elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
     return true;
@@ -4415,24 +4422,23 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section,
                }
 
              skip = false;
+             relocate = false;
 
              outrel.r_offset =
                _bfd_elf_section_offset (output_bfd, info, input_section,
                                         rel->r_offset);
              if (outrel.r_offset == (bfd_vma) -1)
                skip = true;
+             else if (outrel.r_offset == (bfd_vma) -2)
+               skip = true, relocate = true;
              outrel.r_offset += (input_section->output_section->vma
                                  + input_section->output_offset);
 
              if (skip)
-               {
-                 memset (&outrel, 0, sizeof outrel);
-                 relocate = false;
-               }
+               memset (&outrel, 0, sizeof outrel);
              else if (r_type == R_SH_REL32)
                {
                  BFD_ASSERT (h != NULL && h->dynindx != -1);
-                 relocate = false;
                  outrel.r_info = ELF32_R_INFO (h->dynindx, R_SH_REL32);
                  outrel.r_addend
                    = bfd_get_32 (input_bfd, contents + rel->r_offset);
@@ -4455,7 +4461,6 @@ sh_elf_relocate_section (output_bfd, info, input_bfd, input_section,
                  else
                    {
                      BFD_ASSERT (h->dynindx != -1);
-                     relocate = false;
                      outrel.r_info = ELF32_R_INFO (h->dynindx, R_SH_DIR32);
                      outrel.r_addend
                        = relocation + bfd_get_32 (input_bfd,
This page took 0.026009 seconds and 4 git commands to generate.