From b3cee0a981326af85e3b0695f728a63f981bf465 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Tue, 5 Apr 1994 15:32:49 +0000 Subject: * aoutx.h (NAME(aout,canonicalize_reloc)): Don't error out if section->relocation is NULL; malloc might have returned NULL when given a zero size if there were no relocations. * bout.c (b_out_canonicalize_reloc): Likewise. * coffcode.h (coff_canonicalize_reloc): Likewise. * ecoff.c (ecoff_canonicalize_reloc): Likewise. * elfcode.h (elf_canonicalize_reloc): Likewise. * mipsbsd.c (MY(canonicalize_reloc)): Likewise. * i386lynx.c (NAME(lynx,canonicalize_reloc)): Likewise. * nlmcode.h (nlm_canonicalize_reloc): Likewise. * som.c (som_canonicalize_reloc): Likewise. * hp300hpux.c (MY(slurp_reloc_table)): Likewise. Also, if malloc returns NULL, don't report an error if we asked for zero bytes. * i386lynx.c (NAME(lynx,slurp_reloc_table)): If malloc returns NULL, don't report an error if we asked for zero bytes. * nlmcode.h (nlm_slurp_reloc_fixups): Likewise. --- bfd/hp300hpux.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'bfd/hp300hpux.c') diff --git a/bfd/hp300hpux.c b/bfd/hp300hpux.c index 3b8cb9c..496f754 100644 --- a/bfd/hp300hpux.c +++ b/bfd/hp300hpux.c @@ -750,7 +750,7 @@ doit: reloc_cache = (arelent *) bfd_zalloc (abfd, (size_t) (count * sizeof (arelent))); - if (!reloc_cache) + if (!reloc_cache && count != 0) { nomem: bfd_set_error (bfd_error_no_memory); @@ -758,7 +758,7 @@ doit: } relocs = (PTR) bfd_alloc (abfd, reloc_size); - if (!relocs) + if (!relocs && reloc_size != 0) { bfd_release (abfd, reloc_cache); goto nomem; @@ -863,8 +863,6 @@ MY (canonicalize_reloc) (abfd, section, relptr, symbols) else { tblptr = section->relocation; - if (!tblptr) - return -1; for (count = 0; count++ < section->reloc_count;) { -- cgit v1.1