Ran "indent", for GNU coding style; some code & comments still need fixup.

Removed some unneeded files.

obj-coff.c (obj_coff_endef): Use as_warn, not fprintf.
tc-m68k.c (md_assemble): 68000+68881 is okay -- could be emulating.
This commit is contained in:
Ken Raeburn 1992-11-23 20:42:33 +00:00
parent 6efd877de5
commit 355afbcd8b
41 changed files with 21425 additions and 18906 deletions

View File

@ -1,3 +1,10 @@
Mon Nov 23 11:50:00 1992 Ken Raeburn (raeburn@cygnus.com)
* obj-coff.c (obj_coff_endef): Use as_warn, not fprintf.
* tc-m68k.c (md_assemble): Don't complain about 68000 with 68881;
could be doing emulation.
Tue Nov 10 09:50:25 1992 Ian Lance Taylor (ian@cygnus.com)
* tc-m68k.c (m68k_reg_parse): If REGISTER_PREFIX isn't defined,

View File

@ -19,18 +19,13 @@
#include "as.h"
#ifdef USG
#define bzero(s,n) memset(s,0,n)
#define bcopy(from,to,n) memcpy((to),(from),(n))
#endif
extern FLONUM_TYPE generic_floating_point_number; /* Flonums returned here. */
#ifndef NULL
#define NULL (0)
#endif
extern char EXP_CHARS[];
extern const char EXP_CHARS[];
/* Precision in LittleNums. */
#define MAX_PRECISION (6)
#define F_PRECISION (2)
@ -41,7 +36,8 @@ extern char EXP_CHARS[];
/* Length in LittleNums of guard bits. */
#define GUARD (2)
static unsigned long mask [] = {
static unsigned long mask[] =
{
0x00000000,
0x00000001,
0x00000003,
@ -83,52 +79,60 @@ static int littlenums_left;
static LITTLENUM_TYPE *littlenum_pointer;
static int
next_bits (number_of_bits)
int number_of_bits;
next_bits (number_of_bits)
int number_of_bits;
{
int return_value;
if (!littlenums_left)
return(0);
if (number_of_bits >= bits_left_in_littlenum) {
return (0);
if (number_of_bits >= bits_left_in_littlenum)
{
return_value = mask[bits_left_in_littlenum] & *littlenum_pointer;
number_of_bits -= bits_left_in_littlenum;
return_value <<= number_of_bits;
if (--littlenums_left) {
if (--littlenums_left)
{
bits_left_in_littlenum = LITTLENUM_NUMBER_OF_BITS - number_of_bits;
--littlenum_pointer;
return_value |= (*littlenum_pointer >> bits_left_in_littlenum) & mask[number_of_bits];
}
} else {
}
else
{
bits_left_in_littlenum -= number_of_bits;
return_value = mask[number_of_bits] & (*littlenum_pointer >> bits_left_in_littlenum);
}
return(return_value);
return (return_value);
}
/* Num had better be less than LITTLENUM_NUMBER_OF_BITS */
static void
unget_bits(num)
int num;
unget_bits (num)
int num;
{
if (!littlenums_left) {
if (!littlenums_left)
{
++littlenum_pointer;
++littlenums_left;
bits_left_in_littlenum = num;
} else if (bits_left_in_littlenum + num > LITTLENUM_NUMBER_OF_BITS) {
}
else if (bits_left_in_littlenum + num > LITTLENUM_NUMBER_OF_BITS)
{
bits_left_in_littlenum = num - (LITTLENUM_NUMBER_OF_BITS - bits_left_in_littlenum);
++littlenum_pointer;
++littlenums_left;
} else
}
else
bits_left_in_littlenum += num;
}
static void
make_invalid_floating_point_number(words)
LITTLENUM_TYPE *words;
make_invalid_floating_point_number (words)
LITTLENUM_TYPE *words;
{
as_bad("cannot create floating-point number");
as_bad ("cannot create floating-point number");
words[0] = ((unsigned) -1) >> 1; /* Zero the leftmost bit */
words[1] = -1;
words[2] = -1;
@ -149,10 +153,10 @@ LITTLENUM_TYPE *words;
them. */
char * /* Return pointer past text consumed. */
atof_ieee(str, what_kind, words)
char *str; /* Text to convert to binary. */
char what_kind; /* 'd', 'f', 'g', 'h' */
LITTLENUM_TYPE *words; /* Build the binary here. */
atof_ieee (str, what_kind, words)
char *str; /* Text to convert to binary. */
char what_kind; /* 'd', 'f', 'g', 'h' */
LITTLENUM_TYPE *words; /* Build the binary here. */
{
static LITTLENUM_TYPE bits[MAX_PRECISION + MAX_PRECISION + GUARD];
/* Extra bits for zeroed low-order bits. */
@ -181,9 +185,10 @@ LITTLENUM_TYPE *words; /* Build the binary here. */
/* necessary: the highest flonum may have */
/* 15 leading 0 bits, so could be useless. */
bzero(bits, sizeof(LITTLENUM_TYPE) * MAX_PRECISION);
memset (bits, '\0', sizeof (LITTLENUM_TYPE) * MAX_PRECISION);
switch (what_kind) {
switch (what_kind)
{
case 'f':
case 'F':
case 's':
@ -216,31 +221,33 @@ LITTLENUM_TYPE *words; /* Build the binary here. */
break;
default:
make_invalid_floating_point_number(words);
return(NULL);
make_invalid_floating_point_number (words);
return (NULL);
}
generic_floating_point_number.high = generic_floating_point_number.low + precision - 1 + GUARD;
if (atof_generic(&return_value, ".", EXP_CHARS, &generic_floating_point_number)) {
if (atof_generic (&return_value, ".", EXP_CHARS, &generic_floating_point_number))
{
/* as_bad("Error converting floating point number (Exponent overflow?)"); */
make_invalid_floating_point_number(words);
return(NULL);
make_invalid_floating_point_number (words);
return (NULL);
}
gen_to_words(words, precision, exponent_bits);
gen_to_words (words, precision, exponent_bits);
/* Restore the generic_floating_point_number's storage alloc
(and everything else). */
generic_floating_point_number = save_gen_flonum;
return(return_value);
return (return_value);
}
/* Turn generic_floating_point_number into a real float/double/extended */
int gen_to_words(words, precision, exponent_bits)
LITTLENUM_TYPE *words;
int precision;
long exponent_bits;
int
gen_to_words (words, precision, exponent_bits)
LITTLENUM_TYPE *words;
int precision;
long exponent_bits;
{
int return_value = 0;
@ -252,52 +259,67 @@ long exponent_bits;
LITTLENUM_TYPE word1;
LITTLENUM_TYPE *lp;
if (generic_floating_point_number.low > generic_floating_point_number.leader) {
if (generic_floating_point_number.low > generic_floating_point_number.leader)
{
/* 0.0e0 seen. */
if (generic_floating_point_number.sign == '+')
words[0] = 0x0000;
else
words[0] = 0x8000;
bzero(&words[1], sizeof(LITTLENUM_TYPE) * (precision - 1));
return(return_value);
memset (&words[1], '\0', sizeof (LITTLENUM_TYPE) * (precision - 1));
return (return_value);
}
/* NaN: Do the right thing */
if (generic_floating_point_number.sign == 0) {
if (precision == F_PRECISION) {
if (generic_floating_point_number.sign == 0)
{
if (precision == F_PRECISION)
{
words[0] = 0x7fff;
words[1] = 0xffff;
} else {
}
else
{
words[0] = 0x7fff;
words[1] = 0xffff;
words[2] = 0xffff;
words[3] = 0xffff;
}
return return_value;
} else if (generic_floating_point_number.sign == 'P') {
}
else if (generic_floating_point_number.sign == 'P')
{
/* +INF: Do the right thing */
if (precision == F_PRECISION) {
if (precision == F_PRECISION)
{
words[0] = 0x7f80;
words[1] = 0;
} else {
}
else
{
words[0] = 0x7ff0;
words[1] = 0;
words[2] = 0;
words[3] = 0;
}
return(return_value);
} else if (generic_floating_point_number.sign == 'N') {
return (return_value);
}
else if (generic_floating_point_number.sign == 'N')
{
/* Negative INF */
if (precision == F_PRECISION) {
if (precision == F_PRECISION)
{
words[0] = 0xff80;
words[1] = 0x0;
} else {
}
else
{
words[0] = 0xfff0;
words[1] = 0x0;
words[2] = 0x0;
words[3] = 0x0;
}
return(return_value);
return (return_value);
}
/*
* The floating point formats we support have:
@ -313,7 +335,7 @@ long exponent_bits;
littlenum_pointer = generic_floating_point_number.leader;
littlenums_left = 1 + generic_floating_point_number.leader - generic_floating_point_number.low;
/* Seek (and forget) 1st significant bit */
for (exponent_skippage = 0;! next_bits(1); exponent_skippage ++) ;;
for (exponent_skippage = 0; !next_bits (1); ++exponent_skippage);;
exponent_1 = generic_floating_point_number.exponent + generic_floating_point_number.leader
+ 1 - generic_floating_point_number.low;
/* Radix LITTLENUM_RADIX, point just higher than generic_floating_point_number.leader. */
@ -330,86 +352,106 @@ long exponent_bits;
word1 = (generic_floating_point_number.sign == '+') ? 0 : (1 << (LITTLENUM_NUMBER_OF_BITS - 1));
/* Assume 2's complement integers. */
if (exponent_4 < 1 && exponent_4 >= -62) {
if (exponent_4 < 1 && exponent_4 >= -62)
{
int prec_bits;
int num_bits;
unget_bits(1);
unget_bits (1);
num_bits = -exponent_4;
prec_bits = LITTLENUM_NUMBER_OF_BITS * precision - (exponent_bits + 1 + num_bits);
if(precision == X_PRECISION && exponent_bits == 15)
if (precision == X_PRECISION && exponent_bits == 15)
prec_bits -= LITTLENUM_NUMBER_OF_BITS + 1;
if (num_bits >= LITTLENUM_NUMBER_OF_BITS - exponent_bits) {
if (num_bits >= LITTLENUM_NUMBER_OF_BITS - exponent_bits)
{
/* Bigger than one littlenum */
num_bits -= (LITTLENUM_NUMBER_OF_BITS - 1) - exponent_bits;
*lp++ = word1;
if (num_bits + exponent_bits + 1 >= precision * LITTLENUM_NUMBER_OF_BITS) {
if (num_bits + exponent_bits + 1 >= precision * LITTLENUM_NUMBER_OF_BITS)
{
/* Exponent overflow */
make_invalid_floating_point_number(words);
return(return_value);
make_invalid_floating_point_number (words);
return (return_value);
}
if (precision == X_PRECISION && exponent_bits == 15) {
if (precision == X_PRECISION && exponent_bits == 15)
{
*lp++ = 0;
*lp++ = 0;
num_bits -= LITTLENUM_NUMBER_OF_BITS - 1;
}
while (num_bits >= LITTLENUM_NUMBER_OF_BITS) {
while (num_bits >= LITTLENUM_NUMBER_OF_BITS)
{
num_bits -= LITTLENUM_NUMBER_OF_BITS;
*lp++ = 0;
}
if (num_bits)
*lp++ = next_bits(LITTLENUM_NUMBER_OF_BITS - (num_bits));
} else {
if (precision == X_PRECISION && exponent_bits == 15) {
*lp++ = next_bits (LITTLENUM_NUMBER_OF_BITS - (num_bits));
}
else
{
if (precision == X_PRECISION && exponent_bits == 15)
{
*lp++ = word1;
*lp++ = 0;
if (num_bits == LITTLENUM_NUMBER_OF_BITS) {
if (num_bits == LITTLENUM_NUMBER_OF_BITS)
{
*lp++ = 0;
*lp++ = next_bits(LITTLENUM_NUMBER_OF_BITS - 1);
} else if (num_bits == LITTLENUM_NUMBER_OF_BITS - 1)
*lp++ = next_bits (LITTLENUM_NUMBER_OF_BITS - 1);
}
else if (num_bits == LITTLENUM_NUMBER_OF_BITS - 1)
*lp++ = 0;
else
*lp++ = next_bits(LITTLENUM_NUMBER_OF_BITS - 1 - num_bits);
*lp++ = next_bits (LITTLENUM_NUMBER_OF_BITS - 1 - num_bits);
num_bits = 0;
} else {
word1 |= next_bits((LITTLENUM_NUMBER_OF_BITS - 1) - (exponent_bits + num_bits));
}
else
{
word1 |= next_bits ((LITTLENUM_NUMBER_OF_BITS - 1) - (exponent_bits + num_bits));
*lp++ = word1;
}
}
while (lp < words + precision)
*lp++ = next_bits(LITTLENUM_NUMBER_OF_BITS);
*lp++ = next_bits (LITTLENUM_NUMBER_OF_BITS);
/* Round the mantissa up, but don't change the number */
if (next_bits(1)) {
if (next_bits (1))
{
--lp;
if (prec_bits > LITTLENUM_NUMBER_OF_BITS) {
if (prec_bits > LITTLENUM_NUMBER_OF_BITS)
{
int n = 0;
int tmp_bits;
n = 0;
tmp_bits = prec_bits;
while (tmp_bits > LITTLENUM_NUMBER_OF_BITS) {
while (tmp_bits > LITTLENUM_NUMBER_OF_BITS)
{
if (lp[n] != (LITTLENUM_TYPE) - 1)
break;
--n;
tmp_bits -= LITTLENUM_NUMBER_OF_BITS;
}
if (tmp_bits > LITTLENUM_NUMBER_OF_BITS || (lp[n] & mask[tmp_bits]) != mask[tmp_bits]) {
if (tmp_bits > LITTLENUM_NUMBER_OF_BITS || (lp[n] & mask[tmp_bits]) != mask[tmp_bits])
{
unsigned long carry;
for (carry = 1; carry && (lp >= words); lp --) {
for (carry = 1; carry && (lp >= words); lp--)
{
carry = *lp + carry;
*lp = carry;
carry >>= LITTLENUM_NUMBER_OF_BITS;
}
}
} else if ((*lp & mask[prec_bits]) != mask[prec_bits])
}
else if ((*lp & mask[prec_bits]) != mask[prec_bits])
lp++;
}
return return_value;
} else if (exponent_4 & ~ mask [exponent_bits]) {
}
else if (exponent_4 & ~mask[exponent_bits])
{
/*
* Exponent overflow. Lose immediately.
*/
@ -421,7 +463,9 @@ long exponent_bits;
*/
make_invalid_floating_point_number (words);
return return_value;
} else {
}
else
{
word1 |= (exponent_4 << ((LITTLENUM_NUMBER_OF_BITS - 1) - exponent_bits))
| next_bits ((LITTLENUM_NUMBER_OF_BITS - 1) - exponent_bits);
}
@ -430,16 +474,18 @@ long exponent_bits;
/* X_PRECISION is special: it has 16 bits of zero in the middle,
followed by a 1 bit. */
if (exponent_bits == 15 && precision == X_PRECISION) {
if (exponent_bits == 15 && precision == X_PRECISION)
{
*lp++ = 0;
*lp++ = 1 << (LITTLENUM_NUMBER_OF_BITS) | next_bits(LITTLENUM_NUMBER_OF_BITS - 1);
*lp++ = 1 << (LITTLENUM_NUMBER_OF_BITS) | next_bits (LITTLENUM_NUMBER_OF_BITS - 1);
}
/* The rest of the words are just mantissa bits. */
while(lp < words + precision)
*lp++ = next_bits(LITTLENUM_NUMBER_OF_BITS);
while (lp < words + precision)
*lp++ = next_bits (LITTLENUM_NUMBER_OF_BITS);
if (next_bits(1)) {
if (next_bits (1))
{
unsigned long carry;
/*
* Since the NEXT bit is a 1, round UP the mantissa.
@ -457,12 +503,14 @@ long exponent_bits;
don't get a sticky sign bit after shifting right, and that
permits us to propagate the carry without any masking of bits.
#endif */
for (carry = 1, lp--; carry && (lp >= words); lp--) {
for (carry = 1, lp--; carry && (lp >= words); lp--)
{
carry = *lp + carry;
*lp = carry;
carry >>= LITTLENUM_NUMBER_OF_BITS;
}
if ((word1 ^ *words) & (1 << (LITTLENUM_NUMBER_OF_BITS - 1))) {
if ((word1 ^ *words) & (1 << (LITTLENUM_NUMBER_OF_BITS - 1)))
{
/* We leave return_value alone: admit we read the
* number, but return a floating exception
* because we can't encode the number.
@ -480,22 +528,22 @@ long exponent_bits;
(JF)
*/
void
int_to_gen(x)
long x;
int_to_gen (x)
long x;
{
char buf[20];
char *bufp;
sprintf(buf,"%ld",x);
sprintf (buf, "%ld", x);
bufp = &buf[0];
if (atof_generic(&bufp, ".", EXP_CHARS, &generic_floating_point_number))
as_bad("Error converting number to floating point (Exponent overflow?)");
if (atof_generic (&bufp, ".", EXP_CHARS, &generic_floating_point_number))
as_bad ("Error converting number to floating point (Exponent overflow?)");
}
#ifdef TEST
char *
print_gen(gen)
FLONUM_TYPE *gen;
print_gen (gen)
FLONUM_TYPE *gen;
{
FLONUM_TYPE f;
LITTLENUM_TYPE arr[10];
@ -503,24 +551,26 @@ FLONUM_TYPE *gen;
float fv;
static char sbuf[40];
if (gen) {
if (gen)
{
f = generic_floating_point_number;
generic_floating_point_number = *gen;
}
gen_to_words(&arr[0], 4, 11);
bcopy(&arr[0], &dv, sizeof(double));
sprintf(sbuf, "%x %x %x %x %.14G ", arr[0], arr[1], arr[2], arr[3], dv);
gen_to_words(&arr[0],2,8);
bcopy(&arr[0],&fv,sizeof(float));
sprintf(sbuf + strlen(sbuf), "%x %x %.12g\n", arr[0], arr[1],
fv);
gen_to_words (&arr[0], 4, 11);
memcpy (&dv, &arr[0], sizeof (double));
sprintf (sbuf, "%x %x %x %x %.14G ", arr[0], arr[1], arr[2], arr[3], dv);
gen_to_words (&arr[0], 2, 8);
memcpy (&fv, &arr[0], sizeof (float));
sprintf (sbuf + strlen (sbuf), "%x %x %.12g\n", arr[0], arr[1], fv);
if (gen) {
if (gen)
{
generic_floating_point_number = f;
}
return(sbuf);
return (sbuf);
}
#endif
/* end of atof-ieee.c */

View File

@ -24,12 +24,12 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
extern FLONUM_TYPE generic_floating_point_number; /* Flonums returned here. */
extern const char EXP_CHARS[];
/* Precision in LittleNums. */
/* Precision in LittleNums. */
#define MAX_PRECISION (4)
#define F_PRECISION (2)
#define D_PRECISION (4)
/* Length in LittleNums of guard bits. */
/* Length in LittleNums of guard bits. */
#define GUARD (2)
int /* Number of chars in flonum type 'letter'. */
@ -60,7 +60,8 @@ atof_sizeof (letter)
return (return_value);
}
static unsigned long int mask [] = {
static unsigned long int mask[] =
{
0x00000000,
0x00000001,
0x00000003,
@ -94,11 +95,11 @@ static unsigned long int mask [] = {
0x3fffffff,
0x7fffffff,
0xffffffff
};
};
static int bits_left_in_littlenum;
static int littlenums_left;
static LITTLENUM_TYPE * littlenum_pointer;
static LITTLENUM_TYPE *littlenum_pointer;
static int
next_bits (number_of_bits)
@ -106,36 +107,37 @@ next_bits (number_of_bits)
{
int return_value;
if(!littlenums_left)
if (!littlenums_left)
return 0;
if (number_of_bits >= bits_left_in_littlenum)
{
return_value = mask [bits_left_in_littlenum] & *littlenum_pointer;
return_value = mask[bits_left_in_littlenum] & *littlenum_pointer;
number_of_bits -= bits_left_in_littlenum;
return_value <<= number_of_bits;
if(littlenums_left) {
if (littlenums_left)
{
bits_left_in_littlenum = LITTLENUM_NUMBER_OF_BITS - number_of_bits;
littlenum_pointer --;
littlenum_pointer--;
--littlenums_left;
return_value |= (*littlenum_pointer>>bits_left_in_littlenum) & mask[number_of_bits];
return_value |= (*littlenum_pointer >> bits_left_in_littlenum) & mask[number_of_bits];
}
}
else
{
bits_left_in_littlenum -= number_of_bits;
return_value = mask [number_of_bits] & (*littlenum_pointer>>bits_left_in_littlenum);
return_value = mask[number_of_bits] & (*littlenum_pointer >> bits_left_in_littlenum);
}
return (return_value);
}
static void
make_invalid_floating_point_number (words)
LITTLENUM_TYPE * words;
LITTLENUM_TYPE *words;
{
words[0]= ((unsigned)-1)>>1; /* Zero the leftmost bit */
words[1]= -1;
words[2]= -1;
words[3]= -1;
words[0] = ((unsigned) -1) >> 1; /* Zero the leftmost bit */
words[1] = -1;
words[2] = -1;
words[3] = -1;
}
/***********************************************************************\
@ -149,16 +151,16 @@ make_invalid_floating_point_number (words)
char * /* Return pointer past text consumed. */
atof_ns32k (str, what_kind, words)
char * str; /* Text to convert to binary. */
char *str; /* Text to convert to binary. */
char what_kind; /* 'd', 'f', 'g', 'h' */
LITTLENUM_TYPE * words; /* Build the binary here. */
LITTLENUM_TYPE *words; /* Build the binary here. */
{
FLONUM_TYPE f;
LITTLENUM_TYPE bits [MAX_PRECISION + MAX_PRECISION + GUARD];
LITTLENUM_TYPE bits[MAX_PRECISION + MAX_PRECISION + GUARD];
/* Extra bits for zeroed low-order bits. */
/* The 1st MAX_PRECISION are zeroed, */
/* the last contain flonum bits. */
char * return_value;
char *return_value;
int precision; /* Number of 16-bit words in the format. */
long int exponent_bits;
@ -168,7 +170,7 @@ atof_ns32k (str, what_kind, words)
long int exponent_4;
int exponent_skippage;
LITTLENUM_TYPE word1;
LITTLENUM_TYPE * lp;
LITTLENUM_TYPE *lp;
return_value = str;
f.low = bits + MAX_PRECISION;
@ -181,9 +183,10 @@ atof_ns32k (str, what_kind, words)
/* necessary: the highest flonum may have */
/* 15 leading 0 bits, so could be useless. */
bzero (bits, sizeof(LITTLENUM_TYPE) * MAX_PRECISION);
bzero (bits, sizeof (LITTLENUM_TYPE) * MAX_PRECISION);
switch(what_kind) {
switch (what_kind)
{
case 'f':
precision = F_PRECISION;
exponent_bits = 8;
@ -201,20 +204,23 @@ atof_ns32k (str, what_kind, words)
f.high = f.low + precision - 1 + GUARD;
if (atof_generic (& return_value, ".", EXP_CHARS, & f)) {
as_warn("Error converting floating point number (Exponent overflow?)");
if (atof_generic (&return_value, ".", EXP_CHARS, &f))
{
as_warn ("Error converting floating point number (Exponent overflow?)");
make_invalid_floating_point_number (words);
return NULL;
}
if (f.low > f.leader) {
if (f.low > f.leader)
{
/* 0.0e0 seen. */
bzero (words, sizeof(LITTLENUM_TYPE) * precision);
bzero (words, sizeof (LITTLENUM_TYPE) * precision);
return return_value;
}
if(f.sign!='+' && f.sign!='-') {
make_invalid_floating_point_number(words);
if (f.sign != '+' && f.sign != '-')
{
make_invalid_floating_point_number (words);
return NULL;
}
@ -232,9 +238,9 @@ atof_ns32k (str, what_kind, words)
*/
bits_left_in_littlenum = LITTLENUM_NUMBER_OF_BITS;
littlenum_pointer = f.leader;
littlenums_left = 1 + f.leader-f.low;
littlenums_left = 1 + f.leader - f.low;
/* Seek (and forget) 1st significant bit */
for (exponent_skippage = 0;! next_bits(1); exponent_skippage ++)
for (exponent_skippage = 0; !next_bits (1); exponent_skippage++)
;
exponent_1 = f.exponent + f.leader + 1 - f.low;
/* Radix LITTLENUM_RADIX, point just higher than f.leader. */
@ -245,7 +251,8 @@ atof_ns32k (str, what_kind, words)
exponent_4 = exponent_3 + ((1 << (exponent_bits - 1)) - 2);
/* Offset exponent. */
if (exponent_4 & ~ mask [exponent_bits]) {
if (exponent_4 & ~mask[exponent_bits])
{
/*
* Exponent overflow. Lose immediately.
*/
@ -256,7 +263,7 @@ atof_ns32k (str, what_kind, words)
* because we can't encode the number.
*/
as_warn("Exponent overflow in floating-point number");
as_warn ("Exponent overflow in floating-point number");
make_invalid_floating_point_number (words);
return return_value;
}
@ -264,15 +271,16 @@ atof_ns32k (str, what_kind, words)
/* Word 1. Sign, exponent and perhaps high bits. */
/* Assume 2's complement integers. */
word1 = ((exponent_4 & mask [exponent_bits]) << (15 - exponent_bits)) |
word1 = ((exponent_4 & mask[exponent_bits]) << (15 - exponent_bits)) |
((f.sign == '+') ? 0 : 0x8000) | next_bits (15 - exponent_bits);
* lp ++ = word1;
*lp++ = word1;
/* The rest of the words are just mantissa bits. */
for (; lp < words + precision; lp++)
* lp = next_bits (LITTLENUM_NUMBER_OF_BITS);
*lp = next_bits (LITTLENUM_NUMBER_OF_BITS);
if (next_bits (1)) {
if (next_bits (1))
{
unsigned long int carry;
/*
* Since the NEXT bit is a 1, round UP the mantissa.
@ -284,19 +292,21 @@ atof_ns32k (str, what_kind, words)
*/
/* #if (sizeof(carry)) < ((sizeof(bits[0]) * BITS_PER_CHAR) + 2)
/* #if (sizeof(carry)) < ((sizeof(bits[0]) * BITS_PER_CHAR) + 2)
Please allow at least 1 more bit in carry than is in a LITTLENUM.
We need that extra bit to hold a carry during a LITTLENUM carry
propagation. Another extra bit (kept 0) will assure us that we
don't get a sticky sign bit after shifting right, and that
permits us to propagate the carry without any masking of bits.
#endif */
for (carry = 1, lp --; carry && (lp >= words); lp --) {
carry = * lp + carry;
* lp = carry;
for (carry = 1, lp--; carry && (lp >= words); lp--)
{
carry = *lp + carry;
*lp = carry;
carry >>= LITTLENUM_NUMBER_OF_BITS;
}
if ( (word1 ^ *words) & (1 << (LITTLENUM_NUMBER_OF_BITS - 1)) ) {
if ((word1 ^ *words) & (1 << (LITTLENUM_NUMBER_OF_BITS - 1)))
{
/* We leave return_value alone: admit we read the
* number, but return a floating exception
* because we can't encode the number.
@ -310,11 +320,11 @@ atof_ns32k (str, what_kind, words)
/* This is really identical to atof_ns32k except for some details */
gen_to_words(words,precision,exponent_bits)
LITTLENUM_TYPE *words;
long int exponent_bits;
gen_to_words (words, precision, exponent_bits)
LITTLENUM_TYPE *words;
long int exponent_bits;
{
int return_value=0;
int return_value = 0;
long int exponent_1;
long int exponent_2;
@ -322,11 +332,12 @@ long int exponent_bits;
long int exponent_4;
int exponent_skippage;
LITTLENUM_TYPE word1;
LITTLENUM_TYPE * lp;
LITTLENUM_TYPE *lp;
if (generic_floating_point_number.low > generic_floating_point_number.leader) {
if (generic_floating_point_number.low > generic_floating_point_number.leader)
{
/* 0.0e0 seen. */
bzero (words, sizeof(LITTLENUM_TYPE) * precision);
bzero (words, sizeof (LITTLENUM_TYPE) * precision);
return return_value;
}
@ -343,9 +354,9 @@ long int exponent_bits;
*/
bits_left_in_littlenum = LITTLENUM_NUMBER_OF_BITS;
littlenum_pointer = generic_floating_point_number.leader;
littlenums_left = 1+generic_floating_point_number.leader - generic_floating_point_number.low;
littlenums_left = 1 + generic_floating_point_number.leader - generic_floating_point_number.low;
/* Seek (and forget) 1st significant bit */
for (exponent_skippage = 0;! next_bits(1); exponent_skippage ++)
for (exponent_skippage = 0; !next_bits (1); exponent_skippage++)
;
exponent_1 = generic_floating_point_number.exponent + generic_floating_point_number.leader + 1 -
generic_floating_point_number.low;
@ -357,7 +368,8 @@ long int exponent_bits;
exponent_4 = exponent_3 + ((1 << (exponent_bits - 1)) - 2);
/* Offset exponent. */
if (exponent_4 & ~ mask [exponent_bits]) {
if (exponent_4 & ~mask[exponent_bits])
{
/*
* Exponent overflow. Lose immediately.
*/
@ -375,15 +387,16 @@ long int exponent_bits;
/* Word 1. Sign, exponent and perhaps high bits. */
/* Assume 2's complement integers. */
word1 = ((exponent_4 & mask [exponent_bits]) << (15 - exponent_bits)) |
word1 = ((exponent_4 & mask[exponent_bits]) << (15 - exponent_bits)) |
((generic_floating_point_number.sign == '+') ? 0 : 0x8000) | next_bits (15 - exponent_bits);
* lp ++ = word1;
*lp++ = word1;
/* The rest of the words are just mantissa bits. */
for (; lp < words + precision; lp++)
* lp = next_bits (LITTLENUM_NUMBER_OF_BITS);
*lp = next_bits (LITTLENUM_NUMBER_OF_BITS);
if (next_bits (1)) {
if (next_bits (1))
{
unsigned long int carry;
/*
* Since the NEXT bit is a 1, round UP the mantissa.
@ -395,19 +408,21 @@ long int exponent_bits;
*/
/* #if (sizeof(carry)) < ((sizeof(bits[0]) * BITS_PER_CHAR) + 2)
/* #if (sizeof(carry)) < ((sizeof(bits[0]) * BITS_PER_CHAR) + 2)
Please allow at least 1 more bit in carry than is in a LITTLENUM.
We need that extra bit to hold a carry during a LITTLENUM carry
propagation. Another extra bit (kept 0) will assure us that we
don't get a sticky sign bit after shifting right, and that
permits us to propagate the carry without any masking of bits.
#endif */
for (carry = 1, lp --; carry && (lp >= words); lp --) {
carry = * lp + carry;
* lp = carry;
for (carry = 1, lp--; carry && (lp >= words); lp--)
{
carry = *lp + carry;
*lp = carry;
carry >>= LITTLENUM_NUMBER_OF_BITS;
}
if ( (word1 ^ *words) & (1 << (LITTLENUM_NUMBER_OF_BITS - 1)) ) {
if ((word1 ^ *words) & (1 << (LITTLENUM_NUMBER_OF_BITS - 1)))
{
/* We leave return_value alone: admit we read the
* number, but return a floating exception
* because we can't encode the number.
@ -423,14 +438,15 @@ long int exponent_bits;
I'm too lazy, and I don't understand this stuff all too well anyway
(JF)
*/
void int_to_gen(x)
long x;
void
int_to_gen (x)
long x;
{
char buf[20];
char *bufp;
sprintf(buf,"%ld",x);
bufp= &buf[0];
if(atof_generic(&bufp,".", EXP_CHARS, &generic_floating_point_number))
as_warn("Error converting number to floating point (Exponent overflow?)");
sprintf (buf, "%ld", x);
bufp = &buf[0];
if (atof_generic (&bufp, ".", EXP_CHARS, &generic_floating_point_number))
as_warn ("Error converting number to floating point (Exponent overflow?)");
}

View File

@ -30,7 +30,8 @@
/********************** FILE HEADER **********************/
struct filehdr {
struct filehdr
{
unsigned short f_magic; /* magic number */
unsigned short f_nscns; /* number of sections */
long f_timdat; /* time & date stamp */
@ -38,7 +39,7 @@ struct filehdr {
long f_nsyms; /* number of symtab entries */
unsigned short f_opthdr; /* sizeof(optional hdr) */
unsigned short f_flags; /* flags */
};
};
/* Bits for f_flags:
* F_RELFLG relocation info stripped from file
@ -53,18 +54,18 @@ struct filehdr {
#define F_LSYMS (0x0008)
#ifdef TC_I960
#define F_AR32WR (0x0010) /* File has 32 bits per word, least
#define F_AR32WR (0x0010)/* File has 32 bits per word, least
significant byte first. */
#else /* TC_I960 */
#define F_AR32WR (0x0100)
#endif /* TC_I960 */
#define F_MINMAL (0x0010) /* ??? */
#define F_UPDATE (0x0020) /* ??? */
#define F_SWABD (0x0040) /* ??? */
#define F_AR16WR (0x0080) /* File has the byte ordering used by
#define F_MINMAL (0x0010)/* ??? */
#define F_UPDATE (0x0020)/* ??? */
#define F_SWABD (0x0040)/* ??? */
#define F_AR16WR (0x0080)/* File has the byte ordering used by
the PDP*-11/70 processor. */
#define F_AR32W (0x0200) /* File has 32 bits per word, most
#define F_AR32W (0x0200)/* File has 32 bits per word, most
significant byte first. */
/*
@ -113,10 +114,13 @@ struct filehdr {
/********************** AOUT "OPTIONAL HEADER" **********************/
typedef struct {
typedef struct
{
unsigned long phys_addr;
unsigned long bitarray;
} TAGBITS;
}
TAGBITS;
/* These appear to be used only by exec(2). I don't know who cares
about them in a cross development environment. In any case, this
@ -137,10 +141,11 @@ typedef struct {
#define PAGEMAGIC3 (0415) /* (?) like ZMAGIC, but address zero mapped. */
#define A_MAGIC5 (0437) /* (?) "system overlay, separated I&D" */
/* intended for non-unix cross development */
#define SASMAGIC (010000) /* Single Address Space */
#define MASMAGIC (020000) /* (?) "Multiple (separate I & D) Address Spaces" */
#define SASMAGIC (010000)/* Single Address Space */
#define MASMAGIC (020000)/* (?) "Multiple (separate I & D) Address Spaces" */
typedef struct aouthdr {
typedef struct aouthdr
{
short magic; /* type of file */
short vstamp; /* version stamp */
unsigned long tsize; /* text size in bytes, padded to FW bdry*/
@ -156,7 +161,9 @@ typedef struct aouthdr {
/* CAREFUL: some formats omit the tagentries member. */
unsigned long tagentries; /* number of tag entries to
follow (always zero for i960) */
} AOUTHDR;
}
AOUTHDR;
/* return a pointer to the tag bits array */
@ -231,7 +238,8 @@ typedef struct aouthdr {
/********************** SECTION HEADER **********************/
struct scnhdr {
struct scnhdr
{
char s_name[8]; /* section name */
long s_paddr; /* physical address, aliased s_nlib */
long s_vaddr; /* virtual address */
@ -246,7 +254,7 @@ struct scnhdr {
#ifdef TC_I960
unsigned long s_align; /* section alignment */
#endif /* TC_I960 */
};
};
#define SCNHDR struct scnhdr
#define SCNHSZ sizeof(SCNHDR)
@ -311,17 +319,20 @@ struct scnhdr {
* grouping will have l_lnno = 0 and in place of physical address will be the
* symbol table index of the function name.
*/
struct lineno {
union {
struct lineno
{
union
{
long l_symndx; /* symbol index of function name, iff l_lnno == 0*/
long l_paddr; /* (physical) address of line number */
} l_addr;
}
l_addr;
unsigned short l_lnno; /* line number */
#ifdef TC_I960
/* not used on a29k */
char padding[2]; /* force alignment */
#endif /* TC_I960 */
};
};
#define LINENO struct lineno
#define LINESZ sizeof(LINENO)
@ -333,15 +344,20 @@ struct lineno {
#define FILNMLEN 14 /* # characters in a file name */
#define DIMNUM 4 /* # array dimensions in auxiliary entry */
struct syment {
union {
struct syment
{
union
{
char _n_name[SYMNMLEN]; /* old COFF version */
struct {
struct
{
long _n_zeroes; /* new == 0 */
long _n_offset; /* offset into string table */
} _n_n;
}
_n_n;
char *_n_nptr[2]; /* allows for overlaying */
} _n;
}
_n;
long n_value; /* value of symbol */
short n_scnum; /* section number */
@ -364,7 +380,7 @@ struct syment {
#ifndef TC_A29K
char pad2[2]; /* force alignment */
#endif /* TC_A29K */
};
};
#define SYMENT struct syment
#define SYMESZ sizeof(SYMENT) /* This had better also be sizeof(AUXENT) */
@ -374,7 +390,7 @@ struct syment {
#define n_zeroes _n._n_n._n_zeroes
#define n_offset _n._n_n._n_offset
/*
/*
* Relocatable symbols have number of the section in which they are defined,
* or one of the following:
*/
@ -442,73 +458,100 @@ struct syment {
#define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK))
union auxent {
struct {
union auxent
{
struct
{
long x_tagndx; /* str, un, or enum tag indx */
union {
struct {
union
{
struct
{
unsigned short x_lnno; /* declaration line number */
unsigned short x_size; /* str/union/array size */
} x_lnsz;
}
x_lnsz;
long x_fsize; /* size of function */
} x_misc;
union {
struct { /* if ISFCN, tag, or .bb */
}
x_misc;
union
{
struct
{ /* if ISFCN, tag, or .bb */
long x_lnnoptr; /* ptr to fcn line # */
long x_endndx; /* entry ndx past block end */
} x_fcn;
struct { /* if ISARY, up to 4 dimen. */
}
x_fcn;
struct
{ /* if ISARY, up to 4 dimen. */
unsigned short x_dimen[DIMNUM];
} x_ary;
} x_fcnary;
}
x_ary;
}
x_fcnary;
unsigned short x_tvndx; /* tv index */
} x_sym;
}
x_sym;
/* This was just a struct x_file with x_fname only in a29k. xoxorich. */
union {
union
{
char x_fname[FILNMLEN];
struct {
struct
{
long x_zeroes;
long x_offset;
} x_n;
} x_file;
}
x_n;
}
x_file;
struct {
struct
{
long x_scnlen; /* section length */
unsigned short x_nreloc; /* # relocation entries */
unsigned short x_nlinno; /* # line numbers */
} x_scn;
unsigned short x_nreloc;/* # relocation entries */
unsigned short x_nlinno;/* # line numbers */
}
x_scn;
struct {
struct
{
long x_tvfill; /* tv fill value */
unsigned short x_tvlen; /* length of .tv */
/* This field was typo'd x_tvrna on a29k. xoxorich. */
unsigned short x_tvran[2]; /* tv range */
} x_tv; /* info about .tv section (in auxent of symbol .tv)) */
}
x_tv; /* info about .tv section (in auxent of symbol .tv)) */
#ifdef TC_I960
/******************************************
* I960-specific *2nd* aux. entry formats
******************************************/
struct {
struct
{
/* This is a very old typo that keeps getting propogated. */
#define x_stdindx x_stindx
long x_stindx; /* sys. table entry */
} x_sc; /* system call entry */
}
x_sc; /* system call entry */
struct {
unsigned long x_balntry; /* BAL entry point */
} x_bal; /* BAL-callable function */
struct
{
unsigned long x_balntry;/* BAL entry point */
}
x_bal; /* BAL-callable function */
struct {
struct
{
unsigned long x_timestamp; /* time stamp */
char x_idstring[20]; /* producer identity string */
} x_ident; /* Producer ident info */
}
x_ident; /* Producer ident info */
char a[sizeof(struct syment)]; /* force auxent/syment sizes to match */
char a[sizeof (struct syment)]; /* force auxent/syment sizes to match */
#endif /* TC_I960 */
};
};
#define AUXENT union auxent
#define AUXESZ sizeof(AUXENT) /* This had better also be sizeof(SYMENT) */
@ -521,7 +564,8 @@ union auxent {
/********************** RELOCATION DIRECTIVES **********************/
struct reloc {
struct reloc
{
long r_vaddr; /* Virtual address of reference */
long r_symndx; /* Index into symbol table */
unsigned short r_type; /* Relocation type */
@ -529,7 +573,7 @@ struct reloc {
/* not used for a29k */
char pad[2]; /* Unused */
#endif /* TC_I960 */
};
};
#define RELOC struct reloc
#define RELSZ sizeof(RELOC)
@ -654,7 +698,8 @@ struct reloc {
#define UINFOSIZ 64 /* size of user info buffer */
typedef char uinfo_t[UINFOSIZ];
struct env387 {
struct env387
{
unsigned short control;
unsigned short r0;
unsigned short status;
@ -668,7 +713,7 @@ struct env387 {
unsigned short operand_seg;
unsigned short r3;
unsigned char regs[8][10];
};
};
#define CD_NAMELEN 16 /* length of most names in this header */
#define CORHDRSIZ 2048 /* size to which header is padded out */
@ -703,21 +748,27 @@ struct env387 {
#ifndef NSIG
# define NSIG 63 /* sys/signal.h */
# define SIGSETSZ ((NSIG+31)/32)
typedef struct ksigmask {
typedef struct ksigmask
{
unsigned long sigs[SIGSETSZ];
} ksigmask_t;
}
ksigmask_t;
#endif
struct corehdr {
struct corehdr
{
char cd_magic[4]; /* COR_MAGIC = "core" */
/* general information about the dump itself */
struct dumpseg { /* table of contents for dump */
struct dumpseg
{ /* table of contents for dump */
long cs_type; /* seg. type; see below */
long cs_len; /* length (in bytes) of segment */
long cs_offset; /* offset (in dump) of segment */
long cs_address; /* address segment had in mem */
} cd_segs[MAX_CORE_SEGS];
}
cd_segs[MAX_CORE_SEGS];
/* general information about the process */
char cd_comm[CD_NAMELEN]; /* command being run */
@ -734,7 +785,7 @@ struct corehdr {
struct env387 cd_fpregs; /* user-mode floating-point state */
/* kernel-mode program state */
int (*cd_sig[NSIG])(); /* disposition of signals */
int (*cd_sig[NSIG]) (); /* disposition of signals */
ksigmask_t cd_sigmask; /* signals to be blocked */
ksigmask_t cd_sigpend; /* signals currently pending */
long cd_cursig; /* signal that caused the dump */
@ -750,11 +801,15 @@ struct corehdr {
char cd_locname[32]; /* name of /local */
char cd_uvers[CD_NAMELEN]; /* user version string */
unsigned short cd_spath[SPATHLEN]; /* sitepath */
};
};
#ifndef NOCHECKS
/* this will generate an error if sizeof(struct corehdr) > CORHDRSIZ */
struct { char xxcdxx[CORHDRSIZ+1-sizeof(struct corehdr)]; };
struct
{
char xxcdxx[CORHDRSIZ + 1 - sizeof (struct corehdr)];
};
#endif /* ! NOCHECKS */
/*

View File

@ -77,10 +77,14 @@ static char **typevec = 0;
static int ntypes = 0;
static int typevec_size = 0;
static struct {
static struct
{
const char *in;
const char *out;
} optable[] = {
}
optable[] =
{
"new", " new",
"delete", " delete",
"ne", "!=",
@ -113,32 +117,35 @@ static struct {
/* Beware: these aren't '\0' terminated. */
typedef struct {
typedef struct
{
char *b; /* pointer to start of string */
char *p; /* pointer after last character */
char *e; /* pointer after end of allocated space */
} string;
}
string;
#if __STDC__ == 1
static void string_need (string *s, int n);
static void string_delete (string *s);
static void string_init (string *s);
static void string_clear (string *s);
static int string_empty (string *s);
static void string_append (string *p, const char *s);
static void string_appends (string *p, string *s);
static void string_appendn (string *p, const char *s, int n);
static void string_prepend (string *p, const char *s);
static void string_need (string * s, int n);
static void string_delete (string * s);
static void string_init (string * s);
static void string_clear (string * s);
static int string_empty (string * s);
static void string_append (string * p, const char *s);
static void string_appends (string * p, string * s);
static void string_appendn (string * p, const char *s, int n);
static void string_prepend (string * p, const char *s);
#if 0
static void string_prepends (string *p, string *s);
static void string_prepends (string * p, string * s);
#endif
static void string_prependn (string *p, const char *s, int n);
static void string_prependn (string * p, const char *s, int n);
static int get_count (const char **type, int *count);
static int do_args (const char **type, string *decl);
static int do_type (const char **type, string *result);
static int do_arg (const char **type, string *result);
static int do_args (const char **type, string *decl);
static void munge_function_name (string *name);
static int do_args (const char **type, string * decl);
static int do_type (const char **type, string * result);
static int do_arg (const char **type, string * result);
static int do_args (const char **type, string * decl);
static void munge_function_name (string * name);
#else
static void string_need ();
static void string_delete ();
@ -160,8 +167,8 @@ static void munge_function_name ();
#endif
char *
cplus_demangle (type)
const char *type;
cplus_demangle (type)
const char *type;
{
string decl;
int n;
@ -185,7 +192,7 @@ const char *type;
/* destructor */
if (type[0] == '_' && type[1] == '$' && type[2] == '_')
{
int n = (strlen (type) - 3)*2 + 3 + 2 + 1;
int n = (strlen (type) - 3) * 2 + 3 + 2 + 1;
char *tem = (char *) xmalloc (n);
strcpy (tem, type + 3);
strcat (tem, "::~");
@ -287,7 +294,7 @@ const char *type;
ntypes = 0;
if (typevec != NULL)
{
free ((char *)typevec);
free ((char *) typevec);
typevec = NULL;
typevec_size = 0;
}
@ -305,9 +312,9 @@ const char *type;
}
static int
get_count (type, count)
const char **type;
int *count;
get_count (type, count)
const char **type;
int *count;
{
if (!isdigit (**type))
return 0;
@ -337,9 +344,9 @@ int *count;
/* result will be initialised here; it will be freed on failure */
static int
do_type (type, result)
const char **type;
string *result;
do_type (type, result)
const char **type;
string *result;
{
int n;
int done;
@ -635,9 +642,9 @@ string *result;
/* `result' will be initialised in do_type; it will be freed on failure */
static int
do_arg (type, result)
const char **type;
string *result;
do_arg (type, result)
const char **type;
string *result;
{
char *tem;
int len;
@ -653,12 +660,12 @@ string *result;
if (typevec_size == 0)
{
typevec_size = 3;
typevec = (char **) xmalloc (sizeof (char*)*typevec_size);
typevec = (char **) xmalloc (sizeof (char *) * typevec_size);
}
else
{
typevec_size *= 2;
typevec = (char **) xrealloc ((char *)typevec, sizeof (char*)*typevec_size);
typevec = (char **) xrealloc ((char *) typevec, sizeof (char *) * typevec_size);
}
}
len = end - start;
@ -673,9 +680,9 @@ string *result;
it won't be freed on failure */
static int
do_args (type, decl)
const char **type;
string *decl;
do_args (type, decl)
const char **type;
string *decl;
{
string arg;
int need_comma = 0;
@ -730,8 +737,8 @@ string *decl;
}
static void
munge_function_name (name)
string *name;
munge_function_name (name)
string *name;
{
if (!string_empty (name) && name->p - name->b >= 3
&& name->b[0] == 'o' && name->b[1] == 'p' && name->b[2] == '$')
@ -741,7 +748,7 @@ string *name;
if (name->p - name->b >= 10 /* op$assign_ */
&& memcmp (name->b + 3, "assign_", 7) == 0)
{
for (i = 0; i < sizeof (optable)/sizeof (optable[0]); i++)
for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++)
{
int len = name->p - name->b - 10;
if (strlen (optable[i].in) == len
@ -757,7 +764,7 @@ string *name;
}
else
{
for (i = 0; i < sizeof (optable)/sizeof (optable[0]); i++)
for (i = 0; i < sizeof (optable) / sizeof (optable[0]); i++)
{
int len = name->p - name->b - 3;
if (strlen (optable[i].in) == len
@ -792,9 +799,9 @@ string *name;
/* a mini string-handling package */
static void
string_need (s, n)
string *s;
int n;
string_need (s, n)
string *s;
int n;
{
if (s->b == NULL)
{
@ -815,8 +822,8 @@ int n;
}
static void
string_delete (s)
string *s;
string_delete (s)
string *s;
{
if (s->b != NULL)
{
@ -826,30 +833,30 @@ string *s;
}
static void
string_init (s)
string *s;
string_init (s)
string *s;
{
s->b = s->p = s->e = NULL;
}
static void
string_clear (s)
string *s;
string_clear (s)
string *s;
{
s->p = s->b;
}
static int
string_empty (s)
string *s;
string_empty (s)
string *s;
{
return s->b == s->p;
}
static void
string_append (p, s)
string *p;
const char *s;
string_append (p, s)
string *p;
const char *s;
{
int n;
if (s == NULL || *s == '\0')
@ -861,8 +868,8 @@ const char *s;
}
static void
string_appends (p, s)
string *p, *s;
string_appends (p, s)
string *p, *s;
{
int n;
if (s->b == s->p)
@ -874,10 +881,10 @@ string *p, *s;
}
static void
string_appendn (p, s, n)
string *p;
const char *s;
int n;
string_appendn (p, s, n)
string *p;
const char *s;
int n;
{
if (n == 0)
return;
@ -887,9 +894,9 @@ int n;
}
static void
string_prepend (p, s)
string *p;
const char *s;
string_prepend (p, s)
string *p;
const char *s;
{
if (s == NULL || *s == '\0')
return;
@ -898,20 +905,21 @@ const char *s;
#if 0
static void
string_prepends (p, s)
string *p, *s;
string_prepends (p, s)
string *p, *s;
{
if (s->b == s->p)
return;
string_prependn (p, s->b, s->p - s->b);
}
#endif
static void
string_prependn (p, s, n)
string *p;
const char *s;
int n;
string_prependn (p, s, n)
string *p;
const char *s;
int n;
{
char *q;

View File

@ -19,8 +19,8 @@
#include <string.h>
extern char *malloc();
extern int free();
extern char *malloc ();
extern int free ();
#if !defined(__GNUC__)
#define know(x)

View File

@ -25,6 +25,6 @@
#define HAVE_STRERROR
extern int free();
extern int free ();
/* end of ho-generic.h */

View File

@ -19,7 +19,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#define HO_I386 1
extern void free();
extern void *malloc();
extern void free ();
extern void *malloc ();
/* end of ho-go32.h */

View File

@ -1,5 +1,5 @@
#include <ho-sunos.h>
extern int sprintf();
extern int sprintf ();
/* end of ho-sun386.h */

View File

@ -24,7 +24,7 @@
#if !defined(__GNUC__) && (__STDC__ != 1)
#include <memory.h>
#else
extern int memset();
extern int memset ();
#endif
/* #include <sys/stdtypes.h> before <stddef.h> when compiling by GCC. */
@ -37,38 +37,38 @@ extern int memset();
/*extern int abort();*/
/*extern int exit();*/
extern char *malloc();
extern char *realloc();
extern char *strchr();
extern char *strrchr();
extern int _filbuf();
extern int _flsbuf();
extern int fclose();
extern int fgetc();
extern int fprintf();
extern int fread();
extern int free();
extern int perror();
extern int printf();
extern int rewind();
extern int setvbuf();
extern int sscanf();
extern int strcmp();
extern int strlen();
extern int strncmp();
extern int time();
extern int ungetc();
extern int vfprintf();
extern int vprintf();
extern int vsprintf();
extern long atol();
extern char *malloc ();
extern char *realloc ();
extern char *strchr ();
extern char *strrchr ();
extern int _filbuf ();
extern int _flsbuf ();
extern int fclose ();
extern int fgetc ();
extern int fprintf ();
extern int fread ();
extern int free ();
extern int perror ();
extern int printf ();
extern int rewind ();
extern int setvbuf ();
extern int sscanf ();
extern int strcmp ();
extern int strlen ();
extern int strncmp ();
extern int time ();
extern int ungetc ();
extern int vfprintf ();
extern int vprintf ();
extern int vsprintf ();
extern long atol ();
#ifndef tolower
extern int tolower();
extern int tolower ();
#endif /* tolower */
#ifndef toupper
extern int toupper();
extern int toupper ();
#endif /* toupper */
/*

View File

@ -21,7 +21,7 @@
#define setbuffer(stream, buf, size) setvbuf((stream), (buf), _IOLBF, (size))
extern int free();
extern char *malloc();
extern int free ();
extern char *malloc ();
/* end of ho-sysv.h */

View File

@ -23,7 +23,7 @@
#define NO_STDARG
#endif /* not ansi */
extern char *malloc();
extern int free();
extern char *malloc ();
extern int free ();
/* end of ho-vax.h */

View File

@ -67,216 +67,216 @@ struct m88k_opcode
static struct m88k_opcode m88k_opcodes[] =
{
/* Opcode Mnemonic Opspec */
/* Opcode Mnemonic Opspec */
_MC88xxx(0xf4007000, "add", "d,1,2")
_MC88xxx(0x70000000, "add", "d,1,I")
_MC88xxx(0xf4007200, "add.ci", "d,1,2")
_MC88xxx(0xf4007300, "add.cio", "d,1,2")
_MC88xxx(0xf4007100, "add.co", "d,1,2")
_MC88xxx(0xf4006000, "addu", "d,1,2")
_MC88xxx(0x60000000, "addu", "d,1,I")
_MC88xxx(0xf4006200, "addu.ci", "d,1,2")
_MC88xxx(0xf4006300, "addu.cio", "d,1,2")
_MC88xxx(0xf4006100, "addu.co", "d,1,2")
_MC88xxx(0xf4004000, "and", "d,1,2")
_MC88xxx(0x40000000, "and", "d,1,I")
_MC88xxx(0xf4004400, "and.c", "d,1,2")
_MC88xxx(0x44000000, "and.u", "d,1,I")
_MC88xxx(0xd0000000, "bb0", "B,1,p")
_MC88xxx(0xd4000000, "bb0.n", "B,1,p")
_MC88xxx(0xd8000000, "bb1", "B,1,p")
_MC88xxx(0xdc000000, "bb1.n", "B,1,p")
_MC88xxx(0xe8000000, "bcnd", "M,1,p")
_MC88xxx(0xec000000, "bcnd.n", "M,1,p")
_MC88xxx(0xc0000000, "br", "P")
_MC88xxx(0xc4000000, "br.n", "P")
_MC88xxx(0xc8000000, "bsr", "P")
_MC88xxx(0xcc000000, "bsr.n", "P")
_MC88xxx(0xf4008000, "clr", "d,1,2")
_MC88xxx(0xf0008000, "clr", "d,1,b")
_MC88xxx(0xf4007c00, "cmp", "d,1,2")
_MC88xxx(0x7c000000, "cmp", "d,1,I")
_MC88xxx(0xf4007800, "div", "d,1,2")
_MC88xxx(0x78000000, "div", "d,1,I")
_MC88xxx(0xf4007800, "divs", "d,1,2")
_MC88xxx(0x78000000, "divs", "d,1,I")
_MC88xxx(0xf4006800, "divu", "d,1,2")
_MC88xxx(0x68000000, "divu", "d,1,I")
_MC88xxx(0xf4009000, "ext", "d,1,2")
_MC88xxx(0xf0009000, "ext", "d,1,b")
_MC88xxx(0xf4009800, "extu", "d,1,2")
_MC88xxx(0xf0009800, "extu", "d,1,b")
_MC88xxx(0x84002800, "fadd.sss", "d,1,2")
_MC88xxx(0x84002880, "fadd.ssd", "d,1,2")
_MC88xxx(0x84002a00, "fadd.sds", "d,1,2")
_MC88xxx(0x84002a80, "fadd.sdd", "d,1,2")
_MC88xxx(0x84002820, "fadd.dss", "d,1,2")
_MC88xxx(0x840028a0, "fadd.dsd", "d,1,2")
_MC88xxx(0x84002a20, "fadd.dds", "d,1,2")
_MC88xxx(0x84002aa0, "fadd.ddd", "d,1,2")
_MC88xxx(0x84003a80, "fcmp.sdd", "d,1,2")
_MC88xxx(0x84003a00, "fcmp.sds", "d,1,2")
_MC88xxx(0x84003880, "fcmp.ssd", "d,1,2")
_MC88xxx(0x84003800, "fcmp.sss", "d,1,2")
_MC88xxx(0x84007000, "fdiv.sss", "d,1,2")
_MC88xxx(0x84007080, "fdiv.ssd", "d,1,2")
_MC88xxx(0x84007200, "fdiv.sds", "d,1,2")
_MC88xxx(0x84007280, "fdiv.sdd", "d,1,2")
_MC88xxx(0x84007020, "fdiv.dss", "d,1,2")
_MC88xxx(0x840070a0, "fdiv.dsd", "d,1,2")
_MC88xxx(0x84007220, "fdiv.dds", "d,1,2")
_MC88xxx(0x840072a0, "fdiv.ddd", "d,1,2")
_MC88xxx(0xf400ec00, "ff0", "d,2")
_MC88xxx(0xf400e800, "ff1", "d,2")
_MC88xxx(0x80004800, "fldcr", "d,f")
_MC88xxx(0x84002020, "flt.ds", "d,2")
_MC88xxx(0x84002000, "flt.ss", "d,2")
_MC88xxx(0x84000000, "fmul.sss", "d,1,2")
_MC88xxx(0x84000080, "fmul.ssd", "d,1,2")
_MC88xxx(0x84000200, "fmul.sds", "d,1,2")
_MC88xxx(0x84000280, "fmul.sdd", "d,1,2")
_MC88xxx(0x84000020, "fmul.dss", "d,1,2")
_MC88xxx(0x840000a0, "fmul.dsd", "d,1,2")
_MC88xxx(0x84000220, "fmul.dds", "d,1,2")
_MC88xxx(0x840002a0, "fmul.ddd", "d,1,2")
_MC88xxx(0x80008800, "fstcr", "3,f")
_MC88xxx(0x84003000, "fsub.sss", "d,1,2")
_MC88xxx(0x84003080, "fsub.ssd", "d,1,2")
_MC88xxx(0x84003200, "fsub.sds", "d,1,2")
_MC88xxx(0x84003280, "fsub.sdd", "d,1,2")
_MC88xxx(0x84003020, "fsub.dss", "d,1,2")
_MC88xxx(0x840030a0, "fsub.dsd", "d,1,2")
_MC88xxx(0x84003220, "fsub.dds", "d,1,2")
_MC88xxx(0x840032a0, "fsub.ddd", "d,1,2")
_MC88xxx(0x8000c800, "fxcr", "d,3,f")
_MC88xxx(0x8400fc01, "illop1", "")
_MC88xxx(0x8400fc02, "illop2", "")
_MC88xxx(0x8400fc03, "illop3", "")
_MC88xxx(0x84004880, "int.sd", "d,2")
_MC88xxx(0x84004800, "int.ss", "d,2")
_MC88xxx(0xf400c000, "jmp", "2")
_MC88xxx(0xf400c400, "jmp.n", "2")
_MC88xxx(0xf400c800, "jsr", "2")
_MC88xxx(0xf400cc00, "jsr.n", "2")
_MC88xxx(0xf4001400, "ld", "d,1,2")
_MC88xxx(0xf4001600, "ld", "d,1[2]")
_MC88xxx(0x14000000, "ld", "d,1,I")
_MC88xxx(0xf4001e00, "ld.b", "d,1[2]")
_MC88xxx(0xf4001c00, "ld.b", "d,1,2")
_MC88xxx(0x1c000000, "ld.b", "d,1,I")
_MC88xxx(0xf4001d00, "ld.b.usr", "d,1,2")
_MC88xxx(0xf4001f00, "ld.b.usr", "d,1[2]")
_MC88xxx(0xf4000e00, "ld.bu", "d,1[2]")
_MC88xxx(0xf4000c00, "ld.bu", "d,1,2")
_MC88xxx(0x0c000000, "ld.bu", "d,1,I")
_MC88xxx(0xf4000d00, "ld.bu.usr", "d,1,2")
_MC88xxx(0xf4000f00, "ld.bu.usr", "d,1[2]")
_MC88xxx(0xf4001200, "ld.d", "d,1[2]")
_MC88xxx(0xf4001000, "ld.d", "d,1,2")
_MC88xxx(0x10000000, "ld.d", "d,1,I")
_MC88xxx(0xf4001100, "ld.d.usr", "d,1,2")
_MC88xxx(0xf4001300, "ld.d.usr", "d,1[2]")
_MC88xxx(0xf4001a00, "ld.h", "d,1[2]")
_MC88xxx(0xf4001800, "ld.h", "d,1,2")
_MC88xxx(0x18000000, "ld.h", "d,1,I")
_MC88xxx(0xf4001900, "ld.h.usr", "d,1,2")
_MC88xxx(0xf4001b00, "ld.h.usr", "d,1[2]")
_MC88xxx(0xf4000a00, "ld.hu", "d,1[2]")
_MC88xxx(0xf4000800, "ld.hu", "d,1,2")
_MC88xxx(0x08000000, "ld.hu", "d,1,I")
_MC88xxx(0xf4000900, "ld.hu.usr", "d,1,2")
_MC88xxx(0xf4000b00, "ld.hu.usr", "d,1[2]")
_MC88xxx(0xf4001500, "ld.usr", "d,1,2")
_MC88xxx(0xf4001700, "ld.usr", "d,1[2]")
_MC88xxx(0xf4003600, "lda", "d,1[2]")
_MC88xxx(0xf4006000, "lda", "?d,1,2") /* Output addu */
_MC88xxx(0x60000000, "lda", "?d,1,I") /* Output addu */
_MC88xxx(0xf4006000, "lda.b", "?d,1[2]") /* Output addu */
_MC88xxx(0xf4006000, "lda.b", "?d,1,2") /* Output addu */
_MC88xxx(0x60000000, "lda.b", "?d,1,I") /* Output addu */
_MC88xxx(0xf4003200, "lda.d", "d,1[2]")
_MC88xxx(0xf4006000, "lda.d", "?d,1,2") /* Output addu */
_MC88xxx(0x60000000, "lda.d", "?d,1,I") /* Output addu */
_MC88xxx(0xf4003a00, "lda.h", "d,1[2]")
_MC88xxx(0xf4006000, "lda.h", "?d,1,2") /* Output addu */
_MC88xxx(0x60000000, "lda.h", "?d,1,I") /* Output addu */
_MC88xxx(0x80004000, "ldcr", "d,c")
_MC88xxx(0xf400a000, "mak", "d,1,2")
_MC88xxx(0xf000a000, "mak", "d,1,b")
_MC88xxx(0x48000000, "mask", "d,1,I")
_MC88xxx(0x4c000000, "mask.u", "d,1,I")
_MC88xxx(0xf4006c00, "mul", "d,1,2")
_MC88xxx(0x6c000000, "mul", "d,1,I")
_MC88xxx(0xf4006c00, "mulu", "d,1,2") /* synonym for mul */
_MC88xxx(0x6c000000, "mulu", "d,1,I") /* synonym for mul */
_MC88xxx(0x84005080, "nint.sd", "d,2")
_MC88xxx(0x84005000, "nint.ss", "d,2")
_MC88xxx(0xf4005800, "or", "d,1,2")
_MC88xxx(0x58000000, "or", "d,1,I")
_MC88xxx(0xf4005c00, "or.c", "d,1,2")
_MC88xxx(0x5c000000, "or.u", "d,1,I")
_MC88xxx(0xf000a800, "rot", "d,1,b")
_MC88xxx(0xf400a800, "rot", "d,1,2")
_MC88xxx(0xf400fc00, "rte", "")
_MC88xxx(0xf4008800, "set", "d,1,2")
_MC88xxx(0xf0008800, "set", "d,1,b")
_MC88xxx(0xf4002600, "st", "d,1[2]")
_MC88xxx(0xf4002400, "st", "d,1,2")
_MC88xxx(0x24000000, "st", "d,1,I")
_MC88xxx(0xf4002e00, "st.b", "d,1[2]")
_MC88xxx(0xf4002c00, "st.b", "d,1,2")
_MC88xxx(0x2c000000, "st.b", "d,1,I")
_MC88xxx(0xf4002d00, "st.b.usr", "d,1,2")
_MC88xxx(0xf4002f00, "st.b.usr", "d,1[2]")
_MC88xxx(0xf4002200, "st.d", "d,1[2]")
_MC88xxx(0xf4002000, "st.d", "d,1,2")
_MC88xxx(0x20000000, "st.d", "d,1,I")
_MC88xxx(0xf4002100, "st.d.usr", "d,1,2")
_MC88xxx(0xf4002300, "st.d.usr", "d,1[2]")
_MC88xxx(0xf4002a00, "st.h", "d,1[2]")
_MC88xxx(0xf4002800, "st.h", "d,1,2")
_MC88xxx(0x28000000, "st.h", "d,1,I")
_MC88xxx(0xf4002900, "st.h.usr", "d,1,2")
_MC88xxx(0xf4002b00, "st.h.usr", "d,1[2]")
_MC88xxx(0xf4002500, "st.usr", "d,1,2")
_MC88xxx(0xf4002700, "st.usr", "d,1[2]")
_MC88xxx(0x80008000, "stcr", "3,c")
_MC88xxx(0xf4007400, "sub", "d,1,2")
_MC88xxx(0x74000000, "sub", "d,1,I")
_MC88xxx(0xf4007600, "sub.ci", "d,1,2")
_MC88xxx(0xf4007700, "sub.cio", "d,1,2")
_MC88xxx(0xf4007500, "sub.co", "d,1,2")
_MC88xxx(0xf4006400, "subu", "d,1,2")
_MC88xxx(0x64000000, "subu", "d,1,I")
_MC88xxx(0xf4006600, "subu.ci", "d,1,2")
_MC88xxx(0xf4006700, "subu.cio", "d,1,2")
_MC88xxx(0xf4006500, "subu.co", "d,1,2")
_MC88xxx(0xf000d000, "tb0", "B,1,V")
_MC88xxx(0xf000d800, "tb1", "B,1,V")
_MC88xxx(0xf400f800, "tbnd", "1,2")
_MC88xxx(0xf8000000, "tbnd", "1,I")
_MC88xxx(0xf000e800, "tcnd", "M,1,V")
_MC88xxx(0x84005880, "trnc.sd", "d,2")
_MC88xxx(0x84005800, "trnc.ss", "d,2")
_MC88xxx(0x8000c000, "xcr", "d,1,c")
_MC88xxx(0xf4000600, "xmem", "d,1[2]")
_MC88xxx(0xf4000400, "xmem", "d,1,2")
_MC88100(0x04000000, "xmem", "?d,1,I")
_MC88xxx(0xf4000200, "xmem.bu", "d,1[2]")
_MC88xxx(0xf4000000, "xmem.bu", "d,1,2")
_MC88100(0x00000000, "xmem.bu", "?d,1,I")
_MC88xxx(0xf4000300, "xmem.bu.usr", "d,1[2]")
_MC88xxx(0xf4000100, "xmem.bu.usr", "d,1,2")
_MC88100(0x00000100, "xmem.bu.usr", "?d,1,I")
_MC88xxx(0xf4000700, "xmem.usr", "d,1[2]")
_MC88xxx(0xf4000500, "xmem.usr", "d,1,2")
_MC88100(0x04000100, "xmem.usr", "?d,1,I")
_MC88xxx(0xf4005000, "xor", "d,1,2")
_MC88xxx(0x50000000, "xor", "d,1,I")
_MC88xxx(0xf4005400, "xor.c", "d,1,2")
_MC88xxx(0x54000000, "xor.u", "d,1,I")
_MC88xxx(0x00000000, "", 0)
_MC88xxx (0xf4007000, "add", "d,1,2")
_MC88xxx (0x70000000, "add", "d,1,I")
_MC88xxx (0xf4007200, "add.ci", "d,1,2")
_MC88xxx (0xf4007300, "add.cio", "d,1,2")
_MC88xxx (0xf4007100, "add.co", "d,1,2")
_MC88xxx (0xf4006000, "addu", "d,1,2")
_MC88xxx (0x60000000, "addu", "d,1,I")
_MC88xxx (0xf4006200, "addu.ci", "d,1,2")
_MC88xxx (0xf4006300, "addu.cio", "d,1,2")
_MC88xxx (0xf4006100, "addu.co", "d,1,2")
_MC88xxx (0xf4004000, "and", "d,1,2")
_MC88xxx (0x40000000, "and", "d,1,I")
_MC88xxx (0xf4004400, "and.c", "d,1,2")
_MC88xxx (0x44000000, "and.u", "d,1,I")
_MC88xxx (0xd0000000, "bb0", "B,1,p")
_MC88xxx (0xd4000000, "bb0.n", "B,1,p")
_MC88xxx (0xd8000000, "bb1", "B,1,p")
_MC88xxx (0xdc000000, "bb1.n", "B,1,p")
_MC88xxx (0xe8000000, "bcnd", "M,1,p")
_MC88xxx (0xec000000, "bcnd.n", "M,1,p")
_MC88xxx (0xc0000000, "br", "P")
_MC88xxx (0xc4000000, "br.n", "P")
_MC88xxx (0xc8000000, "bsr", "P")
_MC88xxx (0xcc000000, "bsr.n", "P")
_MC88xxx (0xf4008000, "clr", "d,1,2")
_MC88xxx (0xf0008000, "clr", "d,1,b")
_MC88xxx (0xf4007c00, "cmp", "d,1,2")
_MC88xxx (0x7c000000, "cmp", "d,1,I")
_MC88xxx (0xf4007800, "div", "d,1,2")
_MC88xxx (0x78000000, "div", "d,1,I")
_MC88xxx (0xf4007800, "divs", "d,1,2")
_MC88xxx (0x78000000, "divs", "d,1,I")
_MC88xxx (0xf4006800, "divu", "d,1,2")
_MC88xxx (0x68000000, "divu", "d,1,I")
_MC88xxx (0xf4009000, "ext", "d,1,2")
_MC88xxx (0xf0009000, "ext", "d,1,b")
_MC88xxx (0xf4009800, "extu", "d,1,2")
_MC88xxx (0xf0009800, "extu", "d,1,b")
_MC88xxx (0x84002800, "fadd.sss", "d,1,2")
_MC88xxx (0x84002880, "fadd.ssd", "d,1,2")
_MC88xxx (0x84002a00, "fadd.sds", "d,1,2")
_MC88xxx (0x84002a80, "fadd.sdd", "d,1,2")
_MC88xxx (0x84002820, "fadd.dss", "d,1,2")
_MC88xxx (0x840028a0, "fadd.dsd", "d,1,2")
_MC88xxx (0x84002a20, "fadd.dds", "d,1,2")
_MC88xxx (0x84002aa0, "fadd.ddd", "d,1,2")
_MC88xxx (0x84003a80, "fcmp.sdd", "d,1,2")
_MC88xxx (0x84003a00, "fcmp.sds", "d,1,2")
_MC88xxx (0x84003880, "fcmp.ssd", "d,1,2")
_MC88xxx (0x84003800, "fcmp.sss", "d,1,2")
_MC88xxx (0x84007000, "fdiv.sss", "d,1,2")
_MC88xxx (0x84007080, "fdiv.ssd", "d,1,2")
_MC88xxx (0x84007200, "fdiv.sds", "d,1,2")
_MC88xxx (0x84007280, "fdiv.sdd", "d,1,2")
_MC88xxx (0x84007020, "fdiv.dss", "d,1,2")
_MC88xxx (0x840070a0, "fdiv.dsd", "d,1,2")
_MC88xxx (0x84007220, "fdiv.dds", "d,1,2")
_MC88xxx (0x840072a0, "fdiv.ddd", "d,1,2")
_MC88xxx (0xf400ec00, "ff0", "d,2")
_MC88xxx (0xf400e800, "ff1", "d,2")
_MC88xxx (0x80004800, "fldcr", "d,f")
_MC88xxx (0x84002020, "flt.ds", "d,2")
_MC88xxx (0x84002000, "flt.ss", "d,2")
_MC88xxx (0x84000000, "fmul.sss", "d,1,2")
_MC88xxx (0x84000080, "fmul.ssd", "d,1,2")
_MC88xxx (0x84000200, "fmul.sds", "d,1,2")
_MC88xxx (0x84000280, "fmul.sdd", "d,1,2")
_MC88xxx (0x84000020, "fmul.dss", "d,1,2")
_MC88xxx (0x840000a0, "fmul.dsd", "d,1,2")
_MC88xxx (0x84000220, "fmul.dds", "d,1,2")
_MC88xxx (0x840002a0, "fmul.ddd", "d,1,2")
_MC88xxx (0x80008800, "fstcr", "3,f")
_MC88xxx (0x84003000, "fsub.sss", "d,1,2")
_MC88xxx (0x84003080, "fsub.ssd", "d,1,2")
_MC88xxx (0x84003200, "fsub.sds", "d,1,2")
_MC88xxx (0x84003280, "fsub.sdd", "d,1,2")
_MC88xxx (0x84003020, "fsub.dss", "d,1,2")
_MC88xxx (0x840030a0, "fsub.dsd", "d,1,2")
_MC88xxx (0x84003220, "fsub.dds", "d,1,2")
_MC88xxx (0x840032a0, "fsub.ddd", "d,1,2")
_MC88xxx (0x8000c800, "fxcr", "d,3,f")
_MC88xxx (0x8400fc01, "illop1", "")
_MC88xxx (0x8400fc02, "illop2", "")
_MC88xxx (0x8400fc03, "illop3", "")
_MC88xxx (0x84004880, "int.sd", "d,2")
_MC88xxx (0x84004800, "int.ss", "d,2")
_MC88xxx (0xf400c000, "jmp", "2")
_MC88xxx (0xf400c400, "jmp.n", "2")
_MC88xxx (0xf400c800, "jsr", "2")
_MC88xxx (0xf400cc00, "jsr.n", "2")
_MC88xxx (0xf4001400, "ld", "d,1,2")
_MC88xxx (0xf4001600, "ld", "d,1[2]")
_MC88xxx (0x14000000, "ld", "d,1,I")
_MC88xxx (0xf4001e00, "ld.b", "d,1[2]")
_MC88xxx (0xf4001c00, "ld.b", "d,1,2")
_MC88xxx (0x1c000000, "ld.b", "d,1,I")
_MC88xxx (0xf4001d00, "ld.b.usr", "d,1,2")
_MC88xxx (0xf4001f00, "ld.b.usr", "d,1[2]")
_MC88xxx (0xf4000e00, "ld.bu", "d,1[2]")
_MC88xxx (0xf4000c00, "ld.bu", "d,1,2")
_MC88xxx (0x0c000000, "ld.bu", "d,1,I")
_MC88xxx (0xf4000d00, "ld.bu.usr", "d,1,2")
_MC88xxx (0xf4000f00, "ld.bu.usr", "d,1[2]")
_MC88xxx (0xf4001200, "ld.d", "d,1[2]")
_MC88xxx (0xf4001000, "ld.d", "d,1,2")
_MC88xxx (0x10000000, "ld.d", "d,1,I")
_MC88xxx (0xf4001100, "ld.d.usr", "d,1,2")
_MC88xxx (0xf4001300, "ld.d.usr", "d,1[2]")
_MC88xxx (0xf4001a00, "ld.h", "d,1[2]")
_MC88xxx (0xf4001800, "ld.h", "d,1,2")
_MC88xxx (0x18000000, "ld.h", "d,1,I")
_MC88xxx (0xf4001900, "ld.h.usr", "d,1,2")
_MC88xxx (0xf4001b00, "ld.h.usr", "d,1[2]")
_MC88xxx (0xf4000a00, "ld.hu", "d,1[2]")
_MC88xxx (0xf4000800, "ld.hu", "d,1,2")
_MC88xxx (0x08000000, "ld.hu", "d,1,I")
_MC88xxx (0xf4000900, "ld.hu.usr", "d,1,2")
_MC88xxx (0xf4000b00, "ld.hu.usr", "d,1[2]")
_MC88xxx (0xf4001500, "ld.usr", "d,1,2")
_MC88xxx (0xf4001700, "ld.usr", "d,1[2]")
_MC88xxx (0xf4003600, "lda", "d,1[2]")
_MC88xxx (0xf4006000, "lda", "?d,1,2") /* Output addu */
_MC88xxx (0x60000000, "lda", "?d,1,I") /* Output addu */
_MC88xxx (0xf4006000, "lda.b", "?d,1[2]") /* Output addu */
_MC88xxx (0xf4006000, "lda.b", "?d,1,2") /* Output addu */
_MC88xxx (0x60000000, "lda.b", "?d,1,I") /* Output addu */
_MC88xxx (0xf4003200, "lda.d", "d,1[2]")
_MC88xxx (0xf4006000, "lda.d", "?d,1,2") /* Output addu */
_MC88xxx (0x60000000, "lda.d", "?d,1,I") /* Output addu */
_MC88xxx (0xf4003a00, "lda.h", "d,1[2]")
_MC88xxx (0xf4006000, "lda.h", "?d,1,2") /* Output addu */
_MC88xxx (0x60000000, "lda.h", "?d,1,I") /* Output addu */
_MC88xxx (0x80004000, "ldcr", "d,c")
_MC88xxx (0xf400a000, "mak", "d,1,2")
_MC88xxx (0xf000a000, "mak", "d,1,b")
_MC88xxx (0x48000000, "mask", "d,1,I")
_MC88xxx (0x4c000000, "mask.u", "d,1,I")
_MC88xxx (0xf4006c00, "mul", "d,1,2")
_MC88xxx (0x6c000000, "mul", "d,1,I")
_MC88xxx (0xf4006c00, "mulu", "d,1,2") /* synonym for mul */
_MC88xxx (0x6c000000, "mulu", "d,1,I") /* synonym for mul */
_MC88xxx (0x84005080, "nint.sd", "d,2")
_MC88xxx (0x84005000, "nint.ss", "d,2")
_MC88xxx (0xf4005800, "or", "d,1,2")
_MC88xxx (0x58000000, "or", "d,1,I")
_MC88xxx (0xf4005c00, "or.c", "d,1,2")
_MC88xxx (0x5c000000, "or.u", "d,1,I")
_MC88xxx (0xf000a800, "rot", "d,1,b")
_MC88xxx (0xf400a800, "rot", "d,1,2")
_MC88xxx (0xf400fc00, "rte", "")
_MC88xxx (0xf4008800, "set", "d,1,2")
_MC88xxx (0xf0008800, "set", "d,1,b")
_MC88xxx (0xf4002600, "st", "d,1[2]")
_MC88xxx (0xf4002400, "st", "d,1,2")
_MC88xxx (0x24000000, "st", "d,1,I")
_MC88xxx (0xf4002e00, "st.b", "d,1[2]")
_MC88xxx (0xf4002c00, "st.b", "d,1,2")
_MC88xxx (0x2c000000, "st.b", "d,1,I")
_MC88xxx (0xf4002d00, "st.b.usr", "d,1,2")
_MC88xxx (0xf4002f00, "st.b.usr", "d,1[2]")
_MC88xxx (0xf4002200, "st.d", "d,1[2]")
_MC88xxx (0xf4002000, "st.d", "d,1,2")
_MC88xxx (0x20000000, "st.d", "d,1,I")
_MC88xxx (0xf4002100, "st.d.usr", "d,1,2")
_MC88xxx (0xf4002300, "st.d.usr", "d,1[2]")
_MC88xxx (0xf4002a00, "st.h", "d,1[2]")
_MC88xxx (0xf4002800, "st.h", "d,1,2")
_MC88xxx (0x28000000, "st.h", "d,1,I")
_MC88xxx (0xf4002900, "st.h.usr", "d,1,2")
_MC88xxx (0xf4002b00, "st.h.usr", "d,1[2]")
_MC88xxx (0xf4002500, "st.usr", "d,1,2")
_MC88xxx (0xf4002700, "st.usr", "d,1[2]")
_MC88xxx (0x80008000, "stcr", "3,c")
_MC88xxx (0xf4007400, "sub", "d,1,2")
_MC88xxx (0x74000000, "sub", "d,1,I")
_MC88xxx (0xf4007600, "sub.ci", "d,1,2")
_MC88xxx (0xf4007700, "sub.cio", "d,1,2")
_MC88xxx (0xf4007500, "sub.co", "d,1,2")
_MC88xxx (0xf4006400, "subu", "d,1,2")
_MC88xxx (0x64000000, "subu", "d,1,I")
_MC88xxx (0xf4006600, "subu.ci", "d,1,2")
_MC88xxx (0xf4006700, "subu.cio", "d,1,2")
_MC88xxx (0xf4006500, "subu.co", "d,1,2")
_MC88xxx (0xf000d000, "tb0", "B,1,V")
_MC88xxx (0xf000d800, "tb1", "B,1,V")
_MC88xxx (0xf400f800, "tbnd", "1,2")
_MC88xxx (0xf8000000, "tbnd", "1,I")
_MC88xxx (0xf000e800, "tcnd", "M,1,V")
_MC88xxx (0x84005880, "trnc.sd", "d,2")
_MC88xxx (0x84005800, "trnc.ss", "d,2")
_MC88xxx (0x8000c000, "xcr", "d,1,c")
_MC88xxx (0xf4000600, "xmem", "d,1[2]")
_MC88xxx (0xf4000400, "xmem", "d,1,2")
_MC88100 (0x04000000, "xmem", "?d,1,I")
_MC88xxx (0xf4000200, "xmem.bu", "d,1[2]")
_MC88xxx (0xf4000000, "xmem.bu", "d,1,2")
_MC88100 (0x00000000, "xmem.bu", "?d,1,I")
_MC88xxx (0xf4000300, "xmem.bu.usr", "d,1[2]")
_MC88xxx (0xf4000100, "xmem.bu.usr", "d,1,2")
_MC88100 (0x00000100, "xmem.bu.usr", "?d,1,I")
_MC88xxx (0xf4000700, "xmem.usr", "d,1[2]")
_MC88xxx (0xf4000500, "xmem.usr", "d,1,2")
_MC88100 (0x04000100, "xmem.usr", "?d,1,I")
_MC88xxx (0xf4005000, "xor", "d,1,2")
_MC88xxx (0x50000000, "xor", "d,1,I")
_MC88xxx (0xf4005400, "xor.c", "d,1,2")
_MC88xxx (0x54000000, "xor.u", "d,1,I")
_MC88xxx (0x00000000, "", 0)
};
#define NUMOPCODES ((sizeof m88k_opcodes)/(sizeof m88k_opcodes[0]))

View File

@ -22,7 +22,8 @@
static
const short seg_N_TYPE[] = {
const short seg_N_TYPE[] =
{
N_ABS,
N_TEXT,
N_DATA,
@ -34,9 +35,10 @@ static
N_UNDF, /* bignum/flonum */
N_UNDF, /* difference */
N_REGISTER, /* register */
};
};
const segT N_TYPE_seg [N_TYPE+2] = { /* N_TYPE == 0x1E = 32-2 */
const segT N_TYPE_seg[N_TYPE + 2] =
{ /* N_TYPE == 0x1E = 32-2 */
SEG_UNKNOWN, /* N_UNDF == 0 */
SEG_GOOF,
SEG_ABSOLUTE, /* N_ABS == 2 */
@ -55,8 +57,9 @@ const segT N_TYPE_seg [N_TYPE+2] = { /* N_TYPE == 0x1E = 32-2 */
};
void obj_symbol_new_hook(symbolP)
symbolS *symbolP;
void
obj_symbol_new_hook (symbolP)
symbolS *symbolP;
{
return;
} /* obj_symbol_new_hook() */

View File

@ -21,7 +21,8 @@
#include "obstack.h"
#include "aout/stab_gnu.h"
const short /* in: segT out: N_TYPE bits */
seg_N_TYPE[] = {
seg_N_TYPE[] =
{
N_ABS,
N_TEXT,
N_DATA,
@ -33,9 +34,10 @@ const short /* in: segT out: N_TYPE bits */
N_UNDF, /* bignum/flonum */
N_UNDF, /* difference */
N_REGISTER, /* register */
};
};
const segT N_TYPE_seg [N_TYPE+2] = { /* N_TYPE == 0x1E = 32-2 */
const segT N_TYPE_seg[N_TYPE + 2] =
{ /* N_TYPE == 0x1E = 32-2 */
SEG_UNKNOWN, /* N_UNDF == 0 */
SEG_GOOF,
SEG_ABSOLUTE, /* N_ABS == 2 */
@ -54,39 +56,40 @@ const segT N_TYPE_seg [N_TYPE+2] = { /* N_TYPE == 0x1E = 32-2 */
};
#if __STDC__ == 1
static void obj_bout_stab(int what);
static void obj_bout_line(void);
static void obj_bout_desc(void);
static void obj_bout_stab (int what);
static void obj_bout_line (void);
static void obj_bout_desc (void);
#else /* not __STDC__ */
static void obj_bout_desc();
static void obj_bout_stab();
static void obj_bout_line();
static void obj_bout_desc ();
static void obj_bout_stab ();
static void obj_bout_line ();
#endif /* not __STDC__ */
const pseudo_typeS obj_pseudo_table[] = {
/* stabs (aka a.out aka b.out directives for debug symbols) */
{ "desc", obj_bout_desc, 0 }, /* def */
{ "line", obj_bout_line, 0 }, /* source code line number */
{ "stabd", obj_bout_stab, 'd' }, /* stabs */
{ "stabn", obj_bout_stab, 'n' }, /* stabs */
{ "stabs", obj_bout_stab, 's' }, /* stabs */
const pseudo_typeS obj_pseudo_table[] =
{
/* stabs (aka a.out aka b.out directives for debug symbols) */
{"desc", obj_bout_desc, 0}, /* def */
{"line", obj_bout_line, 0}, /* source code line number */
{"stabd", obj_bout_stab, 'd'},/* stabs */
{"stabn", obj_bout_stab, 'n'},/* stabs */
{"stabs", obj_bout_stab, 's'},/* stabs */
/* coff debugging directives. Currently ignored silently */
{ "def", s_ignore, 0 },
{ "dim", s_ignore, 0 },
{ "endef", s_ignore, 0 },
{ "ln", s_ignore, 0 },
{ "scl", s_ignore, 0 },
{ "size", s_ignore, 0 },
{ "tag", s_ignore, 0 },
{ "type", s_ignore, 0 },
{ "val", s_ignore, 0 },
/* coff debugging directives. Currently ignored silently */
{"def", s_ignore, 0},
{"dim", s_ignore, 0},
{"endef", s_ignore, 0},
{"ln", s_ignore, 0},
{"scl", s_ignore, 0},
{"size", s_ignore, 0},
{"tag", s_ignore, 0},
{"type", s_ignore, 0},
{"val", s_ignore, 0},
/* other stuff we don't handle */
{ "ABORT", s_ignore, 0 },
{ "ident", s_ignore, 0 },
/* other stuff we don't handle */
{"ABORT", s_ignore, 0},
{"ident", s_ignore, 0},
{ NULL} /* end sentinel */
{NULL} /* end sentinel */
}; /* obj_pseudo_table */
/* Relocation. */
@ -96,16 +99,19 @@ const pseudo_typeS obj_pseudo_table[] = {
*
* Crawl along a fixS chain. Emit the segment's relocations.
*/
void obj_emit_relocations(where, fixP, segment_address_in_file)
char **where;
fixS *fixP; /* Fixup chain for this segment. */
relax_addressT segment_address_in_file;
void
obj_emit_relocations (where, fixP, segment_address_in_file)
char **where;
fixS *fixP; /* Fixup chain for this segment. */
relax_addressT segment_address_in_file;
{
for (; fixP; fixP = fixP->fx_next) {
for (; fixP; fixP = fixP->fx_next)
{
if (fixP->fx_addsy != NULL
|| fixP->fx_r_type != NO_RELOC) {
tc_bout_fix_to_chars(*where, fixP, segment_address_in_file);
*where += sizeof(struct relocation_info);
|| fixP->fx_r_type != NO_RELOC)
{
tc_bout_fix_to_chars (*where, fixP, segment_address_in_file);
*where += sizeof (struct relocation_info);
} /* if there's a symbol */
} /* for each fixup */
@ -114,15 +120,17 @@ relax_addressT segment_address_in_file;
/* Aout file generation & utilities */
/* Convert a lvalue to machine dependent data */
void obj_header_append(where, headers)
char **where;
object_headers *headers;
void
obj_header_append (where, headers)
char **where;
object_headers *headers;
{
/* Always leave in host byte order */
headers->header.a_talign = section_alignment[SEG_TEXT];
if (headers->header.a_talign < 2){
if (headers->header.a_talign < 2)
{
headers->header.a_talign = 2;
} /* force to at least 2 */
@ -130,94 +138,101 @@ object_headers *headers;
headers->header.a_balign = section_alignment[SEG_BSS];
headers->header.a_tload = 0;
headers->header.a_dload = md_section_align(SEG_DATA, H_GET_TEXT_SIZE(headers));
headers->header.a_dload = md_section_align (SEG_DATA, H_GET_TEXT_SIZE (headers));
headers->header.a_relaxable = linkrelax;
#ifdef CROSS_COMPILE
md_number_to_chars(*where, headers->header.a_magic, sizeof(headers->header.a_magic));
*where += sizeof(headers->header.a_magic);
md_number_to_chars(*where, headers->header.a_text, sizeof(headers->header.a_text));
*where += sizeof(headers->header.a_text);
md_number_to_chars(*where, headers->header.a_data, sizeof(headers->header.a_data));
*where += sizeof(headers->header.a_data);
md_number_to_chars(*where, headers->header.a_bss, sizeof(headers->header.a_bss));
*where += sizeof(headers->header.a_bss);
md_number_to_chars(*where, headers->header.a_syms, sizeof(headers->header.a_syms));
*where += sizeof(headers->header.a_syms);
md_number_to_chars(*where, headers->header.a_entry, sizeof(headers->header.a_entry));
*where += sizeof(headers->header.a_entry);
md_number_to_chars(*where, headers->header.a_trsize, sizeof(headers->header.a_trsize));
*where += sizeof(headers->header.a_trsize);
md_number_to_chars(*where, headers->header.a_drsize, sizeof(headers->header.a_drsize));
*where += sizeof(headers->header.a_drsize);
md_number_to_chars(*where, headers->header.a_tload, sizeof(headers->header.a_tload));
*where += sizeof(headers->header.a_tload);
md_number_to_chars(*where, headers->header.a_dload, sizeof(headers->header.a_dload));
*where += sizeof(headers->header.a_dload);
md_number_to_chars(*where, headers->header.a_talign, sizeof(headers->header.a_talign));
*where += sizeof(headers->header.a_talign);
md_number_to_chars(*where, headers->header.a_dalign, sizeof(headers->header.a_dalign));
*where += sizeof(headers->header.a_dalign);
md_number_to_chars(*where, headers->header.a_balign, sizeof(headers->header.a_balign));
*where += sizeof(headers->header.a_balign);
md_number_to_chars(*where, headers->header.a_relaxable, sizeof(headers->header.a_relaxable));
*where += sizeof(headers->header.a_relaxable);
md_number_to_chars (*where, headers->header.a_magic, sizeof (headers->header.a_magic));
*where += sizeof (headers->header.a_magic);
md_number_to_chars (*where, headers->header.a_text, sizeof (headers->header.a_text));
*where += sizeof (headers->header.a_text);
md_number_to_chars (*where, headers->header.a_data, sizeof (headers->header.a_data));
*where += sizeof (headers->header.a_data);
md_number_to_chars (*where, headers->header.a_bss, sizeof (headers->header.a_bss));
*where += sizeof (headers->header.a_bss);
md_number_to_chars (*where, headers->header.a_syms, sizeof (headers->header.a_syms));
*where += sizeof (headers->header.a_syms);
md_number_to_chars (*where, headers->header.a_entry, sizeof (headers->header.a_entry));
*where += sizeof (headers->header.a_entry);
md_number_to_chars (*where, headers->header.a_trsize, sizeof (headers->header.a_trsize));
*where += sizeof (headers->header.a_trsize);
md_number_to_chars (*where, headers->header.a_drsize, sizeof (headers->header.a_drsize));
*where += sizeof (headers->header.a_drsize);
md_number_to_chars (*where, headers->header.a_tload, sizeof (headers->header.a_tload));
*where += sizeof (headers->header.a_tload);
md_number_to_chars (*where, headers->header.a_dload, sizeof (headers->header.a_dload));
*where += sizeof (headers->header.a_dload);
md_number_to_chars (*where, headers->header.a_talign, sizeof (headers->header.a_talign));
*where += sizeof (headers->header.a_talign);
md_number_to_chars (*where, headers->header.a_dalign, sizeof (headers->header.a_dalign));
*where += sizeof (headers->header.a_dalign);
md_number_to_chars (*where, headers->header.a_balign, sizeof (headers->header.a_balign));
*where += sizeof (headers->header.a_balign);
md_number_to_chars (*where, headers->header.a_relaxable, sizeof (headers->header.a_relaxable));
*where += sizeof (headers->header.a_relaxable);
#else /* ! CROSS_COMPILE */
append(where, (char *) &headers->header, sizeof(headers->header));
append (where, (char *) &headers->header, sizeof (headers->header));
#endif /* ! CROSS_COMPILE */
} /* a_header_append() */
void obj_symbol_to_chars(where, symbolP)
char **where;
symbolS *symbolP;
void
obj_symbol_to_chars (where, symbolP)
char **where;
symbolS *symbolP;
{
md_number_to_chars((char *)&(S_GET_OFFSET(symbolP)), S_GET_OFFSET(symbolP), sizeof(S_GET_OFFSET(symbolP)));
md_number_to_chars((char *)&(S_GET_DESC(symbolP)), S_GET_DESC(symbolP), sizeof(S_GET_DESC(symbolP)));
md_number_to_chars((char *)&(S_GET_VALUE(symbolP)), S_GET_VALUE(symbolP), sizeof(S_GET_VALUE(symbolP)));
md_number_to_chars ((char *) &(S_GET_OFFSET (symbolP)), S_GET_OFFSET (symbolP), sizeof (S_GET_OFFSET (symbolP)));
md_number_to_chars ((char *) &(S_GET_DESC (symbolP)), S_GET_DESC (symbolP), sizeof (S_GET_DESC (symbolP)));
md_number_to_chars ((char *) &(S_GET_VALUE (symbolP)), S_GET_VALUE (symbolP), sizeof (S_GET_VALUE (symbolP)));
append(where, (char *)&symbolP->sy_symbol, sizeof(obj_symbol_type));
append (where, (char *) &symbolP->sy_symbol, sizeof (obj_symbol_type));
} /* obj_symbol_to_chars() */
void obj_emit_symbols(where, symbol_rootP)
char **where;
symbolS *symbol_rootP;
void
obj_emit_symbols (where, symbol_rootP)
char **where;
symbolS *symbol_rootP;
{
symbolS * symbolP;
symbolS *symbolP;
/*
* Emit all symbols left in the symbol chain.
*/
for(symbolP = symbol_rootP; symbolP; symbolP = symbol_next(symbolP)) {
for (symbolP = symbol_rootP; symbolP; symbolP = symbol_next (symbolP))
{
/* Used to save the offset of the name. It is used to point
to the string in memory but must be a file offset. */
char *temp;
temp = S_GET_NAME(symbolP);
S_SET_OFFSET(symbolP, symbolP->sy_name_offset);
temp = S_GET_NAME (symbolP);
S_SET_OFFSET (symbolP, symbolP->sy_name_offset);
/* Any symbol still undefined and is not a dbg symbol is made N_EXT. */
if (!S_IS_DEBUG(symbolP) && !S_IS_DEFINED(symbolP)) S_SET_EXTERNAL(symbolP);
if (!S_IS_DEBUG (symbolP) && !S_IS_DEFINED (symbolP))
S_SET_EXTERNAL (symbolP);
obj_symbol_to_chars(where, symbolP);
S_SET_NAME(symbolP,temp);
obj_symbol_to_chars (where, symbolP);
S_SET_NAME (symbolP, temp);
}
} /* emit_symbols() */
void obj_symbol_new_hook(symbolP)
symbolS *symbolP;
void
obj_symbol_new_hook (symbolP)
symbolS *symbolP;
{
S_SET_OTHER(symbolP, 0);
S_SET_DESC(symbolP, 0);
S_SET_OTHER (symbolP, 0);
S_SET_DESC (symbolP, 0);
return;
} /* obj_symbol_new_hook() */
static void obj_bout_line() {
static void
obj_bout_line ()
{
/* Assume delimiter is part of expression. */
/* BSD4.2 as fails with delightful bug, so we */
/* are not being incompatible here. */
new_logical_line ((char *)NULL, (int)(get_absolute_expression ()));
demand_empty_rest_of_line();
new_logical_line ((char *) NULL, (int) (get_absolute_expression ()));
demand_empty_rest_of_line ();
} /* obj_bout_line() */
/*
@ -239,11 +254,12 @@ static void obj_bout_line() {
* .stabX directives always make a symbol table entry. It may be junk if
* the rest of your .stabX directive is malformed.
*/
static void obj_bout_stab(what)
int what;
static void
obj_bout_stab (what)
int what;
{
register symbolS * symbolP = 0;
register char * string;
register symbolS *symbolP = 0;
register char *string;
int saved_type = 0;
int length;
int goof; /* TRUE if we have aborted. */
@ -254,30 +270,35 @@ int what;
* whitespace.
*/
goof = 0; /* JF who forgot this?? */
if (what == 's') {
string = demand_copy_C_string(& length);
SKIP_WHITESPACE();
if (what == 's')
{
string = demand_copy_C_string (&length);
SKIP_WHITESPACE ();
if (*input_line_pointer == ',')
input_line_pointer ++;
else {
as_bad("I need a comma after symbol's name");
input_line_pointer++;
else
{
as_bad ("I need a comma after symbol's name");
goof = 1;
}
} else
}
else
string = "";
/*
* Input_line_pointer->after ','. String->symbol name.
*/
if (!goof) {
symbolP = symbol_new(string,
if (!goof)
{
symbolP = symbol_new (string,
SEG_UNKNOWN,
0,
(struct frag *)0);
switch (what) {
(struct frag *) 0);
switch (what)
{
case 'd':
S_SET_NAME(symbolP,NULL); /* .stabd feature. */
S_SET_VALUE(symbolP,obstack_next_free(&frags) -
S_SET_NAME (symbolP, NULL); /* .stabd feature. */
S_SET_VALUE (symbolP, obstack_next_free (&frags) -
frag_now->fr_literal);
symbolP->sy_frag = frag_now;
break;
@ -287,43 +308,52 @@ int what;
break;
case 's':
symbolP->sy_frag = & zero_address_frag;
symbolP->sy_frag = &zero_address_frag;
break;
default:
BAD_CASE(what);
BAD_CASE (what);
break;
}
if (get_absolute_expression_and_terminator(& longint) == ',')
if (get_absolute_expression_and_terminator (&longint) == ',')
symbolP->sy_symbol.n_type = saved_type = longint;
else {
as_bad("I want a comma after the n_type expression");
else
{
as_bad ("I want a comma after the n_type expression");
goof = 1;
input_line_pointer--; /* Backup over a non-',' char. */
}
}
if (! goof) {
if (get_absolute_expression_and_terminator (& longint) == ',')
S_SET_OTHER(symbolP,longint);
else {
as_bad("I want a comma after the n_other expression");
if (!goof)
{
if (get_absolute_expression_and_terminator (&longint) == ',')
S_SET_OTHER (symbolP, longint);
else
{
as_bad ("I want a comma after the n_other expression");
goof = 1;
input_line_pointer--; /* Backup over a non-',' char. */
}
}
if (! goof) {
S_SET_DESC(symbolP, get_absolute_expression ());
if (what == 's' || what == 'n') {
if (* input_line_pointer != ',') {
as_bad("I want a comma after the n_desc expression");
if (!goof)
{
S_SET_DESC (symbolP, get_absolute_expression ());
if (what == 's' || what == 'n')
{
if (*input_line_pointer != ',')
{
as_bad ("I want a comma after the n_desc expression");
goof = 1;
} else {
input_line_pointer ++;
}
else
{
input_line_pointer++;
}
}
}
if ((! goof) && (what=='s' || what=='n')) {
pseudo_set(symbolP);
if ((!goof) && (what == 's' || what == 'n'))
{
pseudo_set (symbolP);
symbolP->sy_symbol.n_type = saved_type;
}
#ifndef NO_LISTING
@ -335,12 +365,12 @@ int what;
if (symbolP->sy_symbol.n_type == N_SLINE)
{
listing_source_line(symbolP->sy_symbol.n_desc);
listing_source_line (symbolP->sy_symbol.n_desc);
}
else if (symbolP->sy_symbol.n_type == N_SO
|| symbolP->sy_symbol.n_type == N_SOL)
{
listing_source_file(string);
listing_source_file (string);
}
}
}
@ -353,68 +383,80 @@ int what;
demand_empty_rest_of_line ();
} /* obj_bout_stab() */
static void obj_bout_desc() {
static void
obj_bout_desc ()
{
register char *name;
register char c;
register char *p;
register symbolS * symbolP;
register symbolS *symbolP;
register int temp;
/*
* Frob invented at RMS' request. Set the n_desc of a symbol.
*/
name = input_line_pointer;
c = get_symbol_end();
c = get_symbol_end ();
p = input_line_pointer;
* p = c;
SKIP_WHITESPACE();
if (*input_line_pointer != ',') {
*p = 0;
as_bad("Expected comma after name \"%s\"", name);
*p = c;
ignore_rest_of_line();
} else {
input_line_pointer ++;
SKIP_WHITESPACE ();
if (*input_line_pointer != ',')
{
*p = 0;
as_bad ("Expected comma after name \"%s\"", name);
*p = c;
ignore_rest_of_line ();
}
else
{
input_line_pointer++;
temp = get_absolute_expression ();
*p = 0;
symbolP = symbol_find_or_make(name);
symbolP = symbol_find_or_make (name);
*p = c;
S_SET_DESC(symbolP,temp);
S_SET_DESC (symbolP, temp);
}
demand_empty_rest_of_line();
demand_empty_rest_of_line ();
} /* obj_bout_desc() */
void obj_read_begin_hook() {
void
obj_read_begin_hook ()
{
return;
} /* obj_read_begin_hook() */
void obj_crawl_symbol_chain(headers)
object_headers *headers;
void
obj_crawl_symbol_chain (headers)
object_headers *headers;
{
symbolS **symbolPP;
symbolS *symbolP;
int symbol_number = 0;
/* JF deal with forward references first... */
for (symbolP = symbol_rootP; symbolP; symbolP = symbol_next(symbolP)) {
if (symbolP->sy_forward) {
S_SET_VALUE(symbolP, S_GET_VALUE(symbolP)
+ S_GET_VALUE(symbolP->sy_forward)
for (symbolP = symbol_rootP; symbolP; symbolP = symbol_next (symbolP))
{
if (symbolP->sy_forward)
{
S_SET_VALUE (symbolP, S_GET_VALUE (symbolP)
+ S_GET_VALUE (symbolP->sy_forward)
+ symbolP->sy_forward->sy_frag->fr_address);
symbolP->sy_forward=0;
symbolP->sy_forward = 0;
} /* if it has a forward reference */
} /* walk the symbol chain */
tc_crawl_symbol_chain(headers);
tc_crawl_symbol_chain (headers);
symbolPP = & symbol_rootP; /*->last symbol chain link. */
while ((symbolP = *symbolPP) != NULL) {
if (flagseen['R'] && (S_GET_SEGMENT(symbolP) == SEG_DATA)) {
S_SET_SEGMENT(symbolP, SEG_TEXT);
symbolPP = &symbol_rootP; /*->last symbol chain link. */
while ((symbolP = *symbolPP) != NULL)
{
if (flagseen['R'] && (S_GET_SEGMENT (symbolP) == SEG_DATA))
{
S_SET_SEGMENT (symbolP, SEG_TEXT);
} /* if pusing data into text */
S_SET_VALUE(symbolP, S_GET_VALUE(symbolP) + symbolP->sy_frag->fr_address);
S_SET_VALUE (symbolP, S_GET_VALUE (symbolP) + symbolP->sy_frag->fr_address);
/* OK, here is how we decide which symbols go out into the
brave new symtab. Symbols that do are:
@ -433,38 +475,43 @@ object_headers *headers;
if (1
&& !S_IS_REGISTER(symbolP)
&& (!S_GET_NAME(symbolP)
|| S_IS_DEBUG(symbolP)
&& !S_IS_REGISTER (symbolP)
&& (!S_GET_NAME (symbolP)
|| S_IS_DEBUG (symbolP)
#ifdef TC_I960
/* FIXME-SOON this ifdef seems highly dubious to me. xoxorich. */
|| !S_IS_DEFINED(symbolP)
|| S_IS_EXTERNAL(symbolP)
|| !S_IS_DEFINED (symbolP)
|| S_IS_EXTERNAL (symbolP)
#endif /* TC_I960 */
|| (S_GET_NAME(symbolP)[0] != '\001' && (flagseen ['L'] || ! S_LOCAL_NAME(symbolP))))) {
|| (S_GET_NAME (symbolP)[0] != '\001' && (flagseen['L'] || !S_LOCAL_NAME (symbolP)))))
{
symbolP->sy_number = symbol_number++;
/* The + 1 after strlen account for the \0 at the
end of each string */
if (!S_IS_STABD(symbolP)) {
if (!S_IS_STABD (symbolP))
{
/* Ordinary case. */
symbolP->sy_name_offset = string_byte_count;
string_byte_count += strlen(S_GET_NAME(symbolP)) + 1;
string_byte_count += strlen (S_GET_NAME (symbolP)) + 1;
}
else /* .Stabd case. */
symbolP->sy_name_offset = 0;
symbolPP = &(symbol_next(symbolP));
} else {
if (S_IS_EXTERNAL(symbolP) || !S_IS_DEFINED(symbolP)) {
as_bad("Local symbol %s never defined", S_GET_NAME(symbolP));
symbolPP = &(symbol_next (symbolP));
}
else
{
if (S_IS_EXTERNAL (symbolP) || !S_IS_DEFINED (symbolP))
{
as_bad ("Local symbol %s never defined", S_GET_NAME (symbolP));
} /* oops. */
/* Unhook it from the chain */
*symbolPP = symbol_next(symbolP);
*symbolPP = symbol_next (symbolP);
} /* if this symbol should be in the output */
} /* for each symbol */
H_SET_SYMBOL_TABLE_SIZE(headers, symbol_number);
H_SET_SYMBOL_TABLE_SIZE (headers, symbol_number);
return;
} /* obj_crawl_symbol_chain() */
@ -473,22 +520,24 @@ object_headers *headers;
* Find strings by crawling along symbol table chain.
*/
void obj_emit_strings(where)
char **where;
void
obj_emit_strings (where)
char **where;
{
symbolS *symbolP;
#ifdef CROSS_COMPILE
/* Gotta do md_ byte-ordering stuff for string_byte_count first - KWK */
md_number_to_chars(*where, string_byte_count, sizeof(string_byte_count));
*where += sizeof(string_byte_count);
md_number_to_chars (*where, string_byte_count, sizeof (string_byte_count));
*where += sizeof (string_byte_count);
#else /* CROSS_COMPILE */
append(where, (char *) &string_byte_count, (unsigned long) sizeof(string_byte_count));
append (where, (char *) &string_byte_count, (unsigned long) sizeof (string_byte_count));
#endif /* CROSS_COMPILE */
for(symbolP = symbol_rootP; symbolP; symbolP = symbol_next(symbolP)) {
if(S_GET_NAME(symbolP))
append(where, S_GET_NAME(symbolP), (unsigned long)(strlen (S_GET_NAME(symbolP)) + 1));
for (symbolP = symbol_rootP; symbolP; symbolP = symbol_next (symbolP))
{
if (S_GET_NAME (symbolP))
append (where, S_GET_NAME (symbolP), (unsigned long) (strlen (S_GET_NAME (symbolP)) + 1));
} /* walk symbol chain */
return;

View File

@ -86,7 +86,8 @@ extern const segT N_TYPE_seg[];
* 'n' indicates the corresponding segment must begin at an
* address that is a multiple of (2**n).
*/
struct exec {
struct exec
{
/* Standard stuff */
unsigned long a_magic; /* Identifies this as a b.out file */
unsigned long a_text; /* Length of text */
@ -104,7 +105,7 @@ struct exec {
unsigned char a_dalign; /* Alignment of data segment */
unsigned char a_balign; /* Alignment of bss segment */
unsigned char a_relaxable; /* Contains enough info to relax */
};
};
#define N_BADMAG(x) (((x).a_magic)!=BMAGIC)
#define N_TXTOFF(x) ( sizeof(struct exec) )
@ -116,17 +117,20 @@ struct exec {
/* A single entry in the symbol table
*/
struct nlist {
union {
struct nlist
{
union
{
char *n_name;
struct nlist *n_next;
long n_strx; /* Index into string table */
} n_un;
}
n_un;
unsigned char n_type; /* See below */
char n_other; /* Used in i80960 support -- see below */
short n_desc;
unsigned long n_value;
};
};
typedef struct nlist obj_symbol_type;
@ -144,10 +148,11 @@ typedef struct nlist obj_symbol_type;
#define N_STAB 0340 /* Mask for all bits used for SDB entries */
#ifndef CUSTOM_RELOC_FORMAT
struct relocation_info {
struct relocation_info
{
int r_address; /* File address of item to be relocated */
unsigned
r_index:24,/* Index of symbol on which relocation is based*/
r_index:24, /* Index of symbol on which relocation is based*/
r_pcrel:1, /* 1 => relocate PC-relative; else absolute
* On i960, pc-relative implies 24-bit
* address, absolute implies 32-bit.
@ -157,12 +162,12 @@ struct relocation_info {
* 1 => 2 bytes
* 2 => 4 bytes -- only value used for i960
*/
r_extern:1,
r_bsr:1, /* Something for the GNU NS32K assembler */
r_extern:1, r_bsr:1, /* Something for the GNU NS32K assembler */
r_disp:1, /* Something for the GNU NS32K assembler */
r_callj:1, /* 1 if relocation target is an i960 'callj' */
nuthin:1; /* Unused */
};
};
#endif /* CUSTOM_RELOC_FORMAT */
/*
@ -286,10 +291,13 @@ struct relocation_info {
#define segment_name(seg) ( seg_name[(int)(seg)] )
extern char *const seg_name[];
typedef struct {
typedef struct
{
struct exec header; /* a.out header */
long string_table_size; /* names + '\0' + sizeof(int) */
} object_headers;
}
object_headers;
/* unused hooks. */
#define OBJ_EMIT_LINENO(a, b, c) {;}
@ -297,9 +305,9 @@ typedef struct {
#if __STDC__
struct fix;
void tc_aout_fix_to_chars(char *where, struct fix *fixP, relax_addressT segment_address);
void tc_aout_fix_to_chars (char *where, struct fix *fixP, relax_addressT segment_address);
#else /* not __STDC__ */
void tc_aout_fix_to_chars();
void tc_aout_fix_to_chars ();
#endif /* not __STDC__ */
/*

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,7 @@
/* coff object file format
Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
@ -71,7 +75,7 @@ help me
#endif
#if 0
/* Define some processor dependent values according to the processor we are
/* Define some processor dependent values according to the processor we are
on. */
#if defined(TC_H8300)
#define BYTE_ORDERING 0
@ -104,7 +108,7 @@ help me
#define FILE_HEADER_MAGIC SIPFBOMAGIC
#endif /* FILE_HEADER_MAGIC */
#else
you lose
you lose
#endif
#endif
@ -114,7 +118,7 @@ you lose
#endif /* OBJ_COFF_MAX_AUXENTRIES */
extern const segT N_TYPE_seg[];
extern const segT N_TYPE_seg[];
/* Magic number of paged executable. */
#define DEFAULT_MAGIC_NUMBER_FOR_OBJECT_FILE 0x8300
@ -135,7 +139,9 @@ typedef struct
union internal_auxent ost_auxent[OBJ_COFF_MAX_AUXENTRIES]; /* Auxiliary entry. */
unsigned int ost_flags; /* obj_coff internal use only flags */
} obj_symbol_type;
}
obj_symbol_type;
#ifndef DO_NOT_STRIP
#define DO_NOT_STRIP 0
@ -451,7 +457,8 @@ typedef struct
/* Segment flipping */
#define segment_name(v) (seg_name[(int) (v)])
typedef struct {
typedef struct
{
#ifdef BFD_HEADERS
struct internal_aouthdr aouthdr; /* a.out header */
struct internal_filehdr filehdr; /* File header, not machine dep. */
@ -465,7 +472,9 @@ typedef struct {
bytes. */
long lineno_size; /* Size of the line number information
table in bytes */
} object_headers;
}
object_headers;
@ -473,37 +482,40 @@ struct lineno_list
{
struct bfd_internal_lineno line;
char* frag; /* Frag to which the line number is related */
struct lineno_list* next; /* Forward chain pointer */
} ;
char *frag; /* Frag to which the line number is related */
struct lineno_list *next; /* Forward chain pointer */
};
/* stack stuff */
typedef struct {
typedef struct
{
unsigned long chunk_size;
unsigned long element_size;
unsigned long size;
char* data;
char *data;
unsigned long pointer;
} stack;
}
stack;
char *EXFUN(stack_pop,(stack *st));
char *EXFUN(stack_push,(stack *st, char *element));
char *EXFUN(stack_top,(stack *st));
stack *EXFUN(stack_init,(unsigned long chunk_size, unsigned long element_size));
void EXFUN(c_dot_file_symbol,(char *filename));
void EXFUN(obj_extra_stuff,(object_headers *headers));
void EXFUN(stack_delete,(stack *st));
char *EXFUN (stack_pop, (stack * st));
char *EXFUN (stack_push, (stack * st, char *element));
char *EXFUN (stack_top, (stack * st));
stack *EXFUN (stack_init, (unsigned long chunk_size, unsigned long element_size));
void EXFUN (c_dot_file_symbol, (char *filename));
void EXFUN (obj_extra_stuff, (object_headers * headers));
void EXFUN (stack_delete, (stack * st));
void EXFUN(c_section_header,(
void EXFUN (c_section_header, (
struct internal_scnhdr *header,
struct internal_scnhdr * header,
char *name,
long core_address,
long size,
@ -519,11 +531,11 @@ void EXFUN(c_section_header,(
#ifdef TC_I960
#ifndef C_LEAFSTAT
hey! Where is the C_LEAFSTAT definition? i960-coff support is depending on it.
hey ! Where is the C_LEAFSTAT definition ? i960 - coff support is depending on it.
#endif /* no C_LEAFSTAT */
#endif /* TC_I960 */
#ifdef BFD_HEADERS
extern struct internal_scnhdr data_section_header;
extern struct internal_scnhdr data_section_header;
extern struct internal_scnhdr text_section_header;
#else
extern SCNHDR data_section_header;

View File

@ -43,26 +43,29 @@
/* #define SYMBOLS_NEED_PACKPOINTERS */
/* */
typedef struct {
typedef struct
{
void *nothing;
} obj_symbol_type; /* should be the format's symbol structure */
}
obj_symbol_type; /* should be the format's symbol structure */
typedef void *object_headers;
/* symbols have names */
#define S_GET_NAME(s) ("foo") /* get the name of a symbolP */
#define S_SET_NAME(s,v) ;
/* symbols have segments */
/* symbols have segments */
#define S_GET_SEGMENT(s) (SEG_UNKNOWN)
#define S_SET_SEGMENT(s,v) ;
/* symbols have a value */
/* symbols have a value */
#define S_GET_VALUE(s) (0)
#define S_SET_VALUE(s,v) ;
/* symbols may be external */
/* symbols may be external */
#define S_IS_EXTERNAL(s) (0)
#define S_SET_EXTERNAL(s) ;
/* symbols may or may not be defined */
/* symbols may or may not be defined */
#define S_IS_DEFINED(s) (0)

View File

@ -38,75 +38,86 @@
bfd *abfd;
/* How many addresses does the .align take? */
static relax_addressT relax_align(address, alignment)
register relax_addressT address; /* Address now. */
register long alignment; /* Alignment (binary). */
static relax_addressT
relax_align (address, alignment)
register relax_addressT address; /* Address now. */
register long alignment; /* Alignment (binary). */
{
relax_addressT mask;
relax_addressT new_address;
mask = ~ ( (~0) << alignment );
new_address = (address + mask) & (~ mask);
mask = ~((~0) << alignment);
new_address = (address + mask) & (~mask);
return (new_address - address);
} /* relax_align() */
/* calculate the size of the frag chain and create a bfd section
to contain all of it */
static void DEFUN(size_section,(abfd, idx),
bfd *abfd AND
static void
DEFUN (size_section, (abfd, idx),
bfd * abfd AND
unsigned int idx)
{
asection *sec;
unsigned int size = 0;
fragS *frag = segment_info[idx].frag_root;
while (frag) {
if (frag->fr_address != size) {
printf("Out of step\n");
while (frag)
{
if (frag->fr_address != size)
{
printf ("Out of step\n");
size = frag->fr_address;
}
size += frag->fr_fix;
switch (frag->fr_type) {
switch (frag->fr_type)
{
case rs_fill:
case rs_org:
size += frag->fr_offset * frag->fr_var;
break;
case rs_align:
size += relax_align(size, frag->fr_offset);
size += relax_align (size, frag->fr_offset);
}
frag = frag->fr_next;
}
if (size) {
if (size)
{
char *name = segment_info[idx].name;
if (name == (char *)NULL) {
if (name == (char *) NULL)
{
name = ".data";
}
segment_info[idx].user_stuff = (char *)(sec = bfd_make_section(abfd, name));
segment_info[idx].user_stuff = (char *) (sec = bfd_make_section (abfd, name));
/* Make it output through itself */
sec->output_section = sec;
sec->flags |= SEC_HAS_CONTENTS;
bfd_set_section_size(abfd, sec, size);
bfd_set_section_size (abfd, sec, size);
}
}
/* run through a frag chain and write out the data to go with it */
static void DEFUN(fill_section,(abfd, idx),
bfd *abfd AND
static void
DEFUN (fill_section, (abfd, idx),
bfd * abfd AND
unsigned int idx)
{
asection *sec = segment_info[idx].user_stuff;
if (sec) {
if (sec)
{
fragS *frag = segment_info[idx].frag_root;
unsigned int offset = 0;
while (frag) {
while (frag)
{
unsigned int fill_size;
unsigned int count;
switch (frag->fr_type) {
switch (frag->fr_type)
{
case rs_fill:
case rs_align:
case rs_org:
if(frag->fr_fix)
if (frag->fr_fix)
{
bfd_set_section_contents(abfd,
bfd_set_section_contents (abfd,
sec,
frag->fr_literal,
frag->fr_address,
@ -119,7 +130,7 @@ static void DEFUN(fill_section,(abfd, idx),
unsigned int off = frag->fr_fix;
for (count = frag->fr_offset; count; count--)
{
bfd_set_section_contents(abfd, sec,
bfd_set_section_contents (abfd, sec,
frag->fr_literal +
frag->fr_fix,
frag->fr_address + off,
@ -129,7 +140,7 @@ static void DEFUN(fill_section,(abfd, idx),
}
break;
default:
abort();
abort ();
}
frag = frag->fr_next;
}
@ -138,7 +149,8 @@ static void DEFUN(fill_section,(abfd, idx),
/* Count the relocations in a chain */
static unsigned int DEFUN(count_entries_in_chain,(idx),
static unsigned int
DEFUN (count_entries_in_chain, (idx),
unsigned int idx)
{
unsigned int nrelocs;
@ -147,48 +159,50 @@ static unsigned int DEFUN(count_entries_in_chain,(idx),
/* Count the relocations */
fixup_ptr = segment_info[idx].fix_root;
nrelocs = 0;
while (fixup_ptr != (fixS *)NULL)
while (fixup_ptr != (fixS *) NULL)
{
fixup_ptr = fixup_ptr->fx_next;
nrelocs ++ ;
nrelocs++;
}
return nrelocs;
}
/* output all the relocations for a section */
void DEFUN(do_relocs_for,(idx),
void
DEFUN (do_relocs_for, (idx),
unsigned int idx)
{
unsigned int nrelocs;
arelent **reloc_ptr_vector;
arelent *reloc_vector;
asymbol **ptrs;
asection *section = (asection *)(segment_info[idx].user_stuff);
asection *section = (asection *) (segment_info[idx].user_stuff);
unsigned int i;
fixS *from;
if (section) {
nrelocs = count_entries_in_chain(idx);
if (section)
{
nrelocs = count_entries_in_chain (idx);
reloc_ptr_vector = (arelent**)malloc((nrelocs+1) * sizeof(arelent *));
reloc_vector = (arelent*)malloc(nrelocs * sizeof(arelent));
ptrs = (asymbol **)malloc(nrelocs * sizeof(asymbol *));
reloc_ptr_vector = (arelent **) malloc ((nrelocs + 1) * sizeof (arelent *));
reloc_vector = (arelent *) malloc (nrelocs * sizeof (arelent));
ptrs = (asymbol **) malloc (nrelocs * sizeof (asymbol *));
from = segment_info[idx].fix_root;
for (i = 0; i < nrelocs; i++)
{
arelent *to = reloc_vector + i;
asymbol *s ;
asymbol *s;
reloc_ptr_vector[i] = to;
to->howto = (reloc_howto_type *)(from->fx_r_type);
to->howto = (reloc_howto_type *) (from->fx_r_type);
/* We can't represent complicated things in a reloc yet */
/* if (from->fx_addsy == 0 ||
from->fx_subsy != 0) abort();
*/
s = &( from->fx_addsy->sy_symbol.sy);
to->address = ((char *)( from->fx_frag->fr_address +
s = &(from->fx_addsy->sy_symbol.sy);
to->address = ((char *) (from->fx_frag->fr_address +
from->fx_where))
- ((char *)(&(from->fx_frag->fr_literal)));
to->addend = from->fx_offset ;
- ((char *) (&(from->fx_frag->fr_literal)));
to->addend = from->fx_offset;
/* If we know the symbol which we want to relocate to, turn this
reloaction into a section relative.
@ -198,29 +212,35 @@ void DEFUN(do_relocs_for,(idx),
being pc relative and turns into an absolute relocation.
*/
if (s) {
if ((s->flags & BSF_UNDEFINED)==0) {
if (s)
{
if ((s->flags & BSF_UNDEFINED) == 0)
{
to->section = s->section;
to->addend += s->value ;
to->addend += s->value;
to->sym_ptr_ptr = 0;
if (to->howto->pcrel_offset) {
if (to->howto->pcrel_offset)
{
/* This is a pcrel relocation, the addend should be adjusted */
to->addend -= to->address +1;
to->addend -= to->address + 1;
}
}
else {
else
{
to->section = 0;
*ptrs = &(from->fx_addsy->sy_symbol.sy);
to->sym_ptr_ptr = ptrs;
if (to->howto->pcrel_offset) {
if (to->howto->pcrel_offset)
{
/* This is a pcrel relocation, the addend should be adjusted */
to->addend -= to->address -1;
to->addend -= to->address - 1;
}
}
}
else {
else
{
to->section = 0;
}
@ -236,8 +256,9 @@ void DEFUN(do_relocs_for,(idx),
}
/* do the symbols.. */
static void DEFUN(do_symbols, (abfd),
bfd *abfd)
static void
DEFUN (do_symbols, (abfd),
bfd * abfd)
{
extern symbolS *symbol_rootP;
symbolS *ptr;
@ -248,45 +269,48 @@ static void DEFUN(do_symbols, (abfd),
for (ptr = symbol_rootP;
ptr != (symbolS *)NULL;
ptr != (symbolS *) NULL;
ptr = ptr->sy_next)
{
if (SEG_NORMAL(ptr->sy_symbol.seg))
if (SEG_NORMAL (ptr->sy_symbol.seg))
{
ptr->sy_symbol.sy.section =
(asection *)(segment_info[ptr->sy_symbol.seg].user_stuff);
(asection *) (segment_info[ptr->sy_symbol.seg].user_stuff);
ptr->sy_symbol.sy.value += ptr->sy_frag->fr_address;
if (ptr->sy_symbol.sy.flags == 0) {
ptr->sy_symbol.sy.flags = BSF_LOCAL ;
if (ptr->sy_symbol.sy.flags == 0)
{
ptr->sy_symbol.sy.flags = BSF_LOCAL;
}
}
else {
switch (ptr->sy_symbol.seg) {
else
{
switch (ptr->sy_symbol.seg)
{
case SEG_ABSOLUTE:
ptr->sy_symbol.sy.flags |= BSF_ABSOLUTE;
ptr->sy_symbol.sy.section = 0;
break;
case SEG_UNKNOWN:
ptr->sy_symbol.sy.flags = BSF_UNDEFINED ;
ptr->sy_symbol.sy.flags = BSF_UNDEFINED;
ptr->sy_symbol.sy.section = 0;
break;
default:
abort();
abort ();
}
}
count++;
}
symbol_ptr_vec = (asymbol **)malloc((count+1) * sizeof(asymbol *));
symbol_ptr_vec = (asymbol **) malloc ((count + 1) * sizeof (asymbol *));
index = 0;
for (ptr = symbol_rootP;
ptr != (symbolS *)NULL;
ptr != (symbolS *) NULL;
ptr = ptr->sy_next)
{
symbol_ptr_vec[index] = &(ptr->sy_symbol.sy);
index++;
}
symbol_ptr_vec[index] =0;
symbol_ptr_vec[index] = 0;
abfd->outsymbols = symbol_ptr_vec;
abfd->symcount = count;
}
@ -294,44 +318,46 @@ static void DEFUN(do_symbols, (abfd),
/* The generic as->bfd converter. Other backends may have special case
code */
void DEFUN_VOID(bfd_as_write_hook)
void
DEFUN_VOID (bfd_as_write_hook)
{
int i;
for (i = SEG_E0; i < SEG_UNKNOWN; i++) {
size_section(abfd, i);
for (i = SEG_E0; i < SEG_UNKNOWN; i++)
{
size_section (abfd, i);
}
for (i = SEG_E0; i < SEG_UNKNOWN; i++)
fill_section(abfd,i);
fill_section (abfd, i);
do_symbols(abfd);
do_symbols (abfd);
for (i = SEG_E0; i < SEG_UNKNOWN; i++)
do_relocs_for(i);
do_relocs_for (i);
}
S_GET_VALUE(x)
symbolS *x;
S_GET_VALUE (x)
symbolS *x;
{
return x->sy_symbol.sy.value;
}
S_SET_SEGMENT(x,y)
symbolS *x ;
int y;
S_SET_SEGMENT (x, y)
symbolS *x;
int y;
{
x->sy_symbol.seg = y;
}
S_IS_DEFINED(x)
symbolS *x;
S_IS_DEFINED (x)
symbolS *x;
{
if (SEG_NORMAL(x->sy_symbol.seg))
if (SEG_NORMAL (x->sy_symbol.seg))
{
return 1;
}
@ -340,74 +366,106 @@ symbolS *x;
case SEG_UNKNOWN:
return 0;
default:
abort();
abort ();
}
}
S_IS_EXTERNAL(x) { abort(); }
S_GET_DESC(x) { abort() ; }
S_IS_EXTERNAL (x)
{
abort ();
}
S_GET_SEGMENT(x)
symbolS *x;
{ return x->sy_symbol.seg; }
S_GET_DESC (x)
{
abort ();
}
S_SET_EXTERNAL(x)
symbolS *x;
S_GET_SEGMENT (x)
symbolS *x;
{
return x->sy_symbol.seg;
}
S_SET_EXTERNAL (x)
symbolS *x;
{
x->sy_symbol.sy.flags |= BSF_GLOBAL | BSF_EXPORT;
}
S_SET_NAME(x,y)
symbolS*x;
char *y; {
x->sy_symbol.sy.name = y; }
S_SET_NAME (x, y)
symbolS *x;
char *y;
{
x->sy_symbol.sy.name = y;
}
S_SET_VALUE(s,v)
symbolS *s;
long v;
S_SET_VALUE (s, v)
symbolS *s;
long v;
{
s->sy_symbol.sy.value = v;
}
S_GET_OTHER(x) { abort() ;}
S_IS_DEBUG(x) { abort(); }
S_GET_OTHER (x)
{
abort ();
}
char *segment_name() { abort(); }
S_IS_DEBUG (x)
{
abort ();
}
void obj_read_begin_hook() { }
char *
segment_name ()
{
abort ();
}
static void obj_ieee_section(ignore)
int ignore;
void
obj_read_begin_hook ()
{
}
static void
obj_ieee_section (ignore)
int ignore;
{
extern char *input_line_pointer;
extern char is_end_of_line[];
char *p= input_line_pointer;
char *p = input_line_pointer;
char *s = p;
int i;
/* Look up the name, if it doesn't exist, make it */
while (*p &&* p != ' ' && *p != ',' && !is_end_of_line[*p]) {
while (*p && *p != ' ' && *p != ',' && !is_end_of_line[*p])
{
p++;
}
for (i = SEG_E0; i < SEG_UNKNOWN; i++) {
if (segment_info[i].hadone){
if (strncmp(segment_info[i].name, s, p-s) ==0) {
for (i = SEG_E0; i < SEG_UNKNOWN; i++)
{
if (segment_info[i].hadone)
{
if (strncmp (segment_info[i].name, s, p - s) == 0)
{
goto ok;
}
}
else break;
else
break;
}
if (i == SEG_UNKNOWN) {
as_bad("too many sections");
if (i == SEG_UNKNOWN)
{
as_bad ("too many sections");
return;
}
segment_info[i].hadone = 1;
segment_info[i].name = malloc(p-s + 1);
memcpy(segment_info[i].name, s, p-s);
segment_info[i].name[p-s] = 0;
ok:
subseg_new(i,0);
segment_info[i].name = malloc (p - s + 1);
memcpy (segment_info[i].name, s, p - s);
segment_info[i].name[p - s] = 0;
ok:
subseg_new (i, 0);
while (!is_end_of_line[*p])
p++;
input_line_pointer = p;
@ -415,8 +473,8 @@ int ignore;
}
void cons();
void s_ignore();
void cons ();
void s_ignore ();
/*
@ -427,8 +485,8 @@ void s_ignore();
* Caller should have checked need_pass_2 is FALSE because we don't check it.
*/
void stringer();
void s_globl();
void stringer ();
void s_globl ();
const pseudo_typeS obj_pseudo_table[] =
{
{"section", obj_ieee_section, 0},
@ -446,8 +504,9 @@ const pseudo_typeS obj_pseudo_table[] =
void obj_symbol_new_hook(symbolP)
symbolS *symbolP;
void
obj_symbol_new_hook (symbolP)
symbolS *symbolP;
{
symbolP->sy_symbol.sy.the_bfd = abfd;
}
@ -457,37 +516,40 @@ symbolS *symbolP;
#if 1
extern void DEFUN_VOID(write_object_file)
extern void
DEFUN_VOID (write_object_file)
{
int i;
struct frchain *frchain_ptr;
struct frag *frag_ptr;
abfd = bfd_openw(out_file_name, "ieee");
abfd = bfd_openw (out_file_name, "ieee");
if (abfd == 0) {
if (abfd == 0)
{
as_perror ("FATAL: Can't create %s", out_file_name);
exit(42);
exit (42);
}
bfd_set_format(abfd, bfd_object);
bfd_set_arch_mach(abfd, bfd_arch_h8300, 0);
subseg_new(1,0);
subseg_new(2,0);
subseg_new(3,0);
bfd_set_format (abfd, bfd_object);
bfd_set_arch_mach (abfd, bfd_arch_h8300, 0);
subseg_new (1, 0);
subseg_new (2, 0);
subseg_new (3, 0);
for (frchain_ptr = frchain_root;
frchain_ptr != (struct frchain *)NULL;
frchain_ptr = frchain_ptr->frch_next) {
frchain_ptr != (struct frchain *) NULL;
frchain_ptr = frchain_ptr->frch_next)
{
/* Run through all the sub-segments and align them up. Also close any
open frags. We tack a .fill onto the end of the frag chain so
that any .align's size can be worked by looking at the next
frag */
subseg_new(frchain_ptr->frch_seg, frchain_ptr->frch_subseg);
subseg_new (frchain_ptr->frch_seg, frchain_ptr->frch_subseg);
#define SUB_SEGMENT_ALIGN 2
frag_align(SUB_SEGMENT_ALIGN,0);
frag_wane(frag_now);
frag_align (SUB_SEGMENT_ALIGN, 0);
frag_wane (frag_now);
frag_now->fr_fix = 0;
know( frag_now->fr_next == NULL );
know (frag_now->fr_next == NULL);
}
/* Now build one big frag chain for each segment, linked through
@ -495,7 +557,7 @@ extern void DEFUN_VOID(write_object_file)
for (i = SEG_E0; i < SEG_UNKNOWN; i++)
{
fragS ** prev_frag_ptr_ptr ;
fragS **prev_frag_ptr_ptr;
struct frchain *next_frchain_ptr;
/* struct frag **head_ptr = segment_info[i].frag_root;*/
@ -504,7 +566,7 @@ extern void DEFUN_VOID(write_object_file)
#if 0
/* Im not sure what this is for */
for (frchain_ptr = segment_info[i].frchainP->frch_root;
frchain_ptr != (struct frchain *)NULL;
frchain_ptr != (struct frchain *) NULL;
frchain_ptr = frchain_ptr->frch_next)
{
*head_ptr = frchain_ptr;
@ -515,25 +577,57 @@ extern void DEFUN_VOID(write_object_file)
#endif
}
for (i = SEG_E0; i < SEG_UNKNOWN; i++) {
relax_segment(segment_info[i].frag_root, i);
for (i = SEG_E0; i < SEG_UNKNOWN; i++)
{
relax_segment (segment_info[i].frag_root, i);
}
/* Now the addresses of the frags are correct within the segment */
bfd_as_write_hook();
bfd_close(abfd);
bfd_as_write_hook ();
bfd_close (abfd);
}
#endif
H_SET_TEXT_SIZE(a,b) { abort(); }
H_GET_TEXT_SIZE() { abort(); }
H_SET_BSS_SIZE() { abort(); }
H_SET_STRING_SIZE() { abort(); }
H_SET_RELOCATION_SIZE() { abort(); }
H_SET_MAGIC_NUMBER() { abort(); }
H_GET_FILE_SIZE() { abort(); }
H_GET_TEXT_RELOCATION_SIZE() { abort(); }
H_SET_TEXT_SIZE (a, b)
{
abort ();
}
H_GET_TEXT_SIZE ()
{
abort ();
}
H_SET_BSS_SIZE ()
{
abort ();
}
H_SET_STRING_SIZE ()
{
abort ();
}
H_SET_RELOCATION_SIZE ()
{
abort ();
}
H_SET_MAGIC_NUMBER ()
{
abort ();
}
H_GET_FILE_SIZE ()
{
abort ();
}
H_GET_TEXT_RELOCATION_SIZE ()
{
abort ();
}
/* end of obj-ieee.c */

View File

@ -24,15 +24,19 @@
typedef struct
{
asymbol sy;
int seg;
} obj_symbol_type;
asymbol sy;
int seg;
}
obj_symbol_type;
#define S_GET_NAME(s) (((s)->sy_symbol.sy.name))
typedef struct {
int x;
}
typedef struct
{
int x;
}
object_headers;
#define DEFAULT_MAGIC_NUMBER_FOR_OBJECT_FILE 1

File diff suppressed because it is too large Load Diff

View File

@ -37,4 +37,3 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#define COFF_FLAGS F_AR32W
#define reloc_type int

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -110,10 +110,14 @@ struct field_val_assoc cmpslot[] =
{"le", 5},
{"lt", 6},
{"ge", 7},
{"hi", 8}, {"ou", 8},
{"ls", 9}, {"ib", 9},
{"lo", 10}, {"in", 10},
{"hs", 11}, {"ob", 11},
{"hi", 8},
{"ou", 8},
{"ls", 9},
{"ib", 9},
{"lo", 10},
{"in", 10},
{"hs", 11},
{"ob", 11},
{NULL, 0},
};
@ -163,8 +167,8 @@ const char EXP_CHARS[] = "eE";
/* or 0H1.234E-12 (see exp chars above) */
const char FLT_CHARS[] = "dDfF";
extern void float_cons (), cons (), s_globl (), s_line (),
s_space (), s_set (), stringer (), s_lcomm ();
extern void float_cons (), cons (), s_globl (), s_line (), s_space (),
s_set (), stringer (), s_lcomm ();
static void s_file ();
static void s_bss ();
@ -174,11 +178,11 @@ const pseudo_typeS md_pseudo_table[] =
{"dfloat", float_cons, 'd'},
{"ffloat", float_cons, 'f'},
{"global", s_globl, 0},
{"half", cons, 2 },
{"half", cons, 2},
{"bss", s_bss, 0},
{"ln", s_line, 0},
{"string", stringer, 0},
{"word", cons, 4 },
{"word", cons, 4},
{"zero", s_space, 0},
{0}
};
@ -922,9 +926,9 @@ getval (param, valp)
void
md_number_to_chars (buf, val, nbytes)
char *buf;
int val;
int nbytes;
char *buf;
int val;
int nbytes;
{
switch (nbytes)
{
@ -944,11 +948,11 @@ int nbytes;
void
md_number_to_imm (buf, val, nbytes, fixP, seg_type)
unsigned char *buf;
unsigned int val;
int nbytes;
fixS *fixP;
int seg_type;
unsigned char *buf;
unsigned int val;
int nbytes;
fixS *fixP;
int seg_type;
{
if (seg_type != N_TEXT || fixP->fx_r_type == NO_RELOC)
{
@ -1015,9 +1019,9 @@ int seg_type;
void
md_number_to_disp (buf, val, nbytes)
char *buf;
int val;
int nbytes;
char *buf;
int val;
int nbytes;
{
as_fatal ("md_number_to_disp not defined");
md_number_to_chars (buf, val, nbytes);
@ -1025,9 +1029,9 @@ int nbytes;
void
md_number_to_field (buf, val, nbytes)
char *buf;
int val;
int nbytes;
char *buf;
int val;
int nbytes;
{
as_fatal ("md_number_to_field not defined");
md_number_to_chars (buf, val, nbytes);
@ -1078,18 +1082,18 @@ md_atof (type, litP, sizeP)
break;
default:
*sizeP=0;
*sizeP = 0;
return "Bad call to MD_ATOF()";
}
t=atof_ieee (input_line_pointer, type, words);
t = atof_ieee (input_line_pointer, type, words);
if (t)
input_line_pointer=t;
input_line_pointer = t;
*sizeP=prec * sizeof (LITTLENUM_TYPE);
for (wordP=words;prec--;)
*sizeP = prec * sizeof (LITTLENUM_TYPE);
for (wordP = words; prec--;)
{
md_number_to_chars (litP, (long) (*wordP++), sizeof (LITTLENUM_TYPE));
litP+=sizeof (LITTLENUM_TYPE);
litP += sizeof (LITTLENUM_TYPE);
}
return ""; /* Someone should teach Dean about null pointers */
}
@ -1103,7 +1107,10 @@ md_create_short_jump (ptr, from_addr, to_addr, frag, to_symbol)
fragS *frag;
symbolS *to_symbol;
{
ptr[0] = 0xc0; ptr[1] = 0x00; ptr[2] = 0x00; ptr[3] = 0x00;
ptr[0] = 0xc0;
ptr[1] = 0x00;
ptr[2] = 0x00;
ptr[3] = 0x00;
fix_new (frag,
ptr - frag->fr_literal,
4,
@ -1123,7 +1130,10 @@ md_create_long_jump (ptr, from_addr, to_addr, frag, to_symbol)
fragS *frag;
symbolS *to_symbol;
{
ptr[0] = 0xc0; ptr[1] = 0x00; ptr[2] = 0x00; ptr[3] = 0x00;
ptr[0] = 0xc0;
ptr[1] = 0x00;
ptr[2] = 0x00;
ptr[3] = 0x00;
fix_new (frag,
ptr - frag->fr_literal,
4,
@ -1142,7 +1152,8 @@ md_estimate_size_before_relax (fragP, segment_type)
as_fatal ("Relaxation should never occur");
}
const relax_typeS md_relax_table[] = {0};
const relax_typeS md_relax_table[] =
{0};
void
md_convert_frag (fragP)
@ -1170,76 +1181,86 @@ emit_relocations (fixP, segment_address_in_file)
extern char *next_object_file_charP;
bzero ((char *) &ri, sizeof (ri));
for (; fixP; fixP = fixP->fx_next) {
for (; fixP; fixP = fixP->fx_next)
{
if (fixP->fx_r_type >= NO_RELOC) {
if (fixP->fx_r_type >= NO_RELOC)
{
fprintf (stderr, "fixP->fx_r_type = %d\n", fixP->fx_r_type);
abort ();
}
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 ((symbolP->sy_type & N_TYPE) == N_UNDF)
{
ri.r_extern = 1;
ri.r_symbolnum = symbolP->sy_number;
} else {
}
else
{
ri.r_extern = 0;
ri.r_symbolnum = symbolP->sy_type & N_TYPE;
}
if (symbolP && symbolP->sy_frag) {
if (symbolP && symbolP->sy_frag)
{
ri.r_addend = symbolP->sy_frag->fr_address;
}
ri.r_type = fixP->fx_r_type;
if (fixP->fx_pcrel) {
/* ri.r_addend -= fixP->fx_where; */
if (fixP->fx_pcrel)
{
/* ri.r_addend -= fixP->fx_where; */
ri.r_addend -= ri.r_address;
} else {
}
else
{
ri.r_addend = fixP->fx_addnumber;
}
/* md_ri_to_chars ((char *) &ri, ri); */
append (&next_object_file_charP, (char *)& ri, sizeof (ri));
/* md_ri_to_chars ((char *) &ri, ri); */
append (&next_object_file_charP, (char *) &ri, sizeof (ri));
}
}
return;
}
static void
s_bss()
s_bss ()
{
char *name;
char c;
char *p;
int temp, bss_align = 1;
symbolS *symbolP;
extern const char is_end_of_line [256];
extern const char is_end_of_line[256];
name = input_line_pointer;
c = get_symbol_end();
c = get_symbol_end ();
p = input_line_pointer;
*p = c;
SKIP_WHITESPACE();
if ( * input_line_pointer != ',' )
SKIP_WHITESPACE ();
if (*input_line_pointer != ',')
{
as_warn("Expected comma after name");
ignore_rest_of_line();
as_warn ("Expected comma after name");
ignore_rest_of_line ();
return;
}
input_line_pointer ++;
if ((temp = get_absolute_expression()) < 0)
input_line_pointer++;
if ((temp = get_absolute_expression ()) < 0)
{
as_warn("BSS length (%d.) <0! Ignored.", temp);
ignore_rest_of_line();
as_warn ("BSS length (%d.) <0! Ignored.", temp);
ignore_rest_of_line ();
return;
}
*p = 0;
symbolP = symbol_find_or_make(name);
symbolP = symbol_find_or_make (name);
*p = c;
if (*input_line_pointer == ',')
{
input_line_pointer++;
bss_align = get_absolute_expression();
bss_align = get_absolute_expression ();
while (local_bss_counter % bss_align != 0)
local_bss_counter++;
}
@ -1253,13 +1274,13 @@ s_bss()
{
symbolP->sy_value = local_bss_counter;
symbolP->sy_type = N_BSS;
symbolP->sy_frag = & bss_address_frag;
symbolP->sy_frag = &bss_address_frag;
local_bss_counter += temp;
}
else
{
as_warn( "Ignoring attempt to re-define symbol from %d. to %d.",
symbolP->sy_value, local_bss_counter );
as_warn ("Ignoring attempt to re-define symbol from %d. to %d.",
symbolP->sy_value, local_bss_counter);
}
while (!is_end_of_line[*input_line_pointer])
{

View File

@ -1,3 +1,4 @@
/* m88k.h -- Assembler for the Motorola 88000
Contributed by Devon Bowen of Buffalo University
and Torbjorn Granlund of the Swedish Institute of Computer Science.
@ -35,10 +36,10 @@ enum reloc_type
struct reloc_info_m88k
{
unsigned long int r_address;
unsigned int r_symbolnum: 24;
unsigned int r_extern : 1;
unsigned int r_pad : 3;
enum reloc_type r_type : 4;
unsigned int r_symbolnum:24;
unsigned int r_extern:1;
unsigned int r_pad:3;
enum reloc_type r_type:4;
long int r_addend;
};

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -19,7 +19,6 @@
#define TC_SPARC 1
#define NO_LISTING
#define LOCAL_LABELS_FB
#ifdef OBJ_BOUT
@ -35,7 +34,7 @@
#define tc_headers_hook(a) {;} /* don't need it. */
#define tc_crawl_symbol_chain(a) {;} /* don't need it. */
void tc_aout_pre_write_hook();
void tc_aout_pre_write_hook ();
#define LISTING_HEADER "SPARC GAS "

File diff suppressed because it is too large Load Diff