This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
fix for fixup_segment / MD_PCREL_FROM_SECTION
- To: binutils at sources dot redhat dot com
- Subject: fix for fixup_segment / MD_PCREL_FROM_SECTION
- From: Joern Rennecke <amylaar at redhat dot com>
- Date: Tue, 28 Aug 2001 21:07:53 +0100 (BST)
- Cc: law at redhat dot com, amylaar at cambridge dot redhat dot com
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