/* tc-vax.c - vax-specific -
- Copyright (C) 1987, 1991, 1992 Free Software Foundation, Inc.
+ Copyright 1987, 1991, 1992, 1993, 1994, 1995, 1998, 2000, 2001
+ Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with GAS; see the file COPYING. If not, write to
- the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+ along with GAS; see the file COPYING. If not, write to the Free
+ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+ 02111-1307, USA. */
#include "as.h"
another comment */
const char comment_chars[] = "#";
-/* These chars only start a comment at the beginning of a line. */
-/* Note that for the VAX the are the same as comment_chars above. */
+/* These chars only start a comment at the beginning of a line. */
+/* Note that for the VAX the are the same as comment_chars above. */
const char line_comment_chars[] = "#";
-const char line_separator_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";
static expressionS exp_of_operand[VIT_MAX_OPERANDS];
static segT seg_of_operand[VIT_MAX_OPERANDS];
-/* A vax instruction after decoding. */
+/* A vax instruction after decoding. */
static struct vit v;
-/* Hold details of big operands. */
+/* Hold details of big operands. */
LITTLENUM_TYPE big_operand_bits[VIT_MAX_OPERANDS][SIZE_OF_LARGE_NUMBER];
FLONUM_TYPE float_operand[VIT_MAX_OPERANDS];
-/* Above is made to point into big_operand_bits by md_begin(). */
+/* Above is made to point into big_operand_bits by md_begin(). */
int flag_hash_long_names; /* -+ */
int flag_one; /* -1 */
bbcs e3
bbsc e4
bbcc e5
- bbssi e6
- bbcci e7
Always, you complement 0th bit to reverse condition.
Always, 1-byte opcde, longword-address, byte-address, 1-byte-displacement
\f
/* These displacements are relative to the start address of the
displacement. The first letter is Byte, Word. 2nd letter is
- Forward, Backward. */
+ Forward, Backward. */
#define BF (1+ 127)
#define BB (1+-128)
#define WF (2+ 32767)
#define WB (2+-32768)
/* Dont need LF, LB because they always reach. [They are coded as 0.] */
-
#define C(a,b) ENCODE_RELAX(a,b)
-/* This macro has no side-effects. */
+/* This macro has no side-effects. */
#define ENCODE_RELAX(what,length) (((what) << 2) + (length))
+#define RELAX_STATE(s) ((s) >> 2)
+#define RELAX_LENGTH(s) ((s) & 3)
-const relax_typeS
- md_relax_table[] =
+const relax_typeS md_relax_table[] =
{
{1, 1, 0, 0}, /* error sentinel 0,0 */
{1, 1, 0, 0}, /* unused 0,1 */
{1, 1, 0, 0}, /* unused 0,2 */
{1, 1, 0, 0}, /* unused 0,3 */
+
{BF + 1, BB + 1, 2, C (1, 1)},/* B^"foo" 1,0 */
{WF + 1, WB + 1, 3, C (1, 2)},/* W^"foo" 1,1 */
{0, 0, 5, 0}, /* L^"foo" 1,2 */
{1, 1, 0, 0}, /* unused 1,3 */
+
{BF, BB, 1, C (2, 1)}, /* b<cond> B^"foo" 2,0 */
{WF + 2, WB + 2, 4, C (2, 2)},/* br.+? brw X 2,1 */
{0, 0, 7, 0}, /* br.+? jmp X 2,2 */
{1, 1, 0, 0}, /* unused 2,3 */
+
{BF, BB, 1, C (3, 1)}, /* brb B^foo 3,0 */
{WF, WB, 2, C (3, 2)}, /* brw W^foo 3,1 */
{0, 0, 5, 0}, /* Jmp L^foo 3,2 */
{1, 1, 0, 0}, /* unused 3,3 */
+
{1, 1, 0, 0}, /* unused 4,0 */
{WF, WB, 2, C (4, 2)}, /* acb_ ^Wfoo 4,1 */
{0, 0, 10, 0}, /* acb_,br,jmp L^foo4,2 */
{1, 1, 0, 0}, /* unused 4,3 */
+
{BF, BB, 1, C (5, 1)}, /* Xob___,,foo 5,0 */
{WF + 4, WB + 4, 6, C (5, 2)},/* Xob.+2,brb.+3,brw5,1 */
{0, 0, 9, 0}, /* Xob.+2,brb.+6,jmp5,2 */
+ {1, 1, 0, 0}, /* unused 5,3 */
};
#undef C
#define STATE_PC_RELATIVE (1)
#define STATE_CONDITIONAL_BRANCH (2)
-#define STATE_ALWAYS_BRANCH (3) /* includes BSB... */
+#define STATE_ALWAYS_BRANCH (3) /* includes BSB... */
#define STATE_COMPLEX_BRANCH (4)
#define STATE_COMPLEX_HOP (5)
#define STATE_LONG (2)
#define STATE_UNDF (3) /* Symbol undefined in pass1 */
-
#define min(a, b) ((a) < (b) ? (a) : (b))
int flonum_gen2vax PARAMS ((char format_letter, FLONUM_TYPE * f,
LITTLENUM_TYPE * words));
-static const char *vip_begin PARAMS ((int, char *, char *, char *));
-static void vip_op_defaults PARAMS ((char *immediate, char *indirect,
- char *displen));
+static const char *vip_begin PARAMS ((int, const char *, const char *,
+ const char *));
+static void vip_op_defaults PARAMS ((const char *, const char *, const char *));
static void vip_op PARAMS ((char *, struct vop *));
static void vip PARAMS ((struct vit *, char *));
FLONUM_TYPE *fP;
int i;
- if (errtxt = vip_begin (1, "$", "*", "`"))
+ if ((errtxt = vip_begin (1, "$", "*", "`")) != 0)
{
- as_fatal ("VIP_BEGIN error:%s", errtxt);
+ as_fatal (_("VIP_BEGIN error:%s"), errtxt);
}
for (i = 0, fP = float_operand;
/* Fix up some data or instructions after we find out the value of a symbol
that they reference. */
-void /* Knows about order of bytes in address. */
+void /* Knows about order of bytes in address. */
md_apply_fix (fixP, value)
fixS *fixP;
long value;
long
md_chars_to_number (con, nbytes)
- unsigned char con[]; /* Low order byte 1st. */
- int nbytes; /* Number of bytes in the input. */
+ unsigned char con[]; /* Low order byte 1st. */
+ int nbytes; /* Number of bytes in the input. */
{
long retval;
for (retval = 0, con += nbytes - 1; nbytes--; con--)
void
md_assemble (instruction_string)
- char *instruction_string; /* A string: assemble 1 instruction. */
+ char *instruction_string; /* A string: assemble 1 instruction. */
{
- /* Non-zero if operand expression's segment is not known yet. */
+ /* Non-zero if operand expression's segment is not known yet. */
int is_undefined;
int length_code;
char *p;
- /* An operand. Scans all operands. */
+ /* An operand. Scans all operands. */
struct vop *operandP;
char *save_input_line_pointer;
- /* What used to live after an expression. */
+ /* What used to live after an expression. */
char c_save;
- /* 1: instruction_string bad for all passes. */
+ /* 1: instruction_string bad for all passes. */
int goofed;
/* Points to slot just after last operand. */
struct vop *end_operandP;
expressionS *expP;
segT *segP;
- /* These refer to an instruction operand expression. */
+ /* These refer to an instruction operand expression. */
/* Target segment of the address. */
segT to_seg;
valueT this_add_number;
- /* Positive (minuend) symbol. */
- struct symbol *this_add_symbol;
- /* As a number. */
+ /* Positive (minuend) symbol. */
+ symbolS *this_add_symbol;
+ /* As a number. */
long opcode_as_number;
- /* Least significant byte 1st. */
+ /* Least significant byte 1st. */
char *opcode_as_chars;
- /* As an array of characters. */
+ /* As an array of characters. */
/* Least significant byte 1st */
char *opcode_low_byteP;
- /* length (bytes) meant by vop_short. */
+ /* length (bytes) meant by vop_short. */
int length;
- /* 0, or 1 if '@' is in addressing mode. */
+ /* 0, or 1 if '@' is in addressing mode. */
int at;
/* From vop_nbytes: vax_operand_width (in bytes) */
int nbytes;
FLONUM_TYPE *floatP;
LITTLENUM_TYPE literal_float[8];
- /* Big enough for any floating point literal. */
+ /* Big enough for any floating point literal. */
vip (&v, instruction_string);
* and we can safely flush it, without causing interpass symbol phase
* errors. That is, without changing label values in different passes.
*/
- if (goofed = (*v.vit_error))
+ if ((goofed = (*v.vit_error)) != 0)
{
- as_warn ("Ignoring statement due to \"%s\"", v.vit_error);
+ as_warn (_("Ignoring statement due to \"%s\""), v.vit_error);
}
/*
* We need to use expression() and friends, which require us to diddle
{ /* for each operand */
if (operandP->vop_error)
{
- as_warn ("Ignoring statement because \"%s\"", operandP->vop_error);
+ as_warn (_("Ignoring statement because \"%s\""), operandP->vop_error);
goofed = 1;
}
else
{
- /* statement has no syntax goofs: lets sniff the expression */
- int can_be_short = 0; /* 1 if a bignum can be reduced to a short literal. */
+ /* Statement has no syntax goofs: let's sniff the expression. */
+ int can_be_short = 0; /* 1 if a bignum can be reduced to a short literal. */
input_line_pointer = operandP->vop_expr_begin;
c_save = operandP->vop_expr_end[1];
operandP->vop_expr_end[1] = '\0';
- /* If to_seg == SEG_PASS1, expression() will have set need_pass_2 = 1. */
+ /* If to_seg == SEG_PASS1, expression() will have set need_pass_2 = 1. */
*segP = expression (expP);
switch (expP->X_op)
{
* instruction operands.
*/
need_pass_2 = 1;
- as_warn ("Can't relocate expression");
+ as_warn (_("Can't relocate expression"));
break;
case O_big:
- /* Preserve the bits. */
+ /* Preserve the bits. */
if (expP->X_add_number > 0)
{
bignum_copy (generic_bignum, expP->X_add_number,
&& operandP->vop_reg == 0xF
&& (operandP->vop_mode & 0xE) == 0x8))
{
- /* Saw a '#'. */
+ /* Saw a '#'. */
if (operandP->vop_short == ' ')
{
- /* We must chose S^ or I^. */
+ /* We must chose S^ or I^. */
if (expP->X_add_number > 0)
{
- /* Bignum: Short literal impossible. */
+ /* Bignum: Short literal impossible. */
operandP->vop_short = 'i';
operandP->vop_mode = 8;
- operandP->vop_reg = 0xF; /* VAX PC. */
+ operandP->vop_reg = 0xF; /* VAX PC. */
}
else
{
- /* Flonum: Try to do it. */
+ /* Flonum: Try to do it. */
if (can_be_short)
{
operandP->vop_short = 's';
operandP->vop_reg = 0xF; /* VAX PC */
}
} /* bignum or flonum ? */
- } /* if #, but no S^ or I^ seen. */
- /* No more ' ' case: either 's' or 'i'. */
+ } /* if #, but no S^ or I^ seen. */
+ /* No more ' ' case: either 's' or 'i'. */
if (operandP->vop_short == 's')
{
- /* Wants to be a short literal. */
+ /* Wants to be a short literal. */
if (expP->X_add_number > 0)
{
- as_warn ("Bignum not permitted in short literal. Immediate mode assumed.");
+ as_warn (_("Bignum not permitted in short literal. Immediate mode assumed."));
operandP->vop_short = 'i';
operandP->vop_mode = 8;
- operandP->vop_reg = 0xF; /* VAX PC. */
+ operandP->vop_reg = 0xF; /* VAX PC. */
}
else
{
if (!can_be_short)
{
- as_warn ("Can't do flonum short literal: immediate mode used.");
+ as_warn (_("Can't do flonum short literal: immediate mode used."));
operandP->vop_short = 'i';
operandP->vop_mode = 8;
- operandP->vop_reg = 0xF; /* VAX PC. */
+ operandP->vop_reg = 0xF; /* VAX PC. */
}
else
- { /* Encode short literal now. */
+ { /* Encode short literal now. */
int temp = 0;
switch (-expP->X_add_number)
} /* flonum or bignum ? */
}
else
- { /* I^# seen: set it up if float. */
+ { /* I^# seen: set it up if float. */
if (expP->X_add_number < 0)
{
memcpy (floatP->low, literal_float, sizeof (literal_float));
}
- } /* if S^# seen. */
+ } /* if S^# seen. */
}
else
{
- as_warn ("A bignum/flonum may not be a displacement: 0x%x used",
- expP->X_add_number = 0x80000000);
- /* Chosen so luser gets the most offset bits to patch later. */
+ as_warn (_("A bignum/flonum may not be a displacement: 0x%lx used"),
+ (expP->X_add_number = 0x80000000L));
+ /* Chosen so luser gets the most offset bits to patch later. */
}
expP->X_add_number = floatP->low[0]
| ((LITTLENUM_MASK & (floatP->low[1])) << LITTLENUM_NUMBER_OF_BITS);
return;
}
-
- /* Emit op-code. */
- /* Remember where it is, in case we want to modify the op-code later. */
+ /* Emit op-code. */
+ /* Remember where it is, in case we want to modify the op-code later. */
opcode_low_byteP = frag_more (v.vit_opcode_nbytes);
memcpy (opcode_low_byteP, v.vit_opcode, v.vit_opcode_nbytes);
opcode_as_number = md_chars_to_number (opcode_as_chars = v.vit_opcode, 4);
FRAG_APPEND_1_CHAR (0x40 + operandP->vop_ndx);
} /* if(vop_ndx>=0) */
- /* Here to make main operand frag(s). */
+ /* Here to make main operand frag(s). */
this_add_number = expP->X_add_number;
this_add_symbol = expP->X_add_symbol;
to_seg = *segP;
{
if (to_seg == now_seg || is_undefined)
{
- /* If is_undefined, then it might BECOME now_seg. */
+ /* If is_undefined, then it might BECOME now_seg. */
if (nbytes)
{
p = frag_more (nbytes);
{
know (!(opcode_as_number & VIT_OPCODE_SYNTHETIC));
p = frag_more (nbytes);
- /* Conventional relocation. */
+ /* Conventional relocation. */
fix_new (frag_now, p - frag_now->fr_literal,
nbytes, &abs_symbol, this_add_number,
1, NO_RELOC);
*opcode_low_byteP = opcode_as_chars[0] + VAX_WIDEN_LONG;
know (opcode_as_chars[1] == 0);
p = frag_more (5);
- p[0] = VAX_ABSOLUTE_MODE; /* @#... */
+ p[0] = VAX_ABSOLUTE_MODE; /* @#... */
md_number_to_chars (p + 1, this_add_number, 4);
- /* Now (eg) JMP @#foo or JSB @#foo. */
+ /* Now (eg) JMP @#foo or JSB @#foo. */
}
else
{
p[2] = VAX_BRB;
p[3] = 6;
p[4] = VAX_JMP;
- p[5] = VAX_ABSOLUTE_MODE; /* @#... */
+ p[5] = VAX_ABSOLUTE_MODE; /* @#... */
md_number_to_chars (p + 6, this_add_number, 4);
/*
* Now (eg) ACBx 1f
p[1] = VAX_BRB;
p[2] = 6;
p[3] = VAX_JMP;
- p[4] = VAX_PC_RELATIVE_MODE + 1; /* @#... */
+ p[4] = VAX_ABSOLUTE_MODE; /* @#... */
md_number_to_chars (p + 5, this_add_number, 4);
/*
* Now (eg) xOBxxx 1f
/* b<cond> */
*opcode_low_byteP ^= 1;
/* To reverse the condition in a VAX branch,
- complement the lowest order bit. */
+ complement the lowest order bit. */
p = frag_more (7);
p[0] = 6;
p[1] = VAX_JMP;
- p[2] = VAX_ABSOLUTE_MODE; /* @#... */
+ p[2] = VAX_ABSOLUTE_MODE; /* @#... */
md_number_to_chars (p + 3, this_add_number, 4);
/*
* Now (eg) BLEQ 1f
/* to_seg != now_seg && to_seg != SEG_UNKNOWN && to_Seg != SEG_ABSOLUTE */
if (nbytes > 0)
{
- /* Pc-relative. Conventional relocation. */
+ /* Pc-relative. Conventional relocation. */
know (!(opcode_as_number & VIT_OPCODE_SYNTHETIC));
p = frag_more (nbytes);
fix_new (frag_now, p - frag_now->fr_literal,
p + 1 - frag_now->fr_literal, 4,
this_add_symbol,
this_add_number, 1, NO_RELOC);
- /* Now eg JMP foo or JSB foo. */
+ /* Now eg JMP foo or JSB foo. */
}
else
{
else
{
know (operandP->vop_width == VAX_WIDTH_CONDITIONAL_JUMP);
- *opcode_low_byteP ^= 1; /* Reverse branch condition. */
+ *opcode_low_byteP ^= 1; /* Reverse branch condition. */
p = frag_more (7);
p[0] = 6;
p[1] = VAX_JMP;
}
else
{
- know (operandP->vop_access != 'b'); /* So it is ordinary operand. */
- know (operandP->vop_access != ' '); /* ' ' target-independent: elsewhere. */
+ know (operandP->vop_access != 'b'); /* So it is ordinary operand. */
+ know (operandP->vop_access != ' '); /* ' ' target-independent: elsewhere. */
know (operandP->vop_access == 'a'
|| operandP->vop_access == 'm'
|| operandP->vop_access == 'r'
{
if (to_seg == SEG_ABSOLUTE)
{
- if (this_add_number < 0 || this_add_number >= 64)
+ if (this_add_number >= 64)
{
- as_warn ("Short literal overflow(%d.), immediate mode assumed.", this_add_number);
+ as_warn (_("Short literal overflow(%ld.), immediate mode assumed."),
+ (long) this_add_number);
operandP->vop_short = 'i';
operandP->vop_mode = 8;
operandP->vop_reg = 0xF;
}
else
{
- as_warn ("Forced short literal to immediate mode. now_seg=%s to_seg=%s",
+ as_warn (_("Forced short literal to immediate mode. now_seg=%s to_seg=%s"),
segment_name (now_seg), segment_name (to_seg));
operandP->vop_short = 'i';
operandP->vop_mode = 8;
if (operandP->vop_reg >= 0 && (operandP->vop_mode < 8
|| (operandP->vop_reg != 0xF && operandP->vop_mode < 10)))
{
- /* One byte operand. */
+ /* One byte operand. */
know (operandP->vop_mode > 3);
FRAG_APPEND_1_CHAR (operandP->vop_mode << 4 | operandP->vop_reg);
- /* All 1-bytes except S^# happen here. */
+ /* All 1-bytes except S^# happen here. */
}
else
{
/* At is the only context we need to carry
to other side of relax() process. Must
be in the correct bit position of VAX
- operand spec. byte. */
+ operand spec. byte. */
}
else
{
if (this_add_symbol == NULL)
{
know (to_seg == SEG_ABSOLUTE);
- /* Do @#foo: simpler relocation than foo-.(pc) anyway. */
+ /* Do @#foo: simpler relocation than foo-.(pc) anyway. */
p = frag_more (5);
- p[0] = VAX_ABSOLUTE_MODE; /* @#... */
+ p[0] = VAX_ABSOLUTE_MODE; /* @#... */
md_number_to_chars (p + 1, this_add_number, 4);
if (length && length != 4)
{
- as_warn ("Length specification ignored. Address mode 9F used");
+ as_warn (_("Length specification ignored. Address mode 9F used"));
}
}
else
if (length == 0)
{
know (operandP->vop_short == ' ');
- length = 4; /* Longest possible. */
+ length = 4; /* Longest possible. */
}
p = frag_more (length + 1);
p[0] = 0xF | ((at + "?\12\14?\16"[length]) << 4);
if (operandP->vop_mode < 0xA)
{
/* # or S^# or I^# */
+ if (operandP->vop_access == 'v'
+ || operandP->vop_access == 'a')
+ {
+ if (operandP->vop_access == 'v')
+ as_warn (_("Invalid operand: immediate value used as base address."));
+ else
+ as_warn (_("Invalid operand: immediate value used as address."));
+ /* gcc 2.6.3 is known to generate these in at least
+ one case. */
+ }
if (length == 0
- && to_seg == SEG_ABSOLUTE
- && operandP->vop_mode == 8 /* No '@'. */
- && this_add_number < 64
- && this_add_number >= 0)
+ && to_seg == SEG_ABSOLUTE && (expP->X_op != O_big)
+ && operandP->vop_mode == 8 /* No '@'. */
+ && this_add_number < 64)
{
operandP->vop_short = 's';
}
}
else
{
- /* I^#... */
+ /* I^#... */
know (nbytes);
p = frag_more (nbytes + 1);
know (operandP->vop_reg == 0xF);
p[0] = (operandP->vop_mode << 4) | 0xF;
- if (to_seg == SEG_ABSOLUTE)
+ if ((to_seg == SEG_ABSOLUTE) && (expP->X_op != O_big))
{
/*
* If nbytes > 4, then we are scrod. We
* are to be 0xFF or 0x00. BSD4.2 & RMS
* say use 0x00. OK --- but this
* assembler needs ANOTHER rewrite to
- * cope properly with this bug. */
+ * cope properly with this bug. */
md_number_to_chars (p + 1, this_add_number, min (4, nbytes));
if (nbytes > 4)
{
* Problem here is to get the bytes
* in the right order. We stored
* our constant as LITTLENUMs, not
- * bytes. */
+ * bytes. */
LITTLENUM_TYPE *lP;
lP = floatP->low;
} /* for(operandP) */
} /* vax_assemble() */
\f
-/*
- * md_estimate_size_before_relax()
- *
- * Called just before relax().
- * Any symbol that is now undefined will not become defined.
- * Return the correct fr_subtype in the frag.
- * Return the initial "guess for fr_var" to caller.
- * The guess for fr_var is ACTUALLY the growth beyond fr_fix.
- * Whatever we do to grow fr_fix or fr_var contributes to our returned value.
- * Although it may not be explicit in the frag, pretend fr_var starts with a
- * 0 value.
- */
+/* md_estimate_size_before_relax(), called just before relax().
+ Any symbol that is now undefined will not become defined.
+ Return the correct fr_subtype in the frag and the growth beyond
+ fr_fix. */
int
md_estimate_size_before_relax (fragP, segment)
fragS *fragP;
segT segment;
{
- char *p;
- int old_fr_fix;
-
- old_fr_fix = fragP->fr_fix;
- switch (fragP->fr_subtype)
+ if (RELAX_LENGTH (fragP->fr_subtype) == STATE_UNDF)
{
- case ENCODE_RELAX (STATE_PC_RELATIVE, STATE_UNDF):
- if (S_GET_SEGMENT (fragP->fr_symbol) == segment)
- { /* A relaxable case. */
- fragP->fr_subtype = ENCODE_RELAX (STATE_PC_RELATIVE, STATE_BYTE);
- }
- else
+ if (S_GET_SEGMENT (fragP->fr_symbol) != segment)
{
- p = fragP->fr_literal + old_fr_fix;
- p[0] |= VAX_PC_RELATIVE_MODE; /* Preserve @ bit. */
- fragP->fr_fix += 1 + 4;
- fix_new (fragP, old_fr_fix + 1, 4, fragP->fr_symbol,
- fragP->fr_offset, 1, NO_RELOC);
- frag_wane (fragP);
- }
- break;
+ /* Non-relaxable cases. */
+ char *p;
+ int old_fr_fix;
- case ENCODE_RELAX (STATE_CONDITIONAL_BRANCH, STATE_UNDF):
- if (S_GET_SEGMENT (fragP->fr_symbol) == segment)
- {
- fragP->fr_subtype = ENCODE_RELAX (STATE_CONDITIONAL_BRANCH, STATE_BYTE);
- }
- else
- {
+ old_fr_fix = fragP->fr_fix;
p = fragP->fr_literal + old_fr_fix;
- *fragP->fr_opcode ^= 1; /* Reverse sense of branch. */
- p[0] = 6;
- p[1] = VAX_JMP;
- p[2] = VAX_PC_RELATIVE_MODE; /* ...(PC) */
- fragP->fr_fix += 1 + 1 + 1 + 4;
- fix_new (fragP, old_fr_fix + 3, 4, fragP->fr_symbol,
- fragP->fr_offset, 1, NO_RELOC);
- frag_wane (fragP);
- }
- break;
+ switch (RELAX_STATE (fragP->fr_subtype))
+ {
+ case STATE_PC_RELATIVE:
+ p[0] |= VAX_PC_RELATIVE_MODE; /* Preserve @ bit. */
+ fragP->fr_fix += 1 + 4;
+ fix_new (fragP, old_fr_fix + 1, 4, fragP->fr_symbol,
+ fragP->fr_offset, 1, NO_RELOC);
+ break;
- case ENCODE_RELAX (STATE_COMPLEX_BRANCH, STATE_UNDF):
- if (S_GET_SEGMENT (fragP->fr_symbol) == segment)
- {
- fragP->fr_subtype = ENCODE_RELAX (STATE_COMPLEX_BRANCH, STATE_WORD);
- }
- else
- {
- p = fragP->fr_literal + old_fr_fix;
- p[0] = 2;
- p[1] = 0;
- p[2] = VAX_BRB;
- p[3] = 6;
- p[4] = VAX_JMP;
- p[5] = VAX_PC_RELATIVE_MODE; /* ...(pc) */
- fragP->fr_fix += 2 + 2 + 1 + 1 + 4;
- fix_new (fragP, old_fr_fix + 6, 4, fragP->fr_symbol,
- fragP->fr_offset, 1, NO_RELOC);
- frag_wane (fragP);
- }
- break;
+ case STATE_CONDITIONAL_BRANCH:
+ *fragP->fr_opcode ^= 1; /* Reverse sense of branch. */
+ p[0] = 6;
+ p[1] = VAX_JMP;
+ p[2] = VAX_PC_RELATIVE_MODE; /* ...(PC) */
+ fragP->fr_fix += 1 + 1 + 1 + 4;
+ fix_new (fragP, old_fr_fix + 3, 4, fragP->fr_symbol,
+ fragP->fr_offset, 1, NO_RELOC);
+ break;
- case ENCODE_RELAX (STATE_COMPLEX_HOP, STATE_UNDF):
- if (S_GET_SEGMENT (fragP->fr_symbol) == segment)
- {
- fragP->fr_subtype = ENCODE_RELAX (STATE_COMPLEX_HOP, STATE_BYTE);
- }
- else
- {
- p = fragP->fr_literal + old_fr_fix;
- p[0] = 2;
- p[1] = VAX_BRB;
- p[2] = 6;
- p[3] = VAX_JMP;
- p[4] = VAX_PC_RELATIVE_MODE; /* ...(pc) */
- fragP->fr_fix += 1 + 2 + 1 + 1 + 4;
- fix_new (fragP, old_fr_fix + 5, 4, fragP->fr_symbol,
- fragP->fr_offset, 1, NO_RELOC);
+ case STATE_COMPLEX_BRANCH:
+ p[0] = 2;
+ p[1] = 0;
+ p[2] = VAX_BRB;
+ p[3] = 6;
+ p[4] = VAX_JMP;
+ p[5] = VAX_PC_RELATIVE_MODE; /* ...(pc) */
+ fragP->fr_fix += 2 + 2 + 1 + 1 + 4;
+ fix_new (fragP, old_fr_fix + 6, 4, fragP->fr_symbol,
+ fragP->fr_offset, 1, NO_RELOC);
+ break;
+
+ case STATE_COMPLEX_HOP:
+ p[0] = 2;
+ p[1] = VAX_BRB;
+ p[2] = 6;
+ p[3] = VAX_JMP;
+ p[4] = VAX_PC_RELATIVE_MODE; /* ...(pc) */
+ fragP->fr_fix += 1 + 2 + 1 + 1 + 4;
+ fix_new (fragP, old_fr_fix + 5, 4, fragP->fr_symbol,
+ fragP->fr_offset, 1, NO_RELOC);
+ break;
+
+ case STATE_ALWAYS_BRANCH:
+ *fragP->fr_opcode += VAX_WIDEN_LONG;
+ p[0] = VAX_PC_RELATIVE_MODE; /* ...(PC) */
+ fragP->fr_fix += 1 + 4;
+ fix_new (fragP, old_fr_fix + 1, 4, fragP->fr_symbol,
+ fragP->fr_offset, 1, NO_RELOC);
+ break;
+
+ default:
+ abort ();
+ }
frag_wane (fragP);
+
+ /* Return the growth in the fixed part of the frag. */
+ return fragP->fr_fix - old_fr_fix;
}
- break;
- case ENCODE_RELAX (STATE_ALWAYS_BRANCH, STATE_UNDF):
- if (S_GET_SEGMENT (fragP->fr_symbol) == segment)
+ /* Relaxable cases. Set up the initial guess for the variable
+ part of the frag. */
+ switch (RELAX_STATE (fragP->fr_subtype))
{
+ case STATE_PC_RELATIVE:
+ fragP->fr_subtype = ENCODE_RELAX (STATE_PC_RELATIVE, STATE_BYTE);
+ break;
+ case STATE_CONDITIONAL_BRANCH:
+ fragP->fr_subtype = ENCODE_RELAX (STATE_CONDITIONAL_BRANCH, STATE_BYTE);
+ break;
+ case STATE_COMPLEX_BRANCH:
+ fragP->fr_subtype = ENCODE_RELAX (STATE_COMPLEX_BRANCH, STATE_WORD);
+ break;
+ case STATE_COMPLEX_HOP:
+ fragP->fr_subtype = ENCODE_RELAX (STATE_COMPLEX_HOP, STATE_BYTE);
+ break;
+ case STATE_ALWAYS_BRANCH:
fragP->fr_subtype = ENCODE_RELAX (STATE_ALWAYS_BRANCH, STATE_BYTE);
+ break;
}
- else
- {
- p = fragP->fr_literal + old_fr_fix;
- *fragP->fr_opcode += VAX_WIDEN_LONG;
- p[0] = VAX_PC_RELATIVE_MODE; /* ...(PC) */
- fragP->fr_fix += 1 + 4;
- fix_new (fragP, old_fr_fix + 1, 4, fragP->fr_symbol,
- fragP->fr_offset, 1, NO_RELOC);
- frag_wane (fragP);
- }
- break;
-
- default:
- break;
}
- return (fragP->fr_var + fragP->fr_fix - old_fr_fix);
-} /* md_estimate_size_before_relax() */
+
+ if (fragP->fr_subtype >= sizeof (md_relax_table) / sizeof (md_relax_table[0]))
+ abort ();
+
+ /* Return the size of the variable part of the frag. */
+ return md_relax_table[fragP->fr_subtype].rlx_length;
+}
\f
/*
* md_convert_frag();
* Caller will turn frag into a ".space 0".
*/
void
-md_convert_frag (headers, fragP)
+md_convert_frag (headers, seg, fragP)
object_headers *headers;
+ segT seg;
fragS *fragP;
{
- char *addressP; /* -> _var to change. */
- char *opcodeP; /* -> opcode char(s) to change. */
- short int length_code; /* 2=long 1=word 0=byte */
- short int extension = 0; /* Size of relaxed address. */
- /* Added to fr_fix: incl. ALL var chars. */
+ char *addressP; /* -> _var to change. */
+ char *opcodeP; /* -> opcode char(s) to change. */
+ short int extension = 0; /* Size of relaxed address. */
+ /* Added to fr_fix: incl. ALL var chars. */
symbolS *symbolP;
long where;
long address_of_var;
/* Where, in file space, does addr point? */
know (fragP->fr_type == rs_machine_dependent);
- length_code = fragP->fr_subtype & 3; /* depends on ENCODE_RELAX() */
- know (length_code >= 0 && length_code < 3);
where = fragP->fr_fix;
addressP = fragP->fr_literal + where;
opcodeP = fragP->fr_opcode;
{
case ENCODE_RELAX (STATE_PC_RELATIVE, STATE_BYTE):
- know (*addressP == 0 || *addressP == 0x10); /* '@' bit. */
- addressP[0] |= 0xAF; /* Byte displacement. */
+ know (*addressP == 0 || *addressP == 0x10); /* '@' bit. */
+ addressP[0] |= 0xAF; /* Byte displacement. */
addressP[1] = target_address - (address_of_var + 2);
extension = 2;
break;
case ENCODE_RELAX (STATE_PC_RELATIVE, STATE_WORD):
- know (*addressP == 0 || *addressP == 0x10); /* '@' bit. */
- addressP[0] |= 0xCF; /* Word displacement. */
+ know (*addressP == 0 || *addressP == 0x10); /* '@' bit. */
+ addressP[0] |= 0xCF; /* Word displacement. */
md_number_to_chars (addressP + 1, target_address - (address_of_var + 3), 2);
extension = 3;
break;
case ENCODE_RELAX (STATE_PC_RELATIVE, STATE_LONG):
- know (*addressP == 0 || *addressP == 0x10); /* '@' bit. */
- addressP[0] |= 0xEF; /* Long word displacement. */
+ know (*addressP == 0 || *addressP == 0x10); /* '@' bit. */
+ addressP[0] |= 0xEF; /* Long word displacement. */
md_number_to_chars (addressP + 1, target_address - (address_of_var + 5), 4);
extension = 5;
break;
break;
case ENCODE_RELAX (STATE_CONDITIONAL_BRANCH, STATE_WORD):
- opcodeP[0] ^= 1; /* Reverse sense of test. */
+ opcodeP[0] ^= 1; /* Reverse sense of test. */
addressP[0] = 3;
addressP[1] = VAX_BRB + VAX_WIDEN_WORD;
md_number_to_chars (addressP + 2, target_address - (address_of_var + 4), 2);
break;
case ENCODE_RELAX (STATE_CONDITIONAL_BRANCH, STATE_LONG):
- opcodeP[0] ^= 1; /* Reverse sense of test. */
+ opcodeP[0] ^= 1; /* Reverse sense of test. */
addressP[0] = 6;
addressP[1] = VAX_JMP;
addressP[2] = VAX_PC_RELATIVE_MODE;
- md_number_to_chars (addressP + 3, target_address, 4);
+ md_number_to_chars (addressP + 3, target_address - (address_of_var + 7), 4);
extension = 7;
break;
addressP[3] = 6;
addressP[4] = VAX_JMP;
addressP[5] = VAX_PC_RELATIVE_MODE;
- md_number_to_chars (addressP + 6, target_address, 4);
+ md_number_to_chars (addressP + 6, target_address - (address_of_var + 10), 4);
extension = 10;
break;
addressP[2] = 6;
addressP[3] = VAX_JMP;
addressP[4] = VAX_PC_RELATIVE_MODE;
- md_number_to_chars (addressP + 5, target_address, 4);
+ md_number_to_chars (addressP + 5, target_address - (address_of_var + 9), 4);
extension = 9;
break;
On vax: first 4 bytes are normal unsigned long, next three bytes
are symbolnum, least sig. byte first. Last byte is broken up with
the upper nibble as nuthin, bit 3 as extern, bits 2 & 1 as length, and
- bit 0 as pcrel. */
+ bit 0 as pcrel. */
#ifdef comment
void
md_ri_to_chars (the_bytes, ri)
#endif /* comment */
-void
+void
tc_aout_fix_to_chars (where, fixP, segment_address_in_file)
char *where;
fixS *fixP;
static const short int vax_operand_width_size[256] =
{
-
-#define _ 0
- _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _,
- _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _,
- _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _,
- _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _,
- _, _, 1, _, 8, _, 4, 8, 16, _, _, _, 4, _, _, 16, /* ..b.d.fgh...l..o */
- _, 8, _, _, _, _, _, 2, _, _, _, _, _, _, _, _, /* .q.....w........ */
- _, _, 1, _, 8, _, 4, 8, 16, _, _, _, 4, _, _, 16, /* ..b.d.fgh...l..o */
- _, 8, _, _, _, _, _, 2, _, _, _, _, _, _, _, _, /* .q.....w........ */
- _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _,
- _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _,
- _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _,
- _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _,
- _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _,
- _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _,
- _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _,
- _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _};
-#undef _
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 8, 0, 4, 8, 16, 0, 0, 0, 4, 0, 0,16, /* ..b.d.fgh...l..o */
+ 0, 8, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, /* .q.....w........ */
+ 0, 0, 1, 0, 8, 0, 4, 8, 16, 0, 0, 0, 4, 0, 0,16, /* ..b.d.fgh...l..o */
+ 0, 8, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, /* .q.....w........ */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+};
\f
/*
* This perversion encodes all the vax opcodes as a bunch of strings.
{"jbcs", {"rlvbb?", 0x800000e3}},
{"jbsc", {"rlvbb?", 0x800000e4}},
{"jbcc", {"rlvbb?", 0x800000e5}},
- {"jbssi", {"rlvbb?", 0x800000e6}},
- {"jbcci", {"rlvbb?", 0x800000e7}},
{"jlbs", {"rlb?", 0x800000e8}},
{"jlbc", {"rlb?", 0x800000e9}},
{"jsobgeq", {"mlb:", 0xC00000f4}},
{"jsobgtr", {"mlb:", 0xC00000f5}},
-/* CASEx has no branch addresses in our conception of it. */
-/* You should use ".word ..." statements after the "case ...". */
+/* CASEx has no branch addresses in our conception of it. */
+/* You should use ".word ..." statements after the "case ...". */
- {"", ""} /* empty is end sentinel */
+ {"", {"", 0}} /* empty is end sentinel */
}; /* synthetic_votstrs */
\f
static const char *
vip_begin (synthetic_too, immediate, indirect, displen)
- int synthetic_too; /* 1 means include jXXX op-codes. */
- char *immediate, *indirect, *displen;
+ int synthetic_too; /* 1 means include jXXX op-codes. */
+ const char *immediate, *indirect, *displen;
{
const struct vot *vP; /* scan votstrs */
const char *retval = 0; /* error text */
return retval;
}
-
/*
* v i p ( )
*
static void
vip (vitP, instring)
- struct vit *vitP; /* We build an exploded instruction here. */
- char *instring; /* Text of a vax instruction: we modify. */
+ struct vit *vitP; /* We build an exploded instruction here. */
+ char *instring; /* Text of a vax instruction: we modify. */
{
- /* How to bit-encode this opcode. */
+ /* How to bit-encode this opcode. */
struct vot_wot *vwP;
/* 1/skip whitespace.2/scan vot_how */
char *p;
/* scan operands in struct vit */
struct vop *operandp;
/* error over all operands */
- char *alloperr;
- /* Remember char, (we clobber it with '\0' temporarily). */
+ const char *alloperr;
+ /* Remember char, (we clobber it with '\0' temporarily). */
char c;
- /* Op-code of this instruction. */
+ /* Op-code of this instruction. */
vax_opcodeT oc;
if (*instring == ' ')
- ++instring; /* Skip leading whitespace. */
- for (p = instring; *p && *p != ' '; p++);; /* MUST end in end-of-string or exactly 1 space. */
- /* Scanned up to end of operation-code. */
- /* Operation-code is ended with whitespace. */
+ ++instring; /* Skip leading whitespace. */
+ for (p = instring; *p && *p != ' '; p++);; /* MUST end in end-of-string or exactly 1 space. */
+ /* Scanned up to end of operation-code. */
+ /* Operation-code is ended with whitespace. */
if (p - instring == 0)
{
- vitP->vit_error = "No operator";
+ vitP->vit_error = _("No operator");
count = 0;
memset (vitP->vit_opcode, '\0', sizeof (vitP->vit_opcode));
}
* We trust instring points to an op-name, with no whitespace.
*/
vwP = (struct vot_wot *) hash_find (op_hash, instring);
- *p = c; /* Restore char after op-code. */
+ *p = c; /* Restore char after op-code. */
if (vwP == 0)
{
- vitP->vit_error = "Unknown operator";
+ vitP->vit_error = _("Unknown operator");
count = 0;
memset (vitP->vit_opcode, '\0', sizeof (vitP->vit_opcode));
}
else
{
/*
- * We found a match! So lets pick up as many operands as the
+ * We found a match! So let's pick up as many operands as the
* instruction wants, and even gripe if there are too many.
* We expect comma to seperate each operand.
* We let instring track the text, while p tracks a part of the
* struct vot.
*/
+ const char *howp;
/*
* The lines below know about 2-byte opcodes starting FD,FE or FF.
* They also understand synthetic opcodes. Note:
* we return 32 bits of opcode, including bucky bits, BUT
* an opcode length is either 8 or 16 bits for vit_opcode_nbytes.
*/
- oc = vwP->vot_code; /* The op-code. */
+ oc = vwP->vot_code; /* The op-code. */
vitP->vit_opcode_nbytes = (oc & 0xFF) >= 0xFD ? 2 : 1;
md_number_to_chars (vitP->vit_opcode, oc, 4);
count = 0; /* no operands seen yet */
instring = p; /* point just past operation code */
alloperr = "";
- for (p = vwP->vot_how, operandp = vitP->vit_operand;
- !(alloperr && *alloperr) && *p;
- operandp++, p += 2)
+ for (howp = vwP->vot_how, operandp = vitP->vit_operand;
+ !(alloperr && *alloperr) && *howp;
+ operandp++, howp += 2)
{
/*
* Here to parse one operand. Leave instring pointing just
* past any one ',' that marks the end of this operand.
*/
- if (!p[1])
- as_fatal ("odd number of bytes in operand description");
+ if (!howp[1])
+ as_fatal (_("odd number of bytes in operand description"));
else if (*instring)
{
for (q = instring; (c = *q) && c != ','; q++)
* character.
*/
*q = 0;
- operandp->vop_width = p[1];
- operandp->vop_nbytes = vax_operand_width_size[p[1]];
- operandp->vop_access = p[0];
+ operandp->vop_width = howp[1];
+ operandp->vop_nbytes = vax_operand_width_size[(unsigned) howp[1]];
+ operandp->vop_access = howp[0];
vip_op (instring, operandp);
- *q = c; /* Restore input text. */
+ *q = c; /* Restore input text. */
if (operandp->vop_error)
- alloperr = "Bad operand";
+ alloperr = _("Bad operand");
instring = q + (c ? 1 : 0); /* next operand (if any) */
count++; /* won another argument, may have an operr */
}
else
- alloperr = "Not enough operands";
+ alloperr = _("Not enough operands");
}
if (!*alloperr)
{
if (*instring == ' ')
- instring++; /* Skip whitespace. */
+ instring++; /* Skip whitespace. */
if (*instring)
- alloperr = "Too many operands";
+ alloperr = _("Too many operands");
}
vitP->vit_error = alloperr;
}
char *mybug; /* "" or an internal logic diagnostic */
int mycount; /* number of operands */
struct vop *myvop; /* scan operands from myvit */
-int mysynth; /* 1 means want synthetic opcodes. */
+int mysynth; /* 1 means want synthetic opcodes. */
char my_immediate[200];
char my_indirect[200];
char my_displen[200];
/* vax_reg_parse.c - convert a VAX register name to a number */
-/* Copyright (C) 1987 Free Software Foundation, Inc. A part of GNU. */
+/* Copyright (C) 1987 Free Software Foundation, Inc. A part of GNU. */
/*
* v a x _ r e g _ p a r s e ( )
*
*/
-#include <ctype.h>
+#include "safe-ctype.h"
#define AP (12)
#define FP (13)
#define SP (14)
retval = -1;
- if (isupper (c1))
- c1 = tolower (c1);
- if (isupper (c2))
- c2 = tolower (c2);
- if (isdigit (c2) && c1 == 'r')
+ c1 = TOLOWER (c1);
+ c2 = TOLOWER (c2);
+ if (ISDIGIT (c2) && c1 == 'r')
{
retval = c2 - '0';
- if (isdigit (c3))
+ if (ISDIGIT (c3))
{
retval = retval * 10 + c3 - '0';
retval = (retval > 15) ? -1 : retval;
* if the other outputs are to be taken seriously.
*/
-
/*
* Because this module is useful for both VMS and UN*X style assemblers
* and because of the variety of UN*X assemblers we must recognise
static void
vip_op_1 (bit, syms)
int bit;
- char *syms;
+ const char *syms;
{
unsigned char t;
- while (t = *syms++)
+ while ((t = *syms++) != 0)
vip_metacharacters[t] |= bit;
}
/* Can be called any time. More arguments may appear in future. */
-static void
+static void
vip_op_defaults (immediate, indirect, displen)
- char *immediate;
- char *indirect;
- char *displen;
+ const char *immediate;
+ const char *indirect;
+ const char *displen;
{
vip_op_1 (VIP_IMMEDIATE, immediate);
vip_op_1 (VIP_INDIRECT, indirect);
/* Input fields: vop_access, vop_width.
Output fields: _ndx, _reg, _mode, _short, _warn,
_error _expr_begin, _expr_end, _nbytes.
- vop_nbytes : number of bytes in a datum. */
+ vop_nbytes : number of bytes in a datum. */
struct vop *vopP;
{
/* track operand text forward */
int ndx = 0;
/* report illegal operand, ""==OK */
/* " " is a FAKE error: means we won */
- /* ANY err that begins with ' ' is a fake. */
+ /* ANY err that begins with ' ' is a fake. */
/* " " is converted to "" before return */
- char *err;
+ const char *err;
/* warn about weird modes pf address */
- char *wrn;
+ const char *wrn;
/* preserve q in case we backup */
char *oldq = NULL;
/* build up 4-bit operand mode here */
* get the types wrong below, we lose at compile time rather than at
* lint or run time.
*/
- char access; /* vop_access. */
- char width; /* vop_width. */
+ char access_mode; /* vop_access. */
+ char width; /* vop_width. */
- access = vopP->vop_access;
+ access_mode = vopP->vop_access;
width = vopP->vop_width;
/* None of our code bugs (yet), no user text errors, no warnings
even. */
p = optext;
- if (*p == ' ') /* Expect all whitespace reduced to ' '. */
+ if (*p == ' ') /* Expect all whitespace reduced to ' '. */
p++; /* skip over whitespace */
- if (at = INDIRECTP (*p))
+ if ((at = INDIRECTP (*p)) != 0)
{ /* 1 if *p=='@'(or '*' for Un*x) */
p++; /* at is determined */
- if (*p == ' ') /* Expect all whitespace reduced to ' '. */
+ if (*p == ' ') /* Expect all whitespace reduced to ' '. */
p++; /* skip over whitespace */
}
char c;
c = *p;
- if (isupper (c))
- c = tolower (c);
+ c = TOLOWER (c);
if (DISPLENP (p[1]) && strchr ("bilws", len = c))
p += 2; /* skip (letter) '^' */
else /* no (letter) '^' seen */
len = ' '; /* len is determined */
}
- if (*p == ' ') /* Expect all whitespace reduced to ' '. */
+ if (*p == ' ') /* Expect all whitespace reduced to ' '. */
p++; /* skip over whitespace */
- if (hash = IMMEDIATEP (*p)) /* 1 if *p=='#' ('$' for Un*x) */
+ if ((hash = IMMEDIATEP (*p)) != 0) /* 1 if *p=='#' ('$' for Un*x) */
p++; /* hash is determined */
/*
;
q--; /* now q points at last char of text */
\f
- if (*q == ' ' && q >= p) /* Expect all whitespace reduced to ' '. */
+ if (*q == ' ' && q >= p) /* Expect all whitespace reduced to ' '. */
q--;
/* reverse over whitespace, but don't */
/* run back over *p */
q--;
/* either q<p or we got matching '[' */
if (q < p)
- err = "no '[' to match ']'";
+ err = _("no '[' to match ']'");
else
{
/*
* If luser hasn't given us one: be rude.
*/
if (ndx < 0)
- err = "bad register in []";
+ err = _("bad register in []");
else if (ndx == PC)
- err = "[PC] index banned";
+ err = _("[PC] index banned");
else
q--; /* point q just before "[...]" */
}
* Otherwise, ndx is index register number, and q points before "[...]".
*/
\f
- if (*q == ' ' && q >= p) /* Expect all whitespace reduced to ' '. */
+ if (*q == ' ' && q >= p) /* Expect all whitespace reduced to ' '. */
q--;
/* reverse over whitespace, but don't */
/* run back over *p */
q--;
/* either q<p or we got matching '(' */
if (q < p)
- err = "no '(' to match ')'";
+ err = _("no '(' to match ')'");
else
{
/*
*/
if (!paren)
{
- if (*q == ' ' && q >= p) /* Expect all whitespace reduced to ' '. */
+ if (*q == ' ' && q >= p) /* Expect all whitespace reduced to ' '. */
q--;
/* reverse over whitespace, but don't */
/* run back over *p */
* err " " or error message, and other outputs trashed
*/
/* branch operands have restricted forms */
- if ((!err || !*err) && access == 'b')
+ if ((!err || !*err) && access_mode == 'b')
{
if (at || hash || sign || paren || ndx >= 0 || reg >= 0 || len != ' ')
- err = "invalid branch operand";
+ err = _("invalid branch operand");
else
err = " ";
}
\f
- /* Since nobody seems to use it: comment this 'feature'(?) out for now. */
+ /* Since nobody seems to use it: comment this 'feature'(?) out for now. */
#ifdef NEVER
/*
* Case of stand-alone operand. e.g. ".long foo"
* ndx -1
* err " " or error message, and other outputs trashed
*/
- if ((!err || !*err) && access == ' ')
+ if ((!err || !*err) && access_mode == ' ')
{
if (at)
- err = "address prohibits @";
+ err = _("address prohibits @");
else if (hash)
- err = "address prohibits #";
+ err = _("address prohibits #");
else if (sign)
{
if (sign < 0)
- err = "address prohibits -()";
+ err = _("address prohibits -()");
else
- err = "address prohibits ()+";
+ err = _("address prohibits ()+");
}
else if (paren)
- err = "address prohibits ()";
+ err = _("address prohibits ()");
else if (ndx >= 0)
- err = "address prohibits []";
+ err = _("address prohibits []");
else if (reg >= 0)
- err = "address prohibits register";
+ err = _("address prohibits register");
else if (len != ' ')
- err = "address prohibits displacement length specifier";
+ err = _("address prohibits displacement length specifier");
else
{
err = " "; /* succeed */
if ((!err || !*err) && len == 's')
{
if (!hash || paren || at || ndx >= 0)
- err = "invalid operand of S^#";
+ err = _("invalid operand of S^#");
else
{
if (reg >= 0)
* We have all the expression we will ever get.
*/
if (p > q)
- err = "S^# needs expression";
- else if (access == 'r')
+ err = _("S^# needs expression");
+ else if (access_mode == 'r')
{
err = " "; /* WIN! */
mode = 0;
}
else
- err = "S^# may only read-access";
+ err = _("S^# may only read-access");
}
}
\f
if ((!err || !*err) && sign < 0)
{
if (len != ' ' || hash || at || p <= q)
- err = "invalid operand of -()";
+ err = _("invalid operand of -()");
else
{
err = " "; /* win */
mode = 7;
if (reg == PC)
- wrn = "-(PC) unpredictable";
+ wrn = _("-(PC) unpredictable");
else if (reg == ndx)
- wrn = "[]index same as -()register: unpredictable";
+ wrn = _("[]index same as -()register: unpredictable");
}
}
\f
if ((!err || !*err) && sign > 0)
{
if (len != ' ' || hash || p <= q)
- err = "invalid operand of ()+";
+ err = _("invalid operand of ()+");
else
{
err = " "; /* win */
mode = 8 + (at ? 1 : 0);
if (reg == PC)
- wrn = "(PC)+ unpredictable";
+ wrn = _("(PC)+ unpredictable");
else if (reg == ndx)
- wrn = "[]index same as ()+register: unpredictable";
+ wrn = _("[]index same as ()+register: unpredictable");
}
}
\f
if ((!err || !*err) && hash)
{
if (len != 'i' && len != ' ')
- err = "# conflicts length";
+ err = _("# conflicts length");
else if (paren)
- err = "# bars register";
+ err = _("# bars register");
else
{
if (reg >= 0)
err = " "; /* win */
/* JF a bugfix, I think! */
- if (at && access == 'a')
+ if (at && access_mode == 'a')
vopP->vop_nbytes = 4;
mode = (at ? 9 : 8);
reg = PC;
- if ((access == 'm' || access == 'w') && !at)
- wrn = "writing or modifying # is unpredictable";
+ if ((access_mode == 'm' || access_mode == 'w') && !at)
+ wrn = _("writing or modifying # is unpredictable");
}
}
/*
if ((!err || !*err) && !paren && reg >= 0)
{
if (len != ' ')
- err = "length not needed";
+ err = _("length not needed");
else if (at)
{
err = " "; /* win */
mode = 6; /* @Rn */
}
else if (ndx >= 0)
- err = "can't []index a register, because it has no address";
- else if (access == 'a')
- err = "a register has no address";
+ err = _("can't []index a register, because it has no address");
+ else if (access_mode == 'a')
+ err = _("a register has no address");
else
{
/*
* Compute highest byte affected, compare to PC0.
*/
if ((vopP->vop_nbytes + reg * 4) > 60)
- wrn = "PC part of operand unpredictable";
+ wrn = _("PC part of operand unpredictable");
err = " "; /* win */
mode = 5; /* Rn */
}
*/
\f
-#ifdef TEST /* #Define to use this testbed. */
+#ifdef TEST /* #Define to use this testbed. */
/*
* Follows a test program for this function.
{
valueT offset;
- offset = to_addr - (from_addr + 1);
- *ptr++ = 0x31;
+ /* This former calculation was off by two:
+ offset = to_addr - (from_addr + 1);
+ We need to account for the one byte instruction and also its
+ two byte operand. */
+ offset = to_addr - (from_addr + 1 + 2);
+ *ptr++ = VAX_BRW; /* branch with word (16 bit) offset */
md_number_to_chars (ptr, offset, 2);
}
valueT offset;
offset = to_addr - S_GET_VALUE (to_symbol);
- *ptr++ = 0x17;
- *ptr++ = 0x9F;
+ *ptr++ = VAX_JMP; /* arbitrary jump */
+ *ptr++ = VAX_ABSOLUTE_MODE;
md_number_to_chars (ptr, offset, 4);
fix_new (frag, ptr - frag->fr_literal, 4, to_symbol, (long) 0, 0, NO_RELOC);
}
\f
#ifdef OBJ_VMS
-CONST char *md_shortopts = "d:STt:V+1h:Hv:";
+CONST char *md_shortopts = "d:STt:V+1h:Hv::";
#else
CONST char *md_shortopts = "d:STt:V";
#endif
struct option md_longopts[] = {
{NULL, no_argument, NULL, 0}
};
-size_t md_longopts_size = sizeof(md_longopts);
+size_t md_longopts_size = sizeof (md_longopts);
int
md_parse_option (c, arg)
switch (c)
{
case 'S':
- as_warn ("SYMBOL TABLE not implemented");
+ as_warn (_("SYMBOL TABLE not implemented"));
break;
case 'T':
- as_warn ("TOKEN TRACE not implemented");
+ as_warn (_("TOKEN TRACE not implemented"));
break;
case 'd':
- as_warn ("Displacement length %s ignored!", arg);
+ as_warn (_("Displacement length %s ignored!"), arg);
break;
case 't':
- as_warn ("I don't need or use temp. file \"%s\".", arg);
+ as_warn (_("I don't need or use temp. file \"%s\"."), arg);
break;
case 'V':
- as_warn ("I don't use an interpass file! -V ignored");
+ as_warn (_("I don't use an interpass file! -V ignored"));
break;
#ifdef OBJ_VMS
- case '+': /* For g++. Hash any name > 31 chars long. */
+ case '+': /* For g++. Hash any name > 31 chars long. */
flag_hash_long_names = 1;
break;
case 'v':
{
extern char *compiler_version_string;
+ if (!arg || !*arg || access (arg, 0) == 0)
+ return 0; /* have caller show the assembler version */
compiler_version_string = arg;
}
break;
md_show_usage (stream)
FILE *stream;
{
- fprintf(stream, "\
+ fprintf (stream, _("\
VAX options:\n\
-d LENGTH ignored\n\
-J ignored\n\
-S ignored\n\
-t FILE ignored\n\
-T ignored\n\
--V ignored\n");
+-V ignored\n"));
#ifdef OBJ_VMS
- fprintf (stream, "\
--+ hash names longer than 31 characters\n\
--1 don't do const thing\n\
+ fprintf (stream, _("\
+VMS options:\n\
+-+ hash encode names longer than 31 characters\n\
+-1 `const' handling compatible with gcc 1.x\n\
-H show new symbol after hash truncation\n\
-h NUM don't hash mixed-case names, and adjust case:\n\
0 = upper, 2 = lower, 3 = preserve case\n\
--vVERSION compiler version is VERSION\n");
+-v\"VERSION\" code being assembled was produced by compiler \"VERSION\"\n"));
#endif
}
\f
/* We have no need to default values of symbols. */
-/* ARGSUSED */
symbolS *
md_undefined_symbol (name)
char *name;
return 0;
}
-/* Parse an operand that is machine-specific.
- We just return without modifying the expression if we have nothing
- to do. */
-
-/* ARGSUSED */
-void
-md_operand (expressionP)
- expressionS *expressionP;
-{
-}
-
/* Round up a section size to the appropriate boundary. */
valueT
md_section_align (segment, size)