bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug gas/1804] Wrong output for 64-bit difference of labels


From: dave at hiauly1 dot hia dot nrc dot ca
Subject: [Bug gas/1804] Wrong output for 64-bit difference of labels
Date: 6 Nov 2005 00:27:43 -0000

------- Additional Comments From dave at hiauly1 dot hia dot nrc dot ca  
2005-11-06 00:27 -------
Subject: Re:  Wrong output for 64-bit difference of labels

> ------- Additional Comments From amodra at bigpond dot net dot au  2005-11-05 
> 08:36 -------
> This is caused by tc-hppa.c:md_apply_fix treating the fixup as only being 32 
> bit.

Does this look like a reasonable fix?

Dave
-- 
J. David Anglin                                  address@hidden
National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)

Index: config/tc-hppa.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-hppa.c,v
retrieving revision 1.126
diff -u -3 -p -r1.126 tc-hppa.c
--- config/tc-hppa.c    13 Oct 2005 01:06:01 -0000      1.126
+++ config/tc-hppa.c    6 Nov 2005 00:13:48 -0000
@@ -4436,7 +4436,7 @@ md_apply_fix (fixP, valP, seg)
      valueT *valP;
      segT seg ATTRIBUTE_UNUSED;
 {
-  unsigned char *buf;
+  char *fixpos;
   struct hppa_fix_struct *hppa_fixP;
   offsetT new_val;
   int insn, val, fmt;
@@ -4481,8 +4481,16 @@ md_apply_fix (fixP, valP, seg)
       return;
     }
 
-  buf = (unsigned char *) (fixP->fx_frag->fr_literal + fixP->fx_where);
-  insn = bfd_get_32 (stdoutput, buf);
+  fixpos = fixP->fx_frag->fr_literal + fixP->fx_where;
+
+  /* Handle fixups for complex expressions that evaluate to a constant.  */
+  if (fixP->fx_r_type == R_HPPA_COMPLEX && fixP->fx_done)
+    {
+      number_to_chars_bigendian (fixpos, *valP, fixP->fx_size);
+      return;
+    }
+
+  insn = bfd_get_32 (stdoutput, fixpos);
   fmt = bfd_hppa_insn2fmt (stdoutput, insn);
 
   /* If there is a symbol associated with this fixup, then it's something
@@ -4652,7 +4660,7 @@ md_apply_fix (fixP, valP, seg)
     }
 
   /* Insert the relocation.  */
-  bfd_put_32 (stdoutput, insn, buf);
+  bfd_put_32 (stdoutput, insn, fixpos);
 }
 
 /* Exactly what point is a PC-relative offset relative TO?


-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=1804

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]