* elf32-xtensa.c (action_list_count, xlate_map_entry, xlate_map,
[deliverable/binutils-gdb.git] / bfd / elf32-m32r.c
index 082f496ccd032310f10998921d41ca4d88b10627..a4c08db227705be5bd3688b82883e10f507f2525 100644 (file)
@@ -1755,7 +1755,7 @@ m32r_elf_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
 /* Copy the extra info we tack onto an elf_link_hash_entry.  */
 
 static void
-m32r_elf_copy_indirect_symbol (const struct elf_backend_data *bed,
+m32r_elf_copy_indirect_symbol (struct bfd_link_info *info,
                                struct elf_link_hash_entry *dir,
                                struct elf_link_hash_entry *ind)
 {
@@ -1772,10 +1772,7 @@ m32r_elf_copy_indirect_symbol (const struct elf_backend_data *bed,
           struct elf_m32r_dyn_relocs **pp;
           struct elf_m32r_dyn_relocs *p;
 
-          if (ind->root.type == bfd_link_hash_indirect)
-            abort ();
-
-          /* Add reloc counts against the weak sym to the strong sym
+          /* Add reloc counts against the indirect sym to the direct sym
              list.  Merge any entries against the same section.  */
           for (pp = &eind->dyn_relocs; (p = *pp) != NULL;)
             {
@@ -1799,7 +1796,7 @@ m32r_elf_copy_indirect_symbol (const struct elf_backend_data *bed,
       eind->dyn_relocs = NULL;
     }
 
-  _bfd_elf_link_hash_copy_indirect (bed, dir, ind);
+  _bfd_elf_link_hash_copy_indirect (info, dir, ind);
 }
 
 \f
@@ -1911,6 +1908,13 @@ m32r_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
       return TRUE;
     }
 
+  if (h->size == 0)
+    {
+      (*_bfd_error_handler) (_("dynamic variable `%s' is zero size"),
+                            h->root.root.string);
+      return TRUE;
+    }
+
   /* We must allocate the symbol in our .dynbss section, which will
      become part of the .bss section of the executable.  There will be
      an entry for this symbol in the .dynsym section.  The dynamic
@@ -2646,9 +2650,12 @@ m32r_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
                  else if (sec->output_section == NULL)
                     {
                       (*_bfd_error_handler)
-                        (_("%s: warning: unresolvable relocation against symbol `%s' from %s section"),
-                         bfd_get_filename (input_bfd), h->root.root.string,
-                         bfd_get_section_name (input_bfd, input_section));
+                        (_("%B(%A+0x%lx): unresolvable %s relocation against symbol `%s'"),
+                        input_bfd,
+                        input_section,
+                        (long) rel->r_offset,
+                        howto->name,
+                        h->root.root.string);
 
                       relocation = 0;
                     }
@@ -2871,6 +2878,7 @@ m32r_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
             case R_M32R_24_RELA:
             case R_M32R_32_RELA:
             case R_M32R_REL32:
+           case R_M32R_10_PCREL_RELA:
             case R_M32R_18_PCREL_RELA:
             case R_M32R_26_PCREL_RELA:
             case R_M32R_HI16_ULO_RELA:
@@ -2878,7 +2886,8 @@ m32r_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
               if (info->shared
                   && r_symndx != 0
                   && (input_section->flags & SEC_ALLOC) != 0
-                  && ((r_type != R_M32R_18_PCREL_RELA
+                  && ((   r_type != R_M32R_10_PCREL_RELA
+                       && r_type != R_M32R_18_PCREL_RELA
                        && r_type != R_M32R_26_PCREL_RELA
                        && r_type != R_M32R_REL32)
                       || (h != NULL
@@ -2929,7 +2938,8 @@ m32r_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
 
                   if (skip)
                     memset (&outrel, 0, sizeof outrel);
-                  else if (r_type == R_M32R_18_PCREL_RELA
+                  else if (   r_type == R_M32R_10_PCREL_RELA
+                           || r_type == R_M32R_18_PCREL_RELA
                            || r_type == R_M32R_26_PCREL_RELA
                            || r_type == R_M32R_REL32)
                     {
@@ -2968,8 +2978,11 @@ m32r_elf_relocate_section (bfd *output_bfd ATTRIBUTE_UNUSED,
                      an addend for the dynamic reloc.  */
                   if (! relocate)
                     continue;
+                 break;
                 }
-              break;
+             else if (r_type != R_M32R_10_PCREL_RELA)
+               break;
+             /* Fall through.  */
 
            case (int) R_M32R_10_PCREL :
              r = m32r_elf_do_10_pcrel_reloc (input_bfd, howto, input_section,
@@ -3707,6 +3720,7 @@ m32r_elf_gc_sweep_hook (bfd *abfd ATTRIBUTE_UNUSED,
        case R_M32R_HI16_SLO_RELA:
        case R_M32R_LO16_RELA:
        case R_M32R_SDA16_RELA:
+       case R_M32R_10_PCREL_RELA:
        case R_M32R_18_PCREL_RELA:
        case R_M32R_26_PCREL_RELA:
          if (h != NULL)
@@ -3723,8 +3737,9 @@ m32r_elf_gc_sweep_hook (bfd *abfd ATTRIBUTE_UNUSED,
              for (pp = &eh->dyn_relocs; (p = *pp) != NULL; pp = &p->next)
                if (p->sec == sec)
                  {
-                   if (ELF32_R_TYPE (rel->r_info) == R_M32R_26_PCREL_RELA
-                       || ELF32_R_TYPE (rel->r_info) == R_M32R_26_PCREL_RELA
+                   if (   ELF32_R_TYPE (rel->r_info) == R_M32R_26_PCREL_RELA
+                       || ELF32_R_TYPE (rel->r_info) == R_M32R_18_PCREL_RELA
+                       || ELF32_R_TYPE (rel->r_info) == R_M32R_10_PCREL_RELA
                        || ELF32_R_TYPE (rel->r_info) == R_M32R_REL32)
                      p->pc_count -= 1;
                    p->count -= 1;
@@ -3890,6 +3905,7 @@ m32r_elf_check_relocs (bfd *abfd,
         case R_M32R_HI16_SLO_RELA:
         case R_M32R_LO16_RELA:
         case R_M32R_SDA16_RELA:
+       case R_M32R_10_PCREL_RELA:
         case R_M32R_18_PCREL_RELA:
         case R_M32R_26_PCREL_RELA:
 
@@ -3920,8 +3936,9 @@ m32r_elf_check_relocs (bfd *abfd,
              symbol.  */
           if ((info->shared
                && (sec->flags & SEC_ALLOC) != 0
-              && ((r_type != R_M32R_26_PCREL_RELA
+              && ((   r_type != R_M32R_26_PCREL_RELA
                     && r_type != R_M32R_18_PCREL_RELA
+                    && r_type != R_M32R_10_PCREL_RELA
                     && r_type != R_M32R_REL32)
                   || (h != NULL
                       && (! info->symbolic
@@ -3983,6 +4000,7 @@ m32r_elf_check_relocs (bfd *abfd,
               else
                 {
                   asection *s;
+                  void *vpp;
 
                   /* Track dynamic relocs needed for local syms too.  */
                   s = bfd_section_from_r_symndx (abfd, &htab->sym_sec,
@@ -3990,8 +4008,8 @@ m32r_elf_check_relocs (bfd *abfd,
                   if (s == NULL)
                     return FALSE;
 
-                  head = ((struct elf_m32r_dyn_relocs **)
-                          &elf_section_data (s)->local_dynrel);
+                 vpp = &elf_section_data (s)->local_dynrel;
+                  head = (struct elf_m32r_dyn_relocs **) vpp;
                 }
 
               p = *head;
@@ -4010,9 +4028,10 @@ m32r_elf_check_relocs (bfd *abfd,
                 }
 
               p->count += 1;
-              if (ELF32_R_TYPE (rel->r_info) == R_M32R_26_PCREL_RELA
-                 || ELF32_R_TYPE (rel->r_info) == R_M32R_REL32
-                  || ELF32_R_TYPE (rel->r_info) == R_M32R_18_PCREL_RELA)
+              if (   ELF32_R_TYPE (rel->r_info) == R_M32R_26_PCREL_RELA
+                  || ELF32_R_TYPE (rel->r_info) == R_M32R_18_PCREL_RELA
+                 || ELF32_R_TYPE (rel->r_info) == R_M32R_10_PCREL_RELA
+                 || ELF32_R_TYPE (rel->r_info) == R_M32R_REL32)
                 p->pc_count += 1;
             }
           break;
This page took 0.024558 seconds and 4 git commands to generate.