Revert 2001-08-08 changes.

This commit is contained in:
Alan Modra 2001-08-10 01:34:47 +00:00
parent 4e4210bf78
commit 11b37b7b84
6 changed files with 116 additions and 108 deletions

View File

@ -1,3 +1,7 @@
2001-08-10 Alan Modra <amodra@bigpond.net.au>
* config/tc-ppc.c: Revert 2001-08-08.
2001-08-09 Alan Modra <amodra@bigpond.net.au>
* symbols.c: Add missing prototypes.

View File

@ -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 ();

View File

@ -1,3 +1,7 @@
2001-08-10 Alan Modra <amodra@one.net.au>
* ppc.h: Revert 2001-08-08.
2001-08-08 Alan Modra <amodra@one.net.au>
1999-10-25 Torbjorn Granlund <tege@swox.com>

View File

@ -144,7 +144,6 @@ struct powerpc_operand
/* One bit syntax flags. */
unsigned long flags;
int reloc;
};
/* Elements in the table are retrieved by indexing with values from

View File

@ -1,3 +1,7 @@
2001-08-10 Alan Modra <amodra@bigpond.net.au>
* ppc-opc.c: Revert 2001-08-08.
2001-08-09 Alan Modra <amodra@bigpond.net.au>
* dis-buf.c (generic_strcat_address): Add missing prototype.

View File

@ -24,7 +24,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "sysdep.h"
#include "opcode/ppc.h"
#include "opintl.h"
#include "bfd.h"
/* This file holds the PowerPC opcode table. The opcode table
includes almost all of the extended instruction mnemonics. This
@ -94,247 +93,241 @@ const struct powerpc_operand powerpc_operands[] =
/* The zero index is used to indicate the end of the list of
operands. */
#define UNUSED 0
{ 0, 0, 0, 0, 0, 0},
{ 0, 0, 0, 0, 0 },
/* The BA field in an XL form instruction. */
#define BA UNUSED + 1
#define BA_MASK (0x1f << 16)
{ 5, 16, 0, 0, PPC_OPERAND_CR, 0 },
{ 5, 16, 0, 0, PPC_OPERAND_CR },
/* The BA field in an XL form instruction when it must be the same
as the BT field in the same instruction. */
#define BAT BA + 1
{ 5, 16, insert_bat, extract_bat, PPC_OPERAND_FAKE, 0 },
{ 5, 16, insert_bat, extract_bat, PPC_OPERAND_FAKE },
/* The BB field in an XL form instruction. */
#define BB BAT + 1
#define BB_MASK (0x1f << 11)
{ 5, 11, 0, 0, PPC_OPERAND_CR, 0 },
{ 5, 11, 0, 0, PPC_OPERAND_CR },
/* The BB field in an XL form instruction when it must be the same
as the BA field in the same instruction. */
#define BBA BB + 1
{ 5, 11, insert_bba, extract_bba, PPC_OPERAND_FAKE, 0 },
{ 5, 11, insert_bba, extract_bba, PPC_OPERAND_FAKE },
/* The BD field in a B form instruction. The lower two bits are
forced to zero. */
#define BD BBA + 1
{ 16, 0, insert_bd, extract_bd, PPC_OPERAND_RELATIVE | PPC_OPERAND_SIGNED,
BFD_RELOC_PPC_B16 },
{ 16, 0, insert_bd, extract_bd, PPC_OPERAND_RELATIVE | PPC_OPERAND_SIGNED },
/* The BD field in a B form instruction when absolute addressing is
used. */
#define BDA BD + 1
{ 16, 0, insert_bd, extract_bd, PPC_OPERAND_ABSOLUTE | PPC_OPERAND_SIGNED,
BFD_RELOC_PPC_BA16 },
{ 16, 0, insert_bd, extract_bd, PPC_OPERAND_ABSOLUTE | PPC_OPERAND_SIGNED },
/* The BD field in a B form instruction when the - modifier is used.
This sets the y bit of the BO field appropriately. */
#define BDM BDA + 1
{ 16, 0, insert_bdm, extract_bdm, PPC_OPERAND_RELATIVE | PPC_OPERAND_SIGNED,
BFD_RELOC_PPC_B16 },
{ 16, 0, insert_bdm, extract_bdm,
PPC_OPERAND_RELATIVE | PPC_OPERAND_SIGNED },
/* The BD field in a B form instruction when the - modifier is used
and absolute address is used. */
#define BDMA BDM + 1
{ 16, 0, insert_bdm, extract_bdm, PPC_OPERAND_ABSOLUTE | PPC_OPERAND_SIGNED,
BFD_RELOC_PPC_BA16 },
{ 16, 0, insert_bdm, extract_bdm,
PPC_OPERAND_ABSOLUTE | PPC_OPERAND_SIGNED },
/* The BD field in a B form instruction when the + modifier is used.
This sets the y bit of the BO field appropriately. */
#define BDP BDMA + 1
{ 16, 0, insert_bdp, extract_bdp, PPC_OPERAND_RELATIVE | PPC_OPERAND_SIGNED,
BFD_RELOC_PPC_B16 },
{ 16, 0, insert_bdp, extract_bdp,
PPC_OPERAND_RELATIVE | PPC_OPERAND_SIGNED },
/* The BD field in a B form instruction when the + modifier is used
and absolute addressing is used. */
#define BDPA BDP + 1
{ 16, 0, insert_bdp, extract_bdp, PPC_OPERAND_ABSOLUTE | PPC_OPERAND_SIGNED,
BFD_RELOC_PPC_BA16 },
{ 16, 0, insert_bdp, extract_bdp,
PPC_OPERAND_ABSOLUTE | PPC_OPERAND_SIGNED },
/* The BF field in an X or XL form instruction. */
#define BF BDPA + 1
{ 3, 23, 0, 0, PPC_OPERAND_CR, 0 },
{ 3, 23, 0, 0, PPC_OPERAND_CR },
/* An optional BF field. This is used for comparison instructions,
in which an omitted BF field is taken as zero. */
#define OBF BF + 1
{ 3, 23, 0, 0, PPC_OPERAND_CR | PPC_OPERAND_OPTIONAL, 0 },
{ 3, 23, 0, 0, PPC_OPERAND_CR | PPC_OPERAND_OPTIONAL },
/* The BFA field in an X or XL form instruction. */
#define BFA OBF + 1
{ 3, 18, 0, 0, PPC_OPERAND_CR, 0 },
{ 3, 18, 0, 0, PPC_OPERAND_CR },
/* The BI field in a B form or XL form instruction. */
#define BI BFA + 1
#define BI_MASK (0x1f << 16)
{ 5, 16, 0, 0, PPC_OPERAND_CR, 0 },
{ 5, 16, 0, 0, PPC_OPERAND_CR },
/* The BO field in a B form instruction. Certain values are
illegal. */
#define BO BI + 1
#define BO_MASK (0x1f << 21)
{ 5, 21, insert_bo, extract_bo, 0, 0 },
{ 5, 21, insert_bo, extract_bo, 0 },
/* The BO field in a B form instruction when the + or - modifier is
used. This is like the BO field, but it must be even. */
#define BOE BO + 1
{ 5, 21, insert_boe, extract_boe, 0, 0 },
{ 5, 21, insert_boe, extract_boe, 0 },
/* The BT field in an X or XL form instruction. */
#define BT BOE + 1
{ 5, 21, 0, 0, PPC_OPERAND_CR, 0 },
{ 5, 21, 0, 0, PPC_OPERAND_CR },
/* The condition register number portion of the BI field in a B form
or XL form instruction. This is used for the extended
conditional branch mnemonics, which set the lower two bits of the
BI field. This field is optional. */
#define CR BT + 1
{ 3, 18, 0, 0, PPC_OPERAND_CR | PPC_OPERAND_OPTIONAL, 0 },
{ 3, 18, 0, 0, PPC_OPERAND_CR | PPC_OPERAND_OPTIONAL },
/* The D field in a D form instruction. This is a displacement off
a register, and implies that the next operand is a register in
parentheses. */
#define D CR + 1
{ 16, 0, 0, 0, PPC_OPERAND_PARENS | PPC_OPERAND_SIGNED,
BFD_RELOC_PPC_TOC16 },
{ 16, 0, 0, 0, PPC_OPERAND_PARENS | PPC_OPERAND_SIGNED },
/* The DS field in a DS form instruction. This is like D, but the
lower two bits are forced to zero. */
#define DS D + 1
{ 16, 0, insert_ds, extract_ds, PPC_OPERAND_PARENS | PPC_OPERAND_SIGNED,
BFD_RELOC_PPC_TOC16 },
{ 16, 0, insert_ds, extract_ds, PPC_OPERAND_PARENS | PPC_OPERAND_SIGNED },
/* The E field in a wrteei instruction. */
#define E DS + 1
{ 1, 15, 0, 0, 0, 0 },
{ 1, 15, 0, 0, 0 },
/* The FL1 field in a POWER SC form instruction. */
#define FL1 E + 1
{ 4, 12, 0, 0, 0, 0 },
{ 4, 12, 0, 0, 0 },
/* The FL2 field in a POWER SC form instruction. */
#define FL2 FL1 + 1
{ 3, 2, 0, 0, 0, 0 },
{ 3, 2, 0, 0, 0 },
/* The FLM field in an XFL form instruction. */
#define FLM FL2 + 1
{ 8, 17, 0, 0, 0, 0 },
{ 8, 17, 0, 0, 0 },
/* The FRA field in an X or A form instruction. */
#define FRA FLM + 1
#define FRA_MASK (0x1f << 16)
{ 5, 16, 0, 0, PPC_OPERAND_FPR, 0 },
{ 5, 16, 0, 0, PPC_OPERAND_FPR },
/* The FRB field in an X or A form instruction. */
#define FRB FRA + 1
#define FRB_MASK (0x1f << 11)
{ 5, 11, 0, 0, PPC_OPERAND_FPR, 0 },
{ 5, 11, 0, 0, PPC_OPERAND_FPR },
/* The FRC field in an A form instruction. */
#define FRC FRB + 1
#define FRC_MASK (0x1f << 6)
{ 5, 6, 0, 0, PPC_OPERAND_FPR, 0 },
{ 5, 6, 0, 0, PPC_OPERAND_FPR },
/* The FRS field in an X form instruction or the FRT field in a D, X
or A form instruction. */
#define FRS FRC + 1
#define FRT FRS
{ 5, 21, 0, 0, PPC_OPERAND_FPR, 0 },
{ 5, 21, 0, 0, PPC_OPERAND_FPR },
/* The FXM field in an XFX instruction. */
#define FXM FRS + 1
#define FXM_MASK (0xff << 12)
{ 8, 12, 0, 0, 0, 0 },
{ 8, 12, 0, 0, 0 },
/* The L field in a D or X form instruction. */
#define L FXM + 1
{ 1, 21, 0, 0, PPC_OPERAND_OPTIONAL, 0 },
{ 1, 21, 0, 0, PPC_OPERAND_OPTIONAL },
/* The LEV field in a POWER SC form instruction. */
#define LEV L + 1
{ 7, 5, 0, 0, 0, 0 },
{ 7, 5, 0, 0, 0 },
/* The LI field in an I form instruction. The lower two bits are
forced to zero. */
#define LI LEV + 1
{ 26, 0, insert_li, extract_li, PPC_OPERAND_RELATIVE | PPC_OPERAND_SIGNED,
BFD_RELOC_PPC_B26 },
{ 26, 0, insert_li, extract_li, PPC_OPERAND_RELATIVE | PPC_OPERAND_SIGNED },
/* The LI field in an I form instruction when used as an absolute
address. */
#define LIA LI + 1
{ 26, 0, insert_li, extract_li, PPC_OPERAND_ABSOLUTE | PPC_OPERAND_SIGNED,
BFD_RELOC_PPC_BA26 },
{ 26, 0, insert_li, extract_li, PPC_OPERAND_ABSOLUTE | PPC_OPERAND_SIGNED },
/* The MB field in an M form instruction. */
#define MB LIA + 1
#define MB_MASK (0x1f << 6)
{ 5, 6, 0, 0, 0, 0 },
{ 5, 6, 0, 0, 0 },
/* The ME field in an M form instruction. */
#define ME MB + 1
#define ME_MASK (0x1f << 1)
{ 5, 1, 0, 0, 0, 0 },
{ 5, 1, 0, 0, 0 },
/* The MB and ME fields in an M form instruction expressed a single
operand which is a bitmask indicating which bits to select. This
is a two operand form using PPC_OPERAND_NEXT. See the
description in opcode/ppc.h for what this means. */
#define MBE ME + 1
{ 5, 6, 0, 0, PPC_OPERAND_OPTIONAL | PPC_OPERAND_NEXT, 0 },
{ 32, 0, insert_mbe, extract_mbe, 0, 0 },
{ 5, 6, 0, 0, PPC_OPERAND_OPTIONAL | PPC_OPERAND_NEXT },
{ 32, 0, insert_mbe, extract_mbe, 0 },
/* The MB or ME field in an MD or MDS form instruction. The high
bit is wrapped to the low end. */
#define MB6 MBE + 2
#define ME6 MB6
#define MB6_MASK (0x3f << 5)
{ 6, 5, insert_mb6, extract_mb6, 0, 0 },
{ 6, 5, insert_mb6, extract_mb6, 0 },
/* The NB field in an X form instruction. The value 32 is stored as
0. */
#define NB MB6 + 1
{ 6, 11, insert_nb, extract_nb, 0, 0 },
{ 6, 11, insert_nb, extract_nb, 0 },
/* The NSI field in a D form instruction. This is the same as the
SI field, only negated. */
#define NSI NB + 1
{ 16, 0, insert_nsi, extract_nsi,
PPC_OPERAND_NEGATIVE | PPC_OPERAND_SIGNED, 0 },
PPC_OPERAND_NEGATIVE | PPC_OPERAND_SIGNED },
/* The RA field in an D, DS, X, XO, M, or MDS form instruction. */
#define RA NSI + 1
#define RA_MASK (0x1f << 16)
{ 5, 16, 0, 0, PPC_OPERAND_GPR, 0 },
{ 5, 16, 0, 0, PPC_OPERAND_GPR },
/* The RA field in a D or X form instruction which is an updating
load, which means that the RA field may not be zero and may not
equal the RT field. */
#define RAL RA + 1
{ 5, 16, insert_ral, 0, PPC_OPERAND_GPR, 0 },
{ 5, 16, insert_ral, 0, PPC_OPERAND_GPR },
/* The RA field in an lmw instruction, which has special value
restrictions. */
#define RAM RAL + 1
{ 5, 16, insert_ram, 0, PPC_OPERAND_GPR, 0 },
{ 5, 16, insert_ram, 0, PPC_OPERAND_GPR },
/* The RA field in a D or X form instruction which is an updating
store or an updating floating point load, which means that the RA
field may not be zero. */
#define RAS RAM + 1
{ 5, 16, insert_ras, 0, PPC_OPERAND_GPR, 0 },
{ 5, 16, insert_ras, 0, PPC_OPERAND_GPR },
/* The RB field in an X, XO, M, or MDS form instruction. */
#define RB RAS + 1
#define RB_MASK (0x1f << 11)
{ 5, 11, 0, 0, PPC_OPERAND_GPR, 0 },
{ 5, 11, 0, 0, PPC_OPERAND_GPR },
/* The RB field in an X form instruction when it must be the same as
the RS field in the instruction. This is used for extended
mnemonics like mr. */
#define RBS RB + 1
{ 5, 1, insert_rbs, extract_rbs, PPC_OPERAND_FAKE, 0 },
{ 5, 1, insert_rbs, extract_rbs, PPC_OPERAND_FAKE },
/* The RS field in a D, DS, X, XFX, XS, M, MD or MDS form
instruction or the RT field in a D, DS, X, XFX or XO form
@ -342,101 +335,101 @@ const struct powerpc_operand powerpc_operands[] =
#define RS RBS + 1
#define RT RS
#define RT_MASK (0x1f << 21)
{ 5, 21, 0, 0, PPC_OPERAND_GPR, 0 },
{ 5, 21, 0, 0, PPC_OPERAND_GPR },
/* The SH field in an X or M form instruction. */
#define SH RS + 1
#define SH_MASK (0x1f << 11)
{ 5, 11, 0, 0, 0, 0 },
{ 5, 11, 0, 0, 0 },
/* The SH field in an MD form instruction. This is split. */
#define SH6 SH + 1
#define SH6_MASK ((0x1f << 11) | (1 << 1))
{ 6, 1, insert_sh6, extract_sh6, 0, 0 },
{ 6, 1, insert_sh6, extract_sh6, 0 },
/* The SI field in a D form instruction. */
#define SI SH6 + 1
{ 16, 0, 0, 0, PPC_OPERAND_SIGNED, 0 },
{ 16, 0, 0, 0, PPC_OPERAND_SIGNED },
/* The SI field in a D form instruction when we accept a wide range
of positive values. */
#define SISIGNOPT SI + 1
{ 16, 0, 0, 0, PPC_OPERAND_SIGNED | PPC_OPERAND_SIGNOPT, 0 },
{ 16, 0, 0, 0, PPC_OPERAND_SIGNED | PPC_OPERAND_SIGNOPT },
/* The SPR field in an XFX form instruction. This is flipped--the
lower 5 bits are stored in the upper 5 and vice- versa. */
#define SPR SISIGNOPT + 1
#define SPR_MASK (0x3ff << 11)
{ 10, 11, insert_spr, extract_spr, 0, 0 },
{ 10, 11, insert_spr, extract_spr, 0 },
/* The BAT index number in an XFX form m[ft]ibat[lu] instruction. */
#define SPRBAT SPR + 1
#define SPRBAT_MASK (0x3 << 17)
{ 2, 17, 0, 0, 0, 0 },
{ 2, 17, 0, 0, 0 },
/* The SPRG register number in an XFX form m[ft]sprg instruction. */
#define SPRG SPRBAT + 1
#define SPRG_MASK (0x3 << 16)
{ 2, 16, 0, 0, 0, 0 },
{ 2, 16, 0, 0, 0 },
/* The SR field in an X form instruction. */
#define SR SPRG + 1
{ 4, 16, 0, 0, 0, 0 },
{ 4, 16, 0, 0, 0 },
/* The SV field in a POWER SC form instruction. */
#define SV SR + 1
{ 14, 2, 0, 0, 0, 0 },
{ 14, 2, 0, 0, 0 },
/* The TBR field in an XFX form instruction. This is like the SPR
field, but it is optional. */
#define TBR SV + 1
{ 10, 11, insert_tbr, extract_tbr, PPC_OPERAND_OPTIONAL, 0 },
{ 10, 11, insert_tbr, extract_tbr, PPC_OPERAND_OPTIONAL },
/* The TO field in a D or X form instruction. */
#define TO TBR + 1
#define TO_MASK (0x1f << 21)
{ 5, 21, 0, 0, 0, 0 },
{ 5, 21, 0, 0, 0 },
/* The U field in an X form instruction. */
#define U TO + 1
{ 4, 12, 0, 0, 0, 0 },
{ 4, 12, 0, 0, 0 },
/* The UI field in a D form instruction. */
#define UI U + 1
{ 16, 0, 0, 0, 0, 0 },
{ 16, 0, 0, 0, 0 },
/* The VA field in a VA, VX or VXR form instruction. */
#define VA UI + 1
#define VA_MASK (0x1f << 16)
{5, 16, 0, 0, PPC_OPERAND_VR, 0},
{5, 16, 0, 0, PPC_OPERAND_VR},
/* The VB field in a VA, VX or VXR form instruction. */
#define VB VA + 1
#define VB_MASK (0x1f << 11)
{5, 11, 0, 0, PPC_OPERAND_VR, 0},
{5, 11, 0, 0, PPC_OPERAND_VR},
/* The VC field in a VA form instruction. */
#define VC VB + 1
#define VC_MASK (0x1f << 6)
{5, 6, 0, 0, PPC_OPERAND_VR, 0},
{5, 6, 0, 0, PPC_OPERAND_VR},
/* The VD or VS field in a VA, VX, VXR or X form instruction. */
#define VD VC + 1
#define VS VD
#define VD_MASK (0x1f << 21)
{5, 21, 0, 0, PPC_OPERAND_VR, 0},
{5, 21, 0, 0, PPC_OPERAND_VR},
/* The SIMM field in a VX form instruction. */
#define SIMM VD + 1
{ 5, 16, 0, 0, PPC_OPERAND_SIGNED, 0},
{ 5, 16, 0, 0, PPC_OPERAND_SIGNED},
/* The UIMM field in a VX form instruction. */
#define UIMM SIMM + 1
{ 5, 16, 0, 0, 0, 0 },
{ 5, 16, 0, 0, 0 },
/* The SHB field in a VA form instruction. */
#define SHB UIMM + 1
{ 4, 6, 0, 0, 0, 0 },
{ 4, 6, 0, 0, 0 },
};
/* The functions used to insert and extract complicated operands. */