summaryrefslogtreecommitdiff
path: root/gas/config/tc-xtensa.c
diff options
context:
space:
mode:
authorBob Wilson <bob.wilson@acm.org>2007-12-13 19:03:45 +0000
committerBob Wilson <bob.wilson@acm.org>2007-12-13 19:03:45 +0000
commit6b4a65d487ac92d996d367901b2c7d5bda04d2e2 (patch)
tree0be8f8630bfc4df062df8814d66854d6aa926fb3 /gas/config/tc-xtensa.c
parentc6dae6d15cf4f7054cbf2f0a4c95b304425d46cf (diff)
downloadbinutils-redhat-6b4a65d487ac92d996d367901b2c7d5bda04d2e2.tar.gz
gas/
* config/tc-xtensa.c (xg_symbolic_immeds_fit): Relax for weak references but not weak definitions. gas/testsuite/ * gas/xtensa/all.exp: Run new weak-call test. * gas/xtensa/weak-call.d: New. * gas/xtensa/weak-call.s: New.
Diffstat (limited to 'gas/config/tc-xtensa.c')
-rw-r--r--gas/config/tc-xtensa.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c
index 051f79fd6f..e632ef39e3 100644
--- a/gas/config/tc-xtensa.c
+++ b/gas/config/tc-xtensa.c
@@ -3241,9 +3241,15 @@ xg_symbolic_immeds_fit (const TInsn *insn,
|| S_GET_SEGMENT (expr->X_add_symbol) != pc_seg)
{
/* For a direct call with --no-longcalls, be optimistic and
- assume it will be in range. */
+ assume it will be in range. If the symbol is weak and
+ undefined, it may remain undefined at link-time, in which
+ case it will have a zero value and almost certainly be out
+ of range for a direct call; thus, relax for undefined weak
+ symbols even if longcalls is not enabled. */
if (is_direct_call_opcode (insn->opcode)
- && ! pc_frag->tc_frag_data.use_longcalls)
+ && ! pc_frag->tc_frag_data.use_longcalls
+ && (! S_IS_WEAK (expr->X_add_symbol)
+ || S_IS_DEFINED (expr->X_add_symbol)))
return TRUE;
return FALSE;