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


Index N/th> [Date Index] [Subject&;Index] [Author Index] [Thread Index] >
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Threbsp;Next]


> : + Use valuep if fully resolved or pc-relative,
> : +     else use fx_offset. */
> 
> Extra space at end of comment.
 

Oh heck.

> Note - it would be nice if this comment explained why '*valuep' is the
> correct thing to use if the rehas been resolved or if it is a pc
> relative reloc.


Done.  Final checkin attached.

-eric
Index: tc-mn1030:jĀ:=====================
RCS file: /cvs/src/src/gas/config/tc-mn10300.c,v
retrievrevision 1.12
diff -u -p -w -r1.12 tc-mn10300.c
--- tc-mn10300.c	2000/09/05 21:01:39	1.12
+++ tc-mn10300.c	2000/11/01 00:51:@ -1912,11 +1912,12 @@ md_pcrel_from (fixp)
 int
 md_apply_fix3 (fixp, valuep, seg)
      fixS *fixp;
-     valueT *valuep ABUTE_UNUSED;
+     valueT *valuep;
      segT seg;
 {
   char *fixpos = fixp->fx_where + fixp->fx_frag->fr_literal;int size = 0;
+  int value;
 
   assert (fixp->fx_r_type < BFD_RELOC_UNUSED);
 
@@ -1924,6 +1925,23 @@ md_apply_fix3 (, valuep, seg)
   if (seg->flags & SEC_ALLOC)
       abort ();
 
+  /* The value we are passed in *valuep includes thmbol values.
+     Since we are using BFD_ASSEMBLER, if we are doing this relocation
+     the code in write.c is going to cbfd_install_relocation, which
+     is also going to use the symbol value.  That means that if the
+     reloc is fully reso we want to use *valuep since
+     bfd_install_relocation is not being used.
+
+     However, if the reloc is not fully resd we do not want to use
+     *valuep, and must use fx_offset instead.  However, if the reloc
+     is PC relative, we do wao use *valuep since it includes the
+     result of md_pcrel_from.  */
+  if (fixp->fx_addsy == (symbolS *) NULL || fixp-fx_pcrel)
+    value = *valuep;
+  else
+    value = fixp->fx_offset;
+
+
   /* If the fix is relative to a symbol which ot defined, or not
      in the same segment as the fix, we cannot resolve it here.  */
   if (fixp->fx_addsy != NULL
@@ 9,7 +1977,7 @@ md_apply_fix3 (fixp, valuep, seg)
                    _("Bad relocation fixup type (%d)"), fixp->fx_r_type    }
 
-  md_number_to_chars (fixpos, fixp->fx_offset, size);
+  md_number_to_chars (fixpos, value, size);
 
   fixp->done = 1;
   return 0;

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