Hi

This patch fixes crash that happens if we build too big linux kernel so 
that offsets overflow. There are several bugs in elf64-hppa.c:

1. offset is 64-bit, but 32-bit format "%lx" is used. This causes 
parameters mismatch
2. eh may be NULL. If it is NULL, I changed the code to print "unknown". 
Someone who understands the code better can change it to print something 
more descriptive
3. returning bfd_reloc_notsupported causes abort() in 
elf64_hppa_relocate_section. Change it to return bfd_reloc_overflow.

With these changes, ld writese error messages on overflow and doesn't 
crash anymore.

Mikulas

---

--- bfd/elf64-hppa.c_   2011-07-26 23:41:27.000000000 +0200
+++ bfd/elf64-hppa.c    2011-07-26 23:57:41.000000000 +0200
@@ -3296,13 +3296,13 @@ elf_hppa_final_link_relocate (Elf_Intern
            && value + addend + max_branch_offset >= 2*max_branch_offset)
          {
            (*_bfd_error_handler)
-             (_("%B(%A+0x%lx): cannot reach %s"),
+             (_("%B(%A+0x%llx): cannot reach %s"),
              input_bfd,
              input_section,
-             offset,
-             eh->root.root.string);
+             (unsigned long long)offset,
+             eh ? eh->root.root.string : "unknown");
            bfd_set_error (bfd_error_bad_value);
-           return bfd_reloc_notsupported;
+           return bfd_reloc_overflow;
          }
 
        /* Adjust for any field selectors.  */

_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to