]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Prevent an abort in the bfd linker when attempting to generate dynamic relocs for...
authorNick Clifton <nickc@redhat.com>
Wed, 5 Feb 2025 13:26:51 +0000 (13:26 +0000)
committerNick Clifton <nickc@redhat.com>
Wed, 5 Feb 2025 13:26:51 +0000 (13:26 +0000)
PR 32638

bfd/elf64-x86-64.c

index 61334c3ab04f2000ec6bfd3795817f52c543cfbe..32db254ba6cd2e6bd669776b14c5353a4518f100 100644 (file)
@@ -5303,6 +5303,15 @@ elf_x86_64_finish_dynamic_symbol (bfd *output_bfd,
 
       if (generate_dynamic_reloc)
        {
+         /* If the relgot section has not been created, then
+            generate an error instead of a reloc.  cf PR 32638.  */
+         if (relgot == NULL || relgot->size == 0)
+           {
+             info->callbacks->einfo (_("%F%pB: Unable to generate dynamic relocs because a suitable section does not exist\n"),
+                                       output_bfd);
+             return false;
+           }
+         
          if (relative_reloc_name != NULL
              && htab->params->report_relative_reloc)
            _bfd_x86_elf_link_report_relative_reloc