From ef17112f8d8a644394d6bab7addff457c0b623fd Mon Sep 17 00:00:00 2001 From: Hans-Peter Nilsson Date: Mon, 1 Oct 2001 00:06:58 +0000 Subject: [PATCH] * 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. --- gas/ChangeLog | 6 ++++++ gas/config/tc-sh.c | 16 +++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 250b8ee64dc..a31a459df1f 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 b574e68ccf1..46eafddff57 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; } -- 2.30.2