[gas-980322]: Bugs in IEEE handling - patch included
Manfred Hollstein
manfred@s-direktnet.de
Mon Mar 23 04:56:00 GMT 1998
I often found GNU nm and objdump core dumping when applied on an MRI
supplied objects and library files. Since we need to write some support
scripts around the MRI toolchain here, I debugged this today.
The problem is caused by dereferencing various pointers without prior
looking at their current values. I've fixed the ones, which I've seen
by running nm-new and objdump on several MRI files. I'm pretty sure,
there are other locations in this file which need to be fixed.
Mon Mar 23 13:10:21 1998 Manfred Hollstein <manfred@s-direktnet.de>
* ieee.c (do_one): Check section before dereferencing it.
(ieee_canonicalize_reloc): Likewise with src->relent.sym_ptr_ptr.
(ieee_generic_stat_arch_elt): Likewise with abfd->my_archive.
diff -rup -x CVS -x RCS -x *.o -x *.info* -x *.html* -x *.elc -x *.dvi -x *.orig -x *~ -x version.el gas-980322.orig/bfd/ieee.c gas-980322/bfd/ieee.c
--- gas-980322.orig/bfd/ieee.c Sun Mar 22 10:12:51 1998
+++ gas-980322/bfd/ieee.c Mon Mar 23 13:35:55 1998
@@ -1646,7 +1646,7 @@ do_one (ieee, current_map, location_ptr,
s->flags |= SEC_RELOC;
s->owner->flags |= HAS_RELOC;
s->reloc_count++;
- if (r->relent.sym_ptr_ptr == 0)
+ if (r->relent.sym_ptr_ptr == 0 && section)
{
r->relent.sym_ptr_ptr = section->symbol_ptr_ptr;
}
@@ -1987,8 +1987,11 @@ ieee_canonicalize_reloc (abfd, section,
symbols + src->symbol.index + ieee->external_reference_base_offset;
break;
case 0:
- src->relent.sym_ptr_ptr =
- src->relent.sym_ptr_ptr[0]->section->symbol_ptr_ptr;
+ if (src->relent.sym_ptr_ptr)
+ src->relent.sym_ptr_ptr =
+ src->relent.sym_ptr_ptr[0]->section->symbol_ptr_ptr;
+ else
+ src->relent.sym_ptr_ptr = 0;
break;
default:
@@ -3642,9 +3645,11 @@ ieee_generic_stat_arch_elt (abfd, buf)
bfd *abfd;
struct stat *buf;
{
- ieee_ar_data_type *ar = abfd->my_archive->tdata.ieee_ar_data;
+ ieee_ar_data_type *ar = (ieee_ar_data_type *) NULL;
ieee_data_type *ieee;
+ if (abfd->my_archive)
+ ar = abfd->my_archive->tdata.ieee_ar_data;
if (ar == (ieee_ar_data_type *) NULL)
{
bfd_set_error (bfd_error_invalid_operation);
More information about the Bfd
mailing list