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]
Other format: [Raw text]

Re: [avr-gcc-list] tool chain bug (fwd)


On Wed, Sep 25, 2002 at 03:26:02PM -0700, Theodore A. Roth wrote:
> I've been fighting this bug in gas (for the avr target) for a few days and
> haven't been able to find a fix. In looking through the ChangeLog, I
> noticed that you made committed a rather large patch on Sept 5 which
> included some small changes to tc-avr.c (rev 1.17 to 1.18) which I think
> may be the problem.

Heh, large changes get blamed for everything. :)  Looking over the
part I removed from tc-avr.c again though, I think I may have
removed too much.  Does the following patch cure your problem?

	* gas/config/tc-avr.c (md_apply_fix3): Reinstate code handling
	pcrel fixups to current or absolute section.

Index: gas/config/tc-avr.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-avr.c,v
retrieving revision 1.18
diff -u -p -r1.18 tc-avr.c
--- gas/config/tc-avr.c	5 Sep 2002 00:01:17 -0000	1.18
+++ gas/config/tc-avr.c	26 Sep 2002 00:21:55 -0000
@@ -838,6 +838,17 @@ md_apply_fix3 (fixP, valP, seg)
   if (fixP->fx_addsy == (symbolS *) NULL)
     fixP->fx_done = 1;
 
+  else if (fixP->fx_pcrel)
+    {
+      segT s = S_GET_SEGMENT (fixP->fx_addsy);
+
+      if (s == seg || s == absolute_section)
+	{
+	  value += S_GET_VALUE (fixP->fx_addsy);
+	  fixP->fx_done = 1;
+	}
+    }
+
   /* We don't actually support subtracting a symbol.  */
   if (fixP->fx_subsy != (symbolS *) NULL)
     as_bad_where (fixP->fx_file, fixP->fx_line, _("expression too complex"));


> >From what Denis says and my time spent in the debugger, I think that this
> fragment from tc-avr.c:
> 
>     706     case 'l':
>     707       str = parse_exp (str, &op_expr);
>     708       fix_new_exp (frag_now, where, opcode->insn_size * 2,
>     709                    &op_expr, true, BFD_RELOC_AVR_7_PCREL);
>     710       break;
>     711
> 
> should probably not be using a fixup and instead just calculate the
> op_mask from the pcrel offset and be done with it.

I agree.

> stage. But, as I remember, I don't support linking of 7-bit PC
> relative relocations (BFD_RELOC_AVR_7_PCREL).

Especially in light of Denis' comment.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


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