public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* fix for fixup_segment / MD_PCREL_FROM_SECTION
@ 2001-08-28 13:07 Joern Rennecke
  2001-08-28 16:38 ` law
  2001-08-28 22:34 ` Alan Modra
  0 siblings, 2 replies; 6+ messages in thread
From: Joern Rennecke @ 2001-08-28 13:07 UTC (permalink / raw)
  To: binutils; +Cc: law, amylaar

Currently, it is impossible to write a port with a correct definition of
MD_PCREL_FROM that works, because fixup_segment neglects to subtract the
address of the relocation.

Tue Aug 28 20:37:06 2001  J"orn Rennecke <amylaar@redhat.com>

	* write.c (fixup_segment): When resolving pcrel addresses,
	properly subtract the address of the relocation if
	TC_MD_PCREL_FROM_SECTION_FIXED is defined.

Index: write.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gas/write.c,v
retrieving revision 1.239
diff -p -r1.239 write.c
*** write.c	2001/08/11 18:27:01	1.239
--- write.c	2001/08/28 19:33:11
*************** fixup_segment (fixP, this_segment_type)
*** 2772,2777 ****
--- 2781,2789 ----
  
  	      add_number += S_GET_VALUE (add_symbolP);
  	      add_number -= MD_PCREL_FROM_SECTION (fixP, this_segment_type);
+ #ifdef TC_MD_PCREL_FROM_SECTION_FIXED
+ 	      add_number -= fixP->fx_frag->fr_address + fixP->fx_where;
+ #endif
  	      /* Lie.  Don't want further pcrel processing.  */
  	      pcrel = 0;
  
Index: doc/internals.texi
===================================================================
RCS file: /cvs/cvsfiles/devo/gas/doc/internals.texi,v
retrieving revision 1.42
diff -p -r1.42 internals.texi
*** internals.texi	2001/07/14 15:56:19	1.42
--- internals.texi	2001/08/28 19:33:11
*************** If you define this macro, it should retu
*** 1280,1285 ****
--- 1280,1291 ----
  PC relative fixup and the position from which the PC relative adjustment should
  be made.  On many processors, the base of a PC relative instruction is the next
  instruction, so this macro would return the length of an instruction.
+ @item TC_MD_PCREL_FROM_SECTION_FIXED
+ @cindexTC_MD_PCREL_FROM_SECTION_FIXED
+ You also need to define @code{TC_MD_PCREL_FROM_SECTION_FIXED} to make this
+ work right, because a large number of old ports papered over a bug in
+ fixup_segment by making the reverse error in their definition of
+ @code{MD_PCREL_FROM_SECTION}.
  
  @item md_pcrel_from
  @cindex md_pcrel_from

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2001-08-29  8:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-08-28 13:07 fix for fixup_segment / MD_PCREL_FROM_SECTION Joern Rennecke
2001-08-28 16:38 ` law
2001-08-28 22:34 ` Alan Modra
2001-08-29  4:09   ` Joern Rennecke
2001-08-29  5:05     ` Alan Modra
2001-08-29  8:11   ` law

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).