aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Law <law@redhat.com>1994-03-02 20:32:10 +0000
committerJeff Law <law@redhat.com>1994-03-02 20:32:10 +0000
commit98ecc94548f2b98fc65627958853a27b78185911 (patch)
tree7b504e78fe2f5e8816ea9c0b546966051cfce3a5
parentc485c7a9ddc57c1c3b09c87f37f7c8ab02470230 (diff)
downloadgdb-98ecc94548f2b98fc65627958853a27b78185911.zip
gdb-98ecc94548f2b98fc65627958853a27b78185911.tar.gz
gdb-98ecc94548f2b98fc65627958853a27b78185911.tar.bz2
* som.c (log2): Return -1 on error rather than aborting.
(setup_sections): Bubble up an error from log2.
-rw-r--r--bfd/ChangeLog3
-rw-r--r--bfd/som.c14
2 files changed, 11 insertions, 6 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 9b2d231..fd58ef9 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,8 @@
Wed Mar 2 11:57:03 1994 Jeffrey A. Law (law@snake.cs.utah.edu)
+ * som.c (log2): Return -1 on error rather than aborting.
+ (setup_sections): Bubble up an error from log2.
+
* Changes to make HP C compiler happy in both traditional
and ANSI mode.
* som.c (hppa_som_gen_reloc_type): Use correct enum type for
diff --git a/bfd/som.c b/bfd/som.c
index 765d39f..66c68e9 100644
--- a/bfd/som.c
+++ b/bfd/som.c
@@ -1323,9 +1323,7 @@ som_reloc_call (abfd, p, subspace_reloc_sizep, bfd_reloc, sym_num, queue)
/* Return the logarithm of X, base 2, considering X unsigned.
- Abort if X is not a power of two -- this should never happen (FIXME:
- It will happen on corrupt executables. GDB should give an error, not
- a coredump, in that case). */
+ Abort -1 if X is not a power or two or is zero. */
static int
log2 (x)
@@ -1335,7 +1333,7 @@ log2 (x)
/* Test for 0 or a power of 2. */
if (x == 0 || x != (x & -x))
- abort();
+ return -1;
while ((x >>= 1) != 0)
log++;
@@ -1677,6 +1675,8 @@ setup_sections (abfd, file_hdr)
space_asect->vma = subspace.subspace_start;
space_asect->filepos = subspace.file_loc_init_value;
space_asect->alignment_power = log2 (subspace.alignment);
+ if (space_asect->alignment_power == -1)
+ return false;
/* Initialize save_subspace so we can reliably determine if this
loop placed any useful values into it. */
@@ -1775,15 +1775,17 @@ setup_sections (abfd, file_hdr)
subspace_asect->vma = subspace.subspace_start;
subspace_asect->_cooked_size = subspace.subspace_length;
subspace_asect->_raw_size = subspace.subspace_length;
- subspace_asect->alignment_power = log2 (subspace.alignment);
subspace_asect->filepos = subspace.file_loc_init_value;
+ subspace_asect->alignment_power = log2 (subspace.alignment);
+ if (subspace_asect->alignment_power == -1)
+ return false;
}
/* Yow! there is no subspace within the space which actually
has initialized information in it; this should never happen
as far as I know. */
if (!save_subspace.file_loc_init_value)
- abort ();
+ return false;
/* Setup the sizes for the space section based upon the info in the
last subspace of the space. */