mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-21 02:24:17 +08:00
* config/tc-ppc.c (md_apply_fix3): Replace haphazard code for
determining reloc type with code reading operands->reloc field.
This commit is contained in:
@ -1,3 +1,9 @@
|
|||||||
|
2001-08-08 Alan Modra <amodra@bigpond.net.au>
|
||||||
|
|
||||||
|
From 1999-10-25 Torbjorn Granlund <tege@swox.com>
|
||||||
|
* config/tc-ppc.c (md_apply_fix3): Replace haphazard code for
|
||||||
|
determining reloc type with code reading operands->reloc field.
|
||||||
|
|
||||||
2001-08-08 Alan Modra <amodra@bigpond.net.au>
|
2001-08-08 Alan Modra <amodra@bigpond.net.au>
|
||||||
|
|
||||||
* config/obj-elf.c (elf_copy_symbol_attributes): Make it a global
|
* config/obj-elf.c (elf_copy_symbol_attributes): Make it a global
|
||||||
|
@ -4945,37 +4945,8 @@ md_apply_fix3 (fixp, valuep, seg)
|
|||||||
/* Determine a BFD reloc value based on the operand information.
|
/* Determine a BFD reloc value based on the operand information.
|
||||||
We are only prepared to turn a few of the operands into
|
We are only prepared to turn a few of the operands into
|
||||||
relocs.
|
relocs.
|
||||||
FIXME: We need to handle the DS field at the very least.
|
For other operand types, give an error. */
|
||||||
FIXME: Selecting the reloc type is a bit haphazard; perhaps
|
if (operand->reloc == 0)
|
||||||
there should be a new field in the operand table. */
|
|
||||||
if ((operand->flags & PPC_OPERAND_RELATIVE) != 0
|
|
||||||
&& operand->bits == 26
|
|
||||||
&& operand->shift == 0)
|
|
||||||
fixp->fx_r_type = BFD_RELOC_PPC_B26;
|
|
||||||
else if ((operand->flags & PPC_OPERAND_RELATIVE) != 0
|
|
||||||
&& operand->bits == 16
|
|
||||||
&& operand->shift == 0)
|
|
||||||
fixp->fx_r_type = BFD_RELOC_PPC_B16;
|
|
||||||
else if ((operand->flags & PPC_OPERAND_ABSOLUTE) != 0
|
|
||||||
&& operand->bits == 26
|
|
||||||
&& operand->shift == 0)
|
|
||||||
fixp->fx_r_type = BFD_RELOC_PPC_BA26;
|
|
||||||
else if ((operand->flags & PPC_OPERAND_ABSOLUTE) != 0
|
|
||||||
&& operand->bits == 16
|
|
||||||
&& operand->shift == 0)
|
|
||||||
fixp->fx_r_type = BFD_RELOC_PPC_BA16;
|
|
||||||
else if ((operand->flags & PPC_OPERAND_PARENS) != 0
|
|
||||||
&& operand->bits == 16
|
|
||||||
&& operand->shift == 0
|
|
||||||
&& fixp->fx_addsy != NULL
|
|
||||||
&& ppc_is_toc_sym (fixp->fx_addsy))
|
|
||||||
{
|
|
||||||
fixp->fx_size = 2;
|
|
||||||
if (target_big_endian)
|
|
||||||
fixp->fx_where += 2;
|
|
||||||
fixp->fx_r_type = BFD_RELOC_PPC_TOC16;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
char *sfile;
|
char *sfile;
|
||||||
unsigned int sline;
|
unsigned int sline;
|
||||||
@ -4991,6 +4962,28 @@ md_apply_fix3 (fixp, valuep, seg)
|
|||||||
fixp->fx_done = 1;
|
fixp->fx_done = 1;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fixp->fx_r_type = operand->reloc;
|
||||||
|
|
||||||
|
if ((operand->flags & PPC_OPERAND_PARENS) != 0 && fixp->fx_addsy != NULL)
|
||||||
|
{
|
||||||
|
/* For ld/st/la reloc types (`la' == load address).
|
||||||
|
Instruction with D or DS field. */
|
||||||
|
if (ppc_is_toc_sym (fixp->fx_addsy))
|
||||||
|
{
|
||||||
|
fixp->fx_size = 2;
|
||||||
|
if (target_big_endian)
|
||||||
|
fixp->fx_where += 2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
as_bad_where (fixp->fx_file, fixp->fx_line,
|
||||||
|
_("unsupported relocation against %s"),
|
||||||
|
S_GET_NAME (fixp->fx_addsy));
|
||||||
|
fixp->fx_done = 1;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -5017,10 +5010,12 @@ md_apply_fix3 (fixp, valuep, seg)
|
|||||||
if (fixp->fx_pcrel)
|
if (fixp->fx_pcrel)
|
||||||
fixp->fx_r_type = BFD_RELOC_64_PCREL;
|
fixp->fx_r_type = BFD_RELOC_64_PCREL;
|
||||||
/* fall through */
|
/* fall through */
|
||||||
|
|
||||||
case BFD_RELOC_64_PCREL:
|
case BFD_RELOC_64_PCREL:
|
||||||
md_number_to_chars (fixp->fx_frag->fr_literal + fixp->fx_where,
|
md_number_to_chars (fixp->fx_frag->fr_literal + fixp->fx_where,
|
||||||
value, 8);
|
value, 8);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BFD_RELOC_LO16:
|
case BFD_RELOC_LO16:
|
||||||
case BFD_RELOC_16:
|
case BFD_RELOC_16:
|
||||||
case BFD_RELOC_GPREL16:
|
case BFD_RELOC_GPREL16:
|
||||||
@ -5071,6 +5066,7 @@ md_apply_fix3 (fixp, valuep, seg)
|
|||||||
md_number_to_chars (fixp->fx_frag->fr_literal + fixp->fx_where,
|
md_number_to_chars (fixp->fx_frag->fr_literal + fixp->fx_where,
|
||||||
value >> 16, 2);
|
value >> 16, 2);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BFD_RELOC_HI16_S:
|
case BFD_RELOC_HI16_S:
|
||||||
if (fixp->fx_pcrel)
|
if (fixp->fx_pcrel)
|
||||||
abort ();
|
abort ();
|
||||||
|
Reference in New Issue
Block a user