@ -191,6 +191,7 @@ symbolS *mri_common_symbol;
may be needed . */
may be needed . */
static int mri_pending_align ;
static int mri_pending_align ;
static int scrub_from_string PARAMS ( ( char * * ) ) ;
static void do_align PARAMS ( ( int , char * ) ) ;
static void do_align PARAMS ( ( int , char * ) ) ;
static int hex_float PARAMS ( ( int , char * ) ) ;
static int hex_float PARAMS ( ( int , char * ) ) ;
static void do_org PARAMS ( ( segT , expressionS * , int ) ) ;
static void do_org PARAMS ( ( segT , expressionS * , int ) ) ;
@ -330,6 +331,7 @@ static const pseudo_typeS potable[] =
/* print */
/* print */
{ " quad " , cons , 8 } ,
{ " quad " , cons , 8 } ,
{ " rept " , s_rept , 0 } ,
{ " rept " , s_rept , 0 } ,
{ " rva " , s_rva , 4 } ,
{ " sbttl " , listing_title , 1 } , /* Subtitle of listing */
{ " sbttl " , listing_title , 1 } , /* Subtitle of listing */
/* scl */
/* scl */
/* sect */
/* sect */
@ -425,6 +427,24 @@ pobegin ()
}
}
/* This function is used when scrubbing the characters between #APP
and # NO_APP . */
static char * scrub_string ;
static char * scrub_string_end ;
static int
scrub_from_string ( from )
char * * from ;
{
int size ;
* from = scrub_string ;
size = scrub_string_end - scrub_string ;
scrub_string = scrub_string_end ;
return size ;
}
/* read_a_source_file()
/* read_a_source_file()
*
*
* We read the file , putting things into a web that
* We read the file , putting things into a web that
@ -810,7 +830,6 @@ read_a_source_file (name)
char * new_tmp ;
char * new_tmp ;
unsigned int new_length ;
unsigned int new_length ;
char * tmp_buf = 0 ;
char * tmp_buf = 0 ;
extern char * scrub_string , * scrub_last_string ;
bump_line_counters ( ) ;
bump_line_counters ( ) ;
s = input_line_pointer ;
s = input_line_pointer ;
@ -862,26 +881,30 @@ read_a_source_file (name)
{
{
input_line_pointer = ends + 8 ;
input_line_pointer = ends + 8 ;
}
}
new_buf = xmalloc ( 100 ) ;
new_length = 100 ;
new_tmp = new_buf ;
scrub_string = s ;
scrub_string = s ;
scrub_last_string = ends ;
scrub_string_end = ends ;
new_length = ends - s ;
new_buf = ( char * ) xmalloc ( new_length ) ;
new_tmp = new_buf ;
for ( ; ; )
for ( ; ; )
{
{
int ch ;
int space ;
int size ;
ch = do_scrub_next_char ( scrub_from_string , scrub_to_string ) ;
space = ( new_buf + new_length ) - new_tmp ;
if ( ch = = EOF )
size = do_scrub_chars ( scrub_from_string , new_tmp , space ) ;
break ;
* new_tmp + + = ch ;
if ( size < space )
if ( new_tmp = = new_buf + new_length )
{
{
new_buf = xrealloc ( new_buf , new_length + 100 ) ;
new_tmp + = size ;
new_tmp = new_buf + new_length ;
break ;
new_length + = 100 ;
}
}
new_buf = xrealloc ( new_buf , new_length + 100 ) ;
new_tmp = new_buf + new_length ;
new_length + = 100 ;
}
}
if ( tmp_buf )
if ( tmp_buf )
@ -908,6 +931,7 @@ read_a_source_file (name)
if ( old_buffer )
if ( old_buffer )
{
{
free ( buffer ) ;
bump_line_counters ( ) ;
bump_line_counters ( ) ;
if ( old_input ! = 0 )
if ( old_input ! = 0 )
{
{
@ -1224,11 +1248,11 @@ s_data (ignore)
}
}
/* Handle the .appfile pseudo-op. This is automatically generated by
/* Handle the .appfile pseudo-op. This is automatically generated by
do_scrub_next_ char when a preprocessor # line comment is seen with
do_scrub_chars when a preprocessor # line comment is seen with a
a file name . This default definition may be overridden by the
file name . This default definition may be overridden by the object
object o r CPU specific pseudo - ops . This function is also the
or CPU specific pseudo - ops . This function is also the default
default definition for . file ; the APPFILE argument is 1 for
definition for . file ; the APPFILE argument is 1 for . appfile , 0 for
. appfile , 0 for . file . */
. file . */
void
void
s_app_file ( appfile )
s_app_file ( appfile )
@ -1256,9 +1280,9 @@ s_app_file (appfile)
}
}
/* Handle the .appline pseudo-op. This is automatically generated by
/* Handle the .appline pseudo-op. This is automatically generated by
do_scrub_next_ char when a preprocessor # line comment is seen .
do_scrub_chars when a preprocessor # line comment is seen . This
This default definition may be overridden by the object or CPU
default definition may be overridden by the object or CPU specific
specific pseudo - ops . */
pseudo - ops . */
void
void
s_app_line ( ignore )
s_app_line ( ignore )
@ -2362,12 +2386,14 @@ parse_repeat_cons PARAMS ((expressionS *exp, unsigned int nbytes));
/* worker to do .byte etc statements */
/* worker to do .byte etc statements */
/* clobbers input_line_pointer, checks */
/* clobbers input_line_pointer, checks */
/* end-of-line. */
/* end-of-line. */
void
static void
cons ( nbytes )
cons_worker ( nbytes , rva )
register int nbytes ; /* 1=.byte, 2=.word, 4=.long */
register int nbytes ; /* 1=.byte, 2=.word, 4=.long */
int rva ;
{
{
int c ;
int c ;
expressionS exp ;
expressionS exp ;
char * stop = NULL ;
# ifdef md_flush_pending_output
# ifdef md_flush_pending_output
md_flush_pending_output ( ) ;
md_flush_pending_output ( ) ;
@ -2379,17 +2405,54 @@ cons (nbytes)
return ;
return ;
}
}
/* In MRI mode, the operands end at the first unquoted space. */
if ( flag_mri )
{
char * s ;
int inquote = 0 ;
for ( s = input_line_pointer ;
( ( ! is_end_of_line [ ( unsigned char ) * s ] & & * s ! = ' ' & & * s ! = ' \t ' )
| | inquote ) ;
s + + )
{
if ( * s = = ' \' ' )
inquote = ! inquote ;
}
stop = s ;
}
c = 0 ;
c = 0 ;
do
do
{
{
if ( rva )
{
/* If this is an .rva pseudoop then stick
an extra reloc in for this word . */
int reloc ;
char * p = frag_more ( 0 ) ;
exp . X_op = O_absent ;
# ifdef BFD_ASSEMBLER
reloc = BFD_RELOC_RVA ;
# elif defined(TC_RVA_RELOC)
reloc = TC_RVA_RELOC ;
# else
abort ( ) ;
# endif
fix_new_exp ( frag_now , p - frag_now - > fr_literal ,
nbytes , & exp , 0 , reloc ) ;
}
if ( flag_mri )
if ( flag_mri )
parse_mri_cons ( & exp , ( unsigned int ) nbytes ) ;
parse_mri_cons ( & exp , ( unsigned int ) nbytes ) ;
else
else
TC_PARSE_CONS_EXPRESSION ( & exp , ( unsigned int ) nbytes ) ;
TC_PARSE_CONS_EXPRESSION ( & exp , ( unsigned int ) nbytes ) ;
emit_expr ( & exp , ( unsigned int ) nbytes ) ;
emit_expr ( & exp , ( unsigned int ) nbytes ) ;
+ + c ;
+ + c ;
}
}
while ( * input_line_pointer + + = = ' , ' ) ;
while ( * input_line_pointer + + = = ' , '
& & ( ! flag_mri | | input_line_pointer < stop ) ) ;
/* In MRI mode, after an odd number of bytes, we must align to an
/* 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
even word boundary , unless the next instruction is a dc . b , ds . b
@ -2398,9 +2461,33 @@ cons (nbytes)
mri_pending_align = 1 ;
mri_pending_align = 1 ;
input_line_pointer - - ; /* Put terminator back into stream. */
input_line_pointer - - ; /* Put terminator back into stream. */
if ( flag_mri )
{
input_line_pointer = stop ;
while ( ! is_end_of_line [ ( unsigned char ) * input_line_pointer ] )
+ + input_line_pointer ;
}
demand_empty_rest_of_line ( ) ;
demand_empty_rest_of_line ( ) ;
}
}
void
cons ( size )
int size ;
{
cons_worker ( size , 0 ) ;
}
void
s_rva ( size )
int size ;
{
cons_worker ( size , 1 ) ;
}
/* Put the contents of expression EXP into the object file using
/* Put the contents of expression EXP into the object file using
NBYTES bytes . If need_pass_2 is 1 , this does nothing . */
NBYTES bytes . If need_pass_2 is 1 , this does nothing . */
@ -2625,8 +2712,8 @@ emit_expr (exp, nbytes)
fix_new_exp ( frag_now , p - frag_now - > fr_literal , ( int ) nbytes , exp , 0 ,
fix_new_exp ( frag_now , p - frag_now - > fr_literal , ( int ) nbytes , exp , 0 ,
/* @@ Should look at CPU word size. */
/* @@ Should look at CPU word size. */
nbytes = = 2 ? BFD_RELOC_16
nbytes = = 2 ? BFD_RELOC_16
: nbytes = = 8 ? BFD_RELOC_64
: nbytes = = 8 ? BFD_RELOC_64
: BFD_RELOC_32 ) ;
: BFD_RELOC_32 ) ;
# endif
# endif
# else
# else
# ifdef TC_CONS_FIX_NEW
# ifdef TC_CONS_FIX_NEW
@ -3435,6 +3522,8 @@ equals (sym_name)
char * sym_name ;
char * sym_name ;
{
{
register symbolS * symbolP ; /* symbol we are working with */
register symbolS * symbolP ; /* symbol we are working with */
char * stop ;
int stopc ;
input_line_pointer + + ;
input_line_pointer + + ;
if ( * input_line_pointer = = ' = ' )
if ( * input_line_pointer = = ' = ' )
@ -3443,6 +3532,25 @@ equals (sym_name)
while ( * input_line_pointer = = ' ' | | * input_line_pointer = = ' \t ' )
while ( * input_line_pointer = = ' ' | | * input_line_pointer = = ' \t ' )
input_line_pointer + + ;
input_line_pointer + + ;
/* In MRI mode, the operands end at the first unquoted space. */
if ( flag_mri )
{
char * s ;
int inquote = 0 ;
for ( s = input_line_pointer ;
( ( ! is_end_of_line [ ( unsigned char ) * s ] & & * s ! = ' ' & & * s ! = ' \t ' )
| | inquote ) ;
s + + )
{
if ( * s = = ' \' ' )
inquote = ! inquote ;
}
stop = s ;
stopc = * stop ;
* stop = ' \0 ' ;
}
if ( sym_name [ 0 ] = = ' . ' & & sym_name [ 1 ] = = ' \0 ' )
if ( sym_name [ 0 ] = = ' . ' & & sym_name [ 1 ] = = ' \0 ' )
{
{
/* Turn '. = mumble' into a .org mumble */
/* Turn '. = mumble' into a .org mumble */
@ -3458,6 +3566,14 @@ equals (sym_name)
symbolP = symbol_find_or_make ( sym_name ) ;
symbolP = symbol_find_or_make ( sym_name ) ;
pseudo_set ( symbolP ) ;
pseudo_set ( symbolP ) ;
}
}
if ( flag_mri )
{
input_line_pointer = stop ;
* stop = stopc ;
while ( ! is_end_of_line [ ( unsigned char ) * input_line_pointer ] )
+ + input_line_pointer ;
}
} /* equals() */
} /* equals() */
/* .include -- include a file at this point. */
/* .include -- include a file at this point. */