This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

mn10300 assembler crashes


The latest patch I installed in the mn10300 assembler was buggy.
Originally, my patch wouldn't free reloc->sym_ptr_ptr, but Nick
correctly suggested me to do so.  I followed his suggestion blindly,
and apparently failed to test the result, because it crashed while
building a mn10300-elf toolchain.

Here's a patch that fixes the crash, that I'm checking in under the
``obviously correct'' rule.

I apologize for the mistake.

Index: gas/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* config/tc-mn10300.c (tc_gen_reloc): Don't free
	reloc->sym_ptr_ptr if it's not allocated.

Index: gas/config/tc-mn10300.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-mn10300.c,v
retrieving revision 1.30
diff -u -p -r1.30 tc-mn10300.c
--- gas/config/tc-mn10300.c 2001/09/25 08:51:52 1.30
+++ gas/config/tc-mn10300.c 2001/10/05 07:46:15
@@ -1779,6 +1779,8 @@ tc_gen_reloc (seg, fixp)
 
   if (fixp->fx_addsy && fixp->fx_subsy)
     {
+      reloc->sym_ptr_ptr = NULL;
+
       /* If we got a difference between two symbols, and the
 	 subtracted symbol is in the current section, use a
 	 PC-relative relocation.  If both symbols are in the same
@@ -1856,7 +1858,8 @@ tc_gen_reloc (seg, fixp)
 	    }
 	}
 
-      free (reloc->sym_ptr_ptr);
+      if (reloc->sym_ptr_ptr)
+	free (reloc->sym_ptr_ptr);
       free (reloc);
       return NULL;
     }

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]