Provide a more helpful error message when the BFD library is unable to load an extrem...
authorNick Clifton <nickc@redhat.com>
Thu, 10 Nov 2016 12:26:53 +0000 (12:26 +0000)
committerNick Clifton <nickc@redhat.com>
Thu, 10 Nov 2016 12:26:53 +0000 (12:26 +0000)
PR target/20737
* elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Bind defined
symbol locally in PIE.

bfd/ChangeLog
bfd/compress.c

index 9d97c64d356c78d5ffb49d0385032a3ed24a911d..abfda75b2b3bf0f3187886827f4aeec2c8ffcc2e 100644 (file)
@@ -4,6 +4,12 @@
        * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Bind defined
        symbol locally in PIE.
 
+2016-11-10  Nick Clifton  <nickc@redhat.com>
+
+       PR binutils/20801
+       * compress.c (bfd_get_full_section_contents): Provide a more
+       helpful error message when a section is too large to load.
+
 2016-11-08  Pedro Alves  <palves@redhat.com>
 
        * dwarf2.c (struct funcinfo) <is_linkage>: Type is bfd_boolean,
index 0a96630420283e0b185f69c382a157211887e171..95e8c232f6542b8ace705ab78cde95217b916a06 100644 (file)
@@ -247,7 +247,15 @@ bfd_get_full_section_contents (bfd *abfd, sec_ptr sec, bfd_byte **ptr)
        {
          p = (bfd_byte *) bfd_malloc (sz);
          if (p == NULL)
+           {
+             /* PR 20801: Provide a more helpful error message.  */
+             if (bfd_get_error () == bfd_error_no_memory)
+               _bfd_error_handler
+                 /* xgettext:c-format */
+                 (_("error: %B(%A) is too large (%#lx bytes)"),
+                 abfd, sec, (long) sz);
            return FALSE;
+           }
        }
 
       if (!bfd_get_section_contents (abfd, sec, p, 0, sz))