These changes clean things up a bit, and improve Solaris cross

support when using /opt/SUNWspro/SC2.0/acc.

Tue Nov 10 09:50:25 1992  Ian Lance Taylor  (ian@cygnus.com)

	* obj-coffbfd.c (fill_section): set STYP_NOLOAD bit for .bss
	section.

	* atof-ieee.c, atof-ns32k.c, tc-*.c: made EXP_CHARS, FLT_CHARS,
	comment_chars, line_comment_chars and line_seperator_chars
	consistently const, and always initialized them.  Included read.h.
This commit is contained in:
Ian Lance Taylor
1992-11-10 18:17:00 +00:00
parent 9ee6289b47
commit 587c4264e0
7 changed files with 249 additions and 121 deletions

View File

@ -1,3 +1,12 @@
Tue Nov 10 09:50:25 1992 Ian Lance Taylor (ian@cygnus.com)
* obj-coffbfd.c (fill_section): set STYP_NOLOAD bit for .bss
section.
* atof-ieee.c, atof-ns32k.c, tc-*.c: made EXP_CHARS, FLT_CHARS,
comment_chars, line_comment_chars and line_seperator_chars
consistently const, and always initialized them. Included read.h.
Thu Nov 5 17:55:41 1992 Jim Wilson (wilson@sphagnum.cygnus.com)
* tc-sparc.c (sparc_ip): Add code to flag error if an absolute

View File

@ -23,7 +23,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
extern FLONUM_TYPE generic_floating_point_number; /* Flonums returned here. */
extern char EXP_CHARS[];
extern const char EXP_CHARS[];
/* Precision in LittleNums. */
#define MAX_PRECISION (4)
#define F_PRECISION (2)

View File

