[RFA:] Allow bfd_hash_lookup (bfd_get_section_by_name) in an empty bfd
Hans-Peter Nilsson
hp@bitrange.com
Fri Jan 11 21:04:00 GMT 2002
With some work in progress, I called bfd_get_section_by_name
with a bfd with no sections (presumably: yet). It seems like
that should be valid, and not get a SIGFPE on the
"index = hash % table->size" further down.
Ok to commit?
* hash.c (bfd_hash_lookup): Return NULL for an empty table.
Index: hash.c
===================================================================
RCS file: /cvs/src/src/bfd/hash.c,v
retrieving revision 1.6
diff -p -c -r1.6 hash.c
*** hash.c 2001/09/18 09:57:24 1.6
--- hash.c 2002/01/12 04:39:26
*************** bfd_hash_lookup (table, string, create,
*** 368,373 ****
--- 368,376 ----
unsigned int len;
unsigned int index;
+ if (table->size == 0)
+ return (struct bfd_hash_entry *) NULL;
+
hash = 0;
len = 0;
s = (const unsigned char *) string;
brgds, H-P
More information about the Binutils
mailing list