diff --git a/gas/ChangeLog b/gas/ChangeLog index 250b8ee64d..a31a459df1 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,9 @@ +2001-09-17 Hans-Peter Nilsson + + * config/tc-sh.c (md_pcrel_from_section): Transformed from + md_pcrel_from. Handle pc-relativeness against link-time + symbol. Handle relativeness to elsewhere than the fixup. + 2001-09-30 Hans-Peter Nilsson * Makefile.am: Update dependencies with "make dep-am". diff --git a/gas/config/tc-sh.c b/gas/config/tc-sh.c index b574e68ccf..46eafddff5 100644 --- a/gas/config/tc-sh.c +++ b/gas/config/tc-sh.c @@ -3108,9 +3108,23 @@ md_number_to_chars (ptr, use, nbytes) } long -md_pcrel_from (fixP) +md_pcrel_from_section (fixP, sec) fixS *fixP; + segT sec; { + if (fixP->fx_addsy != (symbolS *) NULL + && (! S_IS_DEFINED (fixP->fx_addsy) + || S_IS_EXTERN (fixP->fx_addsy) + || S_IS_WEAK (fixP->fx_addsy) + || S_GET_SEGMENT (fixP->fx_addsy) != sec)) + { + /* The symbol is undefined (or is defined but not in this section, + or we're not sure about it being the final definition). Let the + linker figure it out. We need to adjust the subtraction of a + symbol to the position of the relocated data, though. */ + return fixP->fx_subsy ? fixP->fx_where + fixP->fx_frag->fr_address : 0; + } + return fixP->fx_size + fixP->fx_where + fixP->fx_frag->fr_address + 2; }