Fix error messages in the NFP sources when building for 32-bit targets.
[deliverable/binutils-gdb.git] / bfd / elfnn-ia64.c
index 824652adce77e10a87237c98b72a7fd2269f5e25..e6551df204627b4ac1fb8497148b3c1b8d912500 100644 (file)
@@ -197,13 +197,24 @@ static asection *get_pltoff
 
 /* Given a ELF reloc, return the matching HOWTO structure.  */
 
-static void
+static bfd_boolean
 elfNN_ia64_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED,
                          arelent *bfd_reloc,
                          Elf_Internal_Rela *elf_reloc)
 {
-  bfd_reloc->howto
-    = ia64_elf_lookup_howto ((unsigned int) ELFNN_R_TYPE (elf_reloc->r_info));
+  unsigned int r_type = ELF32_R_TYPE (elf_reloc->r_info);
+
+  bfd_reloc->howto = ia64_elf_lookup_howto (r_type);
+  if (bfd_reloc->howto == NULL)
+    {
+      /* xgettext:c-format */
+      _bfd_error_handler (_("%pB: unsupported relocation type %#x"),
+                         abfd, r_type);
+      bfd_set_error (bfd_error_bad_value);
+      return FALSE;
+    }
+
+  return TRUE;
 }
 \f
 #define PLT_HEADER_SIZE                (3 * 16)
@@ -593,6 +604,9 @@ elfNN_ia64_relax_section (bfd *abfd, asection *sec,
                     1, change it to slot 2.  */
                  if ((irel->r_offset & 3) == 1)
                    irel->r_offset += 1;
+
+                 changed_contents = TRUE;
+                 changed_relocs = TRUE;
                }
 
              continue;
@@ -607,6 +621,9 @@ elfNN_ia64_relax_section (bfd *abfd, asection *sec,
 
              /* Make the relocation offset point to slot 1.  */
              irel->r_offset = (irel->r_offset & ~((bfd_vma) 0x3)) + 1;
+
+             changed_contents = TRUE;
+             changed_relocs = TRUE;
              continue;
            }
 
@@ -617,8 +634,8 @@ elfNN_ia64_relax_section (bfd *abfd, asection *sec,
            {
              _bfd_error_handler
                /* xgettext:c-format */
-               (_("%pB: Can't relax br at %#" PRIx64 " in section `%pA'."
-                  " Please use brl or indirect branch."),
+               (_("%pB: can't relax br at %#" PRIx64 " in section `%pA';"
+                  " please use brl or indirect branch"),
                 sec->owner, (uint64_t) roff, sec);
              bfd_set_error (bfd_error_bad_value);
              goto error_return;
@@ -3851,6 +3868,12 @@ elfNN_ia64_relocate_section (bfd *output_bfd,
        }
 
       howto = ia64_elf_lookup_howto (r_type);
+      if (howto == NULL)
+       {
+         ret_val = FALSE;
+         continue;
+       }
+      
       r_symndx = ELFNN_R_SYM (rel->r_info);
       h = NULL;
       sym = NULL;
This page took 0.025389 seconds and 4 git commands to generate.