PC-relative Processing
Tracy.Kuhrt@microchip.com
Tracy.Kuhrt@microchip.com
Fri Jun 15 08:52:00 GMT 2001
In the fixup_segment function, there exists the following code. Could
someone please tell me why pcrel is set to 0, but MD_PCREL_FROM_SECTION is
not subtracted from add_number? I am working on a new port of binutils,
and this is causing me to calculate an incorrect offset when I do one of
the following bra foo - . or bra . - foo.
if (sub_symbolP)
{
...
else if (S_GET_SEGMENT (sub_symbolP) == add_symbol_segment
&& SEG_NORMAL (add_symbol_segment))
{
/* Difference of 2 symbols from same segment.
Can't make difference of 2 undefineds: 'value' means
something different for N_UNDF. */
#ifdef TC_I960
/* Makes no sense to use the difference of 2 arbitrary
symbols
as the target of a call instruction. */
if (fixP->fx_tcbit)
as_bad_where (fixP->fx_file, fixP->fx_line,
_("callj to difference of 2 symbols"));
#endif /* TC_I960 */
add_number += S_GET_VALUE (add_symbolP) -
S_GET_VALUE (sub_symbolP);
add_symbolP = NULL;
pcrel = 0; /* No further pcrel processing. */
/* Let the target machine make the final determination
as to whether or not a relocation will be needed to
handle this fixup. */
if (!TC_FORCE_RELOCATION_SECTION (fixP, this_segment_type))
{
fixP->fx_pcrel = 0;
fixP->fx_addsy = NULL;
fixP->fx_subsy = NULL;
}
}
Any thoughts on what the appropriate solution is? I do not wish to break
any other ports by suggesting adding the following line before turning off
pc-relative processing:
add_number -= MD_PCREL_FROM_SECTION (fixP, this_segment_type);
Tracy
More information about the Binutils
mailing list