aboutsummaryrefslogtreecommitdiff
path: root/gas/config/tc-ppc.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2001-08-10 01:34:47 +0000
committerAlan Modra <amodra@gmail.com>2001-08-10 01:34:47 +0000
commit11b37b7b843d70275a0edee8a749b76dae4d37be (patch)
tree8e9f25f7daacbaa838a4e6ef5979075e7a6e5e03 /gas/config/tc-ppc.c
parent4e4210bf78ade7c87b4ba8ba8e243d355445e363 (diff)
downloadgdb-11b37b7b843d70275a0edee8a749b76dae4d37be.zip
gdb-11b37b7b843d70275a0edee8a749b76dae4d37be.tar.gz
gdb-11b37b7b843d70275a0edee8a749b76dae4d37be.tar.bz2
Revert 2001-08-08 changes.
Diffstat (limited to 'gas/config/tc-ppc.c')
-rw-r--r--gas/config/tc-ppc.c60
1 files changed, 32 insertions, 28 deletions
diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c
index 115920f..0710a67 100644
--- a/gas/config/tc-ppc.c
+++ b/gas/config/tc-ppc.c
@@ -4945,14 +4945,43 @@ md_apply_fix3 (fixp, valuep, seg)
/* Determine a BFD reloc value based on the operand information.
We are only prepared to turn a few of the operands into
relocs.
- For other operand types, give an error. */
- if (operand->reloc == 0)
+ FIXME: We need to handle the DS field at the very least.
+ FIXME: Selecting the reloc type is a bit haphazard; perhaps
+ 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;
unsigned int sline;
/* Use expr_symbol_where to see if this is an expression
- symbol. */
+ symbol. */
if (expr_symbol_where (fixp->fx_addsy, &sfile, &sline))
as_bad_where (fixp->fx_file, fixp->fx_line,
_("unresolved expression that must be resolved"));
@@ -4962,28 +4991,6 @@ md_apply_fix3 (fixp, valuep, seg)
fixp->fx_done = 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
{
@@ -5010,12 +5017,10 @@ md_apply_fix3 (fixp, valuep, seg)
if (fixp->fx_pcrel)
fixp->fx_r_type = BFD_RELOC_64_PCREL;
/* fall through */
-
case BFD_RELOC_64_PCREL:
md_number_to_chars (fixp->fx_frag->fr_literal + fixp->fx_where,
value, 8);
break;
-
case BFD_RELOC_LO16:
case BFD_RELOC_16:
case BFD_RELOC_GPREL16:
@@ -5066,7 +5071,6 @@ md_apply_fix3 (fixp, valuep, seg)
md_number_to_chars (fixp->fx_frag->fr_literal + fixp->fx_where,
value >> 16, 2);
break;
-
case BFD_RELOC_HI16_S:
if (fixp->fx_pcrel)
abort ();