public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [patch] rx: zero out displacements for unrelocatable operands
@ 2011-01-27 22:38 DJ Delorie
  0 siblings, 0 replies; only message in thread
From: DJ Delorie @ 2011-01-27 22:38 UTC (permalink / raw)
  To: binutils


This just zeros out operands if we're deferring to the linker, so the
output of objdump is prettier.  Committed.

	* config/tc-rx.c (md_convert_frag): If we can't compute the target
	address, zero out the values stored in the object file to make
	objdump's output consistent.

Index: config/tc-rx.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-rx.c,v
retrieving revision 1.7
diff -p -U3 -r1.7 tc-rx.c
--- config/tc-rx.c	5 Jan 2011 22:04:09 -0000	1.7
+++ config/tc-rx.c	27 Jan 2011 22:36:25 -0000
@@ -1603,20 +1603,29 @@ md_convert_frag (bfd *   abfd ATTRIBUTE_
       && fragP->tc_frag_data->relax[0].type == RX_RELAX_DISP)
     ri = 1;
 
+  /* We used a new frag for this opcode, so the opcode address should
+     be the frag address.  */
+  mypc = fragP->fr_address + (fragP->fr_opcode - fragP->fr_literal);
+
   /* Try to get the target address.  If we fail here, we just use the
      largest format.  */
   if (rx_frag_fix_value (fragP, segment, 0, & addr0,
 			 fragP->tc_frag_data->relax[ri].type != RX_RELAX_BRANCH, 0))
-    keep_reloc = 1;
+    {
+      /* We don't know the target address.  */
+      keep_reloc = 1;
+      addr0 = 0;
+      disp = 0;
+    }
+  else
+    {
+      /* We know the target address, and it's in addr0.  */
+      disp = (int) addr0 - (int) mypc;
+    }
 
   if (linkrelax)
     keep_reloc = 1;
 
-  /* We used a new frag for this opcode, so the opcode address should
-     be the frag address.  */
-  mypc = fragP->fr_address + (fragP->fr_opcode - fragP->fr_literal);
-  disp = (int) addr0 - (int) mypc;
-
   reloc_type = BFD_RELOC_NONE;
   reloc_adjust = 0;
 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-01-27 22:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-27 22:38 [patch] rx: zero out displacements for unrelocatable operands DJ Delorie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).