aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1996-03-04 17:50:38 +0000
committerIan Lance Taylor <ian@airs.com>1996-03-04 17:50:38 +0000
commitcb84f0284f77531a312e788742d06928d880820b (patch)
tree74fecb293dc0f30042bec649fcf45d53ac44f72b /bfd
parenteff5fcda23f1eef9cbb20d3c3b3069511009f98b (diff)
downloadgdb-cb84f0284f77531a312e788742d06928d880820b.zip
gdb-cb84f0284f77531a312e788742d06928d880820b.tar.gz
gdb-cb84f0284f77531a312e788742d06928d880820b.tar.bz2
* elf.c (_bfd_elf_symbol_from_bfd_symbol): Print a useful error
message rather than calling BFD_ASSERT. * elfcode.h (write_relocs): Check return value of _bfd_elf_symbol_from_bfd_symbol.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog7
-rw-r--r--bfd/elf.c21
2 files changed, 24 insertions, 4 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index dbf1328..8b3543b 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,10 @@
+Mon Mar 4 12:49:16 1996 Ian Lance Taylor <ian@cygnus.com>
+
+ * elf.c (_bfd_elf_symbol_from_bfd_symbol): Print a useful error
+ message rather than calling BFD_ASSERT.
+ * elfcode.h (write_relocs): Check return value of
+ _bfd_elf_symbol_from_bfd_symbol.
+
Fri Mar 1 09:42:59 1996 Michael Meissner <meissner@tiktok.cygnus.com>
* elf32-ppc.c (ppc_elf_add_symbol_hook): Don't set SEC_LOAD flag
diff --git a/bfd/elf.c b/bfd/elf.c
index 8221561..fdc16d9 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -2583,8 +2583,10 @@ _bfd_elf_section_from_bfd_section (abfd, asect)
return -1;
}
-/* given a symbol, return the bfd index for that symbol. */
- int
+/* Given a BFD symbol, return the index in the ELF symbol table, or -1
+ on error. */
+
+int
_bfd_elf_symbol_from_bfd_symbol (abfd, asym_ptr_ptr)
bfd *abfd;
struct symbol_cache_entry **asym_ptr_ptr;
@@ -2613,13 +2615,24 @@ _bfd_elf_symbol_from_bfd_symbol (abfd, asym_ptr_ptr)
}
idx = asym_ptr->udata.i;
- BFD_ASSERT (idx != 0);
+
+ if (idx == 0)
+ {
+ /* This case can occur when using --strip-symbol on a symbol
+ which is used in a relocation entry. */
+ (*_bfd_error_handler)
+ ("%s: symbol `%s' required but not present",
+ bfd_get_filename (abfd), bfd_asymbol_name (asym_ptr));
+ bfd_set_error (bfd_error_no_symbols);
+ return -1;
+ }
#if DEBUG & 4
{
fprintf (stderr,
"elf_symbol_from_bfd_symbol 0x%.8lx, name = %s, sym num = %d, flags = 0x%.8lx%s\n",
- (long) asym_ptr, asym_ptr->name, idx, flags, elf_symbol_flags (flags));
+ (long) asym_ptr, asym_ptr->name, idx, flags,
+ elf_symbol_flags (flags));
fflush (stderr);
}
#endif