* read.c (potable): Pass negative numbers for new .balign[wl] and

.p2align[wl] pseudo-ops.
	(s_align_bytes): Treat a negative argument as specifying the fill
	length.
	(s_align_ptwo): Likewise.
This commit is contained in:
Ian Lance Taylor
1996-02-09 01:04:21 +00:00
parent 708f7fbcd3
commit 4080c27065
2 changed files with 40 additions and 21 deletions

View File

@ -1,3 +1,11 @@
Thu Feb 8 20:02:58 1996 Ian Lance Taylor <ian@cygnus.com>
* read.c (potable): Pass negative numbers for new .balign[wl] and
.p2align[wl] pseudo-ops.
(s_align_bytes): Treat a negative argument as specifying the fill
length.
(s_align_ptwo): Likewise.
Wed Feb 7 14:12:03 1996 Ian Lance Taylor <ian@cygnus.com> Wed Feb 7 14:12:03 1996 Ian Lance Taylor <ian@cygnus.com>
* read.c (potable): Add balignw, balignl, p2alignw, and p2alignl. * read.c (potable): Add balignw, balignl, p2alignw, and p2alignl.

View File

@ -246,8 +246,8 @@ static const pseudo_typeS potable[] =
{"ascii", stringer, 0}, {"ascii", stringer, 0},
{"asciz", stringer, 1}, {"asciz", stringer, 1},
{"balign", s_align_bytes, 0}, {"balign", s_align_bytes, 0},
{"balignw", s_align_bytes, 2}, {"balignw", s_align_bytes, -2},
{"balignl", s_align_bytes, 4}, {"balignl", s_align_bytes, -4},
/* block */ /* block */
{"byte", cons, 1}, {"byte", cons, 1},
{"comm", s_comm, 0}, {"comm", s_comm, 0},
@ -341,8 +341,8 @@ static const pseudo_typeS potable[] =
{"offset", s_struct, 0}, {"offset", s_struct, 0},
{"org", s_org, 0}, {"org", s_org, 0},
{"p2align", s_align_ptwo, 0}, {"p2align", s_align_ptwo, 0},
{"p2alignw", s_align_ptwo, 2}, {"p2alignw", s_align_ptwo, -2},
{"p2alignl", s_align_ptwo, 4}, {"p2alignl", s_align_ptwo, -4},
{"page", listing_eject, 0}, {"page", listing_eject, 0},
{"plen", listing_psize, 0}, {"plen", listing_psize, 0},
{"print", s_print, 0}, {"print", s_print, 0},
@ -1100,7 +1100,12 @@ s_align_bytes (arg)
stop = mri_comment_field (&stopc); stop = mri_comment_field (&stopc);
if (is_end_of_line[(unsigned char) *input_line_pointer]) if (is_end_of_line[(unsigned char) *input_line_pointer])
{
if (arg < 0)
temp = 0;
else
temp = arg; /* Default value from pseudo-op table */ temp = arg; /* Default value from pseudo-op table */
}
else else
temp = get_absolute_expression (); temp = get_absolute_expression ();
@ -1123,29 +1128,32 @@ s_align_bytes (arg)
if (*input_line_pointer == ',') if (*input_line_pointer == ',')
{ {
offsetT fillval; offsetT fillval;
int len;
input_line_pointer++; input_line_pointer++;
fillval = get_absolute_expression (); fillval = get_absolute_expression ();
if (arg == 0) if (arg >= 0)
arg = 1; len = 1;
if (arg <= 1) else
len = - arg;
if (len <= 1)
{ {
temp_fill = fillval; temp_fill = fillval;
do_align (temp, &temp_fill, arg); do_align (temp, &temp_fill, len);
} }
else else
{ {
char ab[16]; char ab[16];
if (arg > sizeof ab) if (len > sizeof ab)
abort (); abort ();
md_number_to_chars (ab, fillval, arg); md_number_to_chars (ab, fillval, len);
do_align (temp, ab, arg); do_align (temp, ab, len);
} }
} }
else else
{ {
if (arg > 0) if (arg < 0)
as_warn ("expected fill pattern missing"); as_warn ("expected fill pattern missing");
do_align (temp, (char *) NULL, 0); do_align (temp, (char *) NULL, 0);
} }
@ -1181,29 +1189,32 @@ s_align_ptwo (arg)
if (*input_line_pointer == ',') if (*input_line_pointer == ',')
{ {
offsetT fillval; offsetT fillval;
int len;
input_line_pointer++; input_line_pointer++;
fillval = get_absolute_expression (); fillval = get_absolute_expression ();
if (arg == 0) if (arg >= 0)
arg = 1; len = 1;
if (arg <= 1) else
len = - arg;
if (len <= 1)
{ {
temp_fill = fillval; temp_fill = fillval;
do_align (temp, &temp_fill, arg); do_align (temp, &temp_fill, len);
} }
else else
{ {
char ab[16]; char ab[16];
if (arg > sizeof ab) if (len > sizeof ab)
abort (); abort ();
md_number_to_chars (ab, fillval, arg); md_number_to_chars (ab, fillval, len);
do_align (temp, ab, arg); do_align (temp, ab, len);
} }
} }
else else
{ {
if (arg > 0) if (arg < 0)
as_warn ("expected fill pattern missing"); as_warn ("expected fill pattern missing");
do_align (temp, (char *) NULL, 0); do_align (temp, (char *) NULL, 0);
} }