This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
xstormy16-elf-gas: Better fix for pc-relative relocs
- From: Nick Clifton <nickc at redhat dot com>
- To: binutils at sources dot redhat dot com
- Date: Thu, 22 May 2003 09:47:12 +0100
- Subject: xstormy16-elf-gas: Better fix for pc-relative relocs
Hi Guys,
I am applying an improved fix for the problem of pc-relative relocs
on the xstormy16 port not working properly. The problem was the
function md_pcrel_from_section() which was returning a section
relative offset for relocs which were not relative to the section
symbol.
Cheers
Nick
2003-05-22 Nick Clifton <nickc@redhat.com>
* config/tc-xstormy16.c (md_pcrel_from_section): Do not produce
section relative offsets for relocs that will not be based on the
section symbol.
(xstormy16_md_apply_fix3): Remove previous patch to this
function.
Index: config/tc-xstormy16.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gas/config/tc-xstormy16.c,v
retrieving revision 1.7.2.3
diff -c -3 -p -w -r1.7.2.3 tc-xstormy16.c
*** tc-xstormy16.c 2003/05/15 17:59:30 1.7.2.3
--- tc-xstormy16.c 2003/05/22 08:33:50
*************** md_pcrel_from_section (fixP, sec)
*** 333,344 ****
{
if (fixP->fx_addsy != (symbolS *) NULL
&& (! S_IS_DEFINED (fixP->fx_addsy)
! || S_GET_SEGMENT (fixP->fx_addsy) != sec))
! {
! /* The symbol is undefined (or is defined but not in this section).
Let the linker figure it out. */
return 0;
- }
return fixP->fx_frag->fr_address + fixP->fx_where;
}
--- 333,345 ----
{
if (fixP->fx_addsy != (symbolS *) NULL
&& (! S_IS_DEFINED (fixP->fx_addsy)
! || S_GET_SEGMENT (fixP->fx_addsy) != sec)
! || xstormy16_force_relocation (fixP))
! /* The symbol is undefined,
! or it is defined but not in this section,
! or the relocation will be relative to this symbol not the section symbol.
Let the linker figure it out. */
return 0;
return fixP->fx_frag->fr_address + fixP->fx_where;
}
*************** xstormy16_md_apply_fix3 (fixP, valueP, s
*** 584,594 ****
/* Tuck `value' away for use by tc_gen_reloc.
See the comment describing fx_addnumber in write.h.
! This field is misnamed (or misused :-).
! We do not do this for pc-relative relocs against a
! defined symbol, since it will be done for us. */
! if ((! fixP->fx_pcrel)
! || (fixP->fx_addsy && ! S_IS_DEFINED (fixP->fx_addsy)))
fixP->fx_addnumber += value;
}
--- 585,591 ----
/* Tuck `value' away for use by tc_gen_reloc.
See the comment describing fx_addnumber in write.h.
! This field is misnamed (or misused :-). */
fixP->fx_addnumber += value;
}