aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1994-04-05 15:32:49 +0000
committerIan Lance Taylor <ian@airs.com>1994-04-05 15:32:49 +0000
commitb3cee0a981326af85e3b0695f728a63f981bf465 (patch)
tree99a0c79e6eb789249118a4f633524d83c1d8adfc /bfd
parent4e8e5c4ac523dd13db9832f3ed43c19d7e935646 (diff)
downloadfsf-binutils-gdb-b3cee0a981326af85e3b0695f728a63f981bf465.zip
fsf-binutils-gdb-b3cee0a981326af85e3b0695f728a63f981bf465.tar.gz
fsf-binutils-gdb-b3cee0a981326af85e3b0695f728a63f981bf465.tar.bz2
* 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.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog19
-rw-r--r--bfd/aoutx.h1
-rw-r--r--bfd/bout.c6
-rw-r--r--bfd/coffcode.h2
-rw-r--r--bfd/ecoff.c2
-rw-r--r--bfd/elfcode.h2
-rw-r--r--bfd/hp300hpux.c6
-rw-r--r--bfd/i386lynx.c6
-rw-r--r--bfd/mipsbsd.c2
-rw-r--r--bfd/nlmcode.h4
-rw-r--r--bfd/som.c2
11 files changed, 26 insertions, 26 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index abe6ed1..ea22d42 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,22 @@
+Tue Apr 5 11:22:38 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
+
+ * 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.
+
Mon Apr 4 15:30:49 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
* aoutx.h (NAME(aout,bfd_free_cached_info)): Don't free anything
diff --git a/bfd/aoutx.h b/bfd/aoutx.h
index 2bd29ec..5a45b0b 100644
--- a/bfd/aoutx.h
+++ b/bfd/aoutx.h
@@ -2603,7 +2603,6 @@ NAME(aout,canonicalize_reloc) (abfd, section, relptr, symbols)
}
else {
tblptr = section->relocation;
- if (!tblptr) return 0;
for (count = 0; count++ < section->reloc_count;)
{
diff --git a/bfd/bout.c b/bfd/bout.c
index b0570c9..d560e8c 100644
--- a/bfd/bout.c
+++ b/bfd/bout.c
@@ -818,11 +818,9 @@ b_out_canonicalize_reloc (abfd, section, relptr, symbols)
arelent *tblptr = section->relocation;
unsigned int count = 0;
- if (!(tblptr || b_out_slurp_reloc_table (abfd, section, symbols)))
- return -1;
+ if (!(tblptr || b_out_slurp_reloc_table (abfd, section, symbols)))
+ return -1;
tblptr = section->relocation;
- if (!tblptr)
- return -1;
for (; count++ < section->reloc_count;)
*relptr++ = tblptr++;
diff --git a/bfd/coffcode.h b/bfd/coffcode.h
index 445ce5b..3b75ef4 100644
--- a/bfd/coffcode.h
+++ b/bfd/coffcode.h
@@ -2423,8 +2423,6 @@ coff_canonicalize_reloc (abfd, section, relptr, symbols)
return -1;
tblptr = section->relocation;
- if (!tblptr)
- return -1;
for (; count++ < section->reloc_count;)
*relptr++ = tblptr++;
diff --git a/bfd/ecoff.c b/bfd/ecoff.c
index fe786ab..6183305 100644
--- a/bfd/ecoff.c
+++ b/bfd/ecoff.c
@@ -1944,8 +1944,6 @@ ecoff_canonicalize_reloc (abfd, section, relptr, symbols)
return -1;
tblptr = section->relocation;
- if (tblptr == (arelent *) NULL)
- return -1;
for (count = 0; count < section->reloc_count; count++)
*relptr++ = tblptr++;
diff --git a/bfd/elfcode.h b/bfd/elfcode.h
index 7d94179..5c5e8cb 100644
--- a/bfd/elfcode.h
+++ b/bfd/elfcode.h
@@ -3077,8 +3077,6 @@ elf_canonicalize_reloc (abfd, section, relptr, symbols)
}
tblptr = section->relocation;
- if (!tblptr)
- return -1;
for (; count++ < section->reloc_count;)
*relptr++ = tblptr++;
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;)
{
diff --git a/bfd/i386lynx.c b/bfd/i386lynx.c
index 784a6f2..3db7b14 100644
--- a/bfd/i386lynx.c
+++ b/bfd/i386lynx.c
@@ -427,7 +427,7 @@ doit:
memset (reloc_cache, 0, count * sizeof (arelent));
relocs = (PTR) bfd_alloc (abfd, reloc_size);
- if (!relocs)
+ if (!relocs && reloc_size != 0)
{
free (reloc_cache);
goto nomem;
@@ -536,7 +536,7 @@ NAME(lynx,canonicalize_reloc) (abfd, section, relptr, symbols)
arelent *tblptr = section->relocation;
unsigned int count;
- if (!(tblptr || NAME (lynx, slurp_reloc_table) (abfd, section, symbols)))
+ if (!(tblptr || NAME(lynx,slurp_reloc_table) (abfd, section, symbols)))
return -1;
if (section->flags & SEC_CONSTRUCTOR)
@@ -551,8 +551,6 @@ NAME(lynx,canonicalize_reloc) (abfd, section, relptr, symbols)
else
{
tblptr = section->relocation;
- if (!tblptr)
- return -1;
for (count = 0; count++ < section->reloc_count;)
{
diff --git a/bfd/mipsbsd.c b/bfd/mipsbsd.c
index 5d699aa..0b6424d 100644
--- a/bfd/mipsbsd.c
+++ b/bfd/mipsbsd.c
@@ -303,8 +303,6 @@ MY(canonicalize_reloc)(abfd, section, relptr, symbols)
if (!NAME(aout,slurp_reloc_table)(abfd, section, symbols))
return -1;
tblptr = section->relocation;
- if (!tblptr)
- return -1;
/* fix up howto entries */
for (count = 0; count++ < section->reloc_count;)
diff --git a/bfd/nlmcode.h b/bfd/nlmcode.h
index 1ae6cc9..13e4319 100644
--- a/bfd/nlmcode.h
+++ b/bfd/nlmcode.h
@@ -1050,7 +1050,7 @@ nlm_slurp_reloc_fixups (abfd)
count = nlm_fixed_header (abfd)->numberOfRelocationFixups;
rels = (arelent *) bfd_alloc (abfd, count * sizeof (arelent));
secs = (asection **) bfd_alloc (abfd, count * sizeof (asection *));
- if (rels == NULL || secs == NULL)
+ if ((rels == NULL || secs == NULL) && count != 0)
{
bfd_set_error (bfd_error_no_memory);
return false;
@@ -1136,8 +1136,6 @@ nlm_canonicalize_reloc (abfd, sec, relptr, symbols)
if (nlm_slurp_reloc_fixups (abfd) == false)
return -1;
rels = nlm_relocation_fixups (abfd);
- if (rels == NULL)
- return -1;
}
secs = nlm_relocation_fixup_secs (abfd);
diff --git a/bfd/som.c b/bfd/som.c
index 63f406a..7c913b1 100644
--- a/bfd/som.c
+++ b/bfd/som.c
@@ -4221,8 +4221,6 @@ som_canonicalize_reloc (abfd, section, relptr, symbols)
count = section->reloc_count;
tblptr = section->relocation;
- if (tblptr == (arelent *) NULL)
- return -1;
while (count--)
*relptr++ = tblptr++;