1 /* read.c - read a source file -
2 Copyright 1986, 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
4 Free Software Foundation, Inc.
6 This file is part of GAS, the GNU Assembler.
8 GAS is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
13 GAS is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with GAS; see the file COPYING. If not, write to the Free
20 Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
23 /* If your chars aren't 8 bits, you will change this a bit (eg. to 0xFF).
24 But then, GNU isn't spozed to run on your machine anyway.
25 (RMS is so shortsighted sometimes.) */
26 #define MASK_CHAR ((int)(unsigned char) -1)
28 /* This is the largest known floating point format (for now). It will
29 grow when we do 4361 style flonums. */
30 #define MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT (16)
32 /* Routines that read assembler source text to build spaghetti in memory.
33 Another group of these functions is in the expr.c module. */
36 #include "safe-ctype.h"
43 #include "dw2gencfi.h"
45 #ifndef TC_START_LABEL
46 #define TC_START_LABEL(x,y) (x == ':')
49 /* Set by the object-format or the target. */
50 #ifndef TC_IMPLICIT_LCOMM_ALIGNMENT
51 #define TC_IMPLICIT_LCOMM_ALIGNMENT(SIZE, P2VAR) \
56 else if ((SIZE) >= 4) \
58 else if ((SIZE) >= 2) \
66 char *input_line_pointer; /*->next char of source file to parse. */
68 #if BITS_PER_CHAR != 8
69 /* The following table is indexed by[(char)] and will break if
70 a char does not have exactly 256 states (hopefully 0:255!)! */
75 /* The m88k unfortunately uses @ as a label beginner. */
80 /* The RS/6000 assembler uses {,},[,] as parts of symbol names. */
85 /* The Delta 68k assembler permits % inside label names. */
90 /* The PowerPC Windows NT assemblers permits ? inside label names. */
95 /* The IA-64 assembler uses # as a suffix designating a symbol. We include
96 it in the symbol and strip it out in tc_canonicalize_symbol_name. */
101 /* The a29k assembler does not permits labels to start with $. */
106 /* The Delta 68k assembler permits ~ at start of label names. */
110 /* Used by is_... macros. our ctype[]. */
111 char lex_type[256] = {
112 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* @ABCDEFGHIJKLMNO */
113 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* PQRSTUVWXYZ[\]^_ */
114 0, 0, 0, LEX_HASH, LEX_DOLLAR, LEX_PCT, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, /* _!"#$%&'()*+,-./ */
115 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, LEX_QM, /* 0123456789:;<=>? */
116 LEX_AT, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* @ABCDEFGHIJKLMNO */
117 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, LEX_BR, 0, LEX_BR, 0, 3, /* PQRSTUVWXYZ[\]^_ */
118 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* `abcdefghijklmno */
119 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, LEX_BR, 0, LEX_BR, LEX_TILDE, 0, /* pqrstuvwxyz{|}~. */
120 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
121 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
122 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
123 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
124 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
125 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
126 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
127 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3
131 Out: 1 if this character ends a line. */
132 char is_end_of_line[256] = {
134 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, /* @abcdefghijklmno */
136 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, /* @abcdefghijklmno */
138 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
139 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* _!"#$%&'()*+,-./ */
140 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0123456789:;<=>? */
141 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
142 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
143 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
144 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
145 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
146 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
147 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
148 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
149 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
150 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
151 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
152 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /* */
155 #ifndef TC_CASE_SENSITIVE
156 char original_case_string[128];
159 /* Functions private to this file. */
161 static char *buffer; /* 1st char of each buffer of lines is here. */
162 static char *buffer_limit; /*->1 + last char in buffer. */
164 /* TARGET_BYTES_BIG_ENDIAN is required to be defined to either 0 or 1
165 in the tc-<CPU>.h file. See the "Porting GAS" section of the
167 int target_big_endian = TARGET_BYTES_BIG_ENDIAN;
169 /* Variables for handling include file directory table. */
171 /* Table of pointers to directories to search for .include's. */
174 /* How many are in the table. */
175 int include_dir_count;
177 /* Length of longest in table. */
178 int include_dir_maxlen = 1;
180 #ifndef WORKING_DOT_WORD
181 struct broken_word *broken_words;
182 int new_broken_words;
185 /* The current offset into the absolute section. We don't try to
186 build frags in the absolute section, since no data can be stored
187 there. We just keep track of the current offset. */
188 addressT abs_section_offset;
190 /* If this line had an MRI style label, it is stored in this variable.
191 This is used by some of the MRI pseudo-ops. */
194 /* This global variable is used to support MRI common sections. We
195 translate such sections into a common symbol. This variable is
196 non-NULL when we are in an MRI common section. */
197 symbolS *mri_common_symbol;
199 /* In MRI mode, after a dc.b pseudo-op with an odd number of bytes, we
200 need to align to an even byte boundary unless the next pseudo-op is
201 dc.b, ds.b, or dcb.b. This variable is set to 1 if an alignment
203 static int mri_pending_align;
207 /* This variable is set to be non-zero if the next string we see might
208 be the name of the source file in DWARF debugging information. See
209 the comment in emit_expr for the format we look for. */
210 static int dwarf_file_string;
214 static void do_s_func (int end_p, const char *default_prefix);
215 static void do_align (int, char *, int, int);
216 static void s_align (int, int);
217 static void s_altmacro (int);
218 static void s_bad_end (int);
219 static int hex_float (int, char *);
220 static segT get_known_segmented_expression (expressionS * expP);
221 static void pobegin (void);
222 static int get_line_sb (sb *);
223 static void generate_file_debug (void);
231 obj_read_begin_hook ();
233 /* Something close -- but not too close -- to a multiple of 1024.
234 The debugging malloc I'm using has 24 bytes of overhead. */
235 obstack_begin (¬es, chunksize);
236 obstack_begin (&cond_obstack, chunksize);
238 /* Use machine dependent syntax. */
239 for (p = line_separator_chars; *p; p++)
240 is_end_of_line[(unsigned char) *p] = 1;
241 /* Use more. FIXME-SOMEDAY. */
247 #ifndef TC_ADDRESS_BYTES
249 #define TC_ADDRESS_BYTES address_bytes
254 /* Choose smallest of 1, 2, 4, 8 bytes that is large enough to
255 contain an address. */
256 int n = (stdoutput->arch_info->bits_per_address - 1) / 8;
265 /* Set up pseudo-op tables. */
267 static struct hash_control *po_hash;
269 static const pseudo_typeS potable[] = {
270 {"abort", s_abort, 0},
271 {"align", s_align_ptwo, 0},
272 {"altmacro", s_altmacro, 1},
273 {"ascii", stringer, 0},
274 {"asciz", stringer, 1},
275 {"balign", s_align_bytes, 0},
276 {"balignw", s_align_bytes, -2},
277 {"balignl", s_align_bytes, -4},
281 {"common", s_mri_common, 0},
282 {"common.s", s_mri_common, 1},
285 #ifdef TC_ADDRESS_BYTES
289 {"dc.d", float_cons, 'd'},
291 {"dc.s", float_cons, 'f'},
293 {"dc.x", float_cons, 'x'},
295 {"dcb.b", s_space, 1},
296 {"dcb.d", s_float_space, 'd'},
297 {"dcb.l", s_space, 4},
298 {"dcb.s", s_float_space, 'f'},
299 {"dcb.w", s_space, 2},
300 {"dcb.x", s_float_space, 'x'},
302 {"ds.b", s_space, 1},
303 {"ds.d", s_space, 8},
304 {"ds.l", s_space, 4},
305 {"ds.p", s_space, 12},
306 {"ds.s", s_space, 4},
307 {"ds.w", s_space, 2},
308 {"ds.x", s_space, 12},
309 {"debug", s_ignore, 0},
314 {"double", float_cons, 'd'},
316 {"eject", listing_eject, 0}, /* Formfeed listing. */
318 {"elsec", s_else, 0},
319 {"elseif", s_elseif, (int) O_ne},
321 {"endc", s_endif, 0},
322 {"endfunc", s_func, 1},
323 {"endif", s_endif, 0},
324 {"endm", s_bad_end, 0},
325 {"endr", s_bad_end, 1},
330 {"error", s_errwarn, 1},
331 {"exitm", s_mexit, 0},
333 {"extern", s_ignore, 0}, /* We treat all undef as ext. */
334 {"appfile", s_app_file, 1},
335 {"appline", s_app_line, 0},
337 {"file", s_app_file, 0},
339 {"float", float_cons, 'f'},
340 {"format", s_ignore, 0},
342 {"global", s_globl, 0},
343 {"globl", s_globl, 0},
345 {"if", s_if, (int) O_ne},
348 {"ifdef", s_ifdef, 0},
349 {"ifeq", s_if, (int) O_eq},
350 {"ifeqs", s_ifeqs, 0},
351 {"ifge", s_if, (int) O_ge},
352 {"ifgt", s_if, (int) O_gt},
353 {"ifle", s_if, (int) O_le},
354 {"iflt", s_if, (int) O_lt},
357 {"ifndef", s_ifdef, 1},
358 {"ifne", s_if, (int) O_ne},
359 {"ifnes", s_ifeqs, 1},
360 {"ifnotdef", s_ifdef, 1},
361 {"incbin", s_incbin, 0},
362 {"include", s_include, 0},
368 {"lcomm", s_lcomm, 0},
369 {"lflags", listing_flags, 0}, /* Listing flags. */
370 {"linkonce", s_linkonce, 0},
371 {"list", listing_list, 1}, /* Turn listing on. */
372 {"llen", listing_psize, 1},
375 {"macro", s_macro, 0},
376 {"mexit", s_mexit, 0},
378 {".mri", s_mri, 0}, /* Special case so .mri works in MRI mode. */
379 {"name", s_ignore, 0},
380 {"noaltmacro", s_altmacro, 0},
381 {"noformat", s_ignore, 0},
382 {"nolist", listing_list, 0}, /* Turn listing off. */
383 {"nopage", listing_nopage, 0},
385 {"offset", s_struct, 0},
387 {"p2align", s_align_ptwo, 0},
388 {"p2alignw", s_align_ptwo, -2},
389 {"p2alignl", s_align_ptwo, -4},
390 {"page", listing_eject, 0},
391 {"plen", listing_psize, 0},
392 {"print", s_print, 0},
393 {"psize", listing_psize, 0}, /* Set paper size. */
394 {"purgem", s_purgem, 0},
399 {"sbttl", listing_title, 1}, /* Subtitle of listing. */
404 {"single", float_cons, 'f'},
406 {"space", s_space, 0},
407 {"skip", s_space, 0},
408 {"sleb128", s_leb128, 1},
409 {"spc", s_ignore, 0},
410 {"stabd", s_stab, 'd'},
411 {"stabn", s_stab, 'n'},
412 {"stabs", s_stab, 's'},
413 {"string", stringer, 1},
414 {"struct", s_struct, 0},
418 /* This is for gcc to use. It's only just been added (2/94), so gcc
419 won't be able to use it for a while -- probably a year or more.
420 But once this has been released, check with gcc maintainers
421 before deleting it or even changing the spelling. */
422 {"this_GCC_requires_the_GNU_assembler", s_ignore, 0},
423 /* If we're folding case -- done for some targets, not necessarily
424 all -- the above string in an input file will be converted to
425 this one. Match it either way... */
426 {"this_gcc_requires_the_gnu_assembler", s_ignore, 0},
428 {"title", listing_title, 0}, /* Listing title. */
429 {"ttl", listing_title, 0},
431 {"uleb128", s_leb128, 0},
435 {"xdef", s_globl, 0},
436 {"xref", s_ignore, 0},
437 {"xstabs", s_xstab, 's'},
438 {"warning", s_errwarn, 0},
440 {"zero", s_space, 0},
441 {NULL, NULL, 0} /* End sentinel. */
445 get_absolute_expr (expressionS *exp)
448 if (exp->X_op != O_constant)
450 if (exp->X_op != O_absent)
451 as_bad (_("bad or irreducible absolute expression"));
452 exp->X_add_number = 0;
454 return exp->X_add_number;
458 get_absolute_expression (void)
462 return get_absolute_expr (&exp);
465 static int pop_override_ok = 0;
466 static const char *pop_table_name;
469 pop_insert (const pseudo_typeS *table)
472 const pseudo_typeS *pop;
473 for (pop = table; pop->poc_name; pop++)
475 errtxt = hash_insert (po_hash, pop->poc_name, (char *) pop);
476 if (errtxt && (!pop_override_ok || strcmp (errtxt, "exists")))
477 as_fatal (_("error constructing %s pseudo-op table: %s"), pop_table_name,
482 #ifndef md_pop_insert
483 #define md_pop_insert() pop_insert(md_pseudo_table)
486 #ifndef obj_pop_insert
487 #define obj_pop_insert() pop_insert(obj_pseudo_table)
490 #ifndef cfi_pop_insert
491 #define cfi_pop_insert() pop_insert(cfi_pseudo_table)
497 po_hash = hash_new ();
499 /* Do the target-specific pseudo ops. */
500 pop_table_name = "md";
503 /* Now object specific. Skip any that were in the target table. */
504 pop_table_name = "obj";
508 /* Now portable ones. Skip any that we've seen already. */
509 pop_table_name = "standard";
510 pop_insert (potable);
512 #ifdef TARGET_USE_CFIPOP
513 pop_table_name = "cfi";
519 #define HANDLE_CONDITIONAL_ASSEMBLY() \
520 if (ignore_input ()) \
522 while (!is_end_of_line[(unsigned char) *input_line_pointer++]) \
523 if (input_line_pointer == buffer_limit) \
528 /* This function is used when scrubbing the characters between #APP
531 static char *scrub_string;
532 static char *scrub_string_end;
535 scrub_from_string (char *buf, int buflen)
539 copy = scrub_string_end - scrub_string;
542 memcpy (buf, scrub_string, copy);
543 scrub_string += copy;
547 /* Helper function of read_a_source_file, which tries to expand a macro. */
549 try_macro (char term, const char *line)
555 if (check_macro (line, &out, &err, ¯o))
559 *input_line_pointer++ = term;
560 input_scrub_include_sb (&out,
561 input_line_pointer, 1);
564 input_scrub_next_buffer (&input_line_pointer);
566 md_macro_info (macro);
573 /* We read the file, putting things into a web that represents what we
574 have been reading. */
576 read_a_source_file (char *name)
579 register char *s; /* String of symbol, '\0' appended. */
587 buffer = input_scrub_new_file (name);
590 listing_newline (NULL);
591 register_dependency (name);
593 /* Generate debugging information before we've read anything in to denote
594 this file as the "main" source file and not a subordinate one
595 (e.g. N_SO vs N_SOL in stabs). */
596 generate_file_debug ();
598 while ((buffer_limit = input_scrub_next_buffer (&input_line_pointer)) != 0)
599 { /* We have another line to parse. */
601 /* In order to avoid listing macro expansion lines with labels
602 multiple times, keep track of which line was last issued. */
603 static char *last_eol;
607 know (buffer_limit[-1] == '\n'); /* Must have a sentinel. */
609 while (input_line_pointer < buffer_limit)
611 /* We have more of this buffer to parse. */
613 /* We now have input_line_pointer->1st char of next line.
614 If input_line_pointer [-1] == '\n' then we just
615 scanned another line: so bump line counters. */
616 if (is_end_of_line[(unsigned char) input_line_pointer[-1]])
618 #ifdef md_start_line_hook
619 md_start_line_hook ();
621 if (input_line_pointer[-1] == '\n')
622 bump_line_counters ();
626 if (LABELS_WITHOUT_COLONS || flag_m68k_mri)
628 /* Text at the start of a line must be a label, we
629 run down and stick a colon in. */
630 if (is_name_beginner (*input_line_pointer))
632 char *line_start = input_line_pointer;
637 HANDLE_CONDITIONAL_ASSEMBLY ();
639 c = get_symbol_end ();
641 /* In MRI mode, the EQU and MACRO pseudoops must
642 be handled specially. */
646 char *rest = input_line_pointer + 1;
650 if (*rest == ' ' || *rest == '\t')
652 if ((strncasecmp (rest, "EQU", 3) == 0
653 || strncasecmp (rest, "SET", 3) == 0)
654 && (rest[3] == ' ' || rest[3] == '\t'))
656 input_line_pointer = rest + 3;
658 strncasecmp (rest, "SET", 3) == 0);
661 if (strncasecmp (rest, "MACRO", 5) == 0
664 || is_end_of_line[(unsigned char) rest[5]]))
668 /* In MRI mode, we need to handle the MACRO
669 pseudo-op specially: we don't want to put the
670 symbol in the symbol table. */
672 #ifdef TC_START_LABEL_WITHOUT_COLON
673 && TC_START_LABEL_WITHOUT_COLON(c,
677 line_label = colon (line_start);
679 line_label = symbol_create (line_start,
684 *input_line_pointer = c;
686 input_line_pointer++;
691 /* We are at the beginning of a line, or similar place.
692 We expect a well-formed assembler statement.
693 A "symbol-name:" is a statement.
695 Depending on what compiler is used, the order of these tests
696 may vary to catch most common case 1st.
697 Each test is independent of all other tests at the (top) level.
698 PLEASE make a compiler that doesn't use this assembler.
699 It is crufty to waste a compiler's time encoding things for this
700 assembler, which then wastes more time decoding it.
701 (And communicating via (linear) files is silly!
702 If you must pass stuff, please pass a tree!) */
703 if ((c = *input_line_pointer++) == '\t'
707 c = *input_line_pointer++;
709 know (c != ' '); /* No further leading whitespace. */
712 /* If listing is on, and we are expanding a macro, then give
713 the listing code the contents of the expanded line. */
716 if ((listing & LISTING_MACEXP) && macro_nest > 0)
721 /* Find the end of the current expanded macro line. */
722 for (s = input_line_pointer - 1; *s; ++s)
723 if (is_end_of_line[(unsigned char) *s])
729 /* Copy it for safe keeping. Also give an indication of
730 how much macro nesting is involved at this point. */
731 len = s - (input_line_pointer - 1);
732 copy = (char *) xmalloc (len + macro_nest + 2);
733 memset (copy, '>', macro_nest);
734 copy[macro_nest] = ' ';
735 memcpy (copy + macro_nest + 1, input_line_pointer - 1, len);
736 copy[macro_nest + 1 + len] = '\0';
738 /* Install the line with the listing facility. */
739 listing_newline (copy);
743 listing_newline (NULL);
746 /* C is the 1st significant character.
747 Input_line_pointer points after that character. */
748 if (is_name_beginner (c))
750 /* Want user-defined label or pseudo/opcode. */
751 HANDLE_CONDITIONAL_ASSEMBLY ();
753 s = --input_line_pointer;
754 c = get_symbol_end (); /* name's delimiter. */
756 /* C is character after symbol.
757 That character's place in the input line is now '\0'.
758 S points to the beginning of the symbol.
759 [In case of pseudo-op, s->'.'.]
760 Input_line_pointer->'\0' where c was. */
761 if (TC_START_LABEL (c, input_line_pointer))
765 char *rest = input_line_pointer + 1;
767 /* In MRI mode, \tsym: set 0 is permitted. */
771 if (*rest == ' ' || *rest == '\t')
774 if ((strncasecmp (rest, "EQU", 3) == 0
775 || strncasecmp (rest, "SET", 3) == 0)
776 && (rest[3] == ' ' || rest[3] == '\t'))
778 input_line_pointer = rest + 3;
784 line_label = colon (s); /* User-defined label. */
785 /* Put ':' back for error messages' sake. */
786 *input_line_pointer++ = ':';
787 #ifdef tc_check_label
788 tc_check_label (line_label);
790 /* Input_line_pointer->after ':'. */
794 || ((c == ' ' || c == '\t')
795 && input_line_pointer[1] == '='))
796 #ifdef TC_EQUAL_IN_INSN
797 && !TC_EQUAL_IN_INSN (c, s)
802 demand_empty_rest_of_line ();
806 /* Expect pseudo-op or machine instruction. */
809 #ifndef TC_CASE_SENSITIVE
813 strncpy (original_case_string, s2, sizeof (original_case_string));
814 original_case_string[sizeof (original_case_string) - 1] = 0;
823 if (NO_PSEUDO_DOT || flag_m68k_mri)
825 /* The MRI assembler and the m88k use pseudo-ops
827 pop = (pseudo_typeS *) hash_find (po_hash, s);
828 if (pop != NULL && pop->poc_handler == NULL)
833 || (!flag_m68k_mri && *s == '.'))
837 WARNING: c has next char, which may be end-of-line.
838 We lookup the pseudo-op table with s+1 because we
839 already know that the pseudo-op begins with a '.'. */
842 pop = (pseudo_typeS *) hash_find (po_hash, s + 1);
843 if (pop && !pop->poc_handler)
846 /* In MRI mode, we may need to insert an
847 automatic alignment directive. What a hack
849 if (mri_pending_align
851 || !((pop->poc_handler == cons
852 && pop->poc_val == 1)
853 || (pop->poc_handler == s_space
854 && pop->poc_val == 1)
855 #ifdef tc_conditional_pseudoop
856 || tc_conditional_pseudoop (pop)
858 || pop->poc_handler == s_if
859 || pop->poc_handler == s_ifdef
860 || pop->poc_handler == s_ifc
861 || pop->poc_handler == s_ifeqs
862 || pop->poc_handler == s_else
863 || pop->poc_handler == s_endif
864 || pop->poc_handler == s_globl
865 || pop->poc_handler == s_ignore)))
867 do_align (1, (char *) NULL, 0, 0);
868 mri_pending_align = 0;
870 if (line_label != NULL)
872 symbol_set_frag (line_label, frag_now);
873 S_SET_VALUE (line_label, frag_now_fix ());
877 /* Print the error msg now, while we still can. */
880 char *end = input_line_pointer;
882 *input_line_pointer = c;
884 c = *--input_line_pointer;
885 *input_line_pointer = '\0';
886 if (! macro_defined || ! try_macro (c, s))
889 as_bad (_("unknown pseudo-op: `%s'"), s);
890 *input_line_pointer++ = c;
895 /* Put it back for error messages etc. */
896 *input_line_pointer = c;
897 /* The following skip of whitespace is compulsory.
898 A well shaped space is sometimes all that separates
899 keyword from operands. */
900 if (c == ' ' || c == '\t')
901 input_line_pointer++;
903 /* Input_line is restored.
904 Input_line_pointer->1st non-blank char
905 after pseudo-operation. */
906 (*pop->poc_handler) (pop->poc_val);
908 /* If that was .end, just get out now. */
909 if (pop->poc_handler == s_end)
915 #ifdef QUOTES_IN_INSN
919 /* WARNING: c has char, which may be end-of-line. */
920 /* Also: input_line_pointer->`\0` where c was. */
921 *input_line_pointer = c;
922 while (!is_end_of_line[(unsigned char) *input_line_pointer]
924 #ifdef TC_EOL_IN_INSN
925 || TC_EOL_IN_INSN (input_line_pointer)
929 if (flag_m68k_mri && *input_line_pointer == '\'')
931 #ifdef QUOTES_IN_INSN
934 else if (*input_line_pointer == '"')
936 else if (*input_line_pointer == '\\')
939 input_line_pointer++;
942 c = *input_line_pointer;
943 *input_line_pointer = '\0';
945 generate_lineno_debug ();
947 if (macro_defined && try_macro (c, s))
950 if (mri_pending_align)
952 do_align (1, (char *) NULL, 0, 0);
953 mri_pending_align = 0;
954 if (line_label != NULL)
956 symbol_set_frag (line_label, frag_now);
957 S_SET_VALUE (line_label, frag_now_fix ());
961 md_assemble (s); /* Assemble 1 instruction. */
963 *input_line_pointer++ = c;
965 /* We resume loop AFTER the end-of-line from
972 /* Empty statement? */
973 if (is_end_of_line[(unsigned char) c])
976 if ((LOCAL_LABELS_DOLLAR || LOCAL_LABELS_FB) && ISDIGIT (c))
978 /* local label ("4:") */
979 char *backup = input_line_pointer;
981 HANDLE_CONDITIONAL_ASSEMBLY ();
985 /* Read the whole number. */
986 while (ISDIGIT (*input_line_pointer))
988 temp = (temp * 10) + *input_line_pointer - '0';
989 ++input_line_pointer;
992 if (LOCAL_LABELS_DOLLAR
993 && *input_line_pointer == '$'
994 && *(input_line_pointer + 1) == ':')
996 input_line_pointer += 2;
998 if (dollar_label_defined (temp))
1000 as_fatal (_("label \"%d$\" redefined"), temp);
1003 define_dollar_label (temp);
1004 colon (dollar_label_name (temp, 0));
1009 && *input_line_pointer++ == ':')
1011 fb_label_instance_inc (temp);
1012 colon (fb_label_name (temp, 0));
1016 input_line_pointer = backup;
1017 } /* local label ("4:") */
1019 if (c && strchr (line_comment_chars, c))
1020 { /* Its a comment. Better say APP or NO_APP. */
1025 unsigned int new_length;
1028 bump_line_counters ();
1029 s = input_line_pointer;
1030 if (strncmp (s, "APP\n", 4))
1031 continue; /* We ignore it */
1035 ends = strstr (s, "#NO_APP\n");
1039 unsigned int tmp_len;
1042 /* The end of the #APP wasn't in this buffer. We
1043 keep reading in buffers until we find the #NO_APP
1044 that goes with this #APP There is one. The specs
1046 tmp_len = buffer_limit - s;
1047 tmp_buf = xmalloc (tmp_len + 1);
1048 memcpy (tmp_buf, s, tmp_len);
1051 new_tmp = input_scrub_next_buffer (&buffer);
1055 buffer_limit = new_tmp;
1056 input_line_pointer = buffer;
1057 ends = strstr (buffer, "#NO_APP\n");
1059 num = ends - buffer;
1061 num = buffer_limit - buffer;
1063 tmp_buf = xrealloc (tmp_buf, tmp_len + num);
1064 memcpy (tmp_buf + tmp_len, buffer, num);
1069 input_line_pointer = ends ? ends + 8 : NULL;
1077 input_line_pointer = ends + 8;
1081 scrub_string_end = ends;
1083 new_length = ends - s;
1084 new_buf = (char *) xmalloc (new_length);
1091 space = (new_buf + new_length) - new_tmp;
1092 size = do_scrub_chars (scrub_from_string, new_tmp, space);
1100 new_buf = xrealloc (new_buf, new_length + 100);
1101 new_tmp = new_buf + new_length;
1108 /* We've "scrubbed" input to the preferred format. In the
1109 process we may have consumed the whole of the remaining
1110 file (and included files). We handle this formatted
1111 input similar to that of macro expansion, letting
1112 actual macro expansion (possibly nested) and other
1113 input expansion work. Beware that in messages, line
1114 numbers and possibly file names will be incorrect. */
1115 sb_add_string (&sbuf, new_buf);
1116 input_scrub_include_sb (&sbuf, input_line_pointer, 0);
1118 buffer_limit = input_scrub_next_buffer (&input_line_pointer);
1123 HANDLE_CONDITIONAL_ASSEMBLY ();
1125 #ifdef tc_unrecognized_line
1126 if (tc_unrecognized_line (c))
1129 input_line_pointer--;
1130 /* Report unknown char as ignored. */
1131 demand_empty_rest_of_line ();
1134 #ifdef md_after_pass_hook
1135 md_after_pass_hook ();
1144 /* Close the input file. */
1145 input_scrub_close ();
1146 #ifdef WARN_COMMENTS
1148 if (warn_comment && found_comment)
1149 as_warn_where (found_comment_file, found_comment,
1150 "first comment found here");
1155 /* Convert O_constant expression EXP into the equivalent O_big representation.
1156 Take the sign of the number from X_unsigned rather than X_add_number. */
1159 convert_to_bignum (expressionS *exp)
1164 value = exp->X_add_number;
1165 for (i = 0; i < sizeof (exp->X_add_number) / CHARS_PER_LITTLENUM; i++)
1167 generic_bignum[i] = value & LITTLENUM_MASK;
1168 value >>= LITTLENUM_NUMBER_OF_BITS;
1170 /* Add a sequence of sign bits if the top bit of X_add_number is not
1171 the sign of the original value. */
1172 if ((exp->X_add_number < 0) != !exp->X_unsigned)
1173 generic_bignum[i++] = exp->X_unsigned ? 0 : LITTLENUM_MASK;
1175 exp->X_add_number = i;
1178 /* For most MRI pseudo-ops, the line actually ends at the first
1179 nonquoted space. This function looks for that point, stuffs a null
1180 in, and sets *STOPCP to the character that used to be there, and
1181 returns the location.
1183 Until I hear otherwise, I am going to assume that this is only true
1184 for the m68k MRI assembler. */
1187 mri_comment_field (char *stopcp)
1193 know (flag_m68k_mri);
1195 for (s = input_line_pointer;
1196 ((!is_end_of_line[(unsigned char) *s] && *s != ' ' && *s != '\t')
1204 for (s = input_line_pointer;
1205 !is_end_of_line[(unsigned char) *s];
1215 /* Skip to the end of an MRI comment field. */
1218 mri_comment_end (char *stop, int stopc)
1222 input_line_pointer = stop;
1224 while (!is_end_of_line[(unsigned char) *input_line_pointer])
1225 ++input_line_pointer;
1229 s_abort (int ignore ATTRIBUTE_UNUSED)
1231 as_fatal (_(".abort detected. Abandoning ship."));
1234 /* Guts of .align directive. N is the power of two to which to align.
1235 FILL may be NULL, or it may point to the bytes of the fill pattern.
1236 LEN is the length of whatever FILL points to, if anything. MAX is
1237 the maximum number of characters to skip when doing the alignment,
1238 or 0 if there is no maximum. */
1241 do_align (int n, char *fill, int len, int max)
1243 if (now_seg == absolute_section)
1247 if (*fill++ != '\0')
1249 as_warn (_("ignoring fill value in absolute section"));
1256 #ifdef md_flush_pending_output
1257 md_flush_pending_output ();
1260 md_do_align (n, fill, len, max, just_record_alignment);
1263 /* Only make a frag if we HAVE to... */
1264 if (n != 0 && !need_pass_2)
1268 if (subseg_text_p (now_seg))
1269 frag_align_code (n, max);
1271 frag_align (n, 0, max);
1274 frag_align (n, *fill, max);
1276 frag_align_pattern (n, fill, len, max);
1280 just_record_alignment: ATTRIBUTE_UNUSED_LABEL
1283 record_alignment (now_seg, n - OCTETS_PER_BYTE_POWER);
1286 /* Handle the .align pseudo-op. A positive ARG is a default alignment
1287 (in bytes). A negative ARG is the negative of the length of the
1288 fill pattern. BYTES_P is non-zero if the alignment value should be
1289 interpreted as the byte boundary, rather than the power of 2. */
1291 #ifdef BFD_ASSEMBLER
1292 #define ALIGN_LIMIT (stdoutput->arch_info->bits_per_address - 1)
1294 #define ALIGN_LIMIT 15
1298 s_align (int arg, int bytes_p)
1300 unsigned int align_limit = ALIGN_LIMIT;
1309 stop = mri_comment_field (&stopc);
1311 if (is_end_of_line[(unsigned char) *input_line_pointer])
1316 align = arg; /* Default value from pseudo-op table. */
1320 align = get_absolute_expression ();
1326 /* Convert to a power of 2. */
1331 for (i = 0; (align & 1) == 0; align >>= 1, ++i)
1334 as_bad (_("alignment not a power of 2"));
1340 if (align > align_limit)
1342 align = align_limit;
1343 as_warn (_("alignment too large: %u assumed"), align);
1346 if (*input_line_pointer != ',')
1353 ++input_line_pointer;
1354 if (*input_line_pointer == ',')
1358 fill = get_absolute_expression ();
1363 if (*input_line_pointer != ',')
1367 ++input_line_pointer;
1368 max = get_absolute_expression ();
1375 as_warn (_("expected fill pattern missing"));
1376 do_align (align, (char *) NULL, 0, max);
1391 do_align (align, &fill_char, fill_len, max);
1397 if ((size_t) fill_len > sizeof ab)
1399 md_number_to_chars (ab, fill, fill_len);
1400 do_align (align, ab, fill_len, max);
1404 demand_empty_rest_of_line ();
1407 mri_comment_end (stop, stopc);
1410 /* Handle the .align pseudo-op on machines where ".align 4" means
1411 align to a 4 byte boundary. */
1414 s_align_bytes (int arg)
1419 /* Handle the .align pseudo-op on machines where ".align 4" means align
1420 to a 2**4 boundary. */
1423 s_align_ptwo (int arg)
1428 /* Switch in and out of alternate macro mode. */
1433 demand_empty_rest_of_line ();
1434 macro_set_alternate (on);
1438 s_comm_internal (int param,
1439 symbolS *(*comm_parse_extra) (int, symbolS *, addressT))
1445 symbolS *symbolP = NULL;
1451 stop = mri_comment_field (&stopc);
1453 name = input_line_pointer;
1454 c = get_symbol_end ();
1455 /* Just after name is now '\0'. */
1456 p = input_line_pointer;
1461 as_bad (_("expected symbol name"));
1462 discard_rest_of_line ();
1468 /* Accept an optional comma after the name. The comma used to be
1469 required, but Irix 5 cc does not generate it for .lcomm. */
1470 if (*input_line_pointer == ',')
1471 input_line_pointer++;
1473 temp = get_absolute_expr (&exp);
1475 #ifdef BFD_ASSEMBLER
1476 size &= ((offsetT) 2 << (stdoutput->arch_info->bits_per_address - 1)) - 1;
1478 if (exp.X_op == O_absent)
1480 as_bad (_("missing size expression"));
1481 ignore_rest_of_line ();
1484 else if (temp != size || !exp.X_unsigned)
1486 as_warn (_("size (%ld) out of range, ignored"), (long) temp);
1487 ignore_rest_of_line ();
1492 symbolP = symbol_find_or_make (name);
1493 if (S_IS_DEFINED (symbolP) && !S_IS_COMMON (symbolP))
1496 as_bad (_("symbol `%s' is already defined"), name);
1498 ignore_rest_of_line ();
1502 size = S_GET_VALUE (symbolP);
1505 else if (size != temp)
1506 as_warn (_("size of \"%s\" is already %ld; not changing to %ld"),
1507 name, (long) size, (long) temp);
1510 if (comm_parse_extra != NULL)
1511 symbolP = (*comm_parse_extra) (param, symbolP, size);
1514 S_SET_VALUE (symbolP, (valueT) size);
1515 S_SET_EXTERNAL (symbolP);
1518 extern int flag_one;
1519 if (size == 0 || !flag_one)
1520 S_GET_OTHER (symbolP) = const_flag;
1525 demand_empty_rest_of_line ();
1528 mri_comment_end (stop, stopc);
1535 s_comm_internal (ignore, NULL);
1538 /* The MRI COMMON pseudo-op. We handle this by creating a common
1539 symbol with the appropriate name. We make s_space do the right
1540 thing by increasing the size. */
1543 s_mri_common (int small ATTRIBUTE_UNUSED)
1559 stop = mri_comment_field (&stopc);
1563 name = input_line_pointer;
1564 if (!ISDIGIT (*name))
1565 c = get_symbol_end ();
1570 ++input_line_pointer;
1572 while (ISDIGIT (*input_line_pointer));
1574 c = *input_line_pointer;
1575 *input_line_pointer = '\0';
1577 if (line_label != NULL)
1579 alc = (char *) xmalloc (strlen (S_GET_NAME (line_label))
1580 + (input_line_pointer - name)
1582 sprintf (alc, "%s%s", name, S_GET_NAME (line_label));
1587 sym = symbol_find_or_make (name);
1588 *input_line_pointer = c;
1592 if (*input_line_pointer != ',')
1596 ++input_line_pointer;
1597 align = get_absolute_expression ();
1600 if (S_IS_DEFINED (sym) && !S_IS_COMMON (sym))
1602 as_bad (_("symbol `%s' is already defined"), S_GET_NAME (sym));
1603 ignore_rest_of_line ();
1604 mri_comment_end (stop, stopc);
1608 S_SET_EXTERNAL (sym);
1609 mri_common_symbol = sym;
1613 S_SET_ALIGN (sym, align);
1616 if (line_label != NULL)
1619 exp.X_op = O_symbol;
1620 exp.X_add_symbol = sym;
1621 exp.X_add_number = 0;
1622 symbol_set_value_expression (line_label, &exp);
1623 symbol_set_frag (line_label, &zero_address_frag);
1624 S_SET_SEGMENT (line_label, expr_section);
1627 /* FIXME: We just ignore the small argument, which distinguishes
1628 COMMON and COMMON.S. I don't know what we can do about it. */
1630 /* Ignore the type and hptype. */
1631 if (*input_line_pointer == ',')
1632 input_line_pointer += 2;
1633 if (*input_line_pointer == ',')
1634 input_line_pointer += 2;
1636 demand_empty_rest_of_line ();
1638 mri_comment_end (stop, stopc);
1642 s_data (int ignore ATTRIBUTE_UNUSED)
1647 temp = get_absolute_expression ();
1648 if (flag_readonly_data_in_text)
1650 section = text_section;
1654 section = data_section;
1656 subseg_set (section, (subsegT) temp);
1661 demand_empty_rest_of_line ();
1664 /* Handle the .appfile pseudo-op. This is automatically generated by
1665 do_scrub_chars when a preprocessor # line comment is seen with a
1666 file name. This default definition may be overridden by the object
1667 or CPU specific pseudo-ops. This function is also the default
1668 definition for .file; the APPFILE argument is 1 for .appfile, 0 for
1672 s_app_file_string (char *file, int appfile ATTRIBUTE_UNUSED)
1676 listing_source_file (file);
1678 register_dependency (file);
1680 obj_app_file (file, appfile);
1685 s_app_file (int appfile)
1690 /* Some assemblers tolerate immediately following '"'. */
1691 if ((s = demand_copy_string (&length)) != 0)
1693 /* If this is a fake .appfile, a fake newline was inserted into
1694 the buffer. Passing -2 to new_logical_line tells it to
1697 = (!new_logical_line (s, appfile ? -2 : -1) && appfile);
1699 /* In MRI mode, the preprocessor may have inserted an extraneous
1702 && *input_line_pointer == '\''
1703 && is_end_of_line[(unsigned char) input_line_pointer[1]])
1704 ++input_line_pointer;
1706 demand_empty_rest_of_line ();
1708 s_app_file_string (s, appfile);
1712 /* Handle the .appline pseudo-op. This is automatically generated by
1713 do_scrub_chars when a preprocessor # line comment is seen. This
1714 default definition may be overridden by the object or CPU specific
1718 s_app_line (int ignore ATTRIBUTE_UNUSED)
1722 /* The given number is that of the next line. */
1723 l = get_absolute_expression () - 1;
1725 /* Some of the back ends can't deal with non-positive line numbers.
1726 Besides, it's silly. */
1727 as_warn (_("line numbers must be positive; line number %d rejected"),
1731 new_logical_line ((char *) NULL, l);
1734 listing_source_line (l);
1737 demand_empty_rest_of_line ();
1740 /* Handle the .end pseudo-op. Actually, the real work is done in
1741 read_a_source_file. */
1744 s_end (int ignore ATTRIBUTE_UNUSED)
1748 /* The MRI assembler permits the start symbol to follow .end,
1749 but we don't support that. */
1751 if (!is_end_of_line[(unsigned char) *input_line_pointer]
1752 && *input_line_pointer != '*'
1753 && *input_line_pointer != '!')
1754 as_warn (_("start address not supported"));
1758 /* Handle the .err pseudo-op. */
1761 s_err (int ignore ATTRIBUTE_UNUSED)
1763 as_bad (_(".err encountered"));
1764 demand_empty_rest_of_line ();
1767 /* Handle the .error and .warning pseudo-ops. */
1773 /* The purpose for the conditional assignment is not to
1774 internationalize the directive itself, but that we need a
1775 self-contained message, one that can be passed like the
1776 demand_copy_C_string return value, and with no assumption on the
1777 location of the name of the directive within the message. */
1779 = (err ? _(".error directive invoked in source file")
1780 : _(".warning directive invoked in source file"));
1782 if (!is_it_end_of_statement ())
1784 if (*input_line_pointer != '\"')
1786 as_bad (_("%s argument must be a string"),
1787 err ? ".error" : ".warning");
1788 discard_rest_of_line ();
1792 msg = demand_copy_C_string (&len);
1800 as_warn ("%s", msg);
1801 demand_empty_rest_of_line ();
1804 /* Handle the MRI fail pseudo-op. */
1807 s_fail (int ignore ATTRIBUTE_UNUSED)
1814 stop = mri_comment_field (&stopc);
1816 temp = get_absolute_expression ();
1818 as_warn (_(".fail %ld encountered"), (long) temp);
1820 as_bad (_(".fail %ld encountered"), (long) temp);
1822 demand_empty_rest_of_line ();
1825 mri_comment_end (stop, stopc);
1829 s_fill (int ignore ATTRIBUTE_UNUSED)
1831 expressionS rep_exp;
1833 register long fill = 0;
1836 #ifdef md_flush_pending_output
1837 md_flush_pending_output ();
1840 get_known_segmented_expression (&rep_exp);
1841 if (*input_line_pointer == ',')
1843 input_line_pointer++;
1844 size = get_absolute_expression ();
1845 if (*input_line_pointer == ',')
1847 input_line_pointer++;
1848 fill = get_absolute_expression ();
1852 /* This is to be compatible with BSD 4.2 AS, not for any rational reason. */
1853 #define BSD_FILL_SIZE_CROCK_8 (8)
1854 if (size > BSD_FILL_SIZE_CROCK_8)
1856 as_warn (_(".fill size clamped to %d"), BSD_FILL_SIZE_CROCK_8);
1857 size = BSD_FILL_SIZE_CROCK_8;
1861 as_warn (_("size negative; .fill ignored"));
1864 else if (rep_exp.X_op == O_constant && rep_exp.X_add_number <= 0)
1866 if (rep_exp.X_add_number < 0)
1867 as_warn (_("repeat < 0; .fill ignored"));
1871 if (size && !need_pass_2)
1873 if (rep_exp.X_op == O_constant)
1875 p = frag_var (rs_fill, (int) size, (int) size,
1876 (relax_substateT) 0, (symbolS *) 0,
1877 (offsetT) rep_exp.X_add_number,
1882 /* We don't have a constant repeat count, so we can't use
1883 rs_fill. We can get the same results out of rs_space,
1884 but its argument is in bytes, so we must multiply the
1885 repeat count by size. */
1888 rep_sym = make_expr_symbol (&rep_exp);
1891 expressionS size_exp;
1892 size_exp.X_op = O_constant;
1893 size_exp.X_add_number = size;
1895 rep_exp.X_op = O_multiply;
1896 rep_exp.X_add_symbol = rep_sym;
1897 rep_exp.X_op_symbol = make_expr_symbol (&size_exp);
1898 rep_exp.X_add_number = 0;
1899 rep_sym = make_expr_symbol (&rep_exp);
1902 p = frag_var (rs_space, (int) size, (int) size,
1903 (relax_substateT) 0, rep_sym, (offsetT) 0, (char *) 0);
1906 memset (p, 0, (unsigned int) size);
1908 /* The magic number BSD_FILL_SIZE_CROCK_4 is from BSD 4.2 VAX
1909 flavoured AS. The following bizarre behaviour is to be
1910 compatible with above. I guess they tried to take up to 8
1911 bytes from a 4-byte expression and they forgot to sign
1913 #define BSD_FILL_SIZE_CROCK_4 (4)
1914 md_number_to_chars (p, (valueT) fill,
1915 (size > BSD_FILL_SIZE_CROCK_4
1916 ? BSD_FILL_SIZE_CROCK_4
1918 /* Note: .fill (),0 emits no frag (since we are asked to .fill 0 bytes)
1919 but emits no error message because it seems a legal thing to do.
1920 It is a degenerate case of .fill but could be emitted by a
1923 demand_empty_rest_of_line ();
1927 s_globl (int ignore ATTRIBUTE_UNUSED)
1936 stop = mri_comment_field (&stopc);
1940 name = input_line_pointer;
1941 c = get_symbol_end ();
1942 symbolP = symbol_find_or_make (name);
1943 S_SET_EXTERNAL (symbolP);
1945 *input_line_pointer = c;
1947 c = *input_line_pointer;
1950 input_line_pointer++;
1952 if (is_end_of_line[(unsigned char) *input_line_pointer])
1958 demand_empty_rest_of_line ();
1961 mri_comment_end (stop, stopc);
1964 /* Handle the MRI IRP and IRPC pseudo-ops. */
1975 as_where (&file, &line);
1978 while (!is_end_of_line[(unsigned char) *input_line_pointer])
1979 sb_add_char (&s, *input_line_pointer++);
1983 err = expand_irp (irpc, 0, &s, &out, get_line_sb);
1985 as_bad_where (file, line, "%s", err);
1989 input_scrub_include_sb (&out, input_line_pointer, 1);
1991 buffer_limit = input_scrub_next_buffer (&input_line_pointer);
1994 /* Handle the .linkonce pseudo-op. This tells the assembler to mark
1995 the section to only be linked once. However, this is not supported
1996 by most object file formats. This takes an optional argument,
1997 which is what to do about duplicates. */
2000 s_linkonce (int ignore ATTRIBUTE_UNUSED)
2002 enum linkonce_type type;
2006 type = LINKONCE_DISCARD;
2008 if (!is_end_of_line[(unsigned char) *input_line_pointer])
2013 s = input_line_pointer;
2014 c = get_symbol_end ();
2015 if (strcasecmp (s, "discard") == 0)
2016 type = LINKONCE_DISCARD;
2017 else if (strcasecmp (s, "one_only") == 0)
2018 type = LINKONCE_ONE_ONLY;
2019 else if (strcasecmp (s, "same_size") == 0)
2020 type = LINKONCE_SAME_SIZE;
2021 else if (strcasecmp (s, "same_contents") == 0)
2022 type = LINKONCE_SAME_CONTENTS;
2024 as_warn (_("unrecognized .linkonce type `%s'"), s);
2026 *input_line_pointer = c;
2029 #ifdef obj_handle_link_once
2030 obj_handle_link_once (type);
2031 #else /* ! defined (obj_handle_link_once) */
2032 #ifdef BFD_ASSEMBLER
2036 if ((bfd_applicable_section_flags (stdoutput) & SEC_LINK_ONCE) == 0)
2037 as_warn (_(".linkonce is not supported for this object file format"));
2039 flags = bfd_get_section_flags (stdoutput, now_seg);
2040 flags |= SEC_LINK_ONCE;
2045 case LINKONCE_DISCARD:
2046 flags |= SEC_LINK_DUPLICATES_DISCARD;
2048 case LINKONCE_ONE_ONLY:
2049 flags |= SEC_LINK_DUPLICATES_ONE_ONLY;
2051 case LINKONCE_SAME_SIZE:
2052 flags |= SEC_LINK_DUPLICATES_SAME_SIZE;
2054 case LINKONCE_SAME_CONTENTS:
2055 flags |= SEC_LINK_DUPLICATES_SAME_CONTENTS;
2058 if (!bfd_set_section_flags (stdoutput, now_seg, flags))
2059 as_bad (_("bfd_set_section_flags: %s"),
2060 bfd_errmsg (bfd_get_error ()));
2062 #else /* ! defined (BFD_ASSEMBLER) */
2063 as_warn (_(".linkonce is not supported for this object file format"));
2064 #endif /* ! defined (BFD_ASSEMBLER) */
2065 #endif /* ! defined (obj_handle_link_once) */
2067 demand_empty_rest_of_line ();
2071 bss_alloc (symbolS *symbolP, addressT size, int align)
2074 segT current_seg = now_seg;
2075 subsegT current_subseg = now_subseg;
2076 segT bss_seg = bss_section;
2078 #if defined (TC_MIPS) || defined (TC_ALPHA)
2079 if (OUTPUT_FLAVOR == bfd_target_ecoff_flavour
2080 || OUTPUT_FLAVOR == bfd_target_elf_flavour)
2082 /* For MIPS and Alpha ECOFF or ELF, small objects are put in .sbss. */
2083 if (size <= bfd_get_gp_size (stdoutput))
2085 bss_seg = subseg_new (".sbss", 1);
2086 seg_info (bss_seg)->bss = 1;
2087 #ifdef BFD_ASSEMBLER
2088 if (!bfd_set_section_flags (stdoutput, bss_seg, SEC_ALLOC))
2089 as_warn (_("error setting flags for \".sbss\": %s"),
2090 bfd_errmsg (bfd_get_error ()));
2095 subseg_set (bss_seg, 1);
2099 record_alignment (bss_seg, align);
2100 frag_align (align, 0, 0);
2103 /* Detach from old frag. */
2104 if (S_GET_SEGMENT (symbolP) == bss_seg)
2105 symbol_get_frag (symbolP)->fr_symbol = NULL;
2107 symbol_set_frag (symbolP, frag_now);
2108 pfrag = frag_var (rs_org, 1, 1, 0, symbolP, size, NULL);
2112 S_SET_SIZE (symbolP, size);
2114 S_SET_SEGMENT (symbolP, bss_seg);
2117 /* The symbol may already have been created with a preceding
2118 ".globl" directive -- be careful not to step on storage class
2119 in that case. Otherwise, set it to static. */
2120 if (S_GET_STORAGE_CLASS (symbolP) != C_EXT)
2121 S_SET_STORAGE_CLASS (symbolP, C_STAT);
2122 #endif /* OBJ_COFF */
2124 subseg_set (current_seg, current_subseg);
2128 parse_align (int align_bytes)
2134 if (*input_line_pointer != ',')
2137 as_bad (_("expected alignment after size"));
2138 ignore_rest_of_line ();
2142 input_line_pointer++;
2145 align = get_absolute_expr (&exp);
2146 if (exp.X_op == O_absent)
2149 if (!exp.X_unsigned)
2151 as_warn (_("alignment negative; 0 assumed"));
2155 if (align_bytes && align != 0)
2157 /* convert to a power of 2 alignment */
2158 unsigned int alignp2 = 0;
2159 while ((align & 1) == 0)
2160 align >>= 1, ++alignp2;
2163 as_bad (_("alignment not a power of 2"));
2164 ignore_rest_of_line ();
2172 /* Called from s_comm_internal after symbol name and size have been
2173 parsed. NEEDS_ALIGN is 0 if it was an ".lcomm" (2 args only),
2174 1 if this was a ".bss" directive which has a 3rd argument
2175 (alignment as a power of 2), or 2 if this was a ".bss" directive
2176 with alignment in bytes. */
2179 s_lcomm_internal (int needs_align, symbolS *symbolP, addressT size)
2185 align = parse_align (needs_align - 1);
2186 if (align == (addressT) -1)
2190 /* Assume some objects may require alignment on some systems. */
2191 TC_IMPLICIT_LCOMM_ALIGNMENT (size, align);
2193 bss_alloc (symbolP, size, align);
2198 s_lcomm (int needs_align)
2200 s_comm_internal (needs_align, s_lcomm_internal);
2204 s_lcomm_bytes (int needs_align)
2206 s_comm_internal (needs_align * 2, s_lcomm_internal);
2210 s_lsym (int ignore ATTRIBUTE_UNUSED)
2212 register char *name;
2216 register symbolS *symbolP;
2218 /* We permit ANY defined expression: BSD4.2 demands constants. */
2219 name = input_line_pointer;
2220 c = get_symbol_end ();
2221 p = input_line_pointer;
2226 as_bad (_("expected symbol name"));
2227 discard_rest_of_line ();
2233 if (*input_line_pointer != ',')
2236 as_bad (_("expected comma after \"%s\""), name);
2238 ignore_rest_of_line ();
2242 input_line_pointer++;
2245 if (exp.X_op != O_constant
2246 && exp.X_op != O_register)
2248 as_bad (_("bad expression"));
2249 ignore_rest_of_line ();
2254 symbolP = symbol_find_or_make (name);
2256 /* FIXME-SOON I pulled a (&& symbolP->sy_other == 0 &&
2257 symbolP->sy_desc == 0) out of this test because coff doesn't have
2258 those fields, and I can't see when they'd ever be tripped. I
2259 don't think I understand why they were here so I may have
2260 introduced a bug. As recently as 1.37 didn't have this test
2261 anyway. xoxorich. */
2263 if (S_GET_SEGMENT (symbolP) == undefined_section
2264 && S_GET_VALUE (symbolP) == 0)
2266 /* The name might be an undefined .global symbol; be sure to
2267 keep the "external" bit. */
2268 S_SET_SEGMENT (symbolP,
2269 (exp.X_op == O_constant
2272 S_SET_VALUE (symbolP, (valueT) exp.X_add_number);
2276 as_bad (_("symbol `%s' is already defined"), name);
2280 demand_empty_rest_of_line ();
2283 /* Read a line into an sb. Returns the character that ended the line
2284 or zero if there are no more lines. */
2287 get_line_sb (sb *line)
2289 char quote1, quote2, inquote;
2292 if (input_line_pointer[-1] == '\n')
2293 bump_line_counters ();
2295 if (input_line_pointer >= buffer_limit)
2297 buffer_limit = input_scrub_next_buffer (&input_line_pointer);
2298 if (buffer_limit == 0)
2302 /* If app.c sets any other characters to LEX_IS_STRINGQUOTE, this
2303 code needs to be changed. */
2312 #ifdef LEX_IS_STRINGQUOTE
2318 while ((c = * input_line_pointer ++) != 0
2319 && (!is_end_of_line[c]
2320 || (inquote != '\0' && c != '\n')))
2324 else if (inquote == '\0')
2328 else if (c == quote2)
2332 sb_add_char (line, c);
2335 /* Don't skip multiple end-of-line characters, because that breaks support
2336 for the IA-64 stop bit (;;) which looks like two consecutive end-of-line
2337 characters but isn't. Instead just skip one end of line character and
2338 return the character skipped so that the caller can re-insert it if
2343 /* Define a macro. This is an interface to macro.c. */
2346 s_macro (int ignore ATTRIBUTE_UNUSED)
2355 as_where (&file, &line);
2358 while (!is_end_of_line[(unsigned char) *input_line_pointer])
2359 sb_add_char (&s, *input_line_pointer++);
2362 if (line_label != NULL)
2363 sb_add_string (&label, S_GET_NAME (line_label));
2365 err = define_macro (0, &s, &label, get_line_sb, file, line, &name);
2367 as_bad_where (file, line, err, name);
2370 if (line_label != NULL)
2372 S_SET_SEGMENT (line_label, absolute_section);
2373 S_SET_VALUE (line_label, 0);
2374 symbol_set_frag (line_label, &zero_address_frag);
2377 if (((NO_PSEUDO_DOT || flag_m68k_mri)
2378 && hash_find (po_hash, name) != NULL)
2381 && hash_find (po_hash, name + 1) != NULL))
2382 as_warn_where (file,
2384 _("attempt to redefine pseudo-op `%s' ignored"),
2391 /* Handle the .mexit pseudo-op, which immediately exits a macro
2395 s_mexit (int ignore ATTRIBUTE_UNUSED)
2397 cond_exit_macro (macro_nest);
2398 buffer_limit = input_scrub_next_buffer (&input_line_pointer);
2401 /* Switch in and out of MRI mode. */
2404 s_mri (int ignore ATTRIBUTE_UNUSED)
2408 on = get_absolute_expression ();
2409 old_flag = flag_mri;
2427 /* Operator precedence changes in m68k MRI mode, so we need to
2428 update the operator rankings. */
2429 expr_set_precedence ();
2431 #ifdef MRI_MODE_CHANGE
2433 MRI_MODE_CHANGE (on);
2436 demand_empty_rest_of_line ();
2439 /* Handle changing the location counter. */
2442 do_org (segT segment, expressionS *exp, int fill)
2444 if (segment != now_seg && segment != absolute_section)
2445 as_bad (_("invalid segment \"%s\""), segment_name (segment));
2447 if (now_seg == absolute_section)
2450 as_warn (_("ignoring fill value in absolute section"));
2451 if (exp->X_op != O_constant)
2453 as_bad (_("only constant offsets supported in absolute section"));
2454 exp->X_add_number = 0;
2456 abs_section_offset = exp->X_add_number;
2461 symbolS *sym = exp->X_add_symbol;
2462 offsetT off = exp->X_add_number * OCTETS_PER_BYTE;
2464 if (exp->X_op != O_constant && exp->X_op != O_symbol)
2466 /* Handle complex expressions. */
2467 sym = make_expr_symbol (exp);
2471 p = frag_var (rs_org, 1, 1, (relax_substateT) 0, sym, off, (char *) 0);
2477 s_org (int ignore ATTRIBUTE_UNUSED)
2479 register segT segment;
2481 register long temp_fill;
2483 #ifdef md_flush_pending_output
2484 md_flush_pending_output ();
2487 /* The m68k MRI assembler has a different meaning for .org. It
2488 means to create an absolute section at a given address. We can't
2489 support that--use a linker script instead. */
2492 as_bad (_("MRI style ORG pseudo-op not supported"));
2493 ignore_rest_of_line ();
2497 /* Don't believe the documentation of BSD 4.2 AS. There is no such
2498 thing as a sub-segment-relative origin. Any absolute origin is
2499 given a warning, then assumed to be segment-relative. Any
2500 segmented origin expression ("foo+42") had better be in the right
2501 segment or the .org is ignored.
2503 BSD 4.2 AS warns if you try to .org backwards. We cannot because
2504 we never know sub-segment sizes when we are reading code. BSD
2505 will crash trying to emit negative numbers of filler bytes in
2506 certain .orgs. We don't crash, but see as-write for that code.
2508 Don't make frag if need_pass_2==1. */
2509 segment = get_known_segmented_expression (&exp);
2510 if (*input_line_pointer == ',')
2512 input_line_pointer++;
2513 temp_fill = get_absolute_expression ();
2519 do_org (segment, &exp, temp_fill);
2521 demand_empty_rest_of_line ();
2524 /* Handle parsing for the MRI SECT/SECTION pseudo-op. This should be
2525 called by the obj-format routine which handles section changing
2526 when in MRI mode. It will create a new section, and return it. It
2527 will set *TYPE to the section type: one of 'C' (code), 'D' (data),
2528 'M' (mixed), or 'R' (romable). If BFD_ASSEMBLER is defined, the
2529 flags will be set in the section. */
2532 s_mri_sect (char *type ATTRIBUTE_UNUSED)
2542 name = input_line_pointer;
2543 if (!ISDIGIT (*name))
2544 c = get_symbol_end ();
2549 ++input_line_pointer;
2551 while (ISDIGIT (*input_line_pointer));
2553 c = *input_line_pointer;
2554 *input_line_pointer = '\0';
2557 name = xstrdup (name);
2559 *input_line_pointer = c;
2561 seg = subseg_new (name, 0);
2563 if (*input_line_pointer == ',')
2567 ++input_line_pointer;
2568 align = get_absolute_expression ();
2569 record_alignment (seg, align);
2573 if (*input_line_pointer == ',')
2575 c = *++input_line_pointer;
2577 if (c == 'C' || c == 'D' || c == 'M' || c == 'R')
2580 as_bad (_("unrecognized section type"));
2581 ++input_line_pointer;
2583 #ifdef BFD_ASSEMBLER
2587 flags = SEC_NO_FLAGS;
2589 flags = SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_CODE;
2590 else if (*type == 'D' || *type == 'M')
2591 flags = SEC_ALLOC | SEC_LOAD | SEC_DATA;
2592 else if (*type == 'R')
2593 flags = SEC_ALLOC | SEC_LOAD | SEC_DATA | SEC_READONLY | SEC_ROM;
2594 if (flags != SEC_NO_FLAGS)
2596 if (!bfd_set_section_flags (stdoutput, seg, flags))
2597 as_warn (_("error setting flags for \"%s\": %s"),
2598 bfd_section_name (stdoutput, seg),
2599 bfd_errmsg (bfd_get_error ()));
2605 /* Ignore the HP type. */
2606 if (*input_line_pointer == ',')
2607 input_line_pointer += 2;
2609 demand_empty_rest_of_line ();
2611 #else /* ! TC_M68K */
2620 name = input_line_pointer;
2621 c = get_symbol_end ();
2623 name = xstrdup (name);
2625 *input_line_pointer = c;
2627 seg = subseg_new (name, 0);
2629 if (*input_line_pointer != ',')
2635 ++input_line_pointer;
2637 sectype = input_line_pointer;
2638 c = get_symbol_end ();
2639 if (*sectype == '\0')
2641 else if (strcasecmp (sectype, "text") == 0)
2643 else if (strcasecmp (sectype, "data") == 0)
2645 else if (strcasecmp (sectype, "romdata") == 0)
2648 as_warn (_("unrecognized section type `%s'"), sectype);
2649 *input_line_pointer = c;
2652 if (*input_line_pointer == ',')
2656 ++input_line_pointer;
2658 seccmd = input_line_pointer;
2659 c = get_symbol_end ();
2660 if (strcasecmp (seccmd, "absolute") == 0)
2662 as_bad (_("absolute sections are not supported"));
2663 *input_line_pointer = c;
2664 ignore_rest_of_line ();
2667 else if (strcasecmp (seccmd, "align") == 0)
2671 *input_line_pointer = c;
2672 align = get_absolute_expression ();
2673 record_alignment (seg, align);
2677 as_warn (_("unrecognized section command `%s'"), seccmd);
2678 *input_line_pointer = c;
2682 demand_empty_rest_of_line ();
2684 #else /* ! TC_I960 */
2685 /* The MRI assembler seems to use different forms of .sect for
2686 different targets. */
2687 as_bad ("MRI mode not supported for this target");
2688 ignore_rest_of_line ();
2689 #endif /* ! TC_I960 */
2690 #endif /* ! TC_M68K */
2693 /* Handle the .print pseudo-op. */
2696 s_print (int ignore ATTRIBUTE_UNUSED)
2701 s = demand_copy_C_string (&len);
2704 demand_empty_rest_of_line ();
2707 /* Handle the .purgem pseudo-op. */
2710 s_purgem (int ignore ATTRIBUTE_UNUSED)
2712 if (is_it_end_of_statement ())
2714 demand_empty_rest_of_line ();
2724 name = input_line_pointer;
2725 c = get_symbol_end ();
2726 delete_macro (name);
2727 *input_line_pointer = c;
2730 while (*input_line_pointer++ == ',');
2732 --input_line_pointer;
2733 demand_empty_rest_of_line ();
2736 /* Handle the .endm/.endr pseudo-ops. */
2739 s_bad_end (int endr)
2741 as_warn (_(".end%c encountered without preceeding %s"),
2743 endr ? ".rept, .irp, or .irpc" : ".macro");
2744 demand_empty_rest_of_line ();
2747 /* Handle the .rept pseudo-op. */
2750 s_rept (int ignore ATTRIBUTE_UNUSED)
2754 count = get_absolute_expression ();
2756 do_repeat (count, "REPT", "ENDR");
2759 /* This function provides a generic repeat block implementation. It allows
2760 different directives to be used as the start/end keys. */
2763 do_repeat (int count, const char *start, const char *end)
2769 if (!buffer_and_nest (start, end, &one, get_line_sb))
2771 as_bad (_("%s without %s"), start, end);
2777 sb_add_sb (&many, &one);
2781 input_scrub_include_sb (&many, input_line_pointer, 1);
2783 buffer_limit = input_scrub_next_buffer (&input_line_pointer);
2786 /* Skip to end of current repeat loop; EXTRA indicates how many additional
2787 input buffers to skip. Assumes that conditionals preceding the loop end
2788 are properly nested.
2790 This function makes it easier to implement a premature "break" out of the
2791 loop. The EXTRA arg accounts for other buffers we might have inserted,
2792 such as line substitutions. */
2795 end_repeat (int extra)
2797 cond_exit_macro (macro_nest);
2798 while (extra-- >= 0)
2799 buffer_limit = input_scrub_next_buffer (&input_line_pointer);
2803 assign_symbol (char *name, int no_reassign)
2807 if (name[0] == '.' && name[1] == '\0')
2809 /* Turn '. = mumble' into a .org mumble. */
2813 segment = get_known_segmented_expression (&exp);
2816 do_org (segment, &exp, 0);
2821 if ((symbolP = symbol_find (name)) == NULL
2822 && (symbolP = md_undefined_symbol (name)) == NULL)
2824 symbolP = symbol_find_or_make (name);
2826 /* When doing symbol listings, play games with dummy fragments living
2827 outside the normal fragment chain to record the file and line info
2829 if (listing & LISTING_SYMBOLS)
2831 extern struct list_info_struct *listing_tail;
2832 fragS *dummy_frag = (fragS *) xcalloc (1, sizeof (fragS));
2833 dummy_frag->line = listing_tail;
2834 dummy_frag->fr_symbol = symbolP;
2835 symbol_set_frag (symbolP, dummy_frag);
2839 /* "set" symbols are local unless otherwise specified. */
2840 SF_SET_LOCAL (symbolP);
2844 /* Permit register names to be redefined. */
2846 && S_IS_DEFINED (symbolP)
2847 && S_GET_SEGMENT (symbolP) != reg_section)
2848 as_bad (_("symbol `%s' is already defined"), name);
2850 pseudo_set (symbolP);
2853 /* Handle the .equ, .equiv and .set directives. If EQUIV is 1, then
2854 this is .equiv, and it is an error if the symbol is already
2864 /* Especial apologies for the random logic:
2865 this just grew, and could be parsed much more simply!
2867 name = input_line_pointer;
2868 delim = get_symbol_end ();
2869 end_name = input_line_pointer;
2872 if (name == end_name)
2874 as_bad (_("expected symbol name"));
2875 discard_rest_of_line ();
2881 if (*input_line_pointer != ',')
2884 as_bad (_("expected comma after \"%s\""), name);
2886 ignore_rest_of_line ();
2890 input_line_pointer++;
2893 assign_symbol (name, equiv);
2896 demand_empty_rest_of_line ();
2909 #ifdef md_flush_pending_output
2910 md_flush_pending_output ();
2914 stop = mri_comment_field (&stopc);
2916 /* In m68k MRI mode, we need to align to a word boundary, unless
2918 if (flag_m68k_mri && mult > 1)
2920 if (now_seg == absolute_section)
2922 abs_section_offset += abs_section_offset & 1;
2923 if (line_label != NULL)
2924 S_SET_VALUE (line_label, abs_section_offset);
2926 else if (mri_common_symbol != NULL)
2930 val = S_GET_VALUE (mri_common_symbol);
2933 S_SET_VALUE (mri_common_symbol, val + 1);
2934 if (line_label != NULL)
2936 expressionS *symexp;
2938 symexp = symbol_get_value_expression (line_label);
2939 know (symexp->X_op == O_symbol);
2940 know (symexp->X_add_symbol == mri_common_symbol);
2941 symexp->X_add_number += 1;
2947 do_align (1, (char *) NULL, 0, 0);
2948 if (line_label != NULL)
2950 symbol_set_frag (line_label, frag_now);
2951 S_SET_VALUE (line_label, frag_now_fix ());
2961 if (*input_line_pointer == ',')
2963 ++input_line_pointer;
2968 val.X_op = O_constant;
2969 val.X_add_number = 0;
2972 if (val.X_op != O_constant
2973 || val.X_add_number < - 0x80
2974 || val.X_add_number > 0xff
2975 || (mult != 0 && mult != 1 && val.X_add_number != 0))
2977 if (exp.X_op != O_constant)
2978 as_bad (_("unsupported variable size or fill value"));
2985 bytes = mult * exp.X_add_number;
2986 for (i = 0; i < exp.X_add_number; i++)
2987 emit_expr (&val, mult);
2992 if (exp.X_op == O_constant)
2996 repeat = exp.X_add_number;
3003 as_warn (_(".space repeat count is zero, ignored"));
3004 else if (repeat < 0)
3005 as_warn (_(".space repeat count is negative, ignored"));
3009 /* If we are in the absolute section, just bump the offset. */
3010 if (now_seg == absolute_section)
3012 abs_section_offset += repeat;
3016 /* If we are secretly in an MRI common section, then
3017 creating space just increases the size of the common
3019 if (mri_common_symbol != NULL)
3021 S_SET_VALUE (mri_common_symbol,
3022 S_GET_VALUE (mri_common_symbol) + repeat);
3027 p = frag_var (rs_fill, 1, 1, (relax_substateT) 0, (symbolS *) 0,
3028 (offsetT) repeat, (char *) 0);
3032 if (now_seg == absolute_section)
3034 as_bad (_("space allocation too complex in absolute section"));
3035 subseg_set (text_section, 0);
3038 if (mri_common_symbol != NULL)
3040 as_bad (_("space allocation too complex in common section"));
3041 mri_common_symbol = NULL;
3045 p = frag_var (rs_space, 1, 1, (relax_substateT) 0,
3046 make_expr_symbol (&exp), (offsetT) 0, (char *) 0);
3050 *p = val.X_add_number;
3055 /* In MRI mode, after an odd number of bytes, we must align to an
3056 even word boundary, unless the next instruction is a dc.b, ds.b
3058 if (flag_mri && (bytes & 1) != 0)
3059 mri_pending_align = 1;
3061 demand_empty_rest_of_line ();
3064 mri_comment_end (stop, stopc);
3067 /* This is like s_space, but the value is a floating point number with
3068 the given precision. This is for the MRI dcb.s pseudo-op and
3072 s_float_space (int float_type)
3076 char temp[MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT];
3081 stop = mri_comment_field (&stopc);
3083 count = get_absolute_expression ();
3086 if (*input_line_pointer != ',')
3088 as_bad (_("missing value"));
3089 ignore_rest_of_line ();
3091 mri_comment_end (stop, stopc);
3095 ++input_line_pointer;
3099 /* Skip any 0{letter} that may be present. Don't even check if the
3100 * letter is legal. */
3101 if (input_line_pointer[0] == '0'
3102 && ISALPHA (input_line_pointer[1]))
3103 input_line_pointer += 2;
3105 /* Accept :xxxx, where the x's are hex digits, for a floating point
3106 with the exact digits specified. */
3107 if (input_line_pointer[0] == ':')
3109 flen = hex_float (float_type, temp);
3112 ignore_rest_of_line ();
3114 mri_comment_end (stop, stopc);
3122 err = md_atof (float_type, temp, &flen);
3123 know (flen <= MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT);
3127 as_bad (_("bad floating literal: %s"), err);
3128 ignore_rest_of_line ();
3130 mri_comment_end (stop, stopc);
3135 while (--count >= 0)
3139 p = frag_more (flen);
3140 memcpy (p, temp, (unsigned int) flen);
3143 demand_empty_rest_of_line ();
3146 mri_comment_end (stop, stopc);
3149 /* Handle the .struct pseudo-op, as found in MIPS assemblers. */
3152 s_struct (int ignore ATTRIBUTE_UNUSED)
3158 stop = mri_comment_field (&stopc);
3159 abs_section_offset = get_absolute_expression ();
3160 subseg_set (absolute_section, 0);
3161 demand_empty_rest_of_line ();
3163 mri_comment_end (stop, stopc);
3167 s_text (int ignore ATTRIBUTE_UNUSED)
3171 temp = get_absolute_expression ();
3172 subseg_set (text_section, (subsegT) temp);
3173 demand_empty_rest_of_line ();
3175 const_flag &= ~IN_DEFAULT_SECTION;
3180 /* Verify that we are at the end of a line. If not, issue an error and
3184 demand_empty_rest_of_line (void)
3187 if (is_end_of_line[(unsigned char) *input_line_pointer])
3188 input_line_pointer++;
3191 if (ISPRINT (*input_line_pointer))
3192 as_bad (_("junk at end of line, first unrecognized character is `%c'"),
3193 *input_line_pointer);
3195 as_bad (_("junk at end of line, first unrecognized character valued 0x%x"),
3196 *input_line_pointer);
3197 ignore_rest_of_line ();
3200 /* Return pointing just after end-of-line. */
3201 know (is_end_of_line[(unsigned char) input_line_pointer[-1]]);
3204 /* Silently advance to the end of line. Use this after already having
3205 issued an error about something bad. */
3208 ignore_rest_of_line (void)
3210 while (input_line_pointer < buffer_limit
3211 && !is_end_of_line[(unsigned char) *input_line_pointer])
3212 input_line_pointer++;
3214 input_line_pointer++;
3216 /* Return pointing just after end-of-line. */
3217 know (is_end_of_line[(unsigned char) input_line_pointer[-1]]);
3221 discard_rest_of_line (void)
3223 while (input_line_pointer < buffer_limit
3224 && !is_end_of_line[(unsigned char) *input_line_pointer])
3225 input_line_pointer++;
3227 input_line_pointer++;
3229 /* Return pointing just after end-of-line. */
3230 know (is_end_of_line[(unsigned char) input_line_pointer[-1]]);
3233 /* Sets frag for given symbol to zero_address_frag, except when the
3234 symbol frag is already set to a dummy listing frag. */
3237 set_zero_frag (symbolS *symbolP)
3239 if (symbol_get_frag (symbolP)->fr_type != rs_dummy)
3240 symbol_set_frag (symbolP, &zero_address_frag);
3243 /* In: Pointer to a symbol.
3244 Input_line_pointer->expression.
3246 Out: Input_line_pointer->just after any whitespace after expression.
3247 Tried to set symbol to value of expression.
3248 Will change symbols type, value, and frag; */
3251 pseudo_set (symbolS *symbolP)
3255 #if (defined (OBJ_AOUT) || defined (OBJ_BOUT)) && ! defined (BFD_ASSEMBLER)
3257 #endif /* OBJ_AOUT or OBJ_BOUT */
3259 know (symbolP); /* NULL pointer is logic error. */
3261 (void) expression (&exp);
3263 if (exp.X_op == O_illegal)
3264 as_bad (_("illegal expression"));
3265 else if (exp.X_op == O_absent)
3266 as_bad (_("missing expression"));
3267 else if (exp.X_op == O_big)
3269 if (exp.X_add_number > 0)
3270 as_bad (_("bignum invalid"));
3272 as_bad (_("floating point number invalid"));
3274 else if (exp.X_op == O_subtract
3275 && SEG_NORMAL (S_GET_SEGMENT (exp.X_add_symbol))
3276 && (symbol_get_frag (exp.X_add_symbol)
3277 == symbol_get_frag (exp.X_op_symbol)))
3279 exp.X_op = O_constant;
3280 exp.X_add_number = (S_GET_VALUE (exp.X_add_symbol)
3281 - S_GET_VALUE (exp.X_op_symbol));
3284 if (symbol_section_p (symbolP))
3286 as_bad ("attempt to set value of section symbol");
3289 #if (defined (OBJ_AOUT) || defined (OBJ_BOUT)) && ! defined (BFD_ASSEMBLER)
3290 ext = S_IS_EXTERNAL (symbolP);
3291 #endif /* OBJ_AOUT or OBJ_BOUT */
3298 exp.X_add_number = 0;
3301 S_SET_SEGMENT (symbolP, absolute_section);
3302 S_SET_VALUE (symbolP, (valueT) exp.X_add_number);
3303 set_zero_frag (symbolP);
3307 S_SET_SEGMENT (symbolP, reg_section);
3308 S_SET_VALUE (symbolP, (valueT) exp.X_add_number);
3309 set_zero_frag (symbolP);
3313 seg = S_GET_SEGMENT (exp.X_add_symbol);
3314 /* For x=undef+const, create an expression symbol.
3315 For x=x+const, just update x except when x is an undefined symbol
3316 For x=defined+const, evaluate x. */
3317 if (symbolP == exp.X_add_symbol
3318 && (seg != undefined_section
3319 || !symbol_constant_p (symbolP)))
3321 *symbol_X_add_number (symbolP) += exp.X_add_number;
3324 else if (seg != undefined_section)
3326 symbolS *s = exp.X_add_symbol;
3328 if (S_IS_COMMON (s))
3329 as_bad (_("`%s' can't be equated to common symbol '%s'"),
3330 S_GET_NAME (symbolP), S_GET_NAME (s));
3332 S_SET_SEGMENT (symbolP, seg);
3333 S_SET_VALUE (symbolP, exp.X_add_number + S_GET_VALUE (s));
3334 symbol_set_frag (symbolP, symbol_get_frag (s));
3335 copy_symbol_attributes (symbolP, s);
3341 /* The value is some complex expression.
3342 Set segment and frag back to that of a newly created symbol. */
3343 S_SET_SEGMENT (symbolP, undefined_section);
3344 symbol_set_value_expression (symbolP, &exp);
3345 set_zero_frag (symbolP);
3349 #if (defined (OBJ_AOUT) || defined (OBJ_BOUT)) && ! defined (BFD_ASSEMBLER)
3351 S_SET_EXTERNAL (symbolP);
3353 S_CLEAR_EXTERNAL (symbolP);
3354 #endif /* OBJ_AOUT or OBJ_BOUT */
3359 CONStruct more frag of .bytes, or .words etc.
3360 Should need_pass_2 be 1 then emit no frag(s).
3361 This understands EXPRESSIONS.
3365 This has a split personality. We use expression() to read the
3366 value. We can detect if the value won't fit in a byte or word.
3367 But we can't detect if expression() discarded significant digits
3368 in the case of a long. Not worth the crocks required to fix it. */
3370 /* Select a parser for cons expressions. */
3372 /* Some targets need to parse the expression in various fancy ways.
3373 You can define TC_PARSE_CONS_EXPRESSION to do whatever you like
3374 (for example, the HPPA does this). Otherwise, you can define
3375 BITFIELD_CONS_EXPRESSIONS to permit bitfields to be specified, or
3376 REPEAT_CONS_EXPRESSIONS to permit repeat counts. If none of these
3377 are defined, which is the normal case, then only simple expressions
3382 parse_mri_cons (expressionS *exp, unsigned int nbytes);
3385 #ifndef TC_PARSE_CONS_EXPRESSION
3386 #ifdef BITFIELD_CONS_EXPRESSIONS
3387 #define TC_PARSE_CONS_EXPRESSION(EXP, NBYTES) parse_bitfield_cons (EXP, NBYTES)
3389 parse_bitfield_cons (expressionS *exp, unsigned int nbytes);
3391 #ifdef REPEAT_CONS_EXPRESSIONS
3392 #define TC_PARSE_CONS_EXPRESSION(EXP, NBYTES) parse_repeat_cons (EXP, NBYTES)
3394 parse_repeat_cons (expressionS *exp, unsigned int nbytes);
3397 /* If we haven't gotten one yet, just call expression. */
3398 #ifndef TC_PARSE_CONS_EXPRESSION
3399 #define TC_PARSE_CONS_EXPRESSION(EXP, NBYTES) expression (EXP)
3404 do_parse_cons_expression (expressionS *exp,
3405 int nbytes ATTRIBUTE_UNUSED)
3407 TC_PARSE_CONS_EXPRESSION (exp, nbytes);
3411 /* Worker to do .byte etc statements.
3412 Clobbers input_line_pointer and checks end-of-line. */
3415 cons_worker (register int nbytes, /* 1=.byte, 2=.word, 4=.long. */
3423 #ifdef md_flush_pending_output
3424 md_flush_pending_output ();
3428 stop = mri_comment_field (&stopc);
3430 if (is_it_end_of_statement ())
3432 demand_empty_rest_of_line ();
3434 mri_comment_end (stop, stopc);
3438 #ifdef TC_ADDRESS_BYTES
3440 nbytes = TC_ADDRESS_BYTES ();
3443 #ifdef md_cons_align
3444 md_cons_align (nbytes);
3452 parse_mri_cons (&exp, (unsigned int) nbytes);
3455 TC_PARSE_CONS_EXPRESSION (&exp, (unsigned int) nbytes);
3459 if (exp.X_op == O_symbol)
3460 exp.X_op = O_symbol_rva;
3462 as_fatal (_("rva without symbol"));
3464 emit_expr (&exp, (unsigned int) nbytes);
3467 while (*input_line_pointer++ == ',');
3469 /* In MRI mode, after an odd number of bytes, we must align to an
3470 even word boundary, unless the next instruction is a dc.b, ds.b
3472 if (flag_mri && nbytes == 1 && (c & 1) != 0)
3473 mri_pending_align = 1;
3475 input_line_pointer--; /* Put terminator back into stream. */
3477 demand_empty_rest_of_line ();
3480 mri_comment_end (stop, stopc);
3486 cons_worker (size, 0);
3492 cons_worker (size, 1);
3495 /* Put the contents of expression EXP into the object file using
3496 NBYTES bytes. If need_pass_2 is 1, this does nothing. */
3499 emit_expr (expressionS *exp, unsigned int nbytes)
3503 valueT extra_digit = 0;
3505 /* Don't do anything if we are going to make another pass. */
3509 dot_value = frag_now_fix ();
3513 /* When gcc emits DWARF 1 debugging pseudo-ops, a line number will
3514 appear as a four byte positive constant in the .line section,
3515 followed by a 2 byte 0xffff. Look for that case here. */
3517 static int dwarf_line = -1;
3519 if (strcmp (segment_name (now_seg), ".line") != 0)
3521 else if (dwarf_line >= 0
3523 && exp->X_op == O_constant
3524 && (exp->X_add_number == -1 || exp->X_add_number == 0xffff))
3525 listing_source_line ((unsigned int) dwarf_line);
3526 else if (nbytes == 4
3527 && exp->X_op == O_constant
3528 && exp->X_add_number >= 0)
3529 dwarf_line = exp->X_add_number;
3534 /* When gcc emits DWARF 1 debugging pseudo-ops, a file name will
3535 appear as a 2 byte TAG_compile_unit (0x11) followed by a 2 byte
3536 AT_sibling (0x12) followed by a four byte address of the sibling
3537 followed by a 2 byte AT_name (0x38) followed by the name of the
3538 file. We look for that case here. */
3540 static int dwarf_file = 0;
3542 if (strcmp (segment_name (now_seg), ".debug") != 0)
3544 else if (dwarf_file == 0
3546 && exp->X_op == O_constant
3547 && exp->X_add_number == 0x11)
3549 else if (dwarf_file == 1
3551 && exp->X_op == O_constant
3552 && exp->X_add_number == 0x12)
3554 else if (dwarf_file == 2
3557 else if (dwarf_file == 3
3559 && exp->X_op == O_constant
3560 && exp->X_add_number == 0x38)
3565 /* The variable dwarf_file_string tells stringer that the string
3566 may be the name of the source file. */
3567 if (dwarf_file == 4)
3568 dwarf_file_string = 1;
3570 dwarf_file_string = 0;
3575 if (check_eh_frame (exp, &nbytes))
3580 /* Allow `.word 0' in the absolute section. */
3581 if (now_seg == absolute_section)
3583 if (op != O_constant || exp->X_add_number != 0)
3584 as_bad (_("attempt to store value in absolute section"));
3585 abs_section_offset += nbytes;
3589 /* Handle a negative bignum. */
3591 && exp->X_add_number == 0
3592 && symbol_get_value_expression (exp->X_add_symbol)->X_op == O_big
3593 && symbol_get_value_expression (exp->X_add_symbol)->X_add_number > 0)
3596 unsigned long carry;
3598 exp = symbol_get_value_expression (exp->X_add_symbol);
3600 /* Negate the bignum: one's complement each digit and add 1. */
3602 for (i = 0; i < exp->X_add_number; i++)
3606 next = (((~(generic_bignum[i] & LITTLENUM_MASK))
3609 generic_bignum[i] = next & LITTLENUM_MASK;
3610 carry = next >> LITTLENUM_NUMBER_OF_BITS;
3613 /* We can ignore any carry out, because it will be handled by
3614 extra_digit if it is needed. */
3616 extra_digit = (valueT) -1;
3620 if (op == O_absent || op == O_illegal)
3622 as_warn (_("zero assumed for missing expression"));
3623 exp->X_add_number = 0;
3626 else if (op == O_big && exp->X_add_number <= 0)
3628 as_bad (_("floating point number invalid"));
3629 exp->X_add_number = 0;
3632 else if (op == O_register)
3634 as_warn (_("register value used as expression"));
3638 p = frag_more ((int) nbytes);
3640 #ifndef WORKING_DOT_WORD
3641 /* If we have the difference of two symbols in a word, save it on
3642 the broken_words list. See the code in write.c. */
3643 if (op == O_subtract && nbytes == 2)
3645 struct broken_word *x;
3647 x = (struct broken_word *) xmalloc (sizeof (struct broken_word));
3648 x->next_broken_word = broken_words;
3651 x->subseg = now_subseg;
3653 x->word_goes_here = p;
3655 x->add = exp->X_add_symbol;
3656 x->sub = exp->X_op_symbol;
3657 x->addnum = exp->X_add_number;
3665 /* If we have an integer, but the number of bytes is too large to
3666 pass to md_number_to_chars, handle it as a bignum. */
3667 if (op == O_constant && nbytes > sizeof (valueT))
3669 extra_digit = exp->X_unsigned ? 0 : -1;
3670 convert_to_bignum (exp);
3674 if (op == O_constant)
3676 register valueT get;
3677 register valueT use;
3678 register valueT mask;
3680 register valueT unmask;
3682 /* JF << of >= number of bits in the object is undefined. In
3683 particular SPARC (Sun 4) has problems. */
3684 if (nbytes >= sizeof (valueT))
3687 if (nbytes > sizeof (valueT))
3690 hibit = (valueT) 1 << (nbytes * BITS_PER_CHAR - 1);
3694 /* Don't store these bits. */
3695 mask = ~(valueT) 0 << (BITS_PER_CHAR * nbytes);
3696 hibit = (valueT) 1 << (nbytes * BITS_PER_CHAR - 1);
3699 unmask = ~mask; /* Do store these bits. */
3702 "Do this mod if you want every overflow check to assume SIGNED 2's complement data.";
3703 mask = ~(unmask >> 1); /* Includes sign bit now. */
3706 get = exp->X_add_number;
3708 if ((get & mask) != 0
3709 && ((get & mask) != mask
3710 || (get & hibit) == 0))
3711 { /* Leading bits contain both 0s & 1s. */
3712 as_warn (_("value 0x%lx truncated to 0x%lx"),
3713 (unsigned long) get, (unsigned long) use);
3715 /* Put bytes in right order. */
3716 md_number_to_chars (p, use, (int) nbytes);
3718 else if (op == O_big)
3721 LITTLENUM_TYPE *nums;
3723 know (nbytes % CHARS_PER_LITTLENUM == 0);
3725 size = exp->X_add_number * CHARS_PER_LITTLENUM;
3728 as_warn (_("bignum truncated to %d bytes"), nbytes);
3732 if (target_big_endian)
3734 while (nbytes > size)
3736 md_number_to_chars (p, extra_digit, CHARS_PER_LITTLENUM);
3737 nbytes -= CHARS_PER_LITTLENUM;
3738 p += CHARS_PER_LITTLENUM;
3741 nums = generic_bignum + size / CHARS_PER_LITTLENUM;
3742 while (size >= CHARS_PER_LITTLENUM)
3745 md_number_to_chars (p, (valueT) *nums, CHARS_PER_LITTLENUM);
3746 size -= CHARS_PER_LITTLENUM;
3747 p += CHARS_PER_LITTLENUM;
3752 nums = generic_bignum;
3753 while (size >= CHARS_PER_LITTLENUM)
3755 md_number_to_chars (p, (valueT) *nums, CHARS_PER_LITTLENUM);
3757 size -= CHARS_PER_LITTLENUM;
3758 p += CHARS_PER_LITTLENUM;
3759 nbytes -= CHARS_PER_LITTLENUM;
3762 while (nbytes >= CHARS_PER_LITTLENUM)
3764 md_number_to_chars (p, extra_digit, CHARS_PER_LITTLENUM);
3765 nbytes -= CHARS_PER_LITTLENUM;
3766 p += CHARS_PER_LITTLENUM;
3772 memset (p, 0, nbytes);
3774 /* Now we need to generate a fixS to record the symbol value.
3775 This is easy for BFD. For other targets it can be more
3776 complex. For very complex cases (currently, the HPPA and
3777 NS32K), you can define TC_CONS_FIX_NEW to do whatever you
3778 want. For simpler cases, you can define TC_CONS_RELOC to be
3779 the name of the reloc code that should be stored in the fixS.
3780 If neither is defined, the code uses NO_RELOC if it is
3781 defined, and otherwise uses 0. */
3783 #ifdef BFD_ASSEMBLER
3784 #ifdef TC_CONS_FIX_NEW
3785 TC_CONS_FIX_NEW (frag_now, p - frag_now->fr_literal, nbytes, exp);
3788 bfd_reloc_code_real_type r;
3805 as_bad (_("unsupported BFD relocation size %u"), nbytes);
3809 fix_new_exp (frag_now, p - frag_now->fr_literal, (int) nbytes, exp,
3814 #ifdef TC_CONS_FIX_NEW
3815 TC_CONS_FIX_NEW (frag_now, p - frag_now->fr_literal, nbytes, exp);
3817 /* Figure out which reloc number to use. Use TC_CONS_RELOC if
3818 it is defined, otherwise use NO_RELOC if it is defined,
3820 #ifndef TC_CONS_RELOC
3822 #define TC_CONS_RELOC NO_RELOC
3824 #define TC_CONS_RELOC 0
3827 fix_new_exp (frag_now, p - frag_now->fr_literal, (int) nbytes, exp, 0,
3829 #endif /* TC_CONS_FIX_NEW */
3830 #endif /* BFD_ASSEMBLER */
3834 #ifdef BITFIELD_CONS_EXPRESSIONS
3836 /* i960 assemblers, (eg, asm960), allow bitfields after ".byte" as
3837 w:x,y:z, where w and y are bitwidths and x and y are values. They
3838 then pack them all together. We do a little better in that we allow
3839 them in words, longs, etc. and we'll pack them in target byte order
3842 The rules are: pack least significant bit first, if a field doesn't
3843 entirely fit, put it in the next unit. Overflowing the bitfield is
3844 explicitly *not* even a warning. The bitwidth should be considered
3847 To use this function the tc-XXX.h file should define
3848 BITFIELD_CONS_EXPRESSIONS. */
3851 parse_bitfield_cons (exp, nbytes)
3853 unsigned int nbytes;
3855 unsigned int bits_available = BITS_PER_CHAR * nbytes;
3856 char *hold = input_line_pointer;
3858 (void) expression (exp);
3860 if (*input_line_pointer == ':')
3867 unsigned long width;
3869 if (*input_line_pointer != ':')
3871 input_line_pointer = hold;
3873 } /* Next piece is not a bitfield. */
3875 /* In the general case, we can't allow
3876 full expressions with symbol
3877 differences and such. The relocation
3878 entries for symbols not defined in this
3879 assembly would require arbitrary field
3880 widths, positions, and masks which most
3881 of our current object formats don't
3884 In the specific case where a symbol
3885 *is* defined in this assembly, we
3886 *could* build fixups and track it, but
3887 this could lead to confusion for the
3888 backends. I'm lazy. I'll take any
3889 SEG_ABSOLUTE. I think that means that
3890 you can use a previous .set or
3891 .equ type symbol. xoxorich. */
3893 if (exp->X_op == O_absent)
3895 as_warn (_("using a bit field width of zero"));
3896 exp->X_add_number = 0;
3897 exp->X_op = O_constant;
3898 } /* Implied zero width bitfield. */
3900 if (exp->X_op != O_constant)
3902 *input_line_pointer = '\0';
3903 as_bad (_("field width \"%s\" too complex for a bitfield"), hold);
3904 *input_line_pointer = ':';
3905 demand_empty_rest_of_line ();
3907 } /* Too complex. */
3909 if ((width = exp->X_add_number) > (BITS_PER_CHAR * nbytes))
3911 as_warn (_("field width %lu too big to fit in %d bytes: truncated to %d bits"),
3912 width, nbytes, (BITS_PER_CHAR * nbytes));
3913 width = BITS_PER_CHAR * nbytes;
3916 if (width > bits_available)
3918 /* FIXME-SOMEDAY: backing up and reparsing is wasteful. */
3919 input_line_pointer = hold;
3920 exp->X_add_number = value;
3925 hold = ++input_line_pointer;
3927 (void) expression (exp);
3928 if (exp->X_op != O_constant)
3930 char cache = *input_line_pointer;
3932 *input_line_pointer = '\0';
3933 as_bad (_("field value \"%s\" too complex for a bitfield"), hold);
3934 *input_line_pointer = cache;
3935 demand_empty_rest_of_line ();
3937 } /* Too complex. */
3939 value |= ((~(-1 << width) & exp->X_add_number)
3940 << ((BITS_PER_CHAR * nbytes) - bits_available));
3942 if ((bits_available -= width) == 0
3943 || is_it_end_of_statement ()
3944 || *input_line_pointer != ',')
3947 } /* All the bitfields we're gonna get. */
3949 hold = ++input_line_pointer;
3950 (void) expression (exp);
3953 exp->X_add_number = value;
3954 exp->X_op = O_constant;
3955 exp->X_unsigned = 1;
3959 #endif /* BITFIELD_CONS_EXPRESSIONS */
3961 /* Handle an MRI style string expression. */
3965 parse_mri_cons (exp, nbytes)
3967 unsigned int nbytes;
3969 if (*input_line_pointer != '\''
3970 && (input_line_pointer[1] != '\''
3971 || (*input_line_pointer != 'A'
3972 && *input_line_pointer != 'E')))
3973 TC_PARSE_CONS_EXPRESSION (exp, nbytes);
3977 unsigned int result = 0;
3979 /* An MRI style string. Cut into as many bytes as will fit into
3980 a nbyte chunk, left justify if necessary, and separate with
3981 commas so we can try again later. */
3982 if (*input_line_pointer == 'A')
3983 ++input_line_pointer;
3984 else if (*input_line_pointer == 'E')
3986 as_bad (_("EBCDIC constants are not supported"));
3987 ++input_line_pointer;
3990 input_line_pointer++;
3991 for (scan = 0; scan < nbytes; scan++)
3993 if (*input_line_pointer == '\'')
3995 if (input_line_pointer[1] == '\'')
3997 input_line_pointer++;
4002 result = (result << 8) | (*input_line_pointer++);
4006 while (scan < nbytes)
4012 /* Create correct expression. */
4013 exp->X_op = O_constant;
4014 exp->X_add_number = result;
4016 /* Fake it so that we can read the next char too. */
4017 if (input_line_pointer[0] != '\'' ||
4018 (input_line_pointer[0] == '\'' && input_line_pointer[1] == '\''))
4020 input_line_pointer -= 2;
4021 input_line_pointer[0] = ',';
4022 input_line_pointer[1] = '\'';
4025 input_line_pointer++;
4028 #endif /* TC_M68K */
4030 #ifdef REPEAT_CONS_EXPRESSIONS
4032 /* Parse a repeat expression for cons. This is used by the MIPS
4033 assembler. The format is NUMBER:COUNT; NUMBER appears in the
4034 object file COUNT times.
4036 To use this for a target, define REPEAT_CONS_EXPRESSIONS. */
4039 parse_repeat_cons (exp, nbytes)
4041 unsigned int nbytes;
4048 if (*input_line_pointer != ':')
4050 /* No repeat count. */
4054 ++input_line_pointer;
4055 expression (&count);
4056 if (count.X_op != O_constant
4057 || count.X_add_number <= 0)
4059 as_warn (_("unresolvable or nonpositive repeat count; using 1"));
4063 /* The cons function is going to output this expression once. So we
4064 output it count - 1 times. */
4065 for (i = count.X_add_number - 1; i > 0; i--)
4066 emit_expr (exp, nbytes);
4069 #endif /* REPEAT_CONS_EXPRESSIONS */
4071 /* Parse a floating point number represented as a hex constant. This
4072 permits users to specify the exact bits they want in the floating
4076 hex_float (int float_type, char *bytes)
4108 as_bad (_("unknown floating type type '%c'"), float_type);
4112 /* It would be nice if we could go through expression to parse the
4113 hex constant, but if we get a bignum it's a pain to sort it into
4114 the buffer correctly. */
4116 while (hex_p (*input_line_pointer) || *input_line_pointer == '_')
4120 /* The MRI assembler accepts arbitrary underscores strewn about
4121 through the hex constant, so we ignore them as well. */
4122 if (*input_line_pointer == '_')
4124 ++input_line_pointer;
4130 as_warn (_("floating point constant too large"));
4133 d = hex_value (*input_line_pointer) << 4;
4134 ++input_line_pointer;
4135 while (*input_line_pointer == '_')
4136 ++input_line_pointer;
4137 if (hex_p (*input_line_pointer))
4139 d += hex_value (*input_line_pointer);
4140 ++input_line_pointer;
4142 if (target_big_endian)
4145 bytes[length - i - 1] = d;
4151 if (target_big_endian)
4152 memset (bytes + i, 0, length - i);
4154 memset (bytes, 0, length - i);
4162 CONStruct some more frag chars of .floats .ffloats etc.
4163 Makes 0 or more new frags.
4164 If need_pass_2 == 1, no frags are emitted.
4165 This understands only floating literals, not expressions. Sorry.
4167 A floating constant is defined by atof_generic(), except it is preceded
4168 by 0d 0f 0g or 0h. After observing the STRANGE way my BSD AS does its
4169 reading, I decided to be incompatible. This always tries to give you
4170 rounded bits to the precision of the pseudo-op. Former AS did premature
4171 truncation, restored noisy bits instead of trailing 0s AND gave you
4172 a choice of 2 flavours of noise according to which of 2 floating-point
4173 scanners you directed AS to use.
4175 In: input_line_pointer->whitespace before, or '0' of flonum. */
4178 float_cons (/* Clobbers input_line-pointer, checks end-of-line. */
4179 register int float_type /* 'f':.ffloat ... 'F':.float ... */)
4182 int length; /* Number of chars in an object. */
4183 register char *err; /* Error from scanning floating literal. */
4184 char temp[MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT];
4186 if (is_it_end_of_statement ())
4188 demand_empty_rest_of_line ();
4192 #ifdef md_flush_pending_output
4193 md_flush_pending_output ();
4198 /* input_line_pointer->1st char of a flonum (we hope!). */
4201 /* Skip any 0{letter} that may be present. Don't even check if the
4202 letter is legal. Someone may invent a "z" format and this routine
4203 has no use for such information. Lusers beware: you get
4204 diagnostics if your input is ill-conditioned. */
4205 if (input_line_pointer[0] == '0'
4206 && ISALPHA (input_line_pointer[1]))
4207 input_line_pointer += 2;
4209 /* Accept :xxxx, where the x's are hex digits, for a floating
4210 point with the exact digits specified. */
4211 if (input_line_pointer[0] == ':')
4213 ++input_line_pointer;
4214 length = hex_float (float_type, temp);
4217 ignore_rest_of_line ();
4223 err = md_atof (float_type, temp, &length);
4224 know (length <= MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT);
4228 as_bad (_("bad floating literal: %s"), err);
4229 ignore_rest_of_line ();
4240 #ifdef REPEAT_CONS_EXPRESSIONS
4241 if (*input_line_pointer == ':')
4243 expressionS count_exp;
4245 ++input_line_pointer;
4246 expression (&count_exp);
4248 if (count_exp.X_op != O_constant
4249 || count_exp.X_add_number <= 0)
4250 as_warn (_("unresolvable or nonpositive repeat count; using 1"));
4252 count = count_exp.X_add_number;
4256 while (--count >= 0)
4258 p = frag_more (length);
4259 memcpy (p, temp, (unsigned int) length);
4264 while (*input_line_pointer++ == ',');
4266 /* Put terminator back into stream. */
4267 --input_line_pointer;
4268 demand_empty_rest_of_line ();
4271 /* Return the size of a LEB128 value. */
4274 sizeof_sleb128 (offsetT value)
4276 register int size = 0;
4277 register unsigned byte;
4281 byte = (value & 0x7f);
4282 /* Sadly, we cannot rely on typical arithmetic right shift behaviour.
4283 Fortunately, we can structure things so that the extra work reduces
4284 to a noop on systems that do things "properly". */
4285 value = (value >> 7) | ~(-(offsetT)1 >> 7);
4288 while (!(((value == 0) && ((byte & 0x40) == 0))
4289 || ((value == -1) && ((byte & 0x40) != 0))));
4295 sizeof_uleb128 (valueT value)
4297 register int size = 0;
4298 register unsigned byte;
4302 byte = (value & 0x7f);
4312 sizeof_leb128 (valueT value, int sign)
4315 return sizeof_sleb128 ((offsetT) value);
4317 return sizeof_uleb128 (value);
4320 /* Output a LEB128 value. */
4323 output_sleb128 (char *p, offsetT value)
4325 register char *orig = p;
4330 unsigned byte = (value & 0x7f);
4332 /* Sadly, we cannot rely on typical arithmetic right shift behaviour.
4333 Fortunately, we can structure things so that the extra work reduces
4334 to a noop on systems that do things "properly". */
4335 value = (value >> 7) | ~(-(offsetT)1 >> 7);
4337 more = !((((value == 0) && ((byte & 0x40) == 0))
4338 || ((value == -1) && ((byte & 0x40) != 0))));
4350 output_uleb128 (char *p, valueT value)
4356 unsigned byte = (value & 0x7f);
4359 /* More bytes to follow. */
4370 output_leb128 (char *p, valueT value, int sign)
4373 return output_sleb128 (p, (offsetT) value);
4375 return output_uleb128 (p, value);
4378 /* Do the same for bignums. We combine sizeof with output here in that
4379 we don't output for NULL values of P. It isn't really as critical as
4380 for "normal" values that this be streamlined. */
4383 output_big_sleb128 (char *p, LITTLENUM_TYPE *bignum, int size)
4390 /* Strip leading sign extensions off the bignum. */
4392 && bignum[size - 1] == LITTLENUM_MASK
4393 && bignum[size - 2] > LITTLENUM_MASK / 2)
4398 /* OR in the next part of the littlenum. */
4399 val |= (*bignum << loaded);
4400 loaded += LITTLENUM_NUMBER_OF_BITS;
4404 /* Add bytes until there are less than 7 bits left in VAL
4405 or until every non-sign bit has been written. */
4412 || val != ((byte & 0x40) == 0 ? 0 : ((valueT) 1 << loaded) - 1))
4419 while ((byte & 0x80) != 0 && loaded >= 7);
4423 /* Mop up any left-over bits (of which there will be less than 7). */
4424 if ((byte & 0x80) != 0)
4426 /* Sign-extend VAL. */
4427 if (val & (1 << (loaded - 1)))
4428 val |= ~0 << loaded;
4438 output_big_uleb128 (char *p, LITTLENUM_TYPE *bignum, int size)
4445 /* Strip leading zeros off the bignum. */
4446 /* XXX: Is this needed? */
4447 while (size > 0 && bignum[size - 1] == 0)
4452 if (loaded < 7 && size > 0)
4454 val |= (*bignum << loaded);
4455 loaded += 8 * CHARS_PER_LITTLENUM;
4464 if (size > 0 || val)
4471 while (byte & 0x80);
4477 output_big_leb128 (char *p, LITTLENUM_TYPE *bignum, int size, int sign)
4480 return output_big_sleb128 (p, bignum, size);
4482 return output_big_uleb128 (p, bignum, size);
4485 /* Generate the appropriate fragments for a given expression to emit a
4489 emit_leb128_expr (expressionS *exp, int sign)
4491 operatorT op = exp->X_op;
4492 unsigned int nbytes;
4494 if (op == O_absent || op == O_illegal)
4496 as_warn (_("zero assumed for missing expression"));
4497 exp->X_add_number = 0;
4500 else if (op == O_big && exp->X_add_number <= 0)
4502 as_bad (_("floating point number invalid"));
4503 exp->X_add_number = 0;
4506 else if (op == O_register)
4508 as_warn (_("register value used as expression"));
4511 else if (op == O_constant
4513 && (exp->X_add_number < 0) != !exp->X_unsigned)
4515 /* We're outputting a signed leb128 and the sign of X_add_number
4516 doesn't reflect the sign of the original value. Convert EXP
4517 to a correctly-extended bignum instead. */
4518 convert_to_bignum (exp);
4522 /* Let check_eh_frame know that data is being emitted. nbytes == -1 is
4523 a signal that this is leb128 data. It shouldn't optimize this away. */
4524 nbytes = (unsigned int) -1;
4525 if (check_eh_frame (exp, &nbytes))
4528 /* Let the backend know that subsequent data may be byte aligned. */
4529 #ifdef md_cons_align
4533 if (op == O_constant)
4535 /* If we've got a constant, emit the thing directly right now. */
4537 valueT value = exp->X_add_number;
4541 size = sizeof_leb128 (value, sign);
4542 p = frag_more (size);
4543 output_leb128 (p, value, sign);
4545 else if (op == O_big)
4547 /* O_big is a different sort of constant. */
4552 size = output_big_leb128 (NULL, generic_bignum, exp->X_add_number, sign);
4553 p = frag_more (size);
4554 output_big_leb128 (p, generic_bignum, exp->X_add_number, sign);
4558 /* Otherwise, we have to create a variable sized fragment and
4559 resolve things later. */
4561 frag_var (rs_leb128, sizeof_uleb128 (~(valueT) 0), 0, sign,
4562 make_expr_symbol (exp), 0, (char *) NULL);
4566 /* Parse the .sleb128 and .uleb128 pseudos. */
4573 #ifdef md_flush_pending_output
4574 md_flush_pending_output ();
4580 emit_leb128_expr (&exp, sign);
4582 while (*input_line_pointer++ == ',');
4584 input_line_pointer--;
4585 demand_empty_rest_of_line ();
4588 /* We read 0 or more ',' separated, double-quoted strings.
4589 Caller should have checked need_pass_2 is FALSE because we don't
4593 stringer (/* Worker to do .ascii etc statements. */
4594 /* Checks end-of-line. */
4595 register int append_zero /* 0: don't append '\0', else 1. */)
4597 register unsigned int c;
4600 #ifdef md_flush_pending_output
4601 md_flush_pending_output ();
4604 /* The following awkward logic is to parse ZERO or more strings,
4605 comma separated. Recall a string expression includes spaces
4606 before the opening '\"' and spaces after the closing '\"'.
4607 We fake a leading ',' if there is (supposed to be)
4608 a 1st, expression. We keep demanding expressions for each ','. */
4609 if (is_it_end_of_statement ())
4611 c = 0; /* Skip loop. */
4612 ++input_line_pointer; /* Compensate for end of loop. */
4616 c = ','; /* Do loop. */
4618 /* If we have been switched into the abs_section then we
4619 will not have an obstack onto which we can hang strings. */
4620 if (now_seg == absolute_section)
4622 as_bad (_("strings must be placed into a section"));
4624 ignore_rest_of_line ();
4627 while (c == ',' || c == '<' || c == '"')
4630 switch (*input_line_pointer)
4633 ++input_line_pointer; /*->1st char of string. */
4634 start = input_line_pointer;
4635 while (is_a_char (c = next_char_of_string ()))
4637 FRAG_APPEND_1_CHAR (c);
4641 FRAG_APPEND_1_CHAR (0);
4643 know (input_line_pointer[-1] == '\"');
4647 /* In ELF, when gcc is emitting DWARF 1 debugging output, it
4648 will emit .string with a filename in the .debug section
4649 after a sequence of constants. See the comment in
4650 emit_expr for the sequence. emit_expr will set
4651 dwarf_file_string to non-zero if this string might be a
4652 source file name. */
4653 if (strcmp (segment_name (now_seg), ".debug") != 0)
4654 dwarf_file_string = 0;
4655 else if (dwarf_file_string)
4657 c = input_line_pointer[-1];
4658 input_line_pointer[-1] = '\0';
4659 listing_source_file (start);
4660 input_line_pointer[-1] = c;
4667 input_line_pointer++;
4668 c = get_single_number ();
4669 FRAG_APPEND_1_CHAR (c);
4670 if (*input_line_pointer != '>')
4672 as_bad (_("expected <nn>"));
4674 input_line_pointer++;
4677 input_line_pointer++;
4681 c = *input_line_pointer;
4684 demand_empty_rest_of_line ();
4687 /* FIXME-SOMEDAY: I had trouble here on characters with the
4688 high bits set. We'll probably also have trouble with
4689 multibyte chars, wide chars, etc. Also be careful about
4690 returning values bigger than 1 byte. xoxorich. */
4693 next_char_of_string (void)
4695 register unsigned int c;
4697 c = *input_line_pointer++ & CHAR_MASK;
4705 as_warn (_("unterminated string; newline inserted"));
4706 bump_line_counters ();
4709 #ifndef NO_STRING_ESCAPES
4711 switch (c = *input_line_pointer++)
4739 break; /* As itself. */
4755 for (i = 0, number = 0;
4756 ISDIGIT (c) && i < 3;
4757 c = *input_line_pointer++, i++)
4759 number = number * 8 + c - '0';
4764 --input_line_pointer;
4773 c = *input_line_pointer++;
4774 while (ISXDIGIT (c))
4777 number = number * 16 + c - '0';
4778 else if (ISUPPER (c))
4779 number = number * 16 + c - 'A' + 10;
4781 number = number * 16 + c - 'a' + 10;
4782 c = *input_line_pointer++;
4785 --input_line_pointer;
4790 /* To be compatible with BSD 4.2 as: give the luser a linefeed!! */
4791 as_warn (_("unterminated string; newline inserted"));
4793 bump_line_counters ();
4798 #ifdef ONLY_STANDARD_ESCAPES
4799 as_bad (_("bad escaped character in string"));
4801 #endif /* ONLY_STANDARD_ESCAPES */
4806 #endif /* ! defined (NO_STRING_ESCAPES) */
4815 get_segmented_expression (register expressionS *expP)
4817 register segT retval;
4819 retval = expression (expP);
4820 if (expP->X_op == O_illegal
4821 || expP->X_op == O_absent
4822 || expP->X_op == O_big)
4824 as_bad (_("expected address expression"));
4825 expP->X_op = O_constant;
4826 expP->X_add_number = 0;
4827 retval = absolute_section;
4833 get_known_segmented_expression (register expressionS *expP)
4835 register segT retval;
4837 if ((retval = get_segmented_expression (expP)) == undefined_section)
4839 /* There is no easy way to extract the undefined symbol from the
4841 if (expP->X_add_symbol != NULL
4842 && S_GET_SEGMENT (expP->X_add_symbol) != expr_section)
4843 as_warn (_("symbol \"%s\" undefined; zero assumed"),
4844 S_GET_NAME (expP->X_add_symbol));
4846 as_warn (_("some symbol undefined; zero assumed"));
4847 retval = absolute_section;
4848 expP->X_op = O_constant;
4849 expP->X_add_number = 0;
4851 know (retval == absolute_section || SEG_NORMAL (retval));
4855 char /* Return terminator. */
4856 get_absolute_expression_and_terminator (long *val_pointer /* Return value of expression. */)
4858 /* FIXME: val_pointer should probably be offsetT *. */
4859 *val_pointer = (long) get_absolute_expression ();
4860 return (*input_line_pointer++);
4863 /* Like demand_copy_string, but return NULL if the string contains any '\0's.
4864 Give a warning if that happens. */
4867 demand_copy_C_string (int *len_pointer)
4871 if ((s = demand_copy_string (len_pointer)) != 0)
4875 for (len = *len_pointer; len > 0; len--)
4882 as_bad (_("this string may not contain \'\\0\'"));
4890 /* Demand string, but return a safe (=private) copy of the string.
4891 Return NULL if we can't read a string here. */
4894 demand_copy_string (int *lenP)
4896 register unsigned int c;
4902 if (*input_line_pointer == '\"')
4904 input_line_pointer++; /* Skip opening quote. */
4906 while (is_a_char (c = next_char_of_string ()))
4908 obstack_1grow (¬es, c);
4911 /* JF this next line is so demand_copy_C_string will return a
4912 null terminated string. */
4913 obstack_1grow (¬es, '\0');
4914 retval = obstack_finish (¬es);
4918 as_bad (_("missing string"));
4920 ignore_rest_of_line ();
4926 /* In: Input_line_pointer->next character.
4928 Do: Skip input_line_pointer over all whitespace.
4930 Out: 1 if input_line_pointer->end-of-line. */
4933 is_it_end_of_statement (void)
4936 return (is_end_of_line[(unsigned char) *input_line_pointer]);
4940 equals (char *sym_name, int reassign)
4945 input_line_pointer++;
4946 if (*input_line_pointer == '=')
4947 input_line_pointer++;
4949 while (*input_line_pointer == ' ' || *input_line_pointer == '\t')
4950 input_line_pointer++;
4953 stop = mri_comment_field (&stopc);
4955 assign_symbol (sym_name, !reassign);
4959 demand_empty_rest_of_line ();
4960 mri_comment_end (stop, stopc);
4964 /* .incbin -- include a file verbatim at the current location. */
4967 s_incbin (int x ATTRIBUTE_UNUSED)
4978 #ifdef md_flush_pending_output
4979 md_flush_pending_output ();
4983 filename = demand_copy_string (& len);
4984 if (filename == NULL)
4989 /* Look for optional skip and count. */
4990 if (* input_line_pointer == ',')
4992 ++ input_line_pointer;
4993 skip = get_absolute_expression ();
4997 if (* input_line_pointer == ',')
4999 ++ input_line_pointer;
5001 count = get_absolute_expression ();
5003 as_warn (_(".incbin count zero, ignoring `%s'"), filename);
5009 demand_empty_rest_of_line ();
5011 /* Try opening absolute path first, then try include dirs. */
5012 binfile = fopen (filename, FOPEN_RB);
5013 if (binfile == NULL)
5017 path = xmalloc ((unsigned long) len + include_dir_maxlen + 5);
5019 for (i = 0; i < include_dir_count; i++)
5021 sprintf (path, "%s/%s", include_dirs[i], filename);
5023 binfile = fopen (path, FOPEN_RB);
5024 if (binfile != NULL)
5028 if (binfile == NULL)
5029 as_bad (_("file not found: %s"), filename);
5032 path = xstrdup (filename);
5038 register_dependency (path);
5040 /* Compute the length of the file. */
5041 if (fseek (binfile, 0, SEEK_END) != 0)
5043 as_bad (_("seek to end of .incbin file failed `%s'"), path);
5046 file_len = ftell (binfile);
5048 /* If a count was not specified use the remainder of the file. */
5050 count = file_len - skip;
5052 if (skip < 0 || count < 0 || file_len < 0 || skip + count > file_len)
5054 as_bad (_("skip (%ld) or count (%ld) invalid for file size (%ld)"),
5055 skip, count, file_len);
5059 if (fseek (binfile, skip, SEEK_SET) != 0)
5061 as_bad (_("could not skip to %ld in file `%s'"), skip, path);
5065 /* Allocate frag space and store file contents in it. */
5066 binfrag = frag_more (count);
5068 bytes = fread (binfrag, 1, count, binfile);
5070 as_warn (_("truncated file `%s', %ld of %ld bytes read"),
5071 path, bytes, count);
5074 if (binfile != NULL)
5080 /* .include -- include a file at this point. */
5083 s_include (int arg ATTRIBUTE_UNUSED)
5092 filename = demand_copy_string (&i);
5093 if (filename == NULL)
5095 /* demand_copy_string has already printed an error and
5096 called ignore_rest_of_line. */
5104 while (!is_end_of_line[(unsigned char) *input_line_pointer]
5105 && *input_line_pointer != ' '
5106 && *input_line_pointer != '\t')
5108 obstack_1grow (¬es, *input_line_pointer);
5109 ++input_line_pointer;
5113 obstack_1grow (¬es, '\0');
5114 filename = obstack_finish (¬es);
5115 while (!is_end_of_line[(unsigned char) *input_line_pointer])
5116 ++input_line_pointer;
5119 demand_empty_rest_of_line ();
5120 path = xmalloc ((unsigned long) i + include_dir_maxlen + 5 /* slop */ );
5122 for (i = 0; i < include_dir_count; i++)
5124 strcpy (path, include_dirs[i]);
5126 strcat (path, filename);
5127 if (0 != (try = fopen (path, FOPEN_RT)))
5137 /* malloc Storage leak when file is found on path. FIXME-SOMEDAY. */
5138 register_dependency (path);
5139 input_scrub_insert_file (path);
5143 add_include_dir (char *path)
5147 if (include_dir_count == 0)
5149 include_dirs = (char **) xmalloc (2 * sizeof (*include_dirs));
5150 include_dirs[0] = "."; /* Current dir. */
5151 include_dir_count = 2;
5155 include_dir_count++;
5157 (char **) realloc (include_dirs,
5158 include_dir_count * sizeof (*include_dirs));
5161 include_dirs[include_dir_count - 1] = path; /* New one. */
5164 if (i > include_dir_maxlen)
5165 include_dir_maxlen = i;
5168 /* Output debugging information to denote the source file. */
5171 generate_file_debug (void)
5173 if (debug_type == DEBUG_STABS)
5174 stabs_generate_asm_file ();
5177 /* Output line number debugging information for the current source line. */
5180 generate_lineno_debug (void)
5184 case DEBUG_UNSPECIFIED:
5189 stabs_generate_asm_lineno ();
5192 ecoff_generate_asm_lineno ();
5195 /* ??? We could here indicate to dwarf2dbg.c that something
5196 has changed. However, since there is additional backend
5197 support that is required (calling dwarf2_emit_insn), we
5198 let dwarf2dbg.c call as_where on its own. */
5203 /* Output debugging information to mark a function entry point or end point.
5204 END_P is zero for .func, and non-zero for .endfunc. */
5209 do_s_func (end_p, NULL);
5212 /* Subroutine of s_func so targets can choose a different default prefix.
5213 If DEFAULT_PREFIX is NULL, use the target's "leading char". */
5216 do_s_func (int end_p, const char *default_prefix)
5218 /* Record the current function so that we can issue an error message for
5219 misplaced .func,.endfunc, and also so that .endfunc needs no
5221 static char *current_name;
5222 static char *current_label;
5226 if (current_name == NULL)
5228 as_bad (_("missing .func"));
5229 ignore_rest_of_line ();
5233 if (debug_type == DEBUG_STABS)
5234 stabs_generate_asm_endfunc (current_name, current_label);
5236 current_name = current_label = NULL;
5241 char delim1, delim2;
5243 if (current_name != NULL)
5245 as_bad (_(".endfunc missing for previous .func"));
5246 ignore_rest_of_line ();
5250 name = input_line_pointer;
5251 delim1 = get_symbol_end ();
5252 name = xstrdup (name);
5253 *input_line_pointer = delim1;
5255 if (*input_line_pointer != ',')
5258 asprintf (&label, "%s%s", default_prefix, name);
5261 char leading_char = 0;
5262 #ifdef BFD_ASSEMBLER
5263 leading_char = bfd_get_symbol_leading_char (stdoutput);
5265 /* Missing entry point, use function's name with the leading
5268 asprintf (&label, "%c%s", leading_char, name);
5275 ++input_line_pointer;
5277 label = input_line_pointer;
5278 delim2 = get_symbol_end ();
5279 label = xstrdup (label);
5280 *input_line_pointer = delim2;
5283 if (debug_type == DEBUG_STABS)
5284 stabs_generate_asm_func (name, label);
5286 current_name = name;
5287 current_label = label;
5290 demand_empty_rest_of_line ();
5294 s_ignore (int arg ATTRIBUTE_UNUSED)
5296 while (!is_end_of_line[(unsigned char) *input_line_pointer])
5298 ++input_line_pointer;
5300 ++input_line_pointer;
5304 read_print_statistics (FILE *file)
5306 hash_print_statistics (file, "pseudo-op table", po_hash);
5309 /* Inserts the given line into the input stream.
5311 This call avoids macro/conditionals nesting checking, since the contents of
5312 the line are assumed to replace the contents of a line already scanned.
5314 An appropriate use of this function would be substitution of input lines when
5315 called by md_start_line_hook(). The given line is assumed to already be
5316 properly scrubbed. */
5319 input_scrub_insert_line (const char *line)
5323 sb_add_string (&newline, line);
5324 input_scrub_include_sb (&newline, input_line_pointer, 0);
5326 buffer_limit = input_scrub_next_buffer (&input_line_pointer);
5329 /* Insert a file into the input stream; the path must resolve to an actual
5330 file; no include path searching or dependency registering is performed. */
5333 input_scrub_insert_file (char *path)
5335 input_scrub_include_file (path, input_line_pointer);
5336 buffer_limit = input_scrub_next_buffer (&input_line_pointer);