aboutsummaryrefslogtreecommitdiff
path: root/gas/read.c
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1995-08-09 14:53:21 +0000
committerIan Lance Taylor <ian@airs.com>1995-08-09 14:53:21 +0000
commit286cb27aacfaf81827760d86e3c5fa6186125d1f (patch)
treecb42977757744fd9648e044897b58d1845467a4a /gas/read.c
parentbf4bd1fcf0a92bb66b268a1ccdbb0c6d7c063b4c (diff)
downloadgdb-286cb27aacfaf81827760d86e3c5fa6186125d1f.zip
gdb-286cb27aacfaf81827760d86e3c5fa6186125d1f.tar.gz
gdb-286cb27aacfaf81827760d86e3c5fa6186125d1f.tar.bz2
* configure.in: Move random special target handling before
possible break. * configure: Rebuild.
Diffstat (limited to 'gas/read.c')
-rw-r--r--gas/read.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/gas/read.c b/gas/read.c
index bacd186..c77f588 100644
--- a/gas/read.c
+++ b/gas/read.c
@@ -178,6 +178,13 @@ static symbolS *mri_line_label;
non-NULL when we are in an MRI common section. */
symbolS *mri_common_symbol;
+/* In MRI mode, after a dc.b pseudo-op with an odd number of bytes, we
+ need to align to an even byte boundary unless the next pseudo-op is
+ dc.b, ds.b, or dcb.b. This variable is set to 1 if an alignment
+ may be needed. */
+static int mri_pending_align;
+
+static void do_align PARAMS ((int, char *));
char *demand_copy_string PARAMS ((int *lenP));
int is_it_end_of_statement PARAMS ((void));
static segT get_segmented_expression PARAMS ((expressionS *expP));
@@ -552,6 +559,20 @@ read_a_source_file (name)
if (pop == NULL)
pop = (pseudo_typeS *) hash_find (po_hash, s + 1);
+ /* In MRI mode, we may need to insert an
+ automatic alignment directive. What a hack
+ this is. */
+ if (mri_pending_align
+ && (pop == NULL
+ || ! ((pop->poc_handler == cons
+ && pop->poc_val == 1)
+ || (pop->poc_handler == s_space
+ && pop->poc_val == 1))))
+ {
+ do_align (1, (char *) NULL);
+ mri_pending_align = 0;
+ }
+
/* Print the error msg now, while we still can */
if (pop == NULL)
{
@@ -577,6 +598,12 @@ read_a_source_file (name)
}
else
{ /* machine instruction */
+ if (mri_pending_align)
+ {
+ do_align (1, (char *) NULL);
+ mri_pending_align = 0;
+ }
+
/* WARNING: c has char, which may be end-of-line. */
/* Also: input_line_pointer->`\0` where c was. */
*input_line_pointer = c;
@@ -1847,6 +1874,7 @@ void
cons (nbytes)
register int nbytes; /* 1=.byte, 2=.word, 4=.long */
{
+ int c;
expressionS exp;
#ifdef md_flush_pending_output
@@ -1859,6 +1887,7 @@ cons (nbytes)
return;
}
+ c = 0;
do
{
if (flag_mri)
@@ -1866,9 +1895,16 @@ cons (nbytes)
else
TC_PARSE_CONS_EXPRESSION (&exp, (unsigned int) nbytes);
emit_expr (&exp, (unsigned int) nbytes);
+ ++c;
}
while (*input_line_pointer++ == ',');
+ /* In MRI mode, after an odd number of bytes, we must align to an
+ even word boundary, unless the next instruction is a dc.b, ds.b
+ or dcb.b. */
+ if (flag_mri && nbytes == 1 && (c & 1) != 0)
+ mri_pending_align = 1;
+
input_line_pointer--; /* Put terminator back into stream. */
demand_empty_rest_of_line ();
}