This is the mail archive of the 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]
Other format: [Raw text]

Commit: Cgen: Avoid memory corruption processing complex relocs

Hi Guys,

  I am checking in the patch below to work around a memory corruption
  problem I encountered whilst building a toolchain for the MeP target.
  The symptom was that the abort() in bfd_map_over_sections was being
  triggered, but the cause was that the bfd's section list was being
  corrupted by gas_cgen_parse_operand().  For reasons that I do not yet
  understand the temporary expression symbol computed for a complex
  reloc could sometimes be a local symbol.  This was a problem as the
  code in gas_cgen_parse_operand assumed that it always had a global
  symbol.  The patch below fixes this assumption for the place where the
  memory corruption was occurring (and allows the MeP toolchain to be
  built), but I think that there is probably still an underlying problem
  to be resolved here.  I will get back to this some day in the future.


2012-02-20  Nick Clifton  <>

	* cgen.c (gas_cgen_parse_operand): Do not set BSF_RELC flag on
	local symbols.

Index: gas/cgen.c
RCS file: /cvs/src/src/gas/cgen.c,v
retrieving revision 1.39
diff -u -3 -p -r1.39 cgen.c
--- gas/cgen.c	8 Sep 2011 16:07:10 -0000	1.39
+++ gas/cgen.c	20 Feb 2012 10:17:07 -0000
@@ -483,7 +483,8 @@ gas_cgen_parse_operand (cd, want, strP, 
 	  if (operand && (operand->hw_type == HW_H_SINT))
 	    signed_p = 1;
-	  if (stmp->bsym && (stmp->bsym->section == expr_section))
+	  if (stmp->bsym && (stmp->bsym->section == expr_section)
+	      && ! S_IS_LOCAL (stmp))
 	      if (signed_p)
 		stmp->bsym->flags |= BSF_SRELC;

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