Do not attempt to fixup relocs relative to weak symbols

This commit is contained in:
Nick Clifton
1999-11-06 14:05:24 +00:00
parent dd33dc0f45
commit d6c497c760
2 changed files with 28 additions and 18 deletions

View File

@ -1,3 +1,10 @@
1999-11-06 Nick Clifton <nickc@cygnus.com>
* config/tc-v850.c (v850_force_relocation): Force relocation
for weak symbols.
(v850_pcrel_from_selection): Do not compute a pcrel offset if
the symbol is weak.
1999-11-05 Michael Meissner <meissner@cygnus.com> 1999-11-05 Michael Meissner <meissner@cygnus.com>
* expr.h (operatorT): Increase machine dependent operators to 16. * expr.h (operatorT): Increase machine dependent operators to 16.

View File

@ -2260,7 +2260,7 @@ tc_gen_reloc (seg, fixp)
return NULL; return NULL;
} }
if (fixp->fx_r_type == BFD_RELOC_VTABLE_ENTRY if ( fixp->fx_r_type == BFD_RELOC_VTABLE_ENTRY
|| fixp->fx_r_type == BFD_RELOC_VTABLE_INHERIT) || fixp->fx_r_type == BFD_RELOC_VTABLE_INHERIT)
reloc->addend = fixp->fx_offset; reloc->addend = fixp->fx_offset;
else else
@ -2290,16 +2290,14 @@ v850_pcrel_from_section (fixp, section)
segT section; segT section;
{ {
/* If the symbol is undefined, or in a section other than our own, /* If the symbol is undefined, or in a section other than our own,
or it is weak (in which case it may well be in another section,
then let the linker figure it out. */ then let the linker figure it out. */
if (fixp->fx_addsy != (symbolS *) NULL if (fixp->fx_addsy != (symbolS *) NULL
&& (! S_IS_DEFINED (fixp->fx_addsy) && (! S_IS_DEFINED (fixp->fx_addsy)
|| S_IS_WEAK (fixp->fx_addsy)
|| (S_GET_SEGMENT (fixp->fx_addsy) != section))) || (S_GET_SEGMENT (fixp->fx_addsy) != section)))
{ return 0;
/* The symbol is undefined/not in our section.
Let the linker figure it out. */
return 0;
}
return fixp->fx_frag->fr_address + fixp->fx_where; return fixp->fx_frag->fr_address + fixp->fx_where;
} }
@ -2312,7 +2310,7 @@ md_apply_fix3 (fixp, valuep, seg)
valueT value; valueT value;
char * where; char * where;
if (fixp->fx_r_type == BFD_RELOC_VTABLE_INHERIT if ( fixp->fx_r_type == BFD_RELOC_VTABLE_INHERIT
|| fixp->fx_r_type == BFD_RELOC_VTABLE_ENTRY) || fixp->fx_r_type == BFD_RELOC_VTABLE_ENTRY)
{ {
fixp->fx_done = 0; fixp->fx_done = 0;
@ -2408,7 +2406,7 @@ md_apply_fix3 (fixp, valuep, seg)
on the v850. */ on the v850. */
void void
parse_cons_expression_v850 (exp) parse_cons_expression_v850 (exp)
expressionS *exp; expressionS * exp;
{ {
/* See if there's a reloc prefix like hi() we have to handle. */ /* See if there's a reloc prefix like hi() we have to handle. */
hold_cons_reloc = v850_reloc_prefix (NULL); hold_cons_reloc = v850_reloc_prefix (NULL);
@ -2422,7 +2420,7 @@ parse_cons_expression_v850 (exp)
appropriate one based on the size of the expression. */ appropriate one based on the size of the expression. */
void void
cons_fix_new_v850 (frag, where, size, exp) cons_fix_new_v850 (frag, where, size, exp)
fragS *frag; fragS * frag;
int where; int where;
int size; int size;
expressionS *exp; expressionS *exp;
@ -2442,37 +2440,42 @@ cons_fix_new_v850 (frag, where, size, exp)
else else
fix_new (frag, where, size, NULL, 0, 0, hold_cons_reloc); fix_new (frag, where, size, NULL, 0, 0, hold_cons_reloc);
} }
boolean boolean
v850_fix_adjustable (fixP) v850_fix_adjustable (fixP)
fixS *fixP; fixS * fixP;
{ {
if (fixP->fx_addsy == NULL) if (fixP->fx_addsy == NULL)
return 1; return 1;
/* Prevent all adjustments to global symbols. */ /* Prevent all adjustments to global symbols. */
if (S_IS_EXTERN (fixP->fx_addsy)) if (S_IS_EXTERN (fixP->fx_addsy))
return 0; return 0;
if (S_IS_WEAK (fixP->fx_addsy)) if (S_IS_WEAK (fixP->fx_addsy))
return 0; return 0;
/* Don't adjust function names */ /* Don't adjust function names */
if (S_IS_FUNCTION (fixP->fx_addsy)) if (S_IS_FUNCTION (fixP->fx_addsy))
return 0; return 0;
/* We need the symbol name for the VTABLE entries */ /* We need the symbol name for the VTABLE entries */
if (fixP->fx_r_type == BFD_RELOC_VTABLE_INHERIT if ( fixP->fx_r_type == BFD_RELOC_VTABLE_INHERIT
|| fixP->fx_r_type == BFD_RELOC_VTABLE_ENTRY) || fixP->fx_r_type == BFD_RELOC_VTABLE_ENTRY)
return 0; return 0;
return 1; return 1;
} }
int int
v850_force_relocation (fixp) v850_force_relocation (fixP)
struct fix *fixp; struct fix * fixP;
{ {
if (fixp->fx_r_type == BFD_RELOC_VTABLE_INHERIT if (fixP->fx_addsy && S_IS_WEAK (fixP->fx_addsy))
|| fixp->fx_r_type == BFD_RELOC_VTABLE_ENTRY) return 1;
if ( fixP->fx_r_type == BFD_RELOC_VTABLE_INHERIT
|| fixP->fx_r_type == BFD_RELOC_VTABLE_ENTRY)
return 1; return 1;
return 0; return 0;