@ -481,7 +481,7 @@ static void DEFUN(fill_section,(abfd, filehdr, file_cursor),
else if (strcmp(s->s_name,".data")==0)
s->s_flags |= STYP_DATA;
else if (strcmp(s->s_name,".bss")==0)
s->s_flags |= STYP_BSS;
s->s_flags |= STYP_BSS | STYP_NOLOAD;
else if (strcmp(s->s_name,".lit")==0)
s->s_flags = STYP_LIT | STYP_TEXT;

View File

@ -22,6 +22,7 @@
much bloody rewriting required before. There still probably is. */
#include "as.h"
#include "read.h"
#include "opcode/a29k.h"
@ -102,7 +103,7 @@ int md_reloc_size = 12; /* Not bfdized*/
/* This array holds the chars that always start a comment. If the
pre-processor is disabled, these aren't very useful */
char comment_chars[] = ";";
const char comment_chars[] = ";";
/* This array holds the chars that only start a comment at the beginning of
a line. If the line seems to have the form '# 123 filename'
@ -111,19 +112,19 @@ char comment_chars[] = ";";
first line of the input file. This is because the compiler outputs
#NO_APP at the beginning of its output. */
/* Also note that comments like this one will always work */
char line_comment_chars[] = "#";
const char line_comment_chars[] = "#";
/* We needed an unused char for line separation to work around the
lack of macros, using sed and such. */
char line_separator_chars[] = "@";
const char line_separator_chars[] = "@";
/* Chars that can be used to separate mant from exp in floating point nums */
char EXP_CHARS[] = "eE";
const char EXP_CHARS[] = "eE";
/* Chars that mean this number is a floating point constant */
/* As in 0f12.456 */
/* or 0d1.2345e12 */
char FLT_CHARS[] = "rRsSfFdDxXpP";
const char FLT_CHARS[] = "rRsSfFdDxXpP";
/* Also be aware that MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT may have to be
changed in read.c . Ideally it shouldn't have to know about it at all,

View File

@ -52,6 +52,8 @@ const char comment_chars[] = "|";
/* Also note that comments like this one will always work. */
const char line_comment_chars[] = "#";
const char line_separator_chars[] = "";
/* Chars that can be used to separate mant from exp in floating point nums */
const char EXP_CHARS[] = "eE";
@ -577,11 +579,17 @@ static char alt_notend_table[256];
* advance the pointer.
*/
enum _register m68k_reg_parse(ccp)
register char **ccp;
enum _register
m68k_reg_parse(ccp)
register char **ccp;
{
char *start = *ccp;
#ifdef REGISTER_PREFIX
if (*start == REGISTER_PREFIX)
++start;
#endif
if (isalpha(*start) && is_name_beginner(*start))
{
char c;
@ -589,12 +597,11 @@ register char **ccp;
symbolS *symbolP;
c = *p++;
while (isalpha(c) || isdigit(c))
{
c = *p++;
}
while (isalpha(c) || isdigit(c) || c == '_')
{
c = *p++;
}
;
* -- p = 0;
symbolP = symbol_find(start);
*p = c;
@ -1965,7 +1972,6 @@ void m68k_ip (instring)
break;
} /* Its BIG */
if(offs(opP->con1)>0) {
as_warn("Bignum assumed to be binary bit-pattern");
if(offs(opP->con1)>baseo) {
as_warn("Bignum too big for %c format; truncated",s[1]);
offs(opP->con1)=baseo;
@ -3500,7 +3506,14 @@ void
fixS *fixP;
long val;
{
#ifdef IBM_COMPILER_SUX
/* This is unnecessary but it convinces the native rs6000
compiler to generate the code we want. */
char *buf = fixP->fx_frag->fr_literal;
buf += fixP->fx_where;
#else /* IBM_COMPILER_SUX */
char *buf = fixP->fx_where + fixP->fx_frag->fr_literal;
#endif /* IBM_COMPILER_SUX */
switch(fixP->fx_size) {
case 1:
@ -4136,19 +4149,6 @@ int ok;
break;
}
break;
case SEG_TEXT:
case SEG_DATA:
case SEG_BSS:
case SEG_UNKNOWN:
case SEG_DIFFERENCE:
if(ok>=10 && ok<=70) {
seg(exp)=SEG_ABSOLUTE;
adds(exp)=0;
subs(exp)=0;
offs(exp)= (ok==10) ? 1 : 0;
as_warn("Can't deal with expression \"%s\": defaulting to %ld",exp->e_beg,offs(exp));
}
break;
case SEG_BIG:
if (offs (exp) < 0 /* flonum */
&& (ok == 80 /* no bignums */
@ -4176,7 +4176,21 @@ int ok;
}
break;
default:
as_fatal("failed sanity check.");
case SEG_TEXT:
case SEG_DATA:
case SEG_BSS:
case SEG_UNKNOWN:
case SEG_DIFFERENCE:
if(ok>=10 && ok<=70) {
seg(exp)=SEG_ABSOLUTE;
adds(exp)=0;
subs(exp)=0;
offs(exp)= (ok==10) ? 1 : 0;
as_warn("Can't deal with expression \"%s\": defaulting to %ld",exp->e_beg,offs(exp));
}
break;
}
if(input_line_pointer!=exp->e_end+1)
as_bad("Ignoring junk after expression");

View File

@ -148,18 +148,20 @@ long omagic = OMAGIC;
/* These chars start a comment anywhere in a source file (except inside
another comment */
char comment_chars[] = ";";
const char comment_chars[] = ";";
/* These chars only start a comment at the beginning of a line. */
char line_comment_chars[] = "#";
const char line_comment_chars[] = "#";
const char line_separator_chars[] = "";
/* Chars that can be used to separate mant from exp in floating point nums */
char EXP_CHARS[] = "eE";
const char EXP_CHARS[] = "eE";
/* Chars that mean this number is a floating point constant */
/* as in 0f123.456 */
/* or 0H1.234E-12 (see exp chars above) */
char FLT_CHARS[] = "dDfF";
const char FLT_CHARS[] = "dDfF";
extern void float_cons (), cons (), s_globl (), s_line (),
s_space (), s_set (), stringer (), s_lcomm ();

View File

@ -28,12 +28,14 @@
#include "../opcodes/z8k-opc.h"
#include "as.h"
#include "read.h"
#include "bfd.h"
#include <ctype.h>
#include "listing.h"
char comment_chars[] = { ';',0 };
char line_separator_chars[] = { '$' ,0};
const char comment_chars[] = { '!',0 };
const char line_separator_chars[] = { ';' ,0};
const char line_comment_chars[] = "";
extern int machine;
extern int coff_flags;
@ -74,8 +76,8 @@ const pseudo_typeS md_pseudo_table[] =
{ "import", s_ignore, 0},
{ "page", listing_eject, 0},
{ "program", s_ignore, 0},
{ "SEGM", s_segm, 0},
{ "UNSEG", s_unseg, 0},
{ "z8001", s_segm, 0},
{ "z8002", s_unseg, 0},
{ 0,0,0 }
};
@ -85,7 +87,7 @@ const char EXP_CHARS[] = "eE";
/* Chars that mean this number is a floating point constant */
/* As in 0f12.456 */
/* or 0d1.2345e12 */
char FLT_CHARS[] = "rRsSfFdDxXpP";
const char FLT_CHARS[] = "rRsSfFdDxXpP";
const relax_typeS md_relax_table[1];
@ -139,9 +141,11 @@ typedef struct z8k_op
static op_type *da_address;
static op_type *imm_operand;
static expressionS *da_operand;
static expressionS *imm_operand;
int reg[16];
int the_cc;
char *
@ -187,24 +191,24 @@ DEFUN(parse_reg,(src, mode, reg),
unsigned int *reg)
{
char *res = 0;
if (src[0] == 'R')
if (src[0] == 'r')
{
if (src[1] == 'R')
if (src[1] == 'r')
{
*mode = CLASS_REG_LONG;
res = whatreg(reg, src+2);
}
else if (src[1] == 'H')
else if (src[1] == 'h')
{
*mode = CLASS_REG_BYTE;
res = whatreg(reg, src+2);
}
else if (src[1] == 'L')
else if (src[1] == 'l')
{
*mode = CLASS_REG_BYTE;
res = whatreg(reg, src+2);
}
else if (src[1] == 'Q')
else if (src[1] == 'q')
{
* mode = CLASS_REG_QUAD;
res = whatreg(reg, src+2);
@ -318,27 +322,28 @@ char *name;
struct cc_names table[] =
{
0x0,"F",
0x6,"Z",
0xe,"NZ",
0x7,"C",
0xf,"NC",
0xd,"PL",
0x5,"MI",
0xe,"NE",
0x6,"EQ",
0x4,"OV",
0xc,"NOV",
0x4,"PE",
0xC,"PO",
0x9,"GE",
0x1,"LT",
0xa,"GT",
0x2,"LE",
0xf,"UGE",
0x7,"ULT",
0xb,"UGT",
0x3,"ULE",
0x0,"f",
0x1,"lt",
0x2,"le",
0x3,"ule",
0x4,"ov",
0x4,"pe",
0x5,"mi",
0x6,"eq",
0x6,"z",
0x7,"c",
0x7,"ult",
0x8,"t",
0x9,"ge",
0xa,"gt",
0xb,"ugt",
0xc,"nov",
0xc,"po",
0xd,"pl",
0xe,"ne",
0xe,"nz",
0xf,"nc",
0xf,"uge",
0,0
};
@ -351,6 +356,9 @@ DEFUN(get_cc_operand,(ptr, mode, dst),
char *src = *ptr;
int r;
int i;
while (*src== ' ')
src++;
mode->mode = CLASS_CC;
for (i = 0; table[i].name; i++)
{
@ -360,12 +368,12 @@ DEFUN(get_cc_operand,(ptr, mode, dst),
if (table[i].name[j] != src[j])
goto fail;
}
the_cc = table[i].value;
the_cc = table[i].value;
*ptr = src + j;
return;
fail:;
}
the_cc = 0x8;
the_cc = 0x8;
return ;
}
@ -382,10 +390,13 @@ DEFUN(get_operand,(ptr, mode, dst),
unsigned int size;
mode->mode = 0;
while (*src == ' ')
src++;
if (*src == '#')
{
mode->mode = CLASS_IMM;
imm_operand = mode;
imm_operand = &(mode->exp);
src = parse_exp(src+1, &(mode->exp));
}
else if (*src == '@') {
@ -395,8 +406,8 @@ DEFUN(get_operand,(ptr, mode, dst),
}
else
{
int reg;
end = parse_reg(src, &mode->mode, &reg);
int regn;
end = parse_reg(src, &mode->mode, &regn);
if (end)
{
@ -423,9 +434,9 @@ DEFUN(get_operand,(ptr, mode, dst),
regaddr(mode->mode,"ra(rb) ra");
regword(mode->mode,"ra(rb) rb");
mode->mode = CLASS_BX;
mode->reg = reg;
mode->reg = regn;
mode->x_reg = nr;
reg[ARG_RX] = nr;
}
else
{
@ -435,13 +446,14 @@ DEFUN(get_operand,(ptr, mode, dst),
src = parse_exp(src, &(mode->exp));
src = checkfor(src, ')');
mode->mode = CLASS_BA;
mode->reg = reg;
mode->reg = regn;
mode->x_reg = 0;
da_operand = &(mode->exp);
}
}
else
{
mode->reg = reg;
mode->reg = regn;
mode->x_reg = 0;
}
}
@ -452,12 +464,12 @@ DEFUN(get_operand,(ptr, mode, dst),
if (*src == '(')
{
src++;
end = parse_reg(src, &(mode->mode), &reg);
end = parse_reg(src, &(mode->mode), &regn);
regword(mode->mode,"addr(Ra) ra");
mode->mode = CLASS_X;
mode->reg = reg;
mode->reg = regn;
mode->x_reg =0;
da_address = mode;
da_operand = &(mode->exp);
src = checkfor(end, ')');
}
else
@ -466,7 +478,7 @@ DEFUN(get_operand,(ptr, mode, dst),
mode->mode = CLASS_DA;
mode->reg = 0;
mode->x_reg = 0;
da_address = mode;
da_operand = &(mode->exp);
}
}
}
@ -488,9 +500,17 @@ DEFUN(get_operands,(opcode, op_end, operand),
operand[1].mode = 0;
break;
case 1:
case 1:
ptr++;
get_operand(& ptr, operand +0,0);
if (opcode->arg_info[0] == CLASS_CC)
{
get_cc_operand(&ptr, operand+0,0);
}
else
{
get_operand(& ptr, operand +0,0);
}
operand[1].mode =0;
break;
@ -502,11 +522,21 @@ DEFUN(get_operands,(opcode, op_end, operand),
}
else
{
get_operand(& ptr, operand +0,0);
}
if (*ptr == ',') ptr++;
get_operand(& ptr, operand +1, 1);
break;
case 3:
ptr++;
get_operand(& ptr, operand +0,0);
if (*ptr == ',') ptr++;
get_operand(& ptr, operand +1, 1);
if (*ptr == ',') ptr++;
get_operand(& ptr, operand +2, 2);
break;
default:
abort();
@ -521,8 +551,8 @@ DEFUN(get_operands,(opcode, op_end, operand),
provided
*/
int reg[16];
expressionS disp;
static
opcode_entry_type *
@ -547,9 +577,34 @@ DEFUN(get_specific,(opcode, operands),
{
int mode = operands[i].mode;
if ((mode&CLASS_MASK) != (this_try->arg_info[i] & CLASS_MASK)) goto fail;
reg[this_try->arg_info[i] & ARG_MASK] = operands[i].reg;
if ((mode&CLASS_MASK) != (this_try->arg_info[i] & CLASS_MASK))
{
/* it could be an pc rel operand, if this is a da mode and
we like disps, then insert it */
if (mode == CLASS_DA && this_try->arg_info[i] == CLASS_DISP)
{
/* This is the case */
operands[i].mode = CLASS_DISP;
}
else {
/* Can't think of a way to turn what we've been given into
something that's ok */
goto fail;
}
}
switch (mode & CLASS_MASK) {
default:
break;
case CLASS_X:
case CLASS_IR:
case CLASS_BA:
case CLASS_BX:
case CLASS_DISP:
case CLASS_REG:
reg[this_try->arg_info[i] & ARG_MASK] = operands[i].reg;
break;
}
}
found =1;
@ -587,17 +642,20 @@ static void
DEFUN(newfix,(ptr, type, operand),
int ptr AND
int type AND
op_type *operand)
expressionS *operand)
{
fix_new(frag_now,
ptr,
1,
operand->exp.X_add_symbol,
operand->exp.X_subtract_symbol,
operand->exp.X_add_number,
0,
type);
if (operand->X_add_symbol
|| operand->X_subtract_symbol
|| operand->X_add_number) {
fix_new(frag_now,
ptr,
1,
operand->X_add_symbol,
operand->X_subtract_symbol,
operand->X_add_number,
0,
type);
}
}
@ -619,15 +677,7 @@ static void
int nib;
int nibble;
unsigned short *class_ptr;
length = this_try->length;
if (segmented_mode && da_address)
{
/* two more bytes when in segmented mode and using da address
mode */
length += 2;
}
output = frag_more(length);
memset(buffer, 20, 0);
memset(buffer, 20, 0);
class_ptr = this_try->byte_info;
top: ;
@ -637,19 +687,38 @@ memset(buffer, 20, 0);
switch (c & CLASS_MASK)
{
default:
abort();
case CLASS_ADDRESS:
/* Direct address, we don't cope with the SS mode right now */
if (segmented_mode) {
newfix((output_ptr-buffer)/2, R_DA | R_SEG, da_address);
output_ptr += 8;
newfix((output_ptr-buffer)/2, R_DA | R_SEG, da_operand);
*output_ptr++ = 0;
*output_ptr++ = 0;
*output_ptr++ = 0;
*output_ptr++ = 0;
*output_ptr++ = 0;
*output_ptr++ = 0;
*output_ptr++ = 0;
*output_ptr++ = 0;
}
else {
newfix((output_ptr-buffer)/2, R_DA, da_address);
output_ptr += 4;
newfix((output_ptr-buffer)/2, R_DA, da_operand);
*output_ptr++ = 0;
*output_ptr++ = 0;
*output_ptr++ = 0;
*output_ptr++ = 0;
}
da_address = 0;
da_operand = 0;
break;
case CLASS_DISP8:
/* pc rel 8 bit */
newfix((output_ptr-buffer)/2, R_JR, da_operand);
da_operand = 0;
*output_ptr++ = 0;
*output_ptr++ = 0;
break;
case CLASS_CC:
*output_ptr++ = the_cc;
break;
@ -670,27 +739,51 @@ memset(buffer, 20, 0);
right reg */
*output_ptr++ = reg[c & 0xf];
break;
case CLASS_DISP:
newfix((output_ptr-buffer)/2, R_DA, da_operand);
da_operand= 0;
output_ptr += 4;
break;
case CLASS_IMM:
{
nib = 0;
switch (c & ARG_MASK)
{
case ARG_IMM4:
*output_ptr ++ = imm_operand->X_add_number;
imm_operand->X_add_number = 0;
newfix((output_ptr-buffer)/2, R_IMM4L, imm_operand);
break;
case ARG_IMMNMINUS1:
imm_operand->X_add_number --;
newfix((output_ptr-buffer)/2, R_IMM4L, imm_operand);
*output_ptr++ = 0;
break;
case ARG_IMM8:
newfix((output_ptr-buffer)/2, R_IMM8, imm_operand);
*output_ptr++ = 0;
*output_ptr++ = 0;
case ARG_NIM16:
imm_operand->X_add_number = - imm_operand->X_add_number;
newfix((output_ptr-buffer)/2, R_DA, imm_operand);
*output_ptr++ = 0;
*output_ptr++ = 0;
*output_ptr++ = 0;
*output_ptr++ = 0;
break;
case ARG_IMM16:
newfix((output_ptr-buffer)/2, R_IMM16, imm_operand);
*output_ptr++ = 0;
*output_ptr++ = 0;
*output_ptr++ = 0;
*output_ptr++ = 0;
{
int n = imm_operand->X_add_number ;
imm_operand->X_add_number = 0;
newfix((output_ptr-buffer)/2, R_DA, imm_operand);
*output_ptr++ = n>>24;
*output_ptr++ = n>>16;
*output_ptr++ = n>>8;
*output_ptr++ = n;
}
break;
case ARG_IMM32:
@ -719,8 +812,11 @@ memset(buffer, 20, 0);
/* Copy from the nibble buffer into the frag */
{
int length = (output_ptr - buffer) / 2 ;
char *src = buffer;
char *fragp = output;
char *fragp = frag_more(length);
frag_wane(frag_now);
frag_new(0);
while (src < output_ptr)
{
*fragp = (src[0] << 4) | src[1];
@ -747,7 +843,7 @@ void
char *op_start;
char *op_end;
unsigned int i;
struct z8k_op operand[2];
struct z8k_op operand[3];
opcode_entry_type *opcode;
opcode_entry_type * prev_opcode;
@ -954,12 +1050,18 @@ long val;
buf[0] = (buf[0] & 0xf0) | ((buf[0] + val) & 0xf);
break;
case R_JR:
*buf++= val;
/* if (val != 0) abort();*/
break;
case R_IMM8:
buf[0] += val;
break;
break;
case R_DA:
case R_IMM16:
*buf++=(val>>8);
*buf++=val;
break;
@ -1033,7 +1135,7 @@ bfd_vma base;
{
case 2:
intr->r_type = R_IMM16;
intr->r_type = R_DA;
break;
case 1:
intr->r_type = R_IMM8;