mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-20 18:08:24 +08:00
fix definitions of md_create_long_jump, md_create_short_jump,
md_number_to_chars, and md_section_align to correctly use valueT and addressT
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@ -1244,8 +1244,8 @@ tc_aout_fix_to_chars ()
|
||||
void
|
||||
md_create_short_jump (ptr, from_addr, to_addr, frag, to_symbol)
|
||||
char *ptr;
|
||||
long from_addr;
|
||||
long to_addr;
|
||||
addressT from_addr;
|
||||
addressT to_addr;
|
||||
fragS *frag;
|
||||
symbolS *to_symbol;
|
||||
{
|
||||
@ -1255,7 +1255,7 @@ md_create_short_jump (ptr, from_addr, to_addr, frag, to_symbol)
|
||||
void
|
||||
md_create_long_jump (ptr, from_addr, to_addr, frag, to_symbol)
|
||||
char *ptr;
|
||||
long from_addr, to_addr;
|
||||
addressT from_addr, to_addr;
|
||||
fragS *frag;
|
||||
symbolS *to_symbol;
|
||||
{
|
||||
@ -1402,10 +1402,10 @@ md_convert_frag (headers, fragP)
|
||||
|
||||
}
|
||||
|
||||
long
|
||||
valueT
|
||||
DEFUN (md_section_align, (seg, size),
|
||||
segT seg AND
|
||||
long size)
|
||||
valueT size)
|
||||
{
|
||||
return ((size + (1 << section_alignment[(int) seg]) - 1)
|
||||
& (-1 << section_alignment[(int) seg]));
|
||||
@ -1506,7 +1506,7 @@ md_estimate_size_before_relax (fragP, segment_type)
|
||||
void
|
||||
md_number_to_chars (ptr, use, nbytes)
|
||||
char *ptr;
|
||||
long use;
|
||||
valueT use;
|
||||
int nbytes;
|
||||
{
|
||||
switch (nbytes)
|
||||
|
6941
gas/config/tc-hppa.c
Normal file
6941
gas/config/tc-hppa.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -2161,7 +2161,7 @@ const int md_reloc_size = 8; /* Size of relocation record */
|
||||
void
|
||||
md_create_short_jump (ptr, from_addr, to_addr, frag, to_symbol)
|
||||
char *ptr;
|
||||
valueT from_addr, to_addr;
|
||||
addressT from_addr, to_addr;
|
||||
fragS *frag;
|
||||
symbolS *to_symbol;
|
||||
{
|
||||
@ -2175,7 +2175,7 @@ md_create_short_jump (ptr, from_addr, to_addr, frag, to_symbol)
|
||||
void
|
||||
md_create_long_jump (ptr, from_addr, to_addr, frag, to_symbol)
|
||||
char *ptr;
|
||||
valueT from_addr, to_addr;
|
||||
addressT from_addr, to_addr;
|
||||
fragS *frag;
|
||||
symbolS *to_symbol;
|
||||
{
|
||||
|
@ -21,36 +21,6 @@
|
||||
|
||||
#include "opcode/i860.h"
|
||||
|
||||
/* incorporated from i860.h */
|
||||
enum reloc_type /* NOTE: three bits max, see struct reloc_info_i860.r_type */
|
||||
{
|
||||
NO_RELOC = 0, BRADDR, LOW0, LOW1, LOW2, LOW3, LOW4, SPLIT0, SPLIT1, SPLIT2, RELOC_32,
|
||||
};
|
||||
|
||||
enum highlow_type /* NOTE: two bits max, see reloc_info_i860.r_type */
|
||||
{
|
||||
NO_SPEC = 0, PAIR, HIGH, HIGHADJ,
|
||||
};
|
||||
|
||||
struct reloc_info_i860
|
||||
{
|
||||
unsigned long r_address;
|
||||
/*
|
||||
* Using bit fields here is a bad idea because the order is not portable. :-(
|
||||
*/
|
||||
unsigned int r_symbolnum: 24;
|
||||
unsigned int r_pcrel : 1;
|
||||
unsigned int r_extern : 1;
|
||||
/* combining the two field simplifies the argument passing in "new_fix()" */
|
||||
/* and is compatible with the existing Sparc #ifdef's */
|
||||
/* r_type: highlow_type - bits 5,4; reloc_type - bits 3-0 */
|
||||
unsigned int r_type : 6;
|
||||
long r_addend;
|
||||
};
|
||||
|
||||
#define relocation_info reloc_info_i860
|
||||
|
||||
|
||||
void md_begin ();
|
||||
void md_end ();
|
||||
void md_number_to_chars ();
|
||||
@ -65,13 +35,14 @@ void md_number_to_disp();
|
||||
void md_number_to_field ();
|
||||
void md_ri_to_chars ();
|
||||
static void i860_ip ();
|
||||
void emit_machine_reloc();
|
||||
/* void emit_machine_reloc(); */
|
||||
|
||||
int md_reloc_size = sizeof(struct relocation_info);
|
||||
const int md_reloc_size = sizeof (struct relocation_info);
|
||||
|
||||
void (*md_emit_relocations)() = emit_machine_reloc;
|
||||
/* void (*md_emit_relocations)() = emit_machine_reloc; */
|
||||
|
||||
const relax_typeS md_relax_table[] = { 0 };
|
||||
const relax_typeS md_relax_table[] =
|
||||
{0};
|
||||
|
||||
/* handle of the OPCODE hash table */
|
||||
static struct hash_control *op_hash = NULL;
|
||||
@ -80,7 +51,8 @@ static void s_dual(), s_enddual();
|
||||
static void s_atmp ();
|
||||
|
||||
const pseudo_typeS
|
||||
md_pseudo_table[] = {
|
||||
md_pseudo_table[] =
|
||||
{
|
||||
{"dual", s_dual, 4},
|
||||
{"enddual", s_enddual, 4},
|
||||
{"atmp", s_atmp, 4},
|
||||
@ -92,7 +64,7 @@ int md_long_jump_size = 4;
|
||||
|
||||
/* This array holds the chars that always start a comment. If the
|
||||
pre-processor is disabled, these aren't very useful */
|
||||
char comment_chars[] = "!/"; /* JF removed '|' from comment_chars */
|
||||
const char comment_chars[] = "!/"; /* JF removed '|' from comment_chars */
|
||||
|
||||
/* This array holds the chars that only start a comment at the beginning of
|
||||
a line. If the line seems to have the form '# 123 filename'
|
||||
@ -101,15 +73,17 @@ char comment_chars[] = "!/"; /* JF removed '|' from comment_chars */
|
||||
first line of the input file. This is because the compiler outputs
|
||||
#NO_APP at the beginning of its output. */
|
||||
/* Also note that comments like this one will always work. */
|
||||
char line_comment_chars[] = "#/";
|
||||
const char line_comment_chars[] = "#/";
|
||||
|
||||
const char line_separator_chars[] = "";
|
||||
|
||||
/* Chars that can be used to separate mant from exp in floating point nums */
|
||||
char EXP_CHARS[] = "eE";
|
||||
const char EXP_CHARS[] = "eE";
|
||||
|
||||
/* Chars that mean this number is a floating point constant */
|
||||
/* As in 0f12.456 */
|
||||
/* or 0d1.2345e12 */
|
||||
char FLT_CHARS[] = "rRsSfFdDxXpP";
|
||||
const char FLT_CHARS[] = "rRsSfFdDxXpP";
|
||||
|
||||
/* Also be aware that MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT may have to be
|
||||
changed in read.c . Ideally it shouldn't have to know about it at all,
|
||||
@ -121,7 +95,8 @@ static unsigned char octal[256];
|
||||
#define isoctal(c) octal[c]
|
||||
static unsigned char toHex[256];
|
||||
|
||||
struct i860_it {
|
||||
struct i860_it
|
||||
{
|
||||
char *error;
|
||||
unsigned long opcode;
|
||||
struct nlist *nlistp;
|
||||
@ -171,15 +146,18 @@ static void
|
||||
s_atmp ()
|
||||
{
|
||||
register int temp;
|
||||
if (strncmp(input_line_pointer, "sp", 2) == 0) {
|
||||
if (strncmp (input_line_pointer, "sp", 2) == 0)
|
||||
{
|
||||
input_line_pointer += 2;
|
||||
atmp = 2;
|
||||
}
|
||||
else if (strncmp(input_line_pointer, "fp", 2) == 0) {
|
||||
else if (strncmp (input_line_pointer, "fp", 2) == 0)
|
||||
{
|
||||
input_line_pointer += 2;
|
||||
atmp = 3;
|
||||
}
|
||||
else if (strncmp(input_line_pointer, "r", 1) == 0) {
|
||||
else if (strncmp (input_line_pointer, "r", 1) == 0)
|
||||
{
|
||||
input_line_pointer += 1;
|
||||
temp = get_absolute_expression ();
|
||||
if (temp >= 0 && temp <= 31)
|
||||
@ -187,7 +165,8 @@ static void
|
||||
else
|
||||
as_bad ("Unknown temporary pseudo register");
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
as_bad ("Unknown temporary pseudo register");
|
||||
}
|
||||
demand_empty_rest_of_line ();
|
||||
@ -226,7 +205,8 @@ void
|
||||
lose = 1;
|
||||
}
|
||||
++i;
|
||||
} while (i < NUMOPCODES
|
||||
}
|
||||
while (i < NUMOPCODES
|
||||
&& !strcmp (i860_opcodes[i].name, name));
|
||||
}
|
||||
|
||||
@ -263,11 +243,13 @@ char *str;
|
||||
i860_ip (str);
|
||||
|
||||
/* check for expandable flag to produce pseudo-instructions */
|
||||
if (the_insn.expand != 0 && the_insn.highlow == NO_SPEC) {
|
||||
if (the_insn.expand != 0 && the_insn.highlow == NO_SPEC)
|
||||
{
|
||||
for (i = 0; i < 3; i++)
|
||||
pseudo[i] = the_insn;
|
||||
|
||||
switch (the_insn.expand) {
|
||||
switch (the_insn.expand)
|
||||
{
|
||||
|
||||
case E_DELAY:
|
||||
no_opcodes = 1;
|
||||
@ -380,7 +362,8 @@ char *str;
|
||||
}
|
||||
|
||||
i = 0;
|
||||
do { /* always produce at least one opcode */
|
||||
do
|
||||
{ /* always produce at least one opcode */
|
||||
toP = frag_more (4);
|
||||
/* put out the opcode */
|
||||
md_number_to_chars (toP, the_insn.opcode, 4);
|
||||
@ -389,9 +372,9 @@ char *str;
|
||||
last_expand = the_insn.pcrel;
|
||||
|
||||
/* put out the symbol-dependent stuff */
|
||||
if (the_insn.reloc != NO_RELOC) {
|
||||
fix_new(
|
||||
frag_now, /* which frag */
|
||||
if (the_insn.reloc != NO_RELOC)
|
||||
{
|
||||
fix_new (frag_now, /* which frag */
|
||||
(toP - frag_now->fr_literal), /* where */
|
||||
4, /* size */
|
||||
the_insn.exp.X_add_symbol,
|
||||
@ -399,11 +382,11 @@ char *str;
|
||||
the_insn.exp.X_add_number,
|
||||
the_insn.pcrel,
|
||||
/* merge bit fields into one argument */
|
||||
(int)(((the_insn.highlow & 0x3) << 4) | (the_insn.reloc & 0xf))
|
||||
);
|
||||
(int) (((the_insn.highlow & 0x3) << 4) | (the_insn.reloc & 0xf)));
|
||||
}
|
||||
the_insn = pseudo[++i];
|
||||
} while (--no_opcodes > 0);
|
||||
}
|
||||
while (--no_opcodes > 0);
|
||||
|
||||
}
|
||||
|
||||
@ -425,7 +408,8 @@ char *str;
|
||||
|
||||
for (s = str; islower (*s) || *s == '.' || *s == '3'; ++s)
|
||||
;
|
||||
switch (*s) {
|
||||
switch (*s)
|
||||
{
|
||||
|
||||
case '\0':
|
||||
break;
|
||||
@ -444,7 +428,8 @@ char *str;
|
||||
exit (1);
|
||||
}
|
||||
|
||||
if (strncmp(str, "d.", 2) == 0) { /* check for d. opcode prefix */
|
||||
if (strncmp (str, "d.", 2) == 0)
|
||||
{ /* check for d. opcode prefix */
|
||||
if (dual_mode == DUAL_ON)
|
||||
dual_mode = DUAL_ONDDOT;
|
||||
else
|
||||
@ -452,17 +437,20 @@ char *str;
|
||||
str += 2;
|
||||
}
|
||||
|
||||
if ((insn = (struct i860_opcode *) hash_find(op_hash, str)) == NULL) {
|
||||
if ((insn = (struct i860_opcode *) hash_find (op_hash, str)) == NULL)
|
||||
{
|
||||
if (dual_mode == DUAL_DDOT || dual_mode == DUAL_ONDDOT)
|
||||
str -= 2;
|
||||
as_bad ("Unknown opcode: `%s'", str);
|
||||
return;
|
||||
}
|
||||
if (comma) {
|
||||
if (comma)
|
||||
{
|
||||
*--s = ',';
|
||||
}
|
||||
argsStart = s;
|
||||
for (;;) {
|
||||
for (;;)
|
||||
{
|
||||
opcode = insn->match;
|
||||
memset (&the_insn, '\0', sizeof (the_insn));
|
||||
the_insn.reloc = NO_RELOC;
|
||||
@ -471,11 +459,14 @@ char *str;
|
||||
* Build the opcode, checking as we go to make
|
||||
* sure that the operands match
|
||||
*/
|
||||
for (args = insn->args; ; ++args) {
|
||||
switch (*args) {
|
||||
for (args = insn->args;; ++args)
|
||||
{
|
||||
switch (*args)
|
||||
{
|
||||
|
||||
case '\0': /* end of args */
|
||||
if (*s == '\0') {
|
||||
if (*s == '\0')
|
||||
{
|
||||
match = 1;
|
||||
}
|
||||
break;
|
||||
@ -490,8 +481,10 @@ char *str;
|
||||
break;
|
||||
|
||||
case '#': /* must be at least one digit */
|
||||
if (isdigit(*s++)) {
|
||||
while (isdigit(*s)) {
|
||||
if (isdigit (*s++))
|
||||
{
|
||||
while (isdigit (*s))
|
||||
{
|
||||
++s;
|
||||
}
|
||||
continue;
|
||||
@ -501,11 +494,13 @@ char *str;
|
||||
case '1': /* next operand must be a register */
|
||||
case '2':
|
||||
case 'd':
|
||||
switch (*s) {
|
||||
switch (*s)
|
||||
{
|
||||
|
||||
case 'f': /* frame pointer */
|
||||
s++;
|
||||
if (*s++ == 'p') {
|
||||
if (*s++ == 'p')
|
||||
{
|
||||
mask = 0x3;
|
||||
break;
|
||||
}
|
||||
@ -513,7 +508,8 @@ char *str;
|
||||
|
||||
case 's': /* stack pointer */
|
||||
s++;
|
||||
if (*s++ == 'p') {
|
||||
if (*s++ == 'p')
|
||||
{
|
||||
mask = 0x2;
|
||||
break;
|
||||
}
|
||||
@ -521,14 +517,19 @@ char *str;
|
||||
|
||||
case 'r': /* any register */
|
||||
s++;
|
||||
if (!isdigit(c = *s++)) {
|
||||
if (!isdigit (c = *s++))
|
||||
{
|
||||
goto error;
|
||||
}
|
||||
if (isdigit(*s)) {
|
||||
if ((c = 10 * (c - '0') + (*s++ - '0')) >= 32) {
|
||||
if (isdigit (*s))
|
||||
{
|
||||
if ((c = 10 * (c - '0') + (*s++ - '0')) >= 32)
|
||||
{
|
||||
goto error;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
c -= '0';
|
||||
}
|
||||
mask = c;
|
||||
@ -541,7 +542,8 @@ char *str;
|
||||
* Got the register, now figure out where
|
||||
* it goes in the opcode.
|
||||
*/
|
||||
switch (*args) {
|
||||
switch (*args)
|
||||
{
|
||||
|
||||
case '1':
|
||||
opcode |= mask << 11;
|
||||
@ -561,17 +563,23 @@ char *str;
|
||||
case 'e': /* next operand is a floating point register */
|
||||
case 'f':
|
||||
case 'g':
|
||||
if (*s++ == 'f' && isdigit(*s)) {
|
||||
if (*s++ == 'f' && isdigit (*s))
|
||||
{
|
||||
mask = *s++;
|
||||
if (isdigit(*s)) {
|
||||
if (isdigit (*s))
|
||||
{
|
||||
mask = 10 * (mask - '0') + (*s++ - '0');
|
||||
if (mask >= 32) {
|
||||
if (mask >= 32)
|
||||
{
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
mask -= '0';
|
||||
}
|
||||
switch (*args) {
|
||||
switch (*args)
|
||||
{
|
||||
|
||||
case 'e':
|
||||
opcode |= mask << 11;
|
||||
@ -597,32 +605,38 @@ char *str;
|
||||
break;
|
||||
|
||||
case 'c': /* next operand must be a control register */
|
||||
if (strncmp(s, "fir", 3) == 0) {
|
||||
if (strncmp (s, "fir", 3) == 0)
|
||||
{
|
||||
opcode |= 0x0 << 21;
|
||||
s += 3;
|
||||
continue;
|
||||
}
|
||||
if (strncmp(s, "psr", 3) == 0) {
|
||||
if (strncmp (s, "psr", 3) == 0)
|
||||
{
|
||||
opcode |= 0x1 << 21;
|
||||
s += 3;
|
||||
continue;
|
||||
}
|
||||
if (strncmp(s, "dirbase", 7) == 0) {
|
||||
if (strncmp (s, "dirbase", 7) == 0)
|
||||
{
|
||||
opcode |= 0x2 << 21;
|
||||
s += 7;
|
||||
continue;
|
||||
}
|
||||
if (strncmp(s, "db", 2) == 0) {
|
||||
if (strncmp (s, "db", 2) == 0)
|
||||
{
|
||||
opcode |= 0x3 << 21;
|
||||
s += 2;
|
||||
continue;
|
||||
}
|
||||
if (strncmp(s, "fsr", 3) == 0) {
|
||||
if (strncmp (s, "fsr", 3) == 0)
|
||||
{
|
||||
opcode |= 0x4 << 21;
|
||||
s += 3;
|
||||
continue;
|
||||
}
|
||||
if (strncmp(s, "epsr", 4) == 0) {
|
||||
if (strncmp (s, "epsr", 4) == 0)
|
||||
{
|
||||
opcode |= 0x5 << 21;
|
||||
s += 4;
|
||||
continue;
|
||||
@ -631,7 +645,8 @@ char *str;
|
||||
|
||||
case '5': /* 5 bit immediate in src1 */
|
||||
memset (&the_insn, '\0', sizeof (the_insn));
|
||||
if ( !getExpression(s)) {
|
||||
if (!getExpression (s))
|
||||
{
|
||||
s = expr_end;
|
||||
if (the_insn.exp.X_add_number & ~0x1f)
|
||||
as_bad ("5-bit immediate too large");
|
||||
@ -681,13 +696,18 @@ char *str;
|
||||
immediate:
|
||||
if (*s == ' ')
|
||||
s++;
|
||||
if (strncmp(s, "ha%", 3) == 0) {
|
||||
if (strncmp (s, "ha%", 3) == 0)
|
||||
{
|
||||
the_insn.highlow = HIGHADJ;
|
||||
s += 3;
|
||||
} else if (strncmp(s, "h%", 2) == 0) {
|
||||
}
|
||||
else if (strncmp (s, "h%", 2) == 0)
|
||||
{
|
||||
the_insn.highlow = HIGH;
|
||||
s += 2;
|
||||
} else if (strncmp(s, "l%", 2) == 0) {
|
||||
}
|
||||
else if (strncmp (s, "l%", 2) == 0)
|
||||
{
|
||||
the_insn.highlow = PAIR;
|
||||
s += 2;
|
||||
}
|
||||
@ -698,7 +718,8 @@ char *str;
|
||||
in the input string. Try not to create U symbols for
|
||||
registers, etc. */
|
||||
|
||||
if ( !getExpression(s)) {
|
||||
if (!getExpression (s))
|
||||
{
|
||||
s = expr_end;
|
||||
continue;
|
||||
}
|
||||
@ -742,7 +763,8 @@ char *str;
|
||||
|
||||
save_in = input_line_pointer;
|
||||
input_line_pointer = str;
|
||||
switch (seg = expression(&the_insn.exp)) {
|
||||
switch (seg = expression (&the_insn.exp))
|
||||
{
|
||||
|
||||
case SEG_ABSOLUTE:
|
||||
case SEG_TEXT:
|
||||
@ -790,7 +812,8 @@ int *sizeP;
|
||||
char *t;
|
||||
char *atof_ieee ();
|
||||
|
||||
switch(type) {
|
||||
switch (type)
|
||||
{
|
||||
|
||||
case 'f':
|
||||
case 'F':
|
||||
@ -824,7 +847,8 @@ int *sizeP;
|
||||
if (t)
|
||||
input_line_pointer = t;
|
||||
*sizeP = prec * sizeof (LITTLENUM_TYPE);
|
||||
for(wordP=words;prec--;) {
|
||||
for (wordP = words; prec--;)
|
||||
{
|
||||
md_number_to_chars (litP, (long) (*wordP++), sizeof (LITTLENUM_TYPE));
|
||||
litP += sizeof (LITTLENUM_TYPE);
|
||||
}
|
||||
@ -837,10 +861,11 @@ int *sizeP;
|
||||
void
|
||||
md_number_to_chars (buf, val, n)
|
||||
char *buf;
|
||||
long val;
|
||||
valueT val;
|
||||
int n;
|
||||
{
|
||||
switch(n) {
|
||||
switch (n)
|
||||
{
|
||||
|
||||
case 4:
|
||||
*buf++ = val >> 24;
|
||||
@ -857,7 +882,8 @@ int n;
|
||||
return;
|
||||
}
|
||||
|
||||
void md_number_to_imm(buf,val,n, fixP)
|
||||
void
|
||||
md_number_to_imm (buf, val, n, fixP)
|
||||
char *buf;
|
||||
long val;
|
||||
int n;
|
||||
@ -967,7 +993,7 @@ fixS *fixP;
|
||||
void
|
||||
md_create_short_jump (ptr, from_addr, to_addr, frag, to_symbol)
|
||||
char *ptr;
|
||||
long from_addr, to_addr;
|
||||
addressT from_addr, to_addr;
|
||||
fragS *frag;
|
||||
symbolS *to_symbol;
|
||||
{
|
||||
@ -1036,8 +1062,7 @@ register fragS *fragP;
|
||||
void
|
||||
md_create_long_jump (ptr, from_addr, to_addr, frag, to_symbol)
|
||||
char *ptr;
|
||||
long from_addr,
|
||||
to_addr;
|
||||
addressT from_addr, to_addr;
|
||||
fragS *frag;
|
||||
symbolS *to_symbol;
|
||||
{
|
||||
@ -1054,7 +1079,8 @@ segT segtype;
|
||||
}
|
||||
|
||||
/* for debugging only, must match enum reloc_type */
|
||||
static char *Reloc[] = {
|
||||
static char *Reloc[] =
|
||||
{
|
||||
"NO_RELOC",
|
||||
"BRADDR",
|
||||
"LOW0",
|
||||
@ -1067,7 +1093,8 @@ static char *Reloc[] = {
|
||||
"SPLIT2",
|
||||
"RELOC_32",
|
||||
};
|
||||
static char *Highlow[] = {
|
||||
static char *Highlow[] =
|
||||
{
|
||||
"NO_SPEC",
|
||||
"PAIR",
|
||||
"HIGH",
|
||||
@ -1077,7 +1104,8 @@ static void
|
||||
print_insn (insn)
|
||||
struct i860_it *insn;
|
||||
{
|
||||
if (insn->error) {
|
||||
if (insn->error)
|
||||
{
|
||||
fprintf (stderr, "ERROR: %s\n");
|
||||
}
|
||||
fprintf (stderr, "opcode=0x%08x\t", insn->opcode);
|
||||
@ -1108,6 +1136,7 @@ char ***vecP;
|
||||
return 1;
|
||||
}
|
||||
|
||||
#ifdef comment
|
||||
/*
|
||||
* I860 relocations are completely different, so it needs
|
||||
* this machine dependent routine to emit them.
|
||||
@ -1123,32 +1152,42 @@ relax_addressT segment_address_in_file;
|
||||
long add_number;
|
||||
|
||||
memset ((char *) &ri, '\0', sizeof (ri));
|
||||
for (; fixP; fixP = fixP->fx_next) {
|
||||
for (; fixP; fixP = fixP->fx_next)
|
||||
{
|
||||
|
||||
if (fixP->fx_r_type & ~0x3f) {
|
||||
if (fixP->fx_r_type & ~0x3f)
|
||||
{
|
||||
as_fatal ("fixP->fx_r_type = %d\n", fixP->fx_r_type);
|
||||
}
|
||||
ri.r_pcrel = fixP->fx_pcrel;
|
||||
ri.r_type = fixP->fx_r_type;
|
||||
|
||||
if ((symbolP = fixP->fx_addsy) != NULL) {
|
||||
if ((symbolP = fixP->fx_addsy) != NULL)
|
||||
{
|
||||
ri.r_address = fixP->fx_frag->fr_address +
|
||||
fixP->fx_where - segment_address_in_file;
|
||||
if ((symbolP->sy_type & N_TYPE) == N_UNDF) {
|
||||
if (!S_IS_DEFINED (symbolP))
|
||||
{
|
||||
ri.r_extern = 1;
|
||||
ri.r_symbolnum = symbolP->sy_number;
|
||||
} else {
|
||||
ri.r_extern = 0;
|
||||
ri.r_symbolnum = symbolP->sy_type & N_TYPE;
|
||||
}
|
||||
if (symbolP && symbolP->sy_frag) {
|
||||
else
|
||||
{
|
||||
ri.r_extern = 0;
|
||||
ri.r_symbolnum = S_GET_TYPE (symbolP);
|
||||
}
|
||||
if (symbolP && symbolP->sy_frag)
|
||||
{
|
||||
ri.r_addend = symbolP->sy_frag->fr_address;
|
||||
}
|
||||
ri.r_type = fixP->fx_r_type;
|
||||
if (fixP->fx_pcrel) {
|
||||
if (fixP->fx_pcrel)
|
||||
{
|
||||
/* preserve actual offset vs. pc + 4 */
|
||||
ri.r_addend -= (ri.r_address + 4);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
ri.r_addend = fixP->fx_addnumber;
|
||||
}
|
||||
|
||||
@ -1159,6 +1198,73 @@ relax_addressT segment_address_in_file;
|
||||
return;
|
||||
}
|
||||
|
||||
#endif /* comment */
|
||||
|
||||
#ifdef OBJ_AOUT
|
||||
|
||||
/* on i860: first 4 bytes are normal unsigned long address, next three
|
||||
bytes are index, most sig. byte first. Byte 7 is broken up with
|
||||
bit 7 as pcrel, bit 6 as extern, and the lower six bits as
|
||||
relocation type (highlow 5-4). Next 4 bytes are long addend. */
|
||||
|
||||
void
|
||||
tc_aout_fix_to_chars (where, fixP, segment_address_in_file)
|
||||
char *where;
|
||||
fixS *fixP;
|
||||
relax_addressT segment_address_in_file;
|
||||
{
|
||||
long r_index;
|
||||
long r_extern;
|
||||
long r_addend = 0;
|
||||
long r_address;
|
||||
|
||||
know (fixP->fx_addsy);
|
||||
know (!(fixP->fx_r_type & ~0x3f));
|
||||
|
||||
if (!S_IS_DEFINED (fixP->fx_addsy))
|
||||
{
|
||||
r_extern = 1;
|
||||
r_index = fixP->fx_addsy->sy_number;
|
||||
}
|
||||
else
|
||||
{
|
||||
r_extern = 0;
|
||||
r_index = S_GET_TYPE (fixP->fx_addsy);
|
||||
}
|
||||
|
||||
md_number_to_chars (where,
|
||||
r_address = fixP->fx_frag->fr_address + fixP->fx_where - segment_address_in_file,
|
||||
4);
|
||||
|
||||
where[4] = (r_index >> 16) & 0x0ff;
|
||||
where[5] = (r_index >> 8) & 0x0ff;
|
||||
where[6] = r_index & 0x0ff;
|
||||
where[7] = (((fixP->fx_pcrel << 7) & 0x80)
|
||||
| ((r_extern << 6) & 0x40)
|
||||
| (fixP->fx_r_type & 0x3F));
|
||||
|
||||
if (fixP->fx_addsy->sy_frag)
|
||||
{
|
||||
r_addend = fixP->fx_addsy->sy_frag->fr_address;
|
||||
}
|
||||
|
||||
if (fixP->fx_pcrel)
|
||||
{
|
||||
/* preserve actual offset vs. pc + 4 */
|
||||
r_addend -= (r_address + 4);
|
||||
}
|
||||
else
|
||||
{
|
||||
r_addend = fixP->fx_addnumber;
|
||||
}
|
||||
|
||||
md_number_to_chars (&where[8], r_addend, 4);
|
||||
|
||||
return;
|
||||
} /* tc_aout_fix_to_chars() */
|
||||
|
||||
#endif /* OBJ_AOUT */
|
||||
|
||||
/* Parse an operand that is machine-specific.
|
||||
We just return without modifying the expression if we have nothing
|
||||
to do. */
|
||||
@ -1181,10 +1287,10 @@ char *name;
|
||||
}
|
||||
|
||||
/* Round up a section size to the appropriate boundary. */
|
||||
long
|
||||
valueT
|
||||
md_section_align (segment, size)
|
||||
segT segment;
|
||||
long size;
|
||||
valueT size;
|
||||
{
|
||||
return size; /* Byte alignment is fine */
|
||||
}
|
||||
@ -1206,9 +1312,15 @@ long val;
|
||||
{
|
||||
char *place = fixP->fx_where + fixP->fx_frag->fr_literal;
|
||||
|
||||
if (!fixP->fx_bit_fixP) {
|
||||
/* looks to me like i860 never has bit fixes. Let's see. xoxorich. */
|
||||
know (fixP->fx_bit_fixP == NULL);
|
||||
if (!fixP->fx_bit_fixP)
|
||||
{
|
||||
|
||||
switch (fixP->fx_im_disp) {
|
||||
/* also looks like fx_im_disp is always 0. Let's see. xoxorich. */
|
||||
know (fixP->fx_im_disp == 0);
|
||||
switch (fixP->fx_im_disp)
|
||||
{
|
||||
case 0:
|
||||
fixP->fx_addnumber = val;
|
||||
md_number_to_imm (place, val, fixP->fx_size, fixP);
|
||||
@ -1224,7 +1336,9 @@ long val;
|
||||
default:
|
||||
as_fatal ("Internal error in md_apply_fix() in file \"%s\"", __FILE__);
|
||||
} /* OVE: maybe one ought to put _imm _disp _chars in one md-func */
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
md_number_to_field (place, val, fixP->fx_bit_fixP);
|
||||
}
|
||||
|
||||
@ -1235,6 +1349,7 @@ long val;
|
||||
* Local Variables:
|
||||
* fill-column: 131
|
||||
* comment-column: 0
|
||||
* End:
|
||||
*/
|
||||
|
||||
/* end of tc-i860.c */
|
||||
|
@ -3585,7 +3585,8 @@ md_assemble (str)
|
||||
current_architecture |= m68881;
|
||||
}
|
||||
if (!no_68851
|
||||
&& (cpu_of_arch (current_architecture) & m68020up) != 0)
|
||||
&& (cpu_of_arch (current_architecture) & m68020up) != 0
|
||||
&& cpu_of_arch (current_architecture) != m68040)
|
||||
{
|
||||
current_architecture |= m68851;
|
||||
}
|
||||
@ -3942,7 +3943,7 @@ md_atof (type, litP, sizeP)
|
||||
void
|
||||
md_number_to_chars (buf, val, n)
|
||||
char *buf;
|
||||
long val;
|
||||
valueT val;
|
||||
int n;
|
||||
{
|
||||
switch (n)
|
||||
@ -4535,40 +4536,40 @@ CONST int md_long_jump_size = 6;
|
||||
void
|
||||
md_create_short_jump (ptr, from_addr, to_addr, frag, to_symbol)
|
||||
char *ptr;
|
||||
long from_addr, to_addr;
|
||||
addressT from_addr, to_addr;
|
||||
fragS *frag;
|
||||
symbolS *to_symbol;
|
||||
{
|
||||
long offset;
|
||||
valueT offset;
|
||||
|
||||
offset = to_addr - (from_addr + 2);
|
||||
|
||||
md_number_to_chars (ptr, (long) 0x6000, 2);
|
||||
md_number_to_chars (ptr + 2, (long) offset, 2);
|
||||
md_number_to_chars (ptr, (valueT) 0x6000, 2);
|
||||
md_number_to_chars (ptr + 2, (valueT) offset, 2);
|
||||
}
|
||||
|
||||
void
|
||||
md_create_long_jump (ptr, from_addr, to_addr, frag, to_symbol)
|
||||
char *ptr;
|
||||
long from_addr, to_addr;
|
||||
addressT from_addr, to_addr;
|
||||
fragS *frag;
|
||||
symbolS *to_symbol;
|
||||
{
|
||||
long offset;
|
||||
valueT offset;
|
||||
|
||||
if (cpu_of_arch (current_architecture) < m68020)
|
||||
{
|
||||
offset = to_addr - S_GET_VALUE (to_symbol);
|
||||
md_number_to_chars (ptr, (long) 0x4EF9, 2);
|
||||
md_number_to_chars (ptr + 2, (long) offset, 4);
|
||||
md_number_to_chars (ptr, (valueT) 0x4EF9, 2);
|
||||
md_number_to_chars (ptr + 2, (valueT) offset, 4);
|
||||
fix_new (frag, (ptr + 2) - frag->fr_literal, 4, to_symbol, (symbolS *) 0, (long) 0, 0,
|
||||
NO_RELOC);
|
||||
}
|
||||
else
|
||||
{
|
||||
offset = to_addr - (from_addr + 2);
|
||||
md_number_to_chars (ptr, (long) 0x60ff, 2);
|
||||
md_number_to_chars (ptr + 2, (long) offset, 4);
|
||||
md_number_to_chars (ptr, (valueT) 0x60ff, 2);
|
||||
md_number_to_chars (ptr + 2, (valueT) offset, 4);
|
||||
}
|
||||
}
|
||||
|
||||
@ -5095,10 +5096,10 @@ md_operand (expressionP)
|
||||
}
|
||||
|
||||
/* Round up a section size to the appropriate boundary. */
|
||||
long
|
||||
valueT
|
||||
md_section_align (segment, size)
|
||||
segT segment;
|
||||
long size;
|
||||
valueT size;
|
||||
{
|
||||
return size; /* Byte alignment is fine */
|
||||
}
|
||||
|
@ -21,15 +21,9 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#ifdef USG
|
||||
#include <string.h>
|
||||
#else
|
||||
#include <strings.h>
|
||||
#endif
|
||||
#include "opcode/ns32k.h"
|
||||
|
||||
#include "as.h"
|
||||
#include "read.h"
|
||||
|
||||
#include "obstack.h"
|
||||
|
||||
@ -1536,7 +1530,7 @@ md_atof (type, litP, sizeP)
|
||||
void
|
||||
md_number_to_chars (buf, value, nbytes)
|
||||
char *buf;
|
||||
long value;
|
||||
valueT value;
|
||||
int nbytes;
|
||||
{
|
||||
while (nbytes--)
|
||||
@ -1713,8 +1707,7 @@ tc_aout_fix_to_chars (where, fixP, segment_address_in_file)
|
||||
* Out: GNU LD relocation length code: 0, 1, or 2.
|
||||
*/
|
||||
|
||||
static unsigned char nbytes_r_length[] =
|
||||
{42, 0, 1, 42, 2};
|
||||
static unsigned char nbytes_r_length[] = {42, 0, 1, 42, 2};
|
||||
long r_symbolnum;
|
||||
|
||||
know (fixP->fx_addsy != NULL);
|
||||
@ -1735,9 +1728,7 @@ tc_aout_fix_to_chars (where, fixP, segment_address_in_file)
|
||||
| (long) (fixP->fx_bsr << 28)
|
||||
| (long) (fixP->fx_im_disp << 29)),
|
||||
4);
|
||||
|
||||
return;
|
||||
} /* tc_aout_fix_to_chars() */
|
||||
}
|
||||
|
||||
#endif /* OBJ_AOUT */
|
||||
|
||||
@ -1977,34 +1968,34 @@ md_estimate_size_before_relax (fragP, segment)
|
||||
|
||||
int md_short_jump_size = 3;
|
||||
int md_long_jump_size = 5;
|
||||
int md_reloc_size = 8; /* Size of relocation record */
|
||||
const int md_reloc_size = 8; /* Size of relocation record */
|
||||
|
||||
void
|
||||
md_create_short_jump (ptr, from_addr, to_addr, frag, to_symbol)
|
||||
char *ptr;
|
||||
long from_addr, to_addr;
|
||||
addressT from_addr, to_addr;
|
||||
fragS *frag;
|
||||
symbolS *to_symbol;
|
||||
{
|
||||
long offset;
|
||||
valueT offset;
|
||||
|
||||
offset = to_addr - from_addr;
|
||||
md_number_to_chars (ptr, (long) 0xEA, 1);
|
||||
md_number_to_disp (ptr + 1, (long) offset, 2);
|
||||
md_number_to_chars (ptr, (valueT) 0xEA, 1);
|
||||
md_number_to_disp (ptr + 1, (valueT) offset, 2);
|
||||
}
|
||||
|
||||
void
|
||||
md_create_long_jump (ptr, from_addr, to_addr, frag, to_symbol)
|
||||
char *ptr;
|
||||
long from_addr, to_addr;
|
||||
addressT from_addr, to_addr;
|
||||
fragS *frag;
|
||||
symbolS *to_symbol;
|
||||
{
|
||||
long offset;
|
||||
valueT offset;
|
||||
|
||||
offset = to_addr - from_addr;
|
||||
md_number_to_chars (ptr, (long) 0xEA, 2);
|
||||
md_number_to_disp (ptr + 2, (long) offset, 4);
|
||||
md_number_to_chars (ptr, (valueT) 0xEA, 2);
|
||||
md_number_to_disp (ptr + 2, (valueT) offset, 4);
|
||||
}
|
||||
|
||||
/* JF this is a new function to parse machine-dep options */
|
||||
@ -2099,6 +2090,20 @@ fix_new_ns32k (frag, where, size, add_symbol, sub_symbol, offset, pcrel,
|
||||
fixP->fx_bsr = bsr;
|
||||
} /* fix_new_ns32k() */
|
||||
|
||||
/* This is TC_CONS_FIX_NEW, called by emit_expr in read.c. */
|
||||
|
||||
void
|
||||
cons_fix_new_ns32k (frag, where, size, exp)
|
||||
fragS *frag; /* Which frag? */
|
||||
int where; /* Where in that frag? */
|
||||
int size; /* 1, 2 or 4 usually. */
|
||||
expressionS *exp; /* Expression. */
|
||||
{
|
||||
fix_new_ns32k (frag, where, size, exp->X_add_symbol,
|
||||
exp->X_subtract_symbol, exp->X_add_number,
|
||||
0, 0, 2, 0, 0);
|
||||
}
|
||||
|
||||
/* We have no need to default values of symbols. */
|
||||
|
||||
symbolS *
|
||||
@ -2120,10 +2125,10 @@ md_operand (expressionP)
|
||||
}
|
||||
|
||||
/* Round up a section size to the appropriate boundary. */
|
||||
long
|
||||
valueT
|
||||
md_section_align (segment, size)
|
||||
segT segment;
|
||||
long size;
|
||||
valueT size;
|
||||
{
|
||||
return size; /* Byte alignment is fine */
|
||||
}
|
||||
|
1390
gas/config/tc-sh.c
Normal file
1390
gas/config/tc-sh.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -455,11 +455,11 @@ md_parse_option (argP, cntP, vecP)
|
||||
void /* Knows about order of bytes in address. */
|
||||
md_number_to_chars (con, value, nbytes)
|
||||
char con[]; /* Return 'nbytes' of chars here. */
|
||||
long int value; /* The value of the bits. */
|
||||
valueT value; /* The value of the bits. */
|
||||
int nbytes; /* Number of bytes in the output. */
|
||||
{
|
||||
int n = nbytes;
|
||||
long int v = value;
|
||||
valueT v = value;
|
||||
|
||||
con += nbytes - 1; /* Tahoes is (Bleah!) big endian */
|
||||
while (nbytes--)
|
||||
@ -595,11 +595,11 @@ const int md_short_jump_size = 3;
|
||||
void
|
||||
md_create_short_jump (ptr, from_addr, to_addr, frag, to_symbol)
|
||||
char *ptr;
|
||||
long from_addr, to_addr;
|
||||
addressT from_addr, to_addr;
|
||||
fragS *frag;
|
||||
symbolS *to_symbol;
|
||||
{
|
||||
long offset;
|
||||
valueT offset;
|
||||
|
||||
offset = to_addr - (from_addr + 1);
|
||||
*ptr++ = TAHOE_BRW;
|
||||
@ -612,11 +612,11 @@ const int md_reloc_size = 8; /* Size of relocation record */
|
||||
void
|
||||
md_create_long_jump (ptr, from_addr, to_addr, frag, to_symbol)
|
||||
char *ptr;
|
||||
long from_addr, to_addr;
|
||||
addressT from_addr, to_addr;
|
||||
fragS *frag;
|
||||
symbolS *to_symbol;
|
||||
{
|
||||
long offset;
|
||||
valueT offset;
|
||||
|
||||
offset = to_addr - (from_addr + 4);
|
||||
*ptr++ = TAHOE_JMP;
|
||||
@ -2044,10 +2044,10 @@ md_operand (expressionP)
|
||||
} /* md_operand() */
|
||||
|
||||
/* Round up a section size to the appropriate boundary. */
|
||||
long
|
||||
valueT
|
||||
md_section_align (segment, size)
|
||||
segT segment;
|
||||
long size;
|
||||
valueT size;
|
||||
{
|
||||
return ((size + 7) & ~7); /* Round all sects to multiple of 8 */
|
||||
} /* md_section_align() */
|
||||
|
@ -289,11 +289,11 @@ md_end ()
|
||||
void /* Knows about order of bytes in address. */
|
||||
md_number_to_chars (con, value, nbytes)
|
||||
char con[]; /* Return 'nbytes' of chars here. */
|
||||
long value; /* The value of the bits. */
|
||||
valueT value; /* The value of the bits. */
|
||||
int nbytes; /* Number of bytes in the output. */
|
||||
{
|
||||
int n;
|
||||
long v;
|
||||
valueT v;
|
||||
|
||||
n = nbytes;
|
||||
v = value;
|
||||
@ -3175,11 +3175,11 @@ const int md_reloc_size = 8; /* Size of relocation record */
|
||||
void
|
||||
md_create_short_jump (ptr, from_addr, to_addr, frag, to_symbol)
|
||||
char *ptr;
|
||||
long from_addr, to_addr;
|
||||
addressT from_addr, to_addr;
|
||||
fragS *frag;
|
||||
symbolS *to_symbol;
|
||||
{
|
||||
long offset;
|
||||
valueT offset;
|
||||
|
||||
offset = to_addr - (from_addr + 1);
|
||||
*ptr++ = 0x31;
|
||||
@ -3189,11 +3189,11 @@ md_create_short_jump (ptr, from_addr, to_addr, frag, to_symbol)
|
||||
void
|
||||
md_create_long_jump (ptr, from_addr, to_addr, frag, to_symbol)
|
||||
char *ptr;
|
||||
long from_addr, to_addr;
|
||||
addressT from_addr, to_addr;
|
||||
fragS *frag;
|
||||
symbolS *to_symbol;
|
||||
{
|
||||
long offset;
|
||||
valueT offset;
|
||||
|
||||
offset = to_addr - S_GET_VALUE (to_symbol);
|
||||
*ptr++ = 0x17;
|
||||
@ -3258,10 +3258,13 @@ md_parse_option (argP, cntP, vecP)
|
||||
as_warn ("I don't use an interpass file! -V ignored");
|
||||
break;
|
||||
|
||||
#ifdef VMS
|
||||
#ifdef OBJ_VMS
|
||||
case '+': /* For g++ */
|
||||
break;
|
||||
|
||||
case '1': /* For backward compatibility */
|
||||
break;
|
||||
|
||||
case 'h': /* No hashing of mixed-case names */
|
||||
break;
|
||||
|
||||
@ -3298,10 +3301,10 @@ md_operand (expressionP)
|
||||
}
|
||||
|
||||
/* Round up a section size to the appropriate boundary. */
|
||||
long
|
||||
valueT
|
||||
md_section_align (segment, size)
|
||||
segT segment;
|
||||
long size;
|
||||
valueT size;
|
||||
{
|
||||
return size; /* Byte alignment is fine */
|
||||
}
|
||||
|
@ -27,10 +27,8 @@
|
||||
#include "../opcodes/z8k-opc.h"
|
||||
|
||||
#include "as.h"
|
||||
#include "read.h"
|
||||
#include "bfd.h"
|
||||
#include <ctype.h>
|
||||
#include "listing.h"
|
||||
|
||||
const char comment_chars[] =
|
||||
{'!', 0};
|
||||
@ -41,7 +39,7 @@ const char line_comment_chars[] = { '#', 0};
|
||||
extern int machine;
|
||||
extern int coff_flags;
|
||||
int segmented_mode;
|
||||
int md_reloc_size;
|
||||
const int md_reloc_size;
|
||||
|
||||
/* This table describes all the machine specific pseudo-ops the assembler
|
||||
has to support. The fields are:
|
||||
@ -1170,8 +1168,8 @@ tc_aout_fix_to_chars ()
|
||||
void
|
||||
md_create_short_jump (ptr, from_addr, to_addr, frag, to_symbol)
|
||||
char *ptr;
|
||||
long from_addr;
|
||||
long to_addr;
|
||||
addressT from_addr;
|
||||
addressT to_addr;
|
||||
fragS *frag;
|
||||
symbolS *to_symbol;
|
||||
{
|
||||
@ -1181,7 +1179,7 @@ md_create_short_jump (ptr, from_addr, to_addr, frag, to_symbol)
|
||||
void
|
||||
md_create_long_jump (ptr, from_addr, to_addr, frag, to_symbol)
|
||||
char *ptr;
|
||||
long from_addr, to_addr;
|
||||
addressT from_addr, to_addr;
|
||||
fragS *frag;
|
||||
symbolS *to_symbol;
|
||||
{
|
||||
@ -1198,10 +1196,10 @@ md_convert_frag (headers, fragP)
|
||||
abort ();
|
||||
}
|
||||
|
||||
long
|
||||
valueT
|
||||
DEFUN (md_section_align, (seg, size),
|
||||
segT seg AND
|
||||
long size)
|
||||
valueT size)
|
||||
{
|
||||
return ((size + (1 << section_alignment[(int) seg]) - 1) & (-1 << section_alignment[(int) seg]));
|
||||
|
||||
@ -1274,7 +1272,7 @@ md_estimate_size_before_relax (fragP, segment_type)
|
||||
void
|
||||
DEFUN (md_number_to_chars, (ptr, use, nbytes),
|
||||
char *ptr AND
|
||||
long use AND
|
||||
valueT use AND
|
||||
int nbytes)
|
||||
{
|
||||
switch (nbytes)
|
||||
|
Reference in New Issue
Block a user