public inbox for
 help / color / mirror / Atom feed
From: Manfred Hollstein <>
Subject: [gas-980322]: Bugs in IEEE handling - patch included
Date: Mon, 23 Mar 1998 04:56:00 -0000	[thread overview]
Message-ID: <13590.23051.289572.207215@slsvhmt> (raw)

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  <>

	* 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;
-		  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;
 	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;
@@ -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);

                 reply	other threads:[~1998-03-23  4:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=13590.23051.289572.207215@slsvhmt \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).