Switch the reloc type to GOT32 earlier, and do not permit GOT32 relocs to be
turned into section-relative relocs.
This commit is contained in:
parent
c10f6edafc
commit
79410cf933
32
gnu/dist/gas/config/tc-arm.c
vendored
32
gnu/dist/gas/config/tc-arm.c
vendored
@ -5066,8 +5066,9 @@ md_apply_fix3 (fixP, val, seg)
|
||||
md_number_to_chars (buf, value, 2);
|
||||
break;
|
||||
|
||||
case BFD_RELOC_RVA:
|
||||
case BFD_RELOC_32:
|
||||
case BFD_RELOC_RVA:
|
||||
case BFD_RELOC_ARM_GOT32:
|
||||
if (fixP->fx_done || fixP->fx_pcrel)
|
||||
md_number_to_chars (buf, value, 4);
|
||||
break;
|
||||
@ -5279,10 +5280,7 @@ tc_gen_reloc (section, fixp)
|
||||
case BFD_RELOC_32:
|
||||
if (pic_code && fixp->fx_pcrel == 0 && fixp->fx_addsy != NULL)
|
||||
{
|
||||
if (section == text_section)
|
||||
code = BFD_RELOC_ARM_GOT32;
|
||||
else
|
||||
code = fixp->fx_r_type;
|
||||
code = fixp->fx_r_type;
|
||||
break;
|
||||
}
|
||||
if (fixp->fx_pcrel)
|
||||
@ -5297,7 +5295,9 @@ tc_gen_reloc (section, fixp)
|
||||
code = BFD_RELOC_ARM_JMPSLOT;
|
||||
break;
|
||||
}
|
||||
|
||||
case BFD_RELOC_RVA:
|
||||
case BFD_RELOC_ARM_GOT32:
|
||||
code = fixp->fx_r_type;
|
||||
break;
|
||||
|
||||
@ -6144,22 +6144,22 @@ cons_fix_new_arm(frag, where, size, exp)
|
||||
* and a 32 bit size
|
||||
*/
|
||||
|
||||
if (pic_code != 0 && size == 4 && exp->X_op == O_add
|
||||
&& exp->X_add_symbol
|
||||
&& S_GET_SEGMENT (exp->X_add_symbol) == undefined_section
|
||||
&& exp->X_op_symbol
|
||||
&& S_GET_SEGMENT (exp->X_op_symbol) == expr_section)
|
||||
if (pic_code != 0 && size == 4 && exp->X_add_symbol)
|
||||
{
|
||||
/*
|
||||
* This could be it
|
||||
* Is the primary symbol name "__GLOBAL_OFFSET_TABLE" ?
|
||||
*/
|
||||
if (strcmp (S_GET_NAME(exp->X_add_symbol),
|
||||
GLOBAL_OFFSET_TABLE_NAME) == 0)
|
||||
if (exp->X_op == O_add
|
||||
&& S_GET_SEGMENT (exp->X_add_symbol) == undefined_section
|
||||
&& exp->X_op_symbol
|
||||
&& S_GET_SEGMENT (exp->X_op_symbol) == expr_section
|
||||
&& strcmp (S_GET_NAME(exp->X_add_symbol),
|
||||
GLOBAL_OFFSET_TABLE_NAME) == 0)
|
||||
{
|
||||
type = BFD_RELOC_ARM_GOTPC;
|
||||
pcrel = 1;
|
||||
}
|
||||
else if (exp->X_op == O_symbol)
|
||||
{
|
||||
type = BFD_RELOC_ARM_GOT32;
|
||||
}
|
||||
}
|
||||
|
||||
fix_new_exp (frag, where, (int) size, exp, pcrel, type);
|
||||
|
4
gnu/dist/gas/config/tc-arm.h
vendored
4
gnu/dist/gas/config/tc-arm.h
vendored
@ -71,7 +71,9 @@
|
||||
#define md_start_line_hook() arm_start_line_hook ()
|
||||
#define tc_frob_label(S) arm_frob_label (S)
|
||||
|
||||
/*#define obj_fix_adjustable(fixP) */ /* get this from obj-aout.h */
|
||||
/* adjust_reloc_syms doesn't know about the GOT */
|
||||
#define tc_fix_adjustable(fixP) \
|
||||
((fixP)->fx_r_type != BFD_RELOC_ARM_GOT32)
|
||||
|
||||
#define TC_FIX_TYPE PTR
|
||||
#define TC_INIT_FIX_DATA(FIXP) ((FIXP)->tc_fix_data = NULL)
|
||||
|
Loading…
Reference in New Issue
Block a user