gas/
[deliverable/binutils-gdb.git] / gas / config / tc-xtensa.c
index 051f79fd6f893a6060f0a92fd83def1186f65e12..e632ef39e3eba0b42e733e5616f9ebcbc93a2910 100644 (file)
@@ -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;
This page took 0.029071 seconds and 4 git commands to generate.