* elflink.c (elf_link_sort_relocs): Return early if there are no
authorNick Clifton <nickc@redhat.com>
Thu, 18 Jun 2009 10:48:58 +0000 (10:48 +0000)
committerNick Clifton <nickc@redhat.com>
Thu, 18 Jun 2009 10:48:58 +0000 (10:48 +0000)
        relocs to sort.

bfd/ChangeLog
bfd/elflink.c

index b1ebfcf..8f3edb0 100644 (file)
@@ -1,3 +1,8 @@
+2009-06-18  Nick Clifton  <nickc@redhat.com>
+
+       * elflink.c (elf_link_sort_relocs): Return early if there are no
+       relocs to sort.
+
 2009-06-18  Dave Korn  <dave.korn.cygwin@gmail.com>
 
        Merge cegcc and mingw32ce target name changes from
index 70bca46..2366dd4 100644 (file)
@@ -8082,6 +8082,8 @@ elf_link_sort_relocs (bfd *abfd, struct bfd_link_info *info, asection **psec)
              + (i2e - 1) * sizeof (Elf_Internal_Rela));
 
   count = dynamic_relocs->size / ext_size;
+  if (count == 0)
+    return 0;
   sort = bfd_zmalloc (sort_elt * count);
 
   if (sort == NULL)