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:
Mark Eichin
1993-07-12 19:42:32 +00:00
parent d723cd17d5
commit 025b030243
11 changed files with 10741 additions and 2149 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1244,8 +1244,8 @@ tc_aout_fix_to_chars ()
void void
md_create_short_jump (ptr, from_addr, to_addr, frag, to_symbol) md_create_short_jump (ptr, from_addr, to_addr, frag, to_symbol)
char *ptr; char *ptr;
long from_addr; addressT from_addr;
long to_addr; addressT to_addr;
fragS *frag; fragS *frag;
symbolS *to_symbol; symbolS *to_symbol;
{ {
@ -1255,7 +1255,7 @@ md_create_short_jump (ptr, from_addr, to_addr, frag, to_symbol)
void void
md_create_long_jump (ptr, from_addr, to_addr, frag, to_symbol) md_create_long_jump (ptr, from_addr, to_addr, frag, to_symbol)
char *ptr; char *ptr;
long from_addr, to_addr; addressT from_addr, to_addr;
fragS *frag; fragS *frag;
symbolS *to_symbol; symbolS *to_symbol;
{ {
@ -1402,10 +1402,10 @@ md_convert_frag (headers, fragP)
} }
long valueT
DEFUN (md_section_align, (seg, size), DEFUN (md_section_align, (seg, size),
segT seg AND segT seg AND
long size) valueT size)
{ {
return ((size + (1 << section_alignment[(int) seg]) - 1) return ((size + (1 << section_alignment[(int) seg]) - 1)
& (-1 << section_alignment[(int) seg])); & (-1 << section_alignment[(int) seg]));
@ -1506,7 +1506,7 @@ md_estimate_size_before_relax (fragP, segment_type)
void void
md_number_to_chars (ptr, use, nbytes) md_number_to_chars (ptr, use, nbytes)
char *ptr; char *ptr;
long use; valueT use;
int nbytes; int nbytes;
{ {
switch (nbytes) switch (nbytes)

6941
gas/config/tc-hppa.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -2161,7 +2161,7 @@ const int md_reloc_size = 8; /* Size of relocation record */
void void
md_create_short_jump (ptr, from_addr, to_addr, frag, to_symbol) md_create_short_jump (ptr, from_addr, to_addr, frag, to_symbol)
char *ptr; char *ptr;
valueT from_addr, to_addr; addressT from_addr, to_addr;
fragS *frag; fragS *frag;
symbolS *to_symbol; symbolS *to_symbol;
{ {
@ -2175,7 +2175,7 @@ md_create_short_jump (ptr, from_addr, to_addr, frag, to_symbol)
void void
md_create_long_jump (ptr, from_addr, to_addr, frag, to_symbol) md_create_long_jump (ptr, from_addr, to_addr, frag, to_symbol)
char *ptr; char *ptr;
valueT from_addr, to_addr; addressT from_addr, to_addr;
fragS *frag; fragS *frag;
symbolS *to_symbol; symbolS *to_symbol;
{ {

View File

@ -21,36 +21,6 @@
#include "opcode/i860.h" #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_begin ();
void md_end (); void md_end ();
void md_number_to_chars (); void md_number_to_chars ();
@ -65,13 +35,14 @@ void md_number_to_disp();
void md_number_to_field (); void md_number_to_field ();
void md_ri_to_chars (); void md_ri_to_chars ();
static void i860_ip (); 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 */ /* handle of the OPCODE hash table */
static struct hash_control *op_hash = NULL; static struct hash_control *op_hash = NULL;
@ -80,7 +51,8 @@ static void s_dual(), s_enddual();
static void s_atmp (); static void s_atmp ();
const pseudo_typeS const pseudo_typeS
md_pseudo_table[] = { md_pseudo_table[] =
{
{"dual", s_dual, 4}, {"dual", s_dual, 4},
{"enddual", s_enddual, 4}, {"enddual", s_enddual, 4},
{"atmp", s_atmp, 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 /* This array holds the chars that always start a comment. If the
pre-processor is disabled, these aren't very useful */ 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 /* 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' 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 first line of the input file. This is because the compiler outputs
#NO_APP at the beginning of its output. */ #NO_APP at the beginning of its output. */
/* Also note that comments like this one will always work. */ /* 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 */ /* 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 */ /* Chars that mean this number is a floating point constant */
/* As in 0f12.456 */ /* As in 0f12.456 */
/* or 0d1.2345e12 */ /* 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 /* 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, 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] #define isoctal(c) octal[c]
static unsigned char toHex[256]; static unsigned char toHex[256];
struct i860_it { struct i860_it
{
char *error; char *error;
unsigned long opcode; unsigned long opcode;
struct nlist *nlistp; struct nlist *nlistp;
@ -171,15 +146,18 @@ static void
s_atmp () s_atmp ()
{ {
register int temp; register int temp;
if (strncmp(input_line_pointer, "sp", 2) == 0) { if (strncmp (input_line_pointer, "sp", 2) == 0)
{
input_line_pointer += 2; input_line_pointer += 2;
atmp = 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; input_line_pointer += 2;
atmp = 3; atmp = 3;
} }
else if (strncmp(input_line_pointer, "r", 1) == 0) { else if (strncmp (input_line_pointer, "r", 1) == 0)
{
input_line_pointer += 1; input_line_pointer += 1;
temp = get_absolute_expression (); temp = get_absolute_expression ();
if (temp >= 0 && temp <= 31) if (temp >= 0 && temp <= 31)
@ -187,7 +165,8 @@ static void
else else
as_bad ("Unknown temporary pseudo register"); as_bad ("Unknown temporary pseudo register");
} }
else { else
{
as_bad ("Unknown temporary pseudo register"); as_bad ("Unknown temporary pseudo register");
} }
demand_empty_rest_of_line (); demand_empty_rest_of_line ();
@ -226,7 +205,8 @@ void
lose = 1; lose = 1;
} }
++i; ++i;
} while (i < NUMOPCODES }
while (i < NUMOPCODES
&& !strcmp (i860_opcodes[i].name, name)); && !strcmp (i860_opcodes[i].name, name));
} }
@ -263,11 +243,13 @@ char *str;
i860_ip (str); i860_ip (str);
/* check for expandable flag to produce pseudo-instructions */ /* 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++) for (i = 0; i < 3; i++)
pseudo[i] = the_insn; pseudo[i] = the_insn;
switch (the_insn.expand) { switch (the_insn.expand)
{
case E_DELAY: case E_DELAY:
no_opcodes = 1; no_opcodes = 1;
@ -380,7 +362,8 @@ char *str;
} }
i = 0; i = 0;
do { /* always produce at least one opcode */ do
{ /* always produce at least one opcode */
toP = frag_more (4); toP = frag_more (4);
/* put out the opcode */ /* put out the opcode */
md_number_to_chars (toP, the_insn.opcode, 4); md_number_to_chars (toP, the_insn.opcode, 4);
@ -389,9 +372,9 @@ char *str;
last_expand = the_insn.pcrel; last_expand = the_insn.pcrel;
/* put out the symbol-dependent stuff */ /* put out the symbol-dependent stuff */
if (the_insn.reloc != NO_RELOC) { if (the_insn.reloc != NO_RELOC)
fix_new( {
frag_now, /* which frag */ fix_new (frag_now, /* which frag */
(toP - frag_now->fr_literal), /* where */ (toP - frag_now->fr_literal), /* where */
4, /* size */ 4, /* size */
the_insn.exp.X_add_symbol, the_insn.exp.X_add_symbol,
@ -399,11 +382,11 @@ char *str;
the_insn.exp.X_add_number, the_insn.exp.X_add_number,
the_insn.pcrel, the_insn.pcrel,
/* merge bit fields into one argument */ /* 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]; 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) for (s = str; islower (*s) || *s == '.' || *s == '3'; ++s)
; ;
switch (*s) { switch (*s)
{
case '\0': case '\0':
break; break;
@ -444,7 +428,8 @@ char *str;
exit (1); 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) if (dual_mode == DUAL_ON)
dual_mode = DUAL_ONDDOT; dual_mode = DUAL_ONDDOT;
else else
@ -452,17 +437,20 @@ char *str;
str += 2; 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) if (dual_mode == DUAL_DDOT || dual_mode == DUAL_ONDDOT)
str -= 2; str -= 2;
as_bad ("Unknown opcode: `%s'", str); as_bad ("Unknown opcode: `%s'", str);
return; return;
} }
if (comma) { if (comma)
{
*--s = ','; *--s = ',';
} }
argsStart = s; argsStart = s;
for (;;) { for (;;)
{
opcode = insn->match; opcode = insn->match;
memset (&the_insn, '\0', sizeof (the_insn)); memset (&the_insn, '\0', sizeof (the_insn));
the_insn.reloc = NO_RELOC; the_insn.reloc = NO_RELOC;
@ -471,11 +459,14 @@ char *str;
* Build the opcode, checking as we go to make * Build the opcode, checking as we go to make
* sure that the operands match * sure that the operands match
*/ */
for (args = insn->args; ; ++args) { for (args = insn->args;; ++args)
switch (*args) { {
switch (*args)
{
case '\0': /* end of args */ case '\0': /* end of args */
if (*s == '\0') { if (*s == '\0')
{
match = 1; match = 1;
} }
break; break;
@ -490,8 +481,10 @@ char *str;
break; break;
case '#': /* must be at least one digit */ case '#': /* must be at least one digit */
if (isdigit(*s++)) { if (isdigit (*s++))
while (isdigit(*s)) { {
while (isdigit (*s))
{
++s; ++s;
} }
continue; continue;
@ -501,11 +494,13 @@ char *str;
case '1': /* next operand must be a register */ case '1': /* next operand must be a register */
case '2': case '2':
case 'd': case 'd':
switch (*s) { switch (*s)
{
case 'f': /* frame pointer */ case 'f': /* frame pointer */
s++; s++;
if (*s++ == 'p') { if (*s++ == 'p')
{
mask = 0x3; mask = 0x3;
break; break;
} }
@ -513,7 +508,8 @@ char *str;
case 's': /* stack pointer */ case 's': /* stack pointer */
s++; s++;
if (*s++ == 'p') { if (*s++ == 'p')
{
mask = 0x2; mask = 0x2;
break; break;
} }
@ -521,14 +517,19 @@ char *str;
case 'r': /* any register */ case 'r': /* any register */
s++; s++;
if (!isdigit(c = *s++)) { if (!isdigit (c = *s++))
{
goto error; goto error;
} }
if (isdigit(*s)) { if (isdigit (*s))
if ((c = 10 * (c - '0') + (*s++ - '0')) >= 32) { {
if ((c = 10 * (c - '0') + (*s++ - '0')) >= 32)
{
goto error; goto error;
} }
} else { }
else
{
c -= '0'; c -= '0';
} }
mask = c; mask = c;
@ -541,7 +542,8 @@ char *str;
* Got the register, now figure out where * Got the register, now figure out where
* it goes in the opcode. * it goes in the opcode.
*/ */
switch (*args) { switch (*args)
{
case '1': case '1':
opcode |= mask << 11; opcode |= mask << 11;
@ -561,17 +563,23 @@ char *str;
case 'e': /* next operand is a floating point register */ case 'e': /* next operand is a floating point register */
case 'f': case 'f':
case 'g': case 'g':
if (*s++ == 'f' && isdigit(*s)) { if (*s++ == 'f' && isdigit (*s))
{
mask = *s++; mask = *s++;
if (isdigit(*s)) { if (isdigit (*s))
{
mask = 10 * (mask - '0') + (*s++ - '0'); mask = 10 * (mask - '0') + (*s++ - '0');
if (mask >= 32) { if (mask >= 32)
{
break; break;
} }
} else { }
else
{
mask -= '0'; mask -= '0';
} }
switch (*args) { switch (*args)
{
case 'e': case 'e':
opcode |= mask << 11; opcode |= mask << 11;
@ -597,32 +605,38 @@ char *str;
break; break;
case 'c': /* next operand must be a control register */ case 'c': /* next operand must be a control register */
if (strncmp(s, "fir", 3) == 0) { if (strncmp (s, "fir", 3) == 0)
{
opcode |= 0x0 << 21; opcode |= 0x0 << 21;
s += 3; s += 3;
continue; continue;
} }
if (strncmp(s, "psr", 3) == 0) { if (strncmp (s, "psr", 3) == 0)
{
opcode |= 0x1 << 21; opcode |= 0x1 << 21;
s += 3; s += 3;
continue; continue;
} }
if (strncmp(s, "dirbase", 7) == 0) { if (strncmp (s, "dirbase", 7) == 0)
{
opcode |= 0x2 << 21; opcode |= 0x2 << 21;
s += 7; s += 7;
continue; continue;
} }
if (strncmp(s, "db", 2) == 0) { if (strncmp (s, "db", 2) == 0)
{
opcode |= 0x3 << 21; opcode |= 0x3 << 21;
s += 2; s += 2;
continue; continue;
} }
if (strncmp(s, "fsr", 3) == 0) { if (strncmp (s, "fsr", 3) == 0)
{
opcode |= 0x4 << 21; opcode |= 0x4 << 21;
s += 3; s += 3;
continue; continue;
} }
if (strncmp(s, "epsr", 4) == 0) { if (strncmp (s, "epsr", 4) == 0)
{
opcode |= 0x5 << 21; opcode |= 0x5 << 21;
s += 4; s += 4;
continue; continue;
@ -631,7 +645,8 @@ char *str;
case '5': /* 5 bit immediate in src1 */ case '5': /* 5 bit immediate in src1 */
memset (&the_insn, '\0', sizeof (the_insn)); memset (&the_insn, '\0', sizeof (the_insn));
if ( !getExpression(s)) { if (!getExpression (s))
{
s = expr_end; s = expr_end;
if (the_insn.exp.X_add_number & ~0x1f) if (the_insn.exp.X_add_number & ~0x1f)
as_bad ("5-bit immediate too large"); as_bad ("5-bit immediate too large");
@ -681,13 +696,18 @@ char *str;
immediate: immediate:
if (*s == ' ') if (*s == ' ')
s++; s++;
if (strncmp(s, "ha%", 3) == 0) { if (strncmp (s, "ha%", 3) == 0)
{
the_insn.highlow = HIGHADJ; the_insn.highlow = HIGHADJ;
s += 3; s += 3;
} else if (strncmp(s, "h%", 2) == 0) { }
else if (strncmp (s, "h%", 2) == 0)
{
the_insn.highlow = HIGH; the_insn.highlow = HIGH;
s += 2; s += 2;
} else if (strncmp(s, "l%", 2) == 0) { }
else if (strncmp (s, "l%", 2) == 0)
{
the_insn.highlow = PAIR; the_insn.highlow = PAIR;
s += 2; s += 2;
} }
@ -698,7 +718,8 @@ char *str;
in the input string. Try not to create U symbols for in the input string. Try not to create U symbols for
registers, etc. */ registers, etc. */
if ( !getExpression(s)) { if (!getExpression (s))
{
s = expr_end; s = expr_end;
continue; continue;
} }
@ -742,7 +763,8 @@ char *str;
save_in = input_line_pointer; save_in = input_line_pointer;
input_line_pointer = str; input_line_pointer = str;
switch (seg = expression(&the_insn.exp)) { switch (seg = expression (&the_insn.exp))
{
case SEG_ABSOLUTE: case SEG_ABSOLUTE:
case SEG_TEXT: case SEG_TEXT:
@ -790,7 +812,8 @@ int *sizeP;
char *t; char *t;
char *atof_ieee (); char *atof_ieee ();
switch(type) { switch (type)
{
case 'f': case 'f':
case 'F': case 'F':
@ -824,7 +847,8 @@ int *sizeP;
if (t) if (t)
input_line_pointer = t; input_line_pointer = t;
*sizeP = prec * sizeof (LITTLENUM_TYPE); *sizeP = prec * sizeof (LITTLENUM_TYPE);
for(wordP=words;prec--;) { for (wordP = words; prec--;)
{
md_number_to_chars (litP, (long) (*wordP++), sizeof (LITTLENUM_TYPE)); md_number_to_chars (litP, (long) (*wordP++), sizeof (LITTLENUM_TYPE));
litP += sizeof (LITTLENUM_TYPE); litP += sizeof (LITTLENUM_TYPE);
} }
@ -837,10 +861,11 @@ int *sizeP;
void void
md_number_to_chars (buf, val, n) md_number_to_chars (buf, val, n)
char *buf; char *buf;
long val; valueT val;
int n; int n;
{ {
switch(n) { switch (n)
{
case 4: case 4:
*buf++ = val >> 24; *buf++ = val >> 24;
@ -857,7 +882,8 @@ int n;
return; return;
} }
void md_number_to_imm(buf,val,n, fixP) void
md_number_to_imm (buf, val, n, fixP)
char *buf; char *buf;
long val; long val;
int n; int n;
@ -967,7 +993,7 @@ fixS *fixP;
void void
md_create_short_jump (ptr, from_addr, to_addr, frag, to_symbol) md_create_short_jump (ptr, from_addr, to_addr, frag, to_symbol)
char *ptr; char *ptr;
long from_addr, to_addr; addressT from_addr, to_addr;
fragS *frag; fragS *frag;
symbolS *to_symbol; symbolS *to_symbol;
{ {
@ -1036,8 +1062,7 @@ register fragS *fragP;
void void
md_create_long_jump (ptr, from_addr, to_addr, frag, to_symbol) md_create_long_jump (ptr, from_addr, to_addr, frag, to_symbol)
char *ptr; char *ptr;
long from_addr, addressT from_addr, to_addr;
to_addr;
fragS *frag; fragS *frag;
symbolS *to_symbol; symbolS *to_symbol;
{ {
@ -1054,7 +1079,8 @@ segT segtype;
} }
/* for debugging only, must match enum reloc_type */ /* for debugging only, must match enum reloc_type */
static char *Reloc[] = { static char *Reloc[] =
{
"NO_RELOC", "NO_RELOC",
"BRADDR", "BRADDR",
"LOW0", "LOW0",
@ -1067,7 +1093,8 @@ static char *Reloc[] = {
"SPLIT2", "SPLIT2",
"RELOC_32", "RELOC_32",
}; };
static char *Highlow[] = { static char *Highlow[] =
{
"NO_SPEC", "NO_SPEC",
"PAIR", "PAIR",
"HIGH", "HIGH",
@ -1077,7 +1104,8 @@ static void
print_insn (insn) print_insn (insn)
struct i860_it *insn; struct i860_it *insn;
{ {
if (insn->error) { if (insn->error)
{
fprintf (stderr, "ERROR: %s\n"); fprintf (stderr, "ERROR: %s\n");
} }
fprintf (stderr, "opcode=0x%08x\t", insn->opcode); fprintf (stderr, "opcode=0x%08x\t", insn->opcode);
@ -1108,6 +1136,7 @@ char ***vecP;
return 1; return 1;
} }
#ifdef comment
/* /*
* I860 relocations are completely different, so it needs * I860 relocations are completely different, so it needs
* this machine dependent routine to emit them. * this machine dependent routine to emit them.
@ -1123,32 +1152,42 @@ relax_addressT segment_address_in_file;
long add_number; long add_number;
memset ((char *) &ri, '\0', sizeof (ri)); 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); as_fatal ("fixP->fx_r_type = %d\n", fixP->fx_r_type);
} }
ri.r_pcrel = fixP->fx_pcrel; ri.r_pcrel = fixP->fx_pcrel;
ri.r_type = fixP->fx_r_type; 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 + ri.r_address = fixP->fx_frag->fr_address +
fixP->fx_where - segment_address_in_file; 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_extern = 1;
ri.r_symbolnum = symbolP->sy_number; 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_addend = symbolP->sy_frag->fr_address;
} }
ri.r_type = fixP->fx_r_type; ri.r_type = fixP->fx_r_type;
if (fixP->fx_pcrel) { if (fixP->fx_pcrel)
{
/* preserve actual offset vs. pc + 4 */ /* preserve actual offset vs. pc + 4 */
ri.r_addend -= (ri.r_address + 4); ri.r_addend -= (ri.r_address + 4);
} else { }
else
{
ri.r_addend = fixP->fx_addnumber; ri.r_addend = fixP->fx_addnumber;
} }
@ -1159,6 +1198,73 @@ relax_addressT segment_address_in_file;
return; 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. /* Parse an operand that is machine-specific.
We just return without modifying the expression if we have nothing We just return without modifying the expression if we have nothing
to do. */ to do. */
@ -1181,10 +1287,10 @@ char *name;
} }
/* Round up a section size to the appropriate boundary. */ /* Round up a section size to the appropriate boundary. */
long valueT
md_section_align (segment, size) md_section_align (segment, size)
segT segment; segT segment;
long size; valueT size;
{ {
return size; /* Byte alignment is fine */ return size; /* Byte alignment is fine */
} }
@ -1206,9 +1312,15 @@ long val;
{ {
char *place = fixP->fx_where + fixP->fx_frag->fr_literal; 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: case 0:
fixP->fx_addnumber = val; fixP->fx_addnumber = val;
md_number_to_imm (place, val, fixP->fx_size, fixP); md_number_to_imm (place, val, fixP->fx_size, fixP);
@ -1224,7 +1336,9 @@ long val;
default: default:
as_fatal ("Internal error in md_apply_fix() in file \"%s\"", __FILE__); 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 */ } /* 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); md_number_to_field (place, val, fixP->fx_bit_fixP);
} }
@ -1235,6 +1349,7 @@ long val;
* Local Variables: * Local Variables:
* fill-column: 131 * fill-column: 131
* comment-column: 0 * comment-column: 0
* End:
*/ */
/* end of tc-i860.c */ /* end of tc-i860.c */

View File

@ -3585,7 +3585,8 @@ md_assemble (str)
current_architecture |= m68881; current_architecture |= m68881;
} }
if (!no_68851 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; current_architecture |= m68851;
} }
@ -3942,7 +3943,7 @@ md_atof (type, litP, sizeP)
void void
md_number_to_chars (buf, val, n) md_number_to_chars (buf, val, n)
char *buf; char *buf;
long val; valueT val;
int n; int n;
{ {
switch (n) switch (n)
@ -4535,40 +4536,40 @@ CONST int md_long_jump_size = 6;
void void
md_create_short_jump (ptr, from_addr, to_addr, frag, to_symbol) md_create_short_jump (ptr, from_addr, to_addr, frag, to_symbol)
char *ptr; char *ptr;
long from_addr, to_addr; addressT from_addr, to_addr;
fragS *frag; fragS *frag;
symbolS *to_symbol; symbolS *to_symbol;
{ {
long offset; valueT offset;
offset = to_addr - (from_addr + 2); offset = to_addr - (from_addr + 2);
md_number_to_chars (ptr, (long) 0x6000, 2); md_number_to_chars (ptr, (valueT) 0x6000, 2);
md_number_to_chars (ptr + 2, (long) offset, 2); md_number_to_chars (ptr + 2, (valueT) offset, 2);
} }
void void
md_create_long_jump (ptr, from_addr, to_addr, frag, to_symbol) md_create_long_jump (ptr, from_addr, to_addr, frag, to_symbol)
char *ptr; char *ptr;
long from_addr, to_addr; addressT from_addr, to_addr;
fragS *frag; fragS *frag;
symbolS *to_symbol; symbolS *to_symbol;
{ {
long offset; valueT offset;
if (cpu_of_arch (current_architecture) < m68020) if (cpu_of_arch (current_architecture) < m68020)
{ {
offset = to_addr - S_GET_VALUE (to_symbol); offset = to_addr - S_GET_VALUE (to_symbol);
md_number_to_chars (ptr, (long) 0x4EF9, 2); md_number_to_chars (ptr, (valueT) 0x4EF9, 2);
md_number_to_chars (ptr + 2, (long) offset, 4); 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, fix_new (frag, (ptr + 2) - frag->fr_literal, 4, to_symbol, (symbolS *) 0, (long) 0, 0,
NO_RELOC); NO_RELOC);
} }
else else
{ {
offset = to_addr - (from_addr + 2); offset = to_addr - (from_addr + 2);
md_number_to_chars (ptr, (long) 0x60ff, 2); md_number_to_chars (ptr, (valueT) 0x60ff, 2);
md_number_to_chars (ptr + 2, (long) offset, 4); 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. */ /* Round up a section size to the appropriate boundary. */
long valueT
md_section_align (segment, size) md_section_align (segment, size)
segT segment; segT segment;
long size; valueT size;
{ {
return size; /* Byte alignment is fine */ return size; /* Byte alignment is fine */
} }

View File

@ -21,15 +21,9 @@
#include <stdio.h> #include <stdio.h>
#include <ctype.h> #include <ctype.h>
#ifdef USG
#include <string.h>
#else
#include <strings.h>
#endif
#include "opcode/ns32k.h" #include "opcode/ns32k.h"
#include "as.h" #include "as.h"
#include "read.h"
#include "obstack.h" #include "obstack.h"
@ -1536,7 +1530,7 @@ md_atof (type, litP, sizeP)
void void
md_number_to_chars (buf, value, nbytes) md_number_to_chars (buf, value, nbytes)
char *buf; char *buf;
long value; valueT value;
int nbytes; int nbytes;
{ {
while (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. * Out: GNU LD relocation length code: 0, 1, or 2.
*/ */
static unsigned char nbytes_r_length[] = static unsigned char nbytes_r_length[] = {42, 0, 1, 42, 2};
{42, 0, 1, 42, 2};
long r_symbolnum; long r_symbolnum;
know (fixP->fx_addsy != NULL); 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_bsr << 28)
| (long) (fixP->fx_im_disp << 29)), | (long) (fixP->fx_im_disp << 29)),
4); 4);
}
return;
} /* tc_aout_fix_to_chars() */
#endif /* OBJ_AOUT */ #endif /* OBJ_AOUT */
@ -1977,34 +1968,34 @@ md_estimate_size_before_relax (fragP, segment)
int md_short_jump_size = 3; int md_short_jump_size = 3;
int md_long_jump_size = 5; 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 void
md_create_short_jump (ptr, from_addr, to_addr, frag, to_symbol) md_create_short_jump (ptr, from_addr, to_addr, frag, to_symbol)
char *ptr; char *ptr;
long from_addr, to_addr; addressT from_addr, to_addr;
fragS *frag; fragS *frag;
symbolS *to_symbol; symbolS *to_symbol;
{ {
long offset; valueT offset;
offset = to_addr - from_addr; offset = to_addr - from_addr;
md_number_to_chars (ptr, (long) 0xEA, 1); md_number_to_chars (ptr, (valueT) 0xEA, 1);
md_number_to_disp (ptr + 1, (long) offset, 2); md_number_to_disp (ptr + 1, (valueT) offset, 2);
} }
void void
md_create_long_jump (ptr, from_addr, to_addr, frag, to_symbol) md_create_long_jump (ptr, from_addr, to_addr, frag, to_symbol)
char *ptr; char *ptr;
long from_addr, to_addr; addressT from_addr, to_addr;
fragS *frag; fragS *frag;
symbolS *to_symbol; symbolS *to_symbol;
{ {
long offset; valueT offset;
offset = to_addr - from_addr; offset = to_addr - from_addr;
md_number_to_chars (ptr, (long) 0xEA, 2); md_number_to_chars (ptr, (valueT) 0xEA, 2);
md_number_to_disp (ptr + 2, (long) offset, 4); md_number_to_disp (ptr + 2, (valueT) offset, 4);
} }
/* JF this is a new function to parse machine-dep options */ /* 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; fixP->fx_bsr = bsr;
} /* fix_new_ns32k() */ } /* 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. */ /* We have no need to default values of symbols. */
symbolS * symbolS *
@ -2120,10 +2125,10 @@ md_operand (expressionP)
} }
/* Round up a section size to the appropriate boundary. */ /* Round up a section size to the appropriate boundary. */
long valueT
md_section_align (segment, size) md_section_align (segment, size)
segT segment; segT segment;
long size; valueT size;
{ {
return size; /* Byte alignment is fine */ return size; /* Byte alignment is fine */
} }

1390
gas/config/tc-sh.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -455,11 +455,11 @@ md_parse_option (argP, cntP, vecP)
void /* Knows about order of bytes in address. */ void /* Knows about order of bytes in address. */
md_number_to_chars (con, value, nbytes) md_number_to_chars (con, value, nbytes)
char con[]; /* Return 'nbytes' of chars here. */ 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 nbytes; /* Number of bytes in the output. */
{ {
int n = nbytes; int n = nbytes;
long int v = value; valueT v = value;
con += nbytes - 1; /* Tahoes is (Bleah!) big endian */ con += nbytes - 1; /* Tahoes is (Bleah!) big endian */
while (nbytes--) while (nbytes--)
@ -595,11 +595,11 @@ const int md_short_jump_size = 3;
void void
md_create_short_jump (ptr, from_addr, to_addr, frag, to_symbol) md_create_short_jump (ptr, from_addr, to_addr, frag, to_symbol)
char *ptr; char *ptr;
long from_addr, to_addr; addressT from_addr, to_addr;
fragS *frag; fragS *frag;
symbolS *to_symbol; symbolS *to_symbol;
{ {
long offset; valueT offset;
offset = to_addr - (from_addr + 1); offset = to_addr - (from_addr + 1);
*ptr++ = TAHOE_BRW; *ptr++ = TAHOE_BRW;
@ -612,11 +612,11 @@ const int md_reloc_size = 8; /* Size of relocation record */
void void
md_create_long_jump (ptr, from_addr, to_addr, frag, to_symbol) md_create_long_jump (ptr, from_addr, to_addr, frag, to_symbol)
char *ptr; char *ptr;
long from_addr, to_addr; addressT from_addr, to_addr;
fragS *frag; fragS *frag;
symbolS *to_symbol; symbolS *to_symbol;
{ {
long offset; valueT offset;
offset = to_addr - (from_addr + 4); offset = to_addr - (from_addr + 4);
*ptr++ = TAHOE_JMP; *ptr++ = TAHOE_JMP;
@ -2044,10 +2044,10 @@ md_operand (expressionP)
} /* md_operand() */ } /* md_operand() */
/* Round up a section size to the appropriate boundary. */ /* Round up a section size to the appropriate boundary. */
long valueT
md_section_align (segment, size) md_section_align (segment, size)
segT segment; segT segment;
long size; valueT size;
{ {
return ((size + 7) & ~7); /* Round all sects to multiple of 8 */ return ((size + 7) & ~7); /* Round all sects to multiple of 8 */
} /* md_section_align() */ } /* md_section_align() */

View File

@ -289,11 +289,11 @@ md_end ()
void /* Knows about order of bytes in address. */ void /* Knows about order of bytes in address. */
md_number_to_chars (con, value, nbytes) md_number_to_chars (con, value, nbytes)
char con[]; /* Return 'nbytes' of chars here. */ 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 nbytes; /* Number of bytes in the output. */
{ {
int n; int n;
long v; valueT v;
n = nbytes; n = nbytes;
v = value; v = value;
@ -3175,11 +3175,11 @@ const int md_reloc_size = 8; /* Size of relocation record */
void void
md_create_short_jump (ptr, from_addr, to_addr, frag, to_symbol) md_create_short_jump (ptr, from_addr, to_addr, frag, to_symbol)
char *ptr; char *ptr;
long from_addr, to_addr; addressT from_addr, to_addr;
fragS *frag; fragS *frag;
symbolS *to_symbol; symbolS *to_symbol;
{ {
long offset; valueT offset;
offset = to_addr - (from_addr + 1); offset = to_addr - (from_addr + 1);
*ptr++ = 0x31; *ptr++ = 0x31;
@ -3189,11 +3189,11 @@ md_create_short_jump (ptr, from_addr, to_addr, frag, to_symbol)
void void
md_create_long_jump (ptr, from_addr, to_addr, frag, to_symbol) md_create_long_jump (ptr, from_addr, to_addr, frag, to_symbol)
char *ptr; char *ptr;
long from_addr, to_addr; addressT from_addr, to_addr;
fragS *frag; fragS *frag;
symbolS *to_symbol; symbolS *to_symbol;
{ {
long offset; valueT offset;
offset = to_addr - S_GET_VALUE (to_symbol); offset = to_addr - S_GET_VALUE (to_symbol);
*ptr++ = 0x17; *ptr++ = 0x17;
@ -3258,10 +3258,13 @@ md_parse_option (argP, cntP, vecP)
as_warn ("I don't use an interpass file! -V ignored"); as_warn ("I don't use an interpass file! -V ignored");
break; break;
#ifdef VMS #ifdef OBJ_VMS
case '+': /* For g++ */ case '+': /* For g++ */
break; break;
case '1': /* For backward compatibility */
break;
case 'h': /* No hashing of mixed-case names */ case 'h': /* No hashing of mixed-case names */
break; break;
@ -3298,10 +3301,10 @@ md_operand (expressionP)
} }
/* Round up a section size to the appropriate boundary. */ /* Round up a section size to the appropriate boundary. */
long valueT
md_section_align (segment, size) md_section_align (segment, size)
segT segment; segT segment;
long size; valueT size;
{ {
return size; /* Byte alignment is fine */ return size; /* Byte alignment is fine */
} }

View File

@ -27,10 +27,8 @@
#include "../opcodes/z8k-opc.h" #include "../opcodes/z8k-opc.h"
#include "as.h" #include "as.h"
#include "read.h"
#include "bfd.h" #include "bfd.h"
#include <ctype.h> #include <ctype.h>
#include "listing.h"
const char comment_chars[] = const char comment_chars[] =
{'!', 0}; {'!', 0};
@ -41,7 +39,7 @@ const char line_comment_chars[] = { '#', 0};
extern int machine; extern int machine;
extern int coff_flags; extern int coff_flags;
int segmented_mode; int segmented_mode;
int md_reloc_size; const int md_reloc_size;
/* This table describes all the machine specific pseudo-ops the assembler /* This table describes all the machine specific pseudo-ops the assembler
has to support. The fields are: has to support. The fields are:
@ -1170,8 +1168,8 @@ tc_aout_fix_to_chars ()
void void
md_create_short_jump (ptr, from_addr, to_addr, frag, to_symbol) md_create_short_jump (ptr, from_addr, to_addr, frag, to_symbol)
char *ptr; char *ptr;
long from_addr; addressT from_addr;
long to_addr; addressT to_addr;
fragS *frag; fragS *frag;
symbolS *to_symbol; symbolS *to_symbol;
{ {
@ -1181,7 +1179,7 @@ md_create_short_jump (ptr, from_addr, to_addr, frag, to_symbol)
void void
md_create_long_jump (ptr, from_addr, to_addr, frag, to_symbol) md_create_long_jump (ptr, from_addr, to_addr, frag, to_symbol)
char *ptr; char *ptr;
long from_addr, to_addr; addressT from_addr, to_addr;
fragS *frag; fragS *frag;
symbolS *to_symbol; symbolS *to_symbol;
{ {
@ -1198,10 +1196,10 @@ md_convert_frag (headers, fragP)
abort (); abort ();
} }
long valueT
DEFUN (md_section_align, (seg, size), DEFUN (md_section_align, (seg, size),
segT seg AND segT seg AND
long size) valueT size)
{ {
return ((size + (1 << section_alignment[(int) seg]) - 1) & (-1 << section_alignment[(int) seg])); 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 void
DEFUN (md_number_to_chars, (ptr, use, nbytes), DEFUN (md_number_to_chars, (ptr, use, nbytes),
char *ptr AND char *ptr AND
long use AND valueT use AND
int nbytes) int nbytes)
{ {
switch (nbytes) switch (nbytes)