I don't know if a fix is needed for the SVR4_PIC mode. I've only
fixed it for the non-PIC mode. KR 95/04/07 */
-static int nopic_need_relax PARAMS ((symbolS *));
+static int nopic_need_relax PARAMS ((symbolS *, int));
/* handle of the OPCODE hash table */
static struct hash_control *op_hash = NULL;
addiu $reg,$reg,<sym> (BFD_RELOC_LO16)
If we have an addend, we always use the latter form. */
if ((valueT) ep->X_add_number >= MAX_GPREL_OFFSET
- || nopic_need_relax (ep->X_add_symbol))
+ || nopic_need_relax (ep->X_add_symbol, 1))
p = NULL;
else
{
If we have a constant, we need two instructions anyhow,
so we may as well always use the latter form. */
if ((valueT) offset_expr.X_add_number >= MAX_GPREL_OFFSET
- || nopic_need_relax (offset_expr.X_add_symbol))
+ || nopic_need_relax (offset_expr.X_add_symbol, 1))
p = NULL;
else
{
if (breg == 0)
{
if ((valueT) offset_expr.X_add_number >= MAX_GPREL_OFFSET
- || nopic_need_relax (offset_expr.X_add_symbol))
+ || nopic_need_relax (offset_expr.X_add_symbol, 1))
p = NULL;
else
{
else
{
if ((valueT) offset_expr.X_add_number >= MAX_GPREL_OFFSET
- || nopic_need_relax (offset_expr.X_add_symbol))
+ || nopic_need_relax (offset_expr.X_add_symbol, 1))
p = NULL;
else
{
lui instruction. If there is a constant, we always use
the last case. */
if ((valueT) offset_expr.X_add_number >= MAX_GPREL_OFFSET
- || nopic_need_relax (offset_expr.X_add_symbol))
+ || nopic_need_relax (offset_expr.X_add_symbol, 1))
{
p = NULL;
used_at = 1;
undefined earlier.) */
static int
-nopic_need_relax (sym)
+nopic_need_relax (sym, before_relaxing)
symbolS *sym;
+ int before_relaxing;
{
if (sym == 0)
return 0;
#ifndef NO_ECOFF_DEBUGGING
|| (sym->ecoff_extern_size != 0
&& sym->ecoff_extern_size <= g_switch_value)
+ /* We must defer this decision until after the whole
+ file has been read, since there might be a .extern
+ after the first use of this symbol. */
+ || (sym->ecoff_extern_size == 0 && before_relaxing)
#endif
|| (S_GET_VALUE (sym) != 0
&& S_GET_VALUE (sym) <= g_switch_value)))
if (mips_pic == NO_PIC)
{
- change = nopic_need_relax (fragp->fr_symbol);
+ change = nopic_need_relax (fragp->fr_symbol, 0);
}
else if (mips_pic == SVR4_PIC)
{