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]

tc-hppa.c md_apply_fix correction


The main purpose of this patch is to remove the incorrect assert I added
on 2000-09-26.  The rest is just to hide the fact that it needed
removing. :-)

gas/ChangeLog
	* config/tc-hppa.c (md_apply_fix): Remove plainly wrong assert.
	Re-arrange function a little and improve error message.

Alan Modra
-- 
Linuxcare.  Support for the Revolution.

Index: config/tc-hppa.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-hppa.c,v
retrieving revision 1.69
diff -u -p -w -r1.69 tc-hppa.c
--- tc-hppa.c	2000/09/28 06:24:43	1.69
+++ tc-hppa.c	2000/10/07 14:11:08
@@ -4341,12 +4341,11 @@ md_apply_fix (fixP, valp)
      fixS *fixP;
      valueT *valp;
 {
-  char *buf = fixP->fx_where + fixP->fx_frag->fr_literal;
+  unsigned char *buf;
   struct hppa_fix_struct *hppa_fixP;
   offsetT new_val;
-  int insn, val;
+  int insn, val, fmt;
 
-  hppa_fixP = (struct hppa_fix_struct *) fixP->tc_fix_data;
   /* SOM uses R_HPPA_ENTRY and R_HPPA_EXIT relocations which can
      never be "applied" (they are just markers).  Likewise for
      R_HPPA_BEGIN_BRTAB and R_HPPA_END_BRTAB.  */
@@ -4373,14 +4372,19 @@ md_apply_fix (fixP, valp)
     return 1;
 #endif
 
-  insn = bfd_get_32 (stdoutput, (unsigned char *) buf);
   /* There should have been an HPPA specific fixup associated
      with the GAS fixup.  */
-  if (hppa_fixP)
+  hppa_fixP = (struct hppa_fix_struct *) fixP->tc_fix_data;
+  if (hppa_fixP == NULL)
     {
-      int fmt = bfd_hppa_insn2fmt (stdoutput, insn);
+      printf (_("no hppa_fixup entry for fixup type 0x%x at %s:%d"),
+	      fixP->fx_r_type, fixP->fx_file, fixP->fx_line);
+      return 0;
+    }
 
-      assert (fmt == hppa_fixP->fx_r_format);
+  buf = fixP->fx_frag->fr_literal + fixP->fx_where;
+  insn = bfd_get_32 (stdoutput, buf);
+  fmt = bfd_hppa_insn2fmt (stdoutput, insn);
 
       /* If there is a symbol associated with this fixup, then it's something
 	 which will need a SOM relocation (except for some PC-relative relocs).
@@ -4402,7 +4406,7 @@ md_apply_fix (fixP, valp)
 	       || hppa_fixP->fx_r_field == e_rtsel
 	       || hppa_fixP->fx_r_field == e_ltsel)
 	new_val = ((fmt == 12 || fmt == 17 || fmt == 22) ? 8 : 0);
-      /* This is truely disgusting.  The machine independent code blindly
+  /* This is truly disgusting.  The machine independent code blindly
 	 adds in the value of the symbol being relocated against.  Damn!  */
       else if (fmt == 32
 	       && fixP->fx_addsy != NULL
@@ -4545,15 +4549,8 @@ md_apply_fix (fixP, valp)
 	}
 
       /* Insert the relocation.  */
-      bfd_put_32 (stdoutput, insn, (unsigned char *) buf);
+  bfd_put_32 (stdoutput, insn, buf);
       return 1;
-    }
-  else
-    {
-      printf (_("no hppa_fixup entry for this fixup (fixP = 0x%x, type = 0x%x)\n"),
-	      (unsigned int) fixP, fixP->fx_r_type);
-      return 0;
-    }
 }
 
 /* Exactly what point is a PC-relative offset relative TO?


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