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, 59 Temple Place - Suite 330, 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},
347 {"ifdef", s_ifdef, 0},
348 {"ifeq", s_if, (int) O_eq},
349 {"ifeqs", s_ifeqs, 0},
350 {"ifge", s_if, (int) O_ge},
351 {"ifgt", s_if, (int) O_gt},
352 {"ifle", s_if, (int) O_le},
353 {"iflt", s_if, (int) O_lt},
355 {"ifndef", s_ifdef, 1},
356 {"ifne", s_if, (int) O_ne},
357 {"ifnes", s_ifeqs, 1},
358 {"ifnotdef", s_ifdef, 1},
359 {"incbin", s_incbin, 0},
360 {"include", s_include, 0},
366 {"lcomm", s_lcomm, 0},
367 {"lflags", listing_flags, 0}, /* Listing flags. */
368 {"linkonce", s_linkonce, 0},
369 {"list", listing_list, 1}, /* Turn listing on. */
370 {"llen", listing_psize, 1},
373 {"macro", s_macro, 0},
374 {"mexit", s_mexit, 0},
376 {".mri", s_mri, 0}, /* Special case so .mri works in MRI mode. */
377 {"name", s_ignore, 0},
378 {"noaltmacro", s_altmacro, 0},
379 {"noformat", s_ignore, 0},
380 {"nolist", listing_list, 0}, /* Turn listing off. */
381 {"nopage", listing_nopage, 0},
383 {"offset", s_struct, 0},
385 {"p2align", s_align_ptwo, 0},
386 {"p2alignw", s_align_ptwo, -2},
387 {"p2alignl", s_align_ptwo, -4},
388 {"page", listing_eject, 0},
389 {"plen", listing_psize, 0},
390 {"print", s_print, 0},
391 {"psize", listing_psize, 0}, /* Set paper size. */
392 {"purgem", s_purgem, 0},
397 {"sbttl", listing_title, 1}, /* Subtitle of listing. */
402 {"single", float_cons, 'f'},
404 {"space", s_space, 0},
405 {"skip", s_space, 0},
406 {"sleb128", s_leb128, 1},
407 {"spc", s_ignore, 0},
408 {"stabd", s_stab, 'd'},
409 {"stabn", s_stab, 'n'},
410 {"stabs", s_stab, 's'},
411 {"string", stringer, 1},
412 {"struct", s_struct, 0},
416 /* This is for gcc to use. It's only just been added (2/94), so gcc
417 won't be able to use it for a while -- probably a year or more.
418 But once this has been released, check with gcc maintainers
419 before deleting it or even changing the spelling. */
420 {"this_GCC_requires_the_GNU_assembler", s_ignore, 0},
421 /* If we're folding case -- done for some targets, not necessarily
422 all -- the above string in an input file will be converted to
423 this one. Match it either way... */
424 {"this_gcc_requires_the_gnu_assembler", s_ignore, 0},
426 {"title", listing_title, 0}, /* Listing title. */
427 {"ttl", listing_title, 0},
429 {"uleb128", s_leb128, 0},
433 {"xdef", s_globl, 0},
434 {"xref", s_ignore, 0},
435 {"xstabs", s_xstab, 's'},
436 {"warning", s_errwarn, 0},
438 {"zero", s_space, 0},
439 {NULL, NULL, 0} /* End sentinel. */
443 get_absolute_expr (expressionS *exp)
446 if (exp->X_op != O_constant)
448 if (exp->X_op != O_absent)
449 as_bad (_("bad or irreducible absolute expression"));
450 exp->X_add_number = 0;
452 return exp->X_add_number;
456 get_absolute_expression (void)
460 return get_absolute_expr (&exp);
463 static int pop_override_ok = 0;
464 static const char *pop_table_name;
467 pop_insert (const pseudo_typeS *table)
470 const pseudo_typeS *pop;
471 for (pop = table; pop->poc_name; pop++)
473 errtxt = hash_insert (po_hash, pop->poc_name, (char *) pop);
474 if (errtxt && (!pop_override_ok || strcmp (errtxt, "exists")))
475 as_fatal (_("error constructing %s pseudo-op table: %s"), pop_table_name,
480 #ifndef md_pop_insert
481 #define md_pop_insert() pop_insert(md_pseudo_table)
484 #ifndef obj_pop_insert
485 #define obj_pop_insert() pop_insert(obj_pseudo_table)
488 #ifndef cfi_pop_insert
489 #define cfi_pop_insert() pop_insert(cfi_pseudo_table)
495 po_hash = hash_new ();
497 /* Do the target-specific pseudo ops. */
498 pop_table_name = "md";
501 /* Now object specific. Skip any that were in the target table. */
502 pop_table_name = "obj";
506 /* Now portable ones. Skip any that we've seen already. */
507 pop_table_name = "standard";
508 pop_insert (potable);
510 #ifdef TARGET_USE_CFIPOP
511 pop_table_name = "cfi";
517 #define HANDLE_CONDITIONAL_ASSEMBLY() \
518 if (ignore_input ()) \
520 while (!is_end_of_line[(unsigned char) *input_line_pointer++]) \
521 if (input_line_pointer == buffer_limit) \
526 /* This function is used when scrubbing the characters between #APP
529 static char *scrub_string;
530 static char *scrub_string_end;
533 scrub_from_string (char *buf, int buflen)
537 copy = scrub_string_end - scrub_string;
540 memcpy (buf, scrub_string, copy);
541 scrub_string += copy;
545 /* Helper function of read_a_source_file, which tries to expand a macro. */
547 try_macro (char term, const char *line)
553 if (check_macro (line, &out, &err, ¯o))
557 *input_line_pointer++ = term;
558 input_scrub_include_sb (&out,
559 input_line_pointer, 1);
562 input_scrub_next_buffer (&input_line_pointer);
564 md_macro_info (macro);
571 /* We read the file, putting things into a web that represents what we
572 have been reading. */
574 read_a_source_file (char *name)
577 register char *s; /* String of symbol, '\0' appended. */
585 buffer = input_scrub_new_file (name);
588 listing_newline (NULL);
589 register_dependency (name);
591 /* Generate debugging information before we've read anything in to denote
592 this file as the "main" source file and not a subordinate one
593 (e.g. N_SO vs N_SOL in stabs). */
594 generate_file_debug ();
596 while ((buffer_limit = input_scrub_next_buffer (&input_line_pointer)) != 0)
597 { /* We have another line to parse. */
599 /* In order to avoid listing macro expansion lines with labels
600 multiple times, keep track of which line was last issued. */
601 static char *last_eol;
605 know (buffer_limit[-1] == '\n'); /* Must have a sentinel. */
607 while (input_line_pointer < buffer_limit)
609 /* We have more of this buffer to parse. */
611 /* We now have input_line_pointer->1st char of next line.
612 If input_line_pointer [-1] == '\n' then we just
613 scanned another line: so bump line counters. */
614 if (is_end_of_line[(unsigned char) input_line_pointer[-1]])
616 #ifdef md_start_line_hook
617 md_start_line_hook ();
619 if (input_line_pointer[-1] == '\n')
620 bump_line_counters ();
624 if (LABELS_WITHOUT_COLONS || flag_m68k_mri)
626 /* Text at the start of a line must be a label, we
627 run down and stick a colon in. */
628 if (is_name_beginner (*input_line_pointer))
630 char *line_start = input_line_pointer;
635 HANDLE_CONDITIONAL_ASSEMBLY ();
637 c = get_symbol_end ();
639 /* In MRI mode, the EQU and MACRO pseudoops must
640 be handled specially. */
644 char *rest = input_line_pointer + 1;
648 if (*rest == ' ' || *rest == '\t')
650 if ((strncasecmp (rest, "EQU", 3) == 0
651 || strncasecmp (rest, "SET", 3) == 0)
652 && (rest[3] == ' ' || rest[3] == '\t'))
654 input_line_pointer = rest + 3;
656 strncasecmp (rest, "SET", 3) == 0);
659 if (strncasecmp (rest, "MACRO", 5) == 0
662 || is_end_of_line[(unsigned char) rest[5]]))
666 /* In MRI mode, we need to handle the MACRO
667 pseudo-op specially: we don't want to put the
668 symbol in the symbol table. */
670 #ifdef TC_START_LABEL_WITHOUT_COLON
671 && TC_START_LABEL_WITHOUT_COLON(c,
675 line_label = colon (line_start);
677 line_label = symbol_create (line_start,
682 *input_line_pointer = c;
684 input_line_pointer++;
689 /* We are at the beginning of a line, or similar place.
690 We expect a well-formed assembler statement.
691 A "symbol-name:" is a statement.
693 Depending on what compiler is used, the order of these tests
694 may vary to catch most common case 1st.
695 Each test is independent of all other tests at the (top) level.
696 PLEASE make a compiler that doesn't use this assembler.
697 It is crufty to waste a compiler's time encoding things for this
698 assembler, which then wastes more time decoding it.
699 (And communicating via (linear) files is silly!
700 If you must pass stuff, please pass a tree!) */
701 if ((c = *input_line_pointer++) == '\t'
705 c = *input_line_pointer++;
707 know (c != ' '); /* No further leading whitespace. */
710 /* If listing is on, and we are expanding a macro, then give
711 the listing code the contents of the expanded line. */
714 if ((listing & LISTING_MACEXP) && macro_nest > 0)
719 /* Find the end of the current expanded macro line. */
720 for (s = input_line_pointer - 1; *s; ++s)
721 if (is_end_of_line[(unsigned char) *s])
727 /* Copy it for safe keeping. Also give an indication of
728 how much macro nesting is involved at this point. */
729 len = s - (input_line_pointer - 1);
730 copy = (char *) xmalloc (len + macro_nest + 2);
731 memset (copy, '>', macro_nest);
732 copy[macro_nest] = ' ';
733 memcpy (copy + macro_nest + 1, input_line_pointer - 1, len);
734 copy[macro_nest + 1 + len] = '\0';
736 /* Install the line with the listing facility. */
737 listing_newline (copy);
741 listing_newline (NULL);
744 /* C is the 1st significant character.
745 Input_line_pointer points after that character. */
746 if (is_name_beginner (c))
748 /* Want user-defined label or pseudo/opcode. */
749 HANDLE_CONDITIONAL_ASSEMBLY ();
751 s = --input_line_pointer;
752 c = get_symbol_end (); /* name's delimiter. */
754 /* C is character after symbol.
755 That character's place in the input line is now '\0'.
756 S points to the beginning of the symbol.
757 [In case of pseudo-op, s->'.'.]
758 Input_line_pointer->'\0' where c was. */
759 if (TC_START_LABEL (c, input_line_pointer))
763 char *rest = input_line_pointer + 1;
765 /* In MRI mode, \tsym: set 0 is permitted. */
769 if (*rest == ' ' || *rest == '\t')
772 if ((strncasecmp (rest, "EQU", 3) == 0
773 || strncasecmp (rest, "SET", 3) == 0)
774 && (rest[3] == ' ' || rest[3] == '\t'))
776 input_line_pointer = rest + 3;
782 line_label = colon (s); /* User-defined label. */
783 /* Put ':' back for error messages' sake. */
784 *input_line_pointer++ = ':';
785 #ifdef tc_check_label
786 tc_check_label (line_label);
788 /* Input_line_pointer->after ':'. */
792 || ((c == ' ' || c == '\t')
793 && input_line_pointer[1] == '='))
794 #ifdef TC_EQUAL_IN_INSN
795 && !TC_EQUAL_IN_INSN (c, s)
800 demand_empty_rest_of_line ();
804 /* Expect pseudo-op or machine instruction. */
807 #ifndef TC_CASE_SENSITIVE
811 strncpy (original_case_string, s2, sizeof (original_case_string));
812 original_case_string[sizeof (original_case_string) - 1] = 0;
821 if (NO_PSEUDO_DOT || flag_m68k_mri)
823 /* The MRI assembler and the m88k use pseudo-ops
825 pop = (pseudo_typeS *) hash_find (po_hash, s);
826 if (pop != NULL && pop->poc_handler == NULL)
831 || (!flag_m68k_mri && *s == '.'))
835 WARNING: c has next char, which may be end-of-line.
836 We lookup the pseudo-op table with s+1 because we
837 already know that the pseudo-op begins with a '.'. */
840 pop = (pseudo_typeS *) hash_find (po_hash, s + 1);
841 if (pop && !pop->poc_handler)
844 /* In MRI mode, we may need to insert an
845 automatic alignment directive. What a hack
847 if (mri_pending_align
849 || !((pop->poc_handler == cons
850 && pop->poc_val == 1)
851 || (pop->poc_handler == s_space
852 && pop->poc_val == 1)
853 #ifdef tc_conditional_pseudoop
854 || tc_conditional_pseudoop (pop)
856 || pop->poc_handler == s_if
857 || pop->poc_handler == s_ifdef
858 || pop->poc_handler == s_ifc
859 || pop->poc_handler == s_ifeqs
860 || pop->poc_handler == s_else
861 || pop->poc_handler == s_endif
862 || pop->poc_handler == s_globl
863 || pop->poc_handler == s_ignore)))
865 do_align (1, (char *) NULL, 0, 0);
866 mri_pending_align = 0;
868 if (line_label != NULL)
870 symbol_set_frag (line_label, frag_now);
871 S_SET_VALUE (line_label, frag_now_fix ());
875 /* Print the error msg now, while we still can. */
878 char *end = input_line_pointer;
880 *input_line_pointer = c;
882 c = *--input_line_pointer;
883 *input_line_pointer = '\0';
884 if (! macro_defined || ! try_macro (c, s))
887 as_bad (_("unknown pseudo-op: `%s'"), s);
888 *input_line_pointer++ = c;
893 /* Put it back for error messages etc. */
894 *input_line_pointer = c;
895 /* The following skip of whitespace is compulsory.
896 A well shaped space is sometimes all that separates
897 keyword from operands. */
898 if (c == ' ' || c == '\t')
899 input_line_pointer++;
901 /* Input_line is restored.
902 Input_line_pointer->1st non-blank char
903 after pseudo-operation. */
904 (*pop->poc_handler) (pop->poc_val);
906 /* If that was .end, just get out now. */
907 if (pop->poc_handler == s_end)
913 #ifdef QUOTES_IN_INSN
917 /* WARNING: c has char, which may be end-of-line. */
918 /* Also: input_line_pointer->`\0` where c was. */
919 *input_line_pointer = c;
920 while (!is_end_of_line[(unsigned char) *input_line_pointer]
922 #ifdef TC_EOL_IN_INSN
923 || TC_EOL_IN_INSN (input_line_pointer)
927 if (flag_m68k_mri && *input_line_pointer == '\'')
929 #ifdef QUOTES_IN_INSN
932 else if (*input_line_pointer == '"')
934 else if (*input_line_pointer == '\\')
937 input_line_pointer++;
940 c = *input_line_pointer;
941 *input_line_pointer = '\0';
943 generate_lineno_debug ();
945 if (macro_defined && try_macro (c, s))
948 if (mri_pending_align)
950 do_align (1, (char *) NULL, 0, 0);
951 mri_pending_align = 0;
952 if (line_label != NULL)
954 symbol_set_frag (line_label, frag_now);
955 S_SET_VALUE (line_label, frag_now_fix ());
959 md_assemble (s); /* Assemble 1 instruction. */
961 *input_line_pointer++ = c;
963 /* We resume loop AFTER the end-of-line from
970 /* Empty statement? */
971 if (is_end_of_line[(unsigned char) c])
974 if ((LOCAL_LABELS_DOLLAR || LOCAL_LABELS_FB) && ISDIGIT (c))
976 /* local label ("4:") */
977 char *backup = input_line_pointer;
979 HANDLE_CONDITIONAL_ASSEMBLY ();
983 /* Read the whole number. */
984 while (ISDIGIT (*input_line_pointer))
986 temp = (temp * 10) + *input_line_pointer - '0';
987 ++input_line_pointer;
990 if (LOCAL_LABELS_DOLLAR
991 && *input_line_pointer == '$'
992 && *(input_line_pointer + 1) == ':')
994 input_line_pointer += 2;
996 if (dollar_label_defined (temp))
998 as_fatal (_("label \"%d$\" redefined"), temp);
1001 define_dollar_label (temp);
1002 colon (dollar_label_name (temp, 0));
1007 && *input_line_pointer++ == ':')
1009 fb_label_instance_inc (temp);
1010 colon (fb_label_name (temp, 0));
1014 input_line_pointer = backup;
1015 } /* local label ("4:") */
1017 if (c && strchr (line_comment_chars, c))
1018 { /* Its a comment. Better say APP or NO_APP. */
1023 unsigned int new_length;
1026 bump_line_counters ();
1027 s = input_line_pointer;
1028 if (strncmp (s, "APP\n", 4))
1029 continue; /* We ignore it */
1033 ends = strstr (s, "#NO_APP\n");
1037 unsigned int tmp_len;
1040 /* The end of the #APP wasn't in this buffer. We
1041 keep reading in buffers until we find the #NO_APP
1042 that goes with this #APP There is one. The specs
1044 tmp_len = buffer_limit - s;
1045 tmp_buf = xmalloc (tmp_len + 1);
1046 memcpy (tmp_buf, s, tmp_len);
1049 new_tmp = input_scrub_next_buffer (&buffer);
1053 buffer_limit = new_tmp;
1054 input_line_pointer = buffer;
1055 ends = strstr (buffer, "#NO_APP\n");
1057 num = ends - buffer;
1059 num = buffer_limit - buffer;
1061 tmp_buf = xrealloc (tmp_buf, tmp_len + num);
1062 memcpy (tmp_buf + tmp_len, buffer, num);
1067 input_line_pointer = ends ? ends + 8 : NULL;
1075 input_line_pointer = ends + 8;
1079 scrub_string_end = ends;
1081 new_length = ends - s;
1082 new_buf = (char *) xmalloc (new_length);
1089 space = (new_buf + new_length) - new_tmp;
1090 size = do_scrub_chars (scrub_from_string, new_tmp, space);
1098 new_buf = xrealloc (new_buf, new_length + 100);
1099 new_tmp = new_buf + new_length;
1106 /* We've "scrubbed" input to the preferred format. In the
1107 process we may have consumed the whole of the remaining
1108 file (and included files). We handle this formatted
1109 input similar to that of macro expansion, letting
1110 actual macro expansion (possibly nested) and other
1111 input expansion work. Beware that in messages, line
1112 numbers and possibly file names will be incorrect. */
1113 sb_add_string (&sbuf, new_buf);
1114 input_scrub_include_sb (&sbuf, input_line_pointer, 0);
1116 buffer_limit = input_scrub_next_buffer (&input_line_pointer);
1121 HANDLE_CONDITIONAL_ASSEMBLY ();
1123 #ifdef tc_unrecognized_line
1124 if (tc_unrecognized_line (c))
1127 input_line_pointer--;
1128 /* Report unknown char as ignored. */
1129 demand_empty_rest_of_line ();
1132 #ifdef md_after_pass_hook
1133 md_after_pass_hook ();
1142 /* Close the input file. */
1143 input_scrub_close ();
1144 #ifdef WARN_COMMENTS
1146 if (warn_comment && found_comment)
1147 as_warn_where (found_comment_file, found_comment,
1148 "first comment found here");
1153 /* Convert O_constant expression EXP into the equivalent O_big representation.
1154 Take the sign of the number from X_unsigned rather than X_add_number. */
1157 convert_to_bignum (expressionS *exp)
1162 value = exp->X_add_number;
1163 for (i = 0; i < sizeof (exp->X_add_number) / CHARS_PER_LITTLENUM; i++)
1165 generic_bignum[i] = value & LITTLENUM_MASK;
1166 value >>= LITTLENUM_NUMBER_OF_BITS;
1168 /* Add a sequence of sign bits if the top bit of X_add_number is not
1169 the sign of the original value. */
1170 if ((exp->X_add_number < 0) != !exp->X_unsigned)
1171 generic_bignum[i++] = exp->X_unsigned ? 0 : LITTLENUM_MASK;
1173 exp->X_add_number = i;
1176 /* For most MRI pseudo-ops, the line actually ends at the first
1177 nonquoted space. This function looks for that point, stuffs a null
1178 in, and sets *STOPCP to the character that used to be there, and
1179 returns the location.
1181 Until I hear otherwise, I am going to assume that this is only true
1182 for the m68k MRI assembler. */
1185 mri_comment_field (char *stopcp)
1191 know (flag_m68k_mri);
1193 for (s = input_line_pointer;
1194 ((!is_end_of_line[(unsigned char) *s] && *s != ' ' && *s != '\t')
1202 for (s = input_line_pointer;
1203 !is_end_of_line[(unsigned char) *s];
1213 /* Skip to the end of an MRI comment field. */
1216 mri_comment_end (char *stop, int stopc)
1220 input_line_pointer = stop;
1222 while (!is_end_of_line[(unsigned char) *input_line_pointer])
1223 ++input_line_pointer;
1227 s_abort (int ignore ATTRIBUTE_UNUSED)
1229 as_fatal (_(".abort detected. Abandoning ship."));
1232 /* Guts of .align directive. N is the power of two to which to align.
1233 FILL may be NULL, or it may point to the bytes of the fill pattern.
1234 LEN is the length of whatever FILL points to, if anything. MAX is
1235 the maximum number of characters to skip when doing the alignment,
1236 or 0 if there is no maximum. */
1239 do_align (int n, char *fill, int len, int max)
1241 if (now_seg == absolute_section)
1245 if (*fill++ != '\0')
1247 as_warn (_("ignoring fill value in absolute section"));
1254 #ifdef md_flush_pending_output
1255 md_flush_pending_output ();
1258 md_do_align (n, fill, len, max, just_record_alignment);
1261 /* Only make a frag if we HAVE to... */
1262 if (n != 0 && !need_pass_2)
1266 if (subseg_text_p (now_seg))
1267 frag_align_code (n, max);
1269 frag_align (n, 0, max);
1272 frag_align (n, *fill, max);
1274 frag_align_pattern (n, fill, len, max);
1278 just_record_alignment: ATTRIBUTE_UNUSED_LABEL
1281 record_alignment (now_seg, n - OCTETS_PER_BYTE_POWER);
1284 /* Handle the .align pseudo-op. A positive ARG is a default alignment
1285 (in bytes). A negative ARG is the negative of the length of the
1286 fill pattern. BYTES_P is non-zero if the alignment value should be
1287 interpreted as the byte boundary, rather than the power of 2. */
1289 #ifdef BFD_ASSEMBLER
1290 #define ALIGN_LIMIT (stdoutput->arch_info->bits_per_address - 1)
1292 #define ALIGN_LIMIT 15
1296 s_align (int arg, int bytes_p)
1298 unsigned int align_limit = ALIGN_LIMIT;
1307 stop = mri_comment_field (&stopc);
1309 if (is_end_of_line[(unsigned char) *input_line_pointer])
1314 align = arg; /* Default value from pseudo-op table. */
1318 align = get_absolute_expression ();
1324 /* Convert to a power of 2. */
1329 for (i = 0; (align & 1) == 0; align >>= 1, ++i)
1332 as_bad (_("alignment not a power of 2"));
1338 if (align > align_limit)
1340 align = align_limit;
1341 as_warn (_("alignment too large: %u assumed"), align);
1344 if (*input_line_pointer != ',')
1351 ++input_line_pointer;
1352 if (*input_line_pointer == ',')
1356 fill = get_absolute_expression ();
1361 if (*input_line_pointer != ',')
1365 ++input_line_pointer;
1366 max = get_absolute_expression ();
1373 as_warn (_("expected fill pattern missing"));
1374 do_align (align, (char *) NULL, 0, max);
1389 do_align (align, &fill_char, fill_len, max);
1395 if ((size_t) fill_len > sizeof ab)
1397 md_number_to_chars (ab, fill, fill_len);
1398 do_align (align, ab, fill_len, max);
1402 demand_empty_rest_of_line ();
1405 mri_comment_end (stop, stopc);
1408 /* Handle the .align pseudo-op on machines where ".align 4" means
1409 align to a 4 byte boundary. */
1412 s_align_bytes (int arg)
1417 /* Handle the .align pseudo-op on machines where ".align 4" means align
1418 to a 2**4 boundary. */
1421 s_align_ptwo (int arg)
1426 /* Switch in and out of alternate macro mode. */
1431 demand_empty_rest_of_line ();
1432 macro_set_alternate (on);
1436 s_comm_internal (int param,
1437 symbolS *(*comm_parse_extra) (int, symbolS *, addressT))
1443 symbolS *symbolP = NULL;
1449 stop = mri_comment_field (&stopc);
1451 name = input_line_pointer;
1452 c = get_symbol_end ();
1453 /* Just after name is now '\0'. */
1454 p = input_line_pointer;
1459 as_bad (_("expected symbol name"));
1460 discard_rest_of_line ();
1466 /* Accept an optional comma after the name. The comma used to be
1467 required, but Irix 5 cc does not generate it for .lcomm. */
1468 if (*input_line_pointer == ',')
1469 input_line_pointer++;
1471 temp = get_absolute_expr (&exp);
1473 #ifdef BFD_ASSEMBLER
1474 size &= ((offsetT) 2 << (stdoutput->arch_info->bits_per_address - 1)) - 1;
1476 if (exp.X_op == O_absent)
1478 as_bad (_("missing size expression"));
1479 ignore_rest_of_line ();
1482 else if (temp != size || !exp.X_unsigned)
1484 as_warn (_("size (%ld) out of range, ignored"), (long) temp);
1485 ignore_rest_of_line ();
1490 symbolP = symbol_find_or_make (name);
1491 if (S_IS_DEFINED (symbolP) && !S_IS_COMMON (symbolP))
1494 as_bad (_("symbol `%s' is already defined"), name);
1496 ignore_rest_of_line ();
1500 size = S_GET_VALUE (symbolP);
1503 else if (size != temp)
1504 as_warn (_("size of \"%s\" is already %ld; not changing to %ld"),
1505 name, (long) size, (long) temp);
1508 if (comm_parse_extra != NULL)
1509 symbolP = (*comm_parse_extra) (param, symbolP, size);
1512 S_SET_VALUE (symbolP, (valueT) size);
1513 S_SET_EXTERNAL (symbolP);
1516 extern int flag_one;
1517 if (size == 0 || !flag_one)
1518 S_GET_OTHER (symbolP) = const_flag;
1523 demand_empty_rest_of_line ();
1526 mri_comment_end (stop, stopc);
1533 s_comm_internal (ignore, NULL);
1536 /* The MRI COMMON pseudo-op. We handle this by creating a common
1537 symbol with the appropriate name. We make s_space do the right
1538 thing by increasing the size. */
1541 s_mri_common (int small ATTRIBUTE_UNUSED)
1557 stop = mri_comment_field (&stopc);
1561 name = input_line_pointer;
1562 if (!ISDIGIT (*name))
1563 c = get_symbol_end ();
1568 ++input_line_pointer;
1570 while (ISDIGIT (*input_line_pointer));
1572 c = *input_line_pointer;
1573 *input_line_pointer = '\0';
1575 if (line_label != NULL)
1577 alc = (char *) xmalloc (strlen (S_GET_NAME (line_label))
1578 + (input_line_pointer - name)
1580 sprintf (alc, "%s%s", name, S_GET_NAME (line_label));
1585 sym = symbol_find_or_make (name);
1586 *input_line_pointer = c;
1590 if (*input_line_pointer != ',')
1594 ++input_line_pointer;
1595 align = get_absolute_expression ();
1598 if (S_IS_DEFINED (sym) && !S_IS_COMMON (sym))
1600 as_bad (_("symbol `%s' is already defined"), S_GET_NAME (sym));
1601 ignore_rest_of_line ();
1602 mri_comment_end (stop, stopc);
1606 S_SET_EXTERNAL (sym);
1607 mri_common_symbol = sym;
1611 S_SET_ALIGN (sym, align);
1614 if (line_label != NULL)
1617 exp.X_op = O_symbol;
1618 exp.X_add_symbol = sym;
1619 exp.X_add_number = 0;
1620 symbol_set_value_expression (line_label, &exp);
1621 symbol_set_frag (line_label, &zero_address_frag);
1622 S_SET_SEGMENT (line_label, expr_section);
1625 /* FIXME: We just ignore the small argument, which distinguishes
1626 COMMON and COMMON.S. I don't know what we can do about it. */
1628 /* Ignore the type and hptype. */
1629 if (*input_line_pointer == ',')
1630 input_line_pointer += 2;
1631 if (*input_line_pointer == ',')
1632 input_line_pointer += 2;
1634 demand_empty_rest_of_line ();
1636 mri_comment_end (stop, stopc);
1640 s_data (int ignore ATTRIBUTE_UNUSED)
1645 temp = get_absolute_expression ();
1646 if (flag_readonly_data_in_text)
1648 section = text_section;
1652 section = data_section;
1654 subseg_set (section, (subsegT) temp);
1659 demand_empty_rest_of_line ();
1662 /* Handle the .appfile pseudo-op. This is automatically generated by
1663 do_scrub_chars when a preprocessor # line comment is seen with a
1664 file name. This default definition may be overridden by the object
1665 or CPU specific pseudo-ops. This function is also the default
1666 definition for .file; the APPFILE argument is 1 for .appfile, 0 for
1670 s_app_file_string (char *file, int appfile ATTRIBUTE_UNUSED)
1674 listing_source_file (file);
1676 register_dependency (file);
1678 obj_app_file (file, appfile);
1683 s_app_file (int appfile)
1688 /* Some assemblers tolerate immediately following '"'. */
1689 if ((s = demand_copy_string (&length)) != 0)
1691 /* If this is a fake .appfile, a fake newline was inserted into
1692 the buffer. Passing -2 to new_logical_line tells it to
1695 = (!new_logical_line (s, appfile ? -2 : -1) && appfile);
1697 /* In MRI mode, the preprocessor may have inserted an extraneous
1700 && *input_line_pointer == '\''
1701 && is_end_of_line[(unsigned char) input_line_pointer[1]])
1702 ++input_line_pointer;
1704 demand_empty_rest_of_line ();
1706 s_app_file_string (s, appfile);
1710 /* Handle the .appline pseudo-op. This is automatically generated by
1711 do_scrub_chars when a preprocessor # line comment is seen. This
1712 default definition may be overridden by the object or CPU specific
1716 s_app_line (int ignore ATTRIBUTE_UNUSED)
1720 /* The given number is that of the next line. */
1721 l = get_absolute_expression () - 1;
1723 /* Some of the back ends can't deal with non-positive line numbers.
1724 Besides, it's silly. */
1725 as_warn (_("line numbers must be positive; line number %d rejected"),
1729 new_logical_line ((char *) NULL, l);
1732 listing_source_line (l);
1735 demand_empty_rest_of_line ();
1738 /* Handle the .end pseudo-op. Actually, the real work is done in
1739 read_a_source_file. */
1742 s_end (int ignore ATTRIBUTE_UNUSED)
1746 /* The MRI assembler permits the start symbol to follow .end,
1747 but we don't support that. */
1749 if (!is_end_of_line[(unsigned char) *input_line_pointer]
1750 && *input_line_pointer != '*'
1751 && *input_line_pointer != '!')
1752 as_warn (_("start address not supported"));
1756 /* Handle the .err pseudo-op. */
1759 s_err (int ignore ATTRIBUTE_UNUSED)
1761 as_bad (_(".err encountered"));
1762 demand_empty_rest_of_line ();
1765 /* Handle the .error and .warning pseudo-ops. */
1771 /* The purpose for the conditional assignment is not to
1772 internationalize the directive itself, but that we need a
1773 self-contained message, one that can be passed like the
1774 demand_copy_C_string return value, and with no assumption on the
1775 location of the name of the directive within the message. */
1777 = (err ? _(".error directive invoked in source file")
1778 : _(".warning directive invoked in source file"));
1780 if (!is_it_end_of_statement ())
1782 if (*input_line_pointer != '\"')
1784 as_bad (_("%s argument must be a string"),
1785 err ? ".error" : ".warning");
1786 discard_rest_of_line ();
1790 msg = demand_copy_C_string (&len);
1798 as_warn ("%s", msg);
1799 demand_empty_rest_of_line ();
1802 /* Handle the MRI fail pseudo-op. */
1805 s_fail (int ignore ATTRIBUTE_UNUSED)
1812 stop = mri_comment_field (&stopc);
1814 temp = get_absolute_expression ();
1816 as_warn (_(".fail %ld encountered"), (long) temp);
1818 as_bad (_(".fail %ld encountered"), (long) temp);
1820 demand_empty_rest_of_line ();
1823 mri_comment_end (stop, stopc);
1827 s_fill (int ignore ATTRIBUTE_UNUSED)
1829 expressionS rep_exp;
1831 register long fill = 0;
1834 #ifdef md_flush_pending_output
1835 md_flush_pending_output ();
1838 get_known_segmented_expression (&rep_exp);
1839 if (*input_line_pointer == ',')
1841 input_line_pointer++;
1842 size = get_absolute_expression ();
1843 if (*input_line_pointer == ',')
1845 input_line_pointer++;
1846 fill = get_absolute_expression ();
1850 /* This is to be compatible with BSD 4.2 AS, not for any rational reason. */
1851 #define BSD_FILL_SIZE_CROCK_8 (8)
1852 if (size > BSD_FILL_SIZE_CROCK_8)
1854 as_warn (_(".fill size clamped to %d"), BSD_FILL_SIZE_CROCK_8);
1855 size = BSD_FILL_SIZE_CROCK_8;
1859 as_warn (_("size negative; .fill ignored"));
1862 else if (rep_exp.X_op == O_constant && rep_exp.X_add_number <= 0)
1864 if (rep_exp.X_add_number < 0)
1865 as_warn (_("repeat < 0; .fill ignored"));
1869 if (size && !need_pass_2)
1871 if (rep_exp.X_op == O_constant)
1873 p = frag_var (rs_fill, (int) size, (int) size,
1874 (relax_substateT) 0, (symbolS *) 0,
1875 (offsetT) rep_exp.X_add_number,
1880 /* We don't have a constant repeat count, so we can't use
1881 rs_fill. We can get the same results out of rs_space,
1882 but its argument is in bytes, so we must multiply the
1883 repeat count by size. */
1886 rep_sym = make_expr_symbol (&rep_exp);
1889 expressionS size_exp;
1890 size_exp.X_op = O_constant;
1891 size_exp.X_add_number = size;
1893 rep_exp.X_op = O_multiply;
1894 rep_exp.X_add_symbol = rep_sym;
1895 rep_exp.X_op_symbol = make_expr_symbol (&size_exp);
1896 rep_exp.X_add_number = 0;
1897 rep_sym = make_expr_symbol (&rep_exp);
1900 p = frag_var (rs_space, (int) size, (int) size,
1901 (relax_substateT) 0, rep_sym, (offsetT) 0, (char *) 0);
1904 memset (p, 0, (unsigned int) size);
1906 /* The magic number BSD_FILL_SIZE_CROCK_4 is from BSD 4.2 VAX
1907 flavoured AS. The following bizarre behaviour is to be
1908 compatible with above. I guess they tried to take up to 8
1909 bytes from a 4-byte expression and they forgot to sign
1911 #define BSD_FILL_SIZE_CROCK_4 (4)
1912 md_number_to_chars (p, (valueT) fill,
1913 (size > BSD_FILL_SIZE_CROCK_4
1914 ? BSD_FILL_SIZE_CROCK_4
1916 /* Note: .fill (),0 emits no frag (since we are asked to .fill 0 bytes)
1917 but emits no error message because it seems a legal thing to do.
1918 It is a degenerate case of .fill but could be emitted by a
1921 demand_empty_rest_of_line ();
1925 s_globl (int ignore ATTRIBUTE_UNUSED)
1934 stop = mri_comment_field (&stopc);
1938 name = input_line_pointer;
1939 c = get_symbol_end ();
1940 symbolP = symbol_find_or_make (name);
1941 S_SET_EXTERNAL (symbolP);
1943 *input_line_pointer = c;
1945 c = *input_line_pointer;
1948 input_line_pointer++;
1950 if (is_end_of_line[(unsigned char) *input_line_pointer])
1956 demand_empty_rest_of_line ();
1959 mri_comment_end (stop, stopc);
1962 /* Handle the MRI IRP and IRPC pseudo-ops. */
1973 as_where (&file, &line);
1976 while (!is_end_of_line[(unsigned char) *input_line_pointer])
1977 sb_add_char (&s, *input_line_pointer++);
1981 err = expand_irp (irpc, 0, &s, &out, get_line_sb);
1983 as_bad_where (file, line, "%s", err);
1987 input_scrub_include_sb (&out, input_line_pointer, 1);
1989 buffer_limit = input_scrub_next_buffer (&input_line_pointer);
1992 /* Handle the .linkonce pseudo-op. This tells the assembler to mark
1993 the section to only be linked once. However, this is not supported
1994 by most object file formats. This takes an optional argument,
1995 which is what to do about duplicates. */
1998 s_linkonce (int ignore ATTRIBUTE_UNUSED)
2000 enum linkonce_type type;
2004 type = LINKONCE_DISCARD;
2006 if (!is_end_of_line[(unsigned char) *input_line_pointer])
2011 s = input_line_pointer;
2012 c = get_symbol_end ();
2013 if (strcasecmp (s, "discard") == 0)
2014 type = LINKONCE_DISCARD;
2015 else if (strcasecmp (s, "one_only") == 0)
2016 type = LINKONCE_ONE_ONLY;
2017 else if (strcasecmp (s, "same_size") == 0)
2018 type = LINKONCE_SAME_SIZE;
2019 else if (strcasecmp (s, "same_contents") == 0)
2020 type = LINKONCE_SAME_CONTENTS;
2022 as_warn (_("unrecognized .linkonce type `%s'"), s);
2024 *input_line_pointer = c;
2027 #ifdef obj_handle_link_once
2028 obj_handle_link_once (type);
2029 #else /* ! defined (obj_handle_link_once) */
2030 #ifdef BFD_ASSEMBLER
2034 if ((bfd_applicable_section_flags (stdoutput) & SEC_LINK_ONCE) == 0)
2035 as_warn (_(".linkonce is not supported for this object file format"));
2037 flags = bfd_get_section_flags (stdoutput, now_seg);
2038 flags |= SEC_LINK_ONCE;
2043 case LINKONCE_DISCARD:
2044 flags |= SEC_LINK_DUPLICATES_DISCARD;
2046 case LINKONCE_ONE_ONLY:
2047 flags |= SEC_LINK_DUPLICATES_ONE_ONLY;
2049 case LINKONCE_SAME_SIZE:
2050 flags |= SEC_LINK_DUPLICATES_SAME_SIZE;
2052 case LINKONCE_SAME_CONTENTS:
2053 flags |= SEC_LINK_DUPLICATES_SAME_CONTENTS;
2056 if (!bfd_set_section_flags (stdoutput, now_seg, flags))
2057 as_bad (_("bfd_set_section_flags: %s"),
2058 bfd_errmsg (bfd_get_error ()));
2060 #else /* ! defined (BFD_ASSEMBLER) */
2061 as_warn (_(".linkonce is not supported for this object file format"));
2062 #endif /* ! defined (BFD_ASSEMBLER) */
2063 #endif /* ! defined (obj_handle_link_once) */
2065 demand_empty_rest_of_line ();
2069 bss_alloc (symbolS *symbolP, addressT size, int align)
2072 segT current_seg = now_seg;
2073 subsegT current_subseg = now_subseg;
2074 segT bss_seg = bss_section;
2076 #if defined (TC_MIPS) || defined (TC_ALPHA)
2077 if (OUTPUT_FLAVOR == bfd_target_ecoff_flavour
2078 || OUTPUT_FLAVOR == bfd_target_elf_flavour)
2080 /* For MIPS and Alpha ECOFF or ELF, small objects are put in .sbss. */
2081 if (size <= bfd_get_gp_size (stdoutput))
2083 bss_seg = subseg_new (".sbss", 1);
2084 seg_info (bss_seg)->bss = 1;
2085 #ifdef BFD_ASSEMBLER
2086 if (!bfd_set_section_flags (stdoutput, bss_seg, SEC_ALLOC))
2087 as_warn (_("error setting flags for \".sbss\": %s"),
2088 bfd_errmsg (bfd_get_error ()));
2093 subseg_set (bss_seg, 1);
2097 record_alignment (bss_seg, align);
2098 frag_align (align, 0, 0);
2101 /* Detach from old frag. */
2102 if (S_GET_SEGMENT (symbolP) == bss_seg)
2103 symbol_get_frag (symbolP)->fr_symbol = NULL;
2105 symbol_set_frag (symbolP, frag_now);
2106 pfrag = frag_var (rs_org, 1, 1, 0, symbolP, size, NULL);
2110 S_SET_SIZE (symbolP, size);
2112 S_SET_SEGMENT (symbolP, bss_seg);
2115 /* The symbol may already have been created with a preceding
2116 ".globl" directive -- be careful not to step on storage class
2117 in that case. Otherwise, set it to static. */
2118 if (S_GET_STORAGE_CLASS (symbolP) != C_EXT)
2119 S_SET_STORAGE_CLASS (symbolP, C_STAT);
2120 #endif /* OBJ_COFF */
2122 subseg_set (current_seg, current_subseg);
2126 parse_align (int align_bytes)
2132 if (*input_line_pointer != ',')
2135 as_bad (_("expected alignment after size"));
2136 ignore_rest_of_line ();
2140 input_line_pointer++;
2143 align = get_absolute_expr (&exp);
2144 if (exp.X_op == O_absent)
2147 if (!exp.X_unsigned)
2149 as_warn (_("alignment negative; 0 assumed"));
2153 if (align_bytes && align != 0)
2155 /* convert to a power of 2 alignment */
2156 unsigned int alignp2 = 0;
2157 while ((align & 1) == 0)
2158 align >>= 1, ++alignp2;
2161 as_bad (_("alignment not a power of 2"));
2162 ignore_rest_of_line ();
2170 /* Called from s_comm_internal after symbol name and size have been
2171 parsed. NEEDS_ALIGN is 0 if it was an ".lcomm" (2 args only),
2172 1 if this was a ".bss" directive which has a 3rd argument
2173 (alignment as a power of 2), or 2 if this was a ".bss" directive
2174 with alignment in bytes. */
2177 s_lcomm_internal (int needs_align, symbolS *symbolP, addressT size)
2183 align = parse_align (needs_align - 1);
2184 if (align == (addressT) -1)
2188 /* Assume some objects may require alignment on some systems. */
2189 TC_IMPLICIT_LCOMM_ALIGNMENT (size, align);
2191 bss_alloc (symbolP, size, align);
2196 s_lcomm (int needs_align)
2198 s_comm_internal (needs_align, s_lcomm_internal);
2202 s_lcomm_bytes (int needs_align)
2204 s_comm_internal (needs_align * 2, s_lcomm_internal);
2208 s_lsym (int ignore ATTRIBUTE_UNUSED)
2210 register char *name;
2214 register symbolS *symbolP;
2216 /* We permit ANY defined expression: BSD4.2 demands constants. */
2217 name = input_line_pointer;
2218 c = get_symbol_end ();
2219 p = input_line_pointer;
2224 as_bad (_("expected symbol name"));
2225 discard_rest_of_line ();
2231 if (*input_line_pointer != ',')
2234 as_bad (_("expected comma after \"%s\""), name);
2236 ignore_rest_of_line ();
2240 input_line_pointer++;
2243 if (exp.X_op != O_constant
2244 && exp.X_op != O_register)
2246 as_bad (_("bad expression"));
2247 ignore_rest_of_line ();
2252 symbolP = symbol_find_or_make (name);
2254 /* FIXME-SOON I pulled a (&& symbolP->sy_other == 0 &&
2255 symbolP->sy_desc == 0) out of this test because coff doesn't have
2256 those fields, and I can't see when they'd ever be tripped. I
2257 don't think I understand why they were here so I may have
2258 introduced a bug. As recently as 1.37 didn't have this test
2259 anyway. xoxorich. */
2261 if (S_GET_SEGMENT (symbolP) == undefined_section
2262 && S_GET_VALUE (symbolP) == 0)
2264 /* The name might be an undefined .global symbol; be sure to
2265 keep the "external" bit. */
2266 S_SET_SEGMENT (symbolP,
2267 (exp.X_op == O_constant
2270 S_SET_VALUE (symbolP, (valueT) exp.X_add_number);
2274 as_bad (_("symbol `%s' is already defined"), name);
2278 demand_empty_rest_of_line ();
2281 /* Read a line into an sb. Returns the character that ended the line
2282 or zero if there are no more lines. */
2285 get_line_sb (sb *line)
2287 char quote1, quote2, inquote;
2290 if (input_line_pointer[-1] == '\n')
2291 bump_line_counters ();
2293 if (input_line_pointer >= buffer_limit)
2295 buffer_limit = input_scrub_next_buffer (&input_line_pointer);
2296 if (buffer_limit == 0)
2300 /* If app.c sets any other characters to LEX_IS_STRINGQUOTE, this
2301 code needs to be changed. */
2310 #ifdef LEX_IS_STRINGQUOTE
2316 while ((c = * input_line_pointer ++) != 0
2317 && (!is_end_of_line[c]
2318 || (inquote != '\0' && c != '\n')))
2322 else if (inquote == '\0')
2326 else if (c == quote2)
2330 sb_add_char (line, c);
2333 /* Don't skip multiple end-of-line characters, because that breaks support
2334 for the IA-64 stop bit (;;) which looks like two consecutive end-of-line
2335 characters but isn't. Instead just skip one end of line character and
2336 return the character skipped so that the caller can re-insert it if
2341 /* Define a macro. This is an interface to macro.c. */
2344 s_macro (int ignore ATTRIBUTE_UNUSED)
2353 as_where (&file, &line);
2356 while (!is_end_of_line[(unsigned char) *input_line_pointer])
2357 sb_add_char (&s, *input_line_pointer++);
2360 if (line_label != NULL)
2361 sb_add_string (&label, S_GET_NAME (line_label));
2363 err = define_macro (0, &s, &label, get_line_sb, file, line, &name);
2365 as_bad_where (file, line, err, name);
2368 if (line_label != NULL)
2370 S_SET_SEGMENT (line_label, absolute_section);
2371 S_SET_VALUE (line_label, 0);
2372 symbol_set_frag (line_label, &zero_address_frag);
2375 if (((NO_PSEUDO_DOT || flag_m68k_mri)
2376 && hash_find (po_hash, name) != NULL)
2379 && hash_find (po_hash, name + 1) != NULL))
2380 as_warn_where (file,
2382 _("attempt to redefine pseudo-op `%s' ignored"),
2389 /* Handle the .mexit pseudo-op, which immediately exits a macro
2393 s_mexit (int ignore ATTRIBUTE_UNUSED)
2395 cond_exit_macro (macro_nest);
2396 buffer_limit = input_scrub_next_buffer (&input_line_pointer);
2399 /* Switch in and out of MRI mode. */
2402 s_mri (int ignore ATTRIBUTE_UNUSED)
2406 on = get_absolute_expression ();
2407 old_flag = flag_mri;
2425 /* Operator precedence changes in m68k MRI mode, so we need to
2426 update the operator rankings. */
2427 expr_set_precedence ();
2429 #ifdef MRI_MODE_CHANGE
2431 MRI_MODE_CHANGE (on);
2434 demand_empty_rest_of_line ();
2437 /* Handle changing the location counter. */
2440 do_org (segT segment, expressionS *exp, int fill)
2442 if (segment != now_seg && segment != absolute_section)
2443 as_bad (_("invalid segment \"%s\""), segment_name (segment));
2445 if (now_seg == absolute_section)
2448 as_warn (_("ignoring fill value in absolute section"));
2449 if (exp->X_op != O_constant)
2451 as_bad (_("only constant offsets supported in absolute section"));
2452 exp->X_add_number = 0;
2454 abs_section_offset = exp->X_add_number;
2459 symbolS *sym = exp->X_add_symbol;
2460 offsetT off = exp->X_add_number * OCTETS_PER_BYTE;
2462 if (exp->X_op != O_constant && exp->X_op != O_symbol)
2464 /* Handle complex expressions. */
2465 sym = make_expr_symbol (exp);
2469 p = frag_var (rs_org, 1, 1, (relax_substateT) 0, sym, off, (char *) 0);
2475 s_org (int ignore ATTRIBUTE_UNUSED)
2477 register segT segment;
2479 register long temp_fill;
2481 #ifdef md_flush_pending_output
2482 md_flush_pending_output ();
2485 /* The m68k MRI assembler has a different meaning for .org. It
2486 means to create an absolute section at a given address. We can't
2487 support that--use a linker script instead. */
2490 as_bad (_("MRI style ORG pseudo-op not supported"));
2491 ignore_rest_of_line ();
2495 /* Don't believe the documentation of BSD 4.2 AS. There is no such
2496 thing as a sub-segment-relative origin. Any absolute origin is
2497 given a warning, then assumed to be segment-relative. Any
2498 segmented origin expression ("foo+42") had better be in the right
2499 segment or the .org is ignored.
2501 BSD 4.2 AS warns if you try to .org backwards. We cannot because
2502 we never know sub-segment sizes when we are reading code. BSD
2503 will crash trying to emit negative numbers of filler bytes in
2504 certain .orgs. We don't crash, but see as-write for that code.
2506 Don't make frag if need_pass_2==1. */
2507 segment = get_known_segmented_expression (&exp);
2508 if (*input_line_pointer == ',')
2510 input_line_pointer++;
2511 temp_fill = get_absolute_expression ();
2517 do_org (segment, &exp, temp_fill);
2519 demand_empty_rest_of_line ();
2522 /* Handle parsing for the MRI SECT/SECTION pseudo-op. This should be
2523 called by the obj-format routine which handles section changing
2524 when in MRI mode. It will create a new section, and return it. It
2525 will set *TYPE to the section type: one of 'C' (code), 'D' (data),
2526 'M' (mixed), or 'R' (romable). If BFD_ASSEMBLER is defined, the
2527 flags will be set in the section. */
2530 s_mri_sect (char *type ATTRIBUTE_UNUSED)
2540 name = input_line_pointer;
2541 if (!ISDIGIT (*name))
2542 c = get_symbol_end ();
2547 ++input_line_pointer;
2549 while (ISDIGIT (*input_line_pointer));
2551 c = *input_line_pointer;
2552 *input_line_pointer = '\0';
2555 name = xstrdup (name);
2557 *input_line_pointer = c;
2559 seg = subseg_new (name, 0);
2561 if (*input_line_pointer == ',')
2565 ++input_line_pointer;
2566 align = get_absolute_expression ();
2567 record_alignment (seg, align);
2571 if (*input_line_pointer == ',')
2573 c = *++input_line_pointer;
2575 if (c == 'C' || c == 'D' || c == 'M' || c == 'R')
2578 as_bad (_("unrecognized section type"));
2579 ++input_line_pointer;
2581 #ifdef BFD_ASSEMBLER
2585 flags = SEC_NO_FLAGS;
2587 flags = SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_CODE;
2588 else if (*type == 'D' || *type == 'M')
2589 flags = SEC_ALLOC | SEC_LOAD | SEC_DATA;
2590 else if (*type == 'R')
2591 flags = SEC_ALLOC | SEC_LOAD | SEC_DATA | SEC_READONLY | SEC_ROM;
2592 if (flags != SEC_NO_FLAGS)
2594 if (!bfd_set_section_flags (stdoutput, seg, flags))
2595 as_warn (_("error setting flags for \"%s\": %s"),
2596 bfd_section_name (stdoutput, seg),
2597 bfd_errmsg (bfd_get_error ()));
2603 /* Ignore the HP type. */
2604 if (*input_line_pointer == ',')
2605 input_line_pointer += 2;
2607 demand_empty_rest_of_line ();
2609 #else /* ! TC_M68K */
2618 name = input_line_pointer;
2619 c = get_symbol_end ();
2621 name = xstrdup (name);
2623 *input_line_pointer = c;
2625 seg = subseg_new (name, 0);
2627 if (*input_line_pointer != ',')
2633 ++input_line_pointer;
2635 sectype = input_line_pointer;
2636 c = get_symbol_end ();
2637 if (*sectype == '\0')
2639 else if (strcasecmp (sectype, "text") == 0)
2641 else if (strcasecmp (sectype, "data") == 0)
2643 else if (strcasecmp (sectype, "romdata") == 0)
2646 as_warn (_("unrecognized section type `%s'"), sectype);
2647 *input_line_pointer = c;
2650 if (*input_line_pointer == ',')
2654 ++input_line_pointer;
2656 seccmd = input_line_pointer;
2657 c = get_symbol_end ();
2658 if (strcasecmp (seccmd, "absolute") == 0)
2660 as_bad (_("absolute sections are not supported"));
2661 *input_line_pointer = c;
2662 ignore_rest_of_line ();
2665 else if (strcasecmp (seccmd, "align") == 0)
2669 *input_line_pointer = c;
2670 align = get_absolute_expression ();
2671 record_alignment (seg, align);
2675 as_warn (_("unrecognized section command `%s'"), seccmd);
2676 *input_line_pointer = c;
2680 demand_empty_rest_of_line ();
2682 #else /* ! TC_I960 */
2683 /* The MRI assembler seems to use different forms of .sect for
2684 different targets. */
2685 as_bad ("MRI mode not supported for this target");
2686 ignore_rest_of_line ();
2687 #endif /* ! TC_I960 */
2688 #endif /* ! TC_M68K */
2691 /* Handle the .print pseudo-op. */
2694 s_print (int ignore ATTRIBUTE_UNUSED)
2699 s = demand_copy_C_string (&len);
2702 demand_empty_rest_of_line ();
2705 /* Handle the .purgem pseudo-op. */
2708 s_purgem (int ignore ATTRIBUTE_UNUSED)
2710 if (is_it_end_of_statement ())
2712 demand_empty_rest_of_line ();
2722 name = input_line_pointer;
2723 c = get_symbol_end ();
2724 delete_macro (name);
2725 *input_line_pointer = c;
2728 while (*input_line_pointer++ == ',');
2730 --input_line_pointer;
2731 demand_empty_rest_of_line ();
2734 /* Handle the .endm/.endr pseudo-ops. */
2737 s_bad_end (int endr)
2739 as_warn (_(".end%c encountered without preceeding %s"),
2741 endr ? ".rept, .irp, or .irpc" : ".macro");
2742 demand_empty_rest_of_line ();
2745 /* Handle the .rept pseudo-op. */
2748 s_rept (int ignore ATTRIBUTE_UNUSED)
2752 count = get_absolute_expression ();
2754 do_repeat (count, "REPT", "ENDR");
2757 /* This function provides a generic repeat block implementation. It allows
2758 different directives to be used as the start/end keys. */
2761 do_repeat (int count, const char *start, const char *end)
2767 if (!buffer_and_nest (start, end, &one, get_line_sb))
2769 as_bad (_("%s without %s"), start, end);
2775 sb_add_sb (&many, &one);
2779 input_scrub_include_sb (&many, input_line_pointer, 1);
2781 buffer_limit = input_scrub_next_buffer (&input_line_pointer);
2784 /* Skip to end of current repeat loop; EXTRA indicates how many additional
2785 input buffers to skip. Assumes that conditionals preceding the loop end
2786 are properly nested.
2788 This function makes it easier to implement a premature "break" out of the
2789 loop. The EXTRA arg accounts for other buffers we might have inserted,
2790 such as line substitutions. */
2793 end_repeat (int extra)
2795 cond_exit_macro (macro_nest);
2796 while (extra-- >= 0)
2797 buffer_limit = input_scrub_next_buffer (&input_line_pointer);
2801 assign_symbol (char *name, int no_reassign)
2805 if (name[0] == '.' && name[1] == '\0')
2807 /* Turn '. = mumble' into a .org mumble. */
2811 segment = get_known_segmented_expression (&exp);
2814 do_org (segment, &exp, 0);
2819 if ((symbolP = symbol_find (name)) == NULL
2820 && (symbolP = md_undefined_symbol (name)) == NULL)
2822 symbolP = symbol_find_or_make (name);
2824 /* When doing symbol listings, play games with dummy fragments living
2825 outside the normal fragment chain to record the file and line info
2827 if (listing & LISTING_SYMBOLS)
2829 extern struct list_info_struct *listing_tail;
2830 fragS *dummy_frag = (fragS *) xcalloc (1, sizeof (fragS));
2831 dummy_frag->line = listing_tail;
2832 dummy_frag->fr_symbol = symbolP;
2833 symbol_set_frag (symbolP, dummy_frag);
2837 /* "set" symbols are local unless otherwise specified. */
2838 SF_SET_LOCAL (symbolP);
2842 /* Permit register names to be redefined. */
2844 && S_IS_DEFINED (symbolP)
2845 && S_GET_SEGMENT (symbolP) != reg_section)
2846 as_bad (_("symbol `%s' is already defined"), name);
2848 pseudo_set (symbolP);
2851 /* Handle the .equ, .equiv and .set directives. If EQUIV is 1, then
2852 this is .equiv, and it is an error if the symbol is already
2862 /* Especial apologies for the random logic:
2863 this just grew, and could be parsed much more simply!
2865 name = input_line_pointer;
2866 delim = get_symbol_end ();
2867 end_name = input_line_pointer;
2870 if (name == end_name)
2872 as_bad (_("expected symbol name"));
2873 discard_rest_of_line ();
2879 if (*input_line_pointer != ',')
2882 as_bad (_("expected comma after \"%s\""), name);
2884 ignore_rest_of_line ();
2888 input_line_pointer++;
2891 assign_symbol (name, equiv);
2894 demand_empty_rest_of_line ();
2907 #ifdef md_flush_pending_output
2908 md_flush_pending_output ();
2912 stop = mri_comment_field (&stopc);
2914 /* In m68k MRI mode, we need to align to a word boundary, unless
2916 if (flag_m68k_mri && mult > 1)
2918 if (now_seg == absolute_section)
2920 abs_section_offset += abs_section_offset & 1;
2921 if (line_label != NULL)
2922 S_SET_VALUE (line_label, abs_section_offset);
2924 else if (mri_common_symbol != NULL)
2928 val = S_GET_VALUE (mri_common_symbol);
2931 S_SET_VALUE (mri_common_symbol, val + 1);
2932 if (line_label != NULL)
2934 expressionS *symexp;
2936 symexp = symbol_get_value_expression (line_label);
2937 know (symexp->X_op == O_symbol);
2938 know (symexp->X_add_symbol == mri_common_symbol);
2939 symexp->X_add_number += 1;
2945 do_align (1, (char *) NULL, 0, 0);
2946 if (line_label != NULL)
2948 symbol_set_frag (line_label, frag_now);
2949 S_SET_VALUE (line_label, frag_now_fix ());
2959 if (*input_line_pointer == ',')
2961 ++input_line_pointer;
2966 val.X_op = O_constant;
2967 val.X_add_number = 0;
2970 if (val.X_op != O_constant
2971 || val.X_add_number < - 0x80
2972 || val.X_add_number > 0xff
2973 || (mult != 0 && mult != 1 && val.X_add_number != 0))
2975 if (exp.X_op != O_constant)
2976 as_bad (_("unsupported variable size or fill value"));
2983 bytes = mult * exp.X_add_number;
2984 for (i = 0; i < exp.X_add_number; i++)
2985 emit_expr (&val, mult);
2990 if (exp.X_op == O_constant)
2994 repeat = exp.X_add_number;
3001 as_warn (_(".space repeat count is zero, ignored"));
3002 else if (repeat < 0)
3003 as_warn (_(".space repeat count is negative, ignored"));
3007 /* If we are in the absolute section, just bump the offset. */
3008 if (now_seg == absolute_section)
3010 abs_section_offset += repeat;
3014 /* If we are secretly in an MRI common section, then
3015 creating space just increases the size of the common
3017 if (mri_common_symbol != NULL)
3019 S_SET_VALUE (mri_common_symbol,
3020 S_GET_VALUE (mri_common_symbol) + repeat);
3025 p = frag_var (rs_fill, 1, 1, (relax_substateT) 0, (symbolS *) 0,
3026 (offsetT) repeat, (char *) 0);
3030 if (now_seg == absolute_section)
3032 as_bad (_("space allocation too complex in absolute section"));
3033 subseg_set (text_section, 0);
3036 if (mri_common_symbol != NULL)
3038 as_bad (_("space allocation too complex in common section"));
3039 mri_common_symbol = NULL;
3043 p = frag_var (rs_space, 1, 1, (relax_substateT) 0,
3044 make_expr_symbol (&exp), (offsetT) 0, (char *) 0);
3048 *p = val.X_add_number;
3053 /* In MRI mode, after an odd number of bytes, we must align to an
3054 even word boundary, unless the next instruction is a dc.b, ds.b
3056 if (flag_mri && (bytes & 1) != 0)
3057 mri_pending_align = 1;
3059 demand_empty_rest_of_line ();
3062 mri_comment_end (stop, stopc);
3065 /* This is like s_space, but the value is a floating point number with
3066 the given precision. This is for the MRI dcb.s pseudo-op and
3070 s_float_space (int float_type)
3074 char temp[MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT];
3079 stop = mri_comment_field (&stopc);
3081 count = get_absolute_expression ();
3084 if (*input_line_pointer != ',')
3086 as_bad (_("missing value"));
3087 ignore_rest_of_line ();
3089 mri_comment_end (stop, stopc);
3093 ++input_line_pointer;
3097 /* Skip any 0{letter} that may be present. Don't even check if the
3098 * letter is legal. */
3099 if (input_line_pointer[0] == '0'
3100 && ISALPHA (input_line_pointer[1]))
3101 input_line_pointer += 2;
3103 /* Accept :xxxx, where the x's are hex digits, for a floating point
3104 with the exact digits specified. */
3105 if (input_line_pointer[0] == ':')
3107 flen = hex_float (float_type, temp);
3110 ignore_rest_of_line ();
3112 mri_comment_end (stop, stopc);
3120 err = md_atof (float_type, temp, &flen);
3121 know (flen <= MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT);
3125 as_bad (_("bad floating literal: %s"), err);
3126 ignore_rest_of_line ();
3128 mri_comment_end (stop, stopc);
3133 while (--count >= 0)
3137 p = frag_more (flen);
3138 memcpy (p, temp, (unsigned int) flen);
3141 demand_empty_rest_of_line ();
3144 mri_comment_end (stop, stopc);
3147 /* Handle the .struct pseudo-op, as found in MIPS assemblers. */
3150 s_struct (int ignore ATTRIBUTE_UNUSED)
3156 stop = mri_comment_field (&stopc);
3157 abs_section_offset = get_absolute_expression ();
3158 subseg_set (absolute_section, 0);
3159 demand_empty_rest_of_line ();
3161 mri_comment_end (stop, stopc);
3165 s_text (int ignore ATTRIBUTE_UNUSED)
3169 temp = get_absolute_expression ();
3170 subseg_set (text_section, (subsegT) temp);
3171 demand_empty_rest_of_line ();
3173 const_flag &= ~IN_DEFAULT_SECTION;
3178 /* Verify that we are at the end of a line. If not, issue an error and
3182 demand_empty_rest_of_line (void)
3185 if (is_end_of_line[(unsigned char) *input_line_pointer])
3186 input_line_pointer++;
3189 if (ISPRINT (*input_line_pointer))
3190 as_bad (_("junk at end of line, first unrecognized character is `%c'"),
3191 *input_line_pointer);
3193 as_bad (_("junk at end of line, first unrecognized character valued 0x%x"),
3194 *input_line_pointer);
3195 ignore_rest_of_line ();
3198 /* Return pointing just after end-of-line. */
3199 know (is_end_of_line[(unsigned char) input_line_pointer[-1]]);
3202 /* Silently advance to the end of line. Use this after already having
3203 issued an error about something bad. */
3206 ignore_rest_of_line (void)
3208 while (input_line_pointer < buffer_limit
3209 && !is_end_of_line[(unsigned char) *input_line_pointer])
3210 input_line_pointer++;
3212 input_line_pointer++;
3214 /* Return pointing just after end-of-line. */
3215 know (is_end_of_line[(unsigned char) input_line_pointer[-1]]);
3219 discard_rest_of_line (void)
3221 while (input_line_pointer < buffer_limit
3222 && !is_end_of_line[(unsigned char) *input_line_pointer])
3223 input_line_pointer++;
3225 input_line_pointer++;
3227 /* Return pointing just after end-of-line. */
3228 know (is_end_of_line[(unsigned char) input_line_pointer[-1]]);
3231 /* Sets frag for given symbol to zero_address_frag, except when the
3232 symbol frag is already set to a dummy listing frag. */
3235 set_zero_frag (symbolS *symbolP)
3237 if (symbol_get_frag (symbolP)->fr_type != rs_dummy)
3238 symbol_set_frag (symbolP, &zero_address_frag);
3241 /* In: Pointer to a symbol.
3242 Input_line_pointer->expression.
3244 Out: Input_line_pointer->just after any whitespace after expression.
3245 Tried to set symbol to value of expression.
3246 Will change symbols type, value, and frag; */
3249 pseudo_set (symbolS *symbolP)
3253 #if (defined (OBJ_AOUT) || defined (OBJ_BOUT)) && ! defined (BFD_ASSEMBLER)
3255 #endif /* OBJ_AOUT or OBJ_BOUT */
3257 know (symbolP); /* NULL pointer is logic error. */
3259 (void) expression (&exp);
3261 if (exp.X_op == O_illegal)
3262 as_bad (_("illegal expression"));
3263 else if (exp.X_op == O_absent)
3264 as_bad (_("missing expression"));
3265 else if (exp.X_op == O_big)
3267 if (exp.X_add_number > 0)
3268 as_bad (_("bignum invalid"));
3270 as_bad (_("floating point number invalid"));
3272 else if (exp.X_op == O_subtract
3273 && SEG_NORMAL (S_GET_SEGMENT (exp.X_add_symbol))
3274 && (symbol_get_frag (exp.X_add_symbol)
3275 == symbol_get_frag (exp.X_op_symbol)))
3277 exp.X_op = O_constant;
3278 exp.X_add_number = (S_GET_VALUE (exp.X_add_symbol)
3279 - S_GET_VALUE (exp.X_op_symbol));
3282 if (symbol_section_p (symbolP))
3284 as_bad ("attempt to set value of section symbol");
3287 #if (defined (OBJ_AOUT) || defined (OBJ_BOUT)) && ! defined (BFD_ASSEMBLER)
3288 ext = S_IS_EXTERNAL (symbolP);
3289 #endif /* OBJ_AOUT or OBJ_BOUT */
3296 exp.X_add_number = 0;
3299 S_SET_SEGMENT (symbolP, absolute_section);
3300 S_SET_VALUE (symbolP, (valueT) exp.X_add_number);
3301 set_zero_frag (symbolP);
3305 S_SET_SEGMENT (symbolP, reg_section);
3306 S_SET_VALUE (symbolP, (valueT) exp.X_add_number);
3307 set_zero_frag (symbolP);
3311 seg = S_GET_SEGMENT (exp.X_add_symbol);
3312 /* For x=undef+const, create an expression symbol.
3313 For x=x+const, just update x except when x is an undefined symbol
3314 For x=defined+const, evaluate x. */
3315 if (symbolP == exp.X_add_symbol
3316 && (seg != undefined_section
3317 || !symbol_constant_p (symbolP)))
3319 *symbol_X_add_number (symbolP) += exp.X_add_number;
3322 else if (seg != undefined_section)
3324 symbolS *s = exp.X_add_symbol;
3326 if (S_IS_COMMON (s))
3327 as_bad (_("`%s' can't be equated to common symbol '%s'"),
3328 S_GET_NAME (symbolP), S_GET_NAME (s));
3330 S_SET_SEGMENT (symbolP, seg);
3331 S_SET_VALUE (symbolP, exp.X_add_number + S_GET_VALUE (s));
3332 symbol_set_frag (symbolP, symbol_get_frag (s));
3333 copy_symbol_attributes (symbolP, s);
3339 /* The value is some complex expression.
3340 Set segment and frag back to that of a newly created symbol. */
3341 S_SET_SEGMENT (symbolP, undefined_section);
3342 symbol_set_value_expression (symbolP, &exp);
3343 set_zero_frag (symbolP);
3347 #if (defined (OBJ_AOUT) || defined (OBJ_BOUT)) && ! defined (BFD_ASSEMBLER)
3349 S_SET_EXTERNAL (symbolP);
3351 S_CLEAR_EXTERNAL (symbolP);
3352 #endif /* OBJ_AOUT or OBJ_BOUT */
3357 CONStruct more frag of .bytes, or .words etc.
3358 Should need_pass_2 be 1 then emit no frag(s).
3359 This understands EXPRESSIONS.
3363 This has a split personality. We use expression() to read the
3364 value. We can detect if the value won't fit in a byte or word.
3365 But we can't detect if expression() discarded significant digits
3366 in the case of a long. Not worth the crocks required to fix it. */
3368 /* Select a parser for cons expressions. */
3370 /* Some targets need to parse the expression in various fancy ways.
3371 You can define TC_PARSE_CONS_EXPRESSION to do whatever you like
3372 (for example, the HPPA does this). Otherwise, you can define
3373 BITFIELD_CONS_EXPRESSIONS to permit bitfields to be specified, or
3374 REPEAT_CONS_EXPRESSIONS to permit repeat counts. If none of these
3375 are defined, which is the normal case, then only simple expressions
3380 parse_mri_cons (expressionS *exp, unsigned int nbytes);
3383 #ifndef TC_PARSE_CONS_EXPRESSION
3384 #ifdef BITFIELD_CONS_EXPRESSIONS
3385 #define TC_PARSE_CONS_EXPRESSION(EXP, NBYTES) parse_bitfield_cons (EXP, NBYTES)
3387 parse_bitfield_cons (expressionS *exp, unsigned int nbytes);
3389 #ifdef REPEAT_CONS_EXPRESSIONS
3390 #define TC_PARSE_CONS_EXPRESSION(EXP, NBYTES) parse_repeat_cons (EXP, NBYTES)
3392 parse_repeat_cons (expressionS *exp, unsigned int nbytes);
3395 /* If we haven't gotten one yet, just call expression. */
3396 #ifndef TC_PARSE_CONS_EXPRESSION
3397 #define TC_PARSE_CONS_EXPRESSION(EXP, NBYTES) expression (EXP)
3402 do_parse_cons_expression (expressionS *exp,
3403 int nbytes ATTRIBUTE_UNUSED)
3405 TC_PARSE_CONS_EXPRESSION (exp, nbytes);
3409 /* Worker to do .byte etc statements.
3410 Clobbers input_line_pointer and checks end-of-line. */
3413 cons_worker (register int nbytes, /* 1=.byte, 2=.word, 4=.long. */
3421 #ifdef md_flush_pending_output
3422 md_flush_pending_output ();
3426 stop = mri_comment_field (&stopc);
3428 if (is_it_end_of_statement ())
3430 demand_empty_rest_of_line ();
3432 mri_comment_end (stop, stopc);
3436 #ifdef TC_ADDRESS_BYTES
3438 nbytes = TC_ADDRESS_BYTES ();
3441 #ifdef md_cons_align
3442 md_cons_align (nbytes);
3450 parse_mri_cons (&exp, (unsigned int) nbytes);
3453 TC_PARSE_CONS_EXPRESSION (&exp, (unsigned int) nbytes);
3457 if (exp.X_op == O_symbol)
3458 exp.X_op = O_symbol_rva;
3460 as_fatal (_("rva without symbol"));
3462 emit_expr (&exp, (unsigned int) nbytes);
3465 while (*input_line_pointer++ == ',');
3467 /* In MRI mode, after an odd number of bytes, we must align to an
3468 even word boundary, unless the next instruction is a dc.b, ds.b
3470 if (flag_mri && nbytes == 1 && (c & 1) != 0)
3471 mri_pending_align = 1;
3473 input_line_pointer--; /* Put terminator back into stream. */
3475 demand_empty_rest_of_line ();
3478 mri_comment_end (stop, stopc);
3484 cons_worker (size, 0);
3490 cons_worker (size, 1);
3493 /* Put the contents of expression EXP into the object file using
3494 NBYTES bytes. If need_pass_2 is 1, this does nothing. */
3497 emit_expr (expressionS *exp, unsigned int nbytes)
3501 valueT extra_digit = 0;
3503 /* Don't do anything if we are going to make another pass. */
3507 dot_value = frag_now_fix ();
3511 /* When gcc emits DWARF 1 debugging pseudo-ops, a line number will
3512 appear as a four byte positive constant in the .line section,
3513 followed by a 2 byte 0xffff. Look for that case here. */
3515 static int dwarf_line = -1;
3517 if (strcmp (segment_name (now_seg), ".line") != 0)
3519 else if (dwarf_line >= 0
3521 && exp->X_op == O_constant
3522 && (exp->X_add_number == -1 || exp->X_add_number == 0xffff))
3523 listing_source_line ((unsigned int) dwarf_line);
3524 else if (nbytes == 4
3525 && exp->X_op == O_constant
3526 && exp->X_add_number >= 0)
3527 dwarf_line = exp->X_add_number;
3532 /* When gcc emits DWARF 1 debugging pseudo-ops, a file name will
3533 appear as a 2 byte TAG_compile_unit (0x11) followed by a 2 byte
3534 AT_sibling (0x12) followed by a four byte address of the sibling
3535 followed by a 2 byte AT_name (0x38) followed by the name of the
3536 file. We look for that case here. */
3538 static int dwarf_file = 0;
3540 if (strcmp (segment_name (now_seg), ".debug") != 0)
3542 else if (dwarf_file == 0
3544 && exp->X_op == O_constant
3545 && exp->X_add_number == 0x11)
3547 else if (dwarf_file == 1
3549 && exp->X_op == O_constant
3550 && exp->X_add_number == 0x12)
3552 else if (dwarf_file == 2
3555 else if (dwarf_file == 3
3557 && exp->X_op == O_constant
3558 && exp->X_add_number == 0x38)
3563 /* The variable dwarf_file_string tells stringer that the string
3564 may be the name of the source file. */
3565 if (dwarf_file == 4)
3566 dwarf_file_string = 1;
3568 dwarf_file_string = 0;
3573 if (check_eh_frame (exp, &nbytes))
3578 /* Allow `.word 0' in the absolute section. */
3579 if (now_seg == absolute_section)
3581 if (op != O_constant || exp->X_add_number != 0)
3582 as_bad (_("attempt to store value in absolute section"));
3583 abs_section_offset += nbytes;
3587 /* Handle a negative bignum. */
3589 && exp->X_add_number == 0
3590 && symbol_get_value_expression (exp->X_add_symbol)->X_op == O_big
3591 && symbol_get_value_expression (exp->X_add_symbol)->X_add_number > 0)
3594 unsigned long carry;
3596 exp = symbol_get_value_expression (exp->X_add_symbol);
3598 /* Negate the bignum: one's complement each digit and add 1. */
3600 for (i = 0; i < exp->X_add_number; i++)
3604 next = (((~(generic_bignum[i] & LITTLENUM_MASK))
3607 generic_bignum[i] = next & LITTLENUM_MASK;
3608 carry = next >> LITTLENUM_NUMBER_OF_BITS;
3611 /* We can ignore any carry out, because it will be handled by
3612 extra_digit if it is needed. */
3614 extra_digit = (valueT) -1;
3618 if (op == O_absent || op == O_illegal)
3620 as_warn (_("zero assumed for missing expression"));
3621 exp->X_add_number = 0;
3624 else if (op == O_big && exp->X_add_number <= 0)
3626 as_bad (_("floating point number invalid"));
3627 exp->X_add_number = 0;
3630 else if (op == O_register)
3632 as_warn (_("register value used as expression"));
3636 p = frag_more ((int) nbytes);
3638 #ifndef WORKING_DOT_WORD
3639 /* If we have the difference of two symbols in a word, save it on
3640 the broken_words list. See the code in write.c. */
3641 if (op == O_subtract && nbytes == 2)
3643 struct broken_word *x;
3645 x = (struct broken_word *) xmalloc (sizeof (struct broken_word));
3646 x->next_broken_word = broken_words;
3649 x->subseg = now_subseg;
3651 x->word_goes_here = p;
3653 x->add = exp->X_add_symbol;
3654 x->sub = exp->X_op_symbol;
3655 x->addnum = exp->X_add_number;
3663 /* If we have an integer, but the number of bytes is too large to
3664 pass to md_number_to_chars, handle it as a bignum. */
3665 if (op == O_constant && nbytes > sizeof (valueT))
3667 extra_digit = exp->X_unsigned ? 0 : -1;
3668 convert_to_bignum (exp);
3672 if (op == O_constant)
3674 register valueT get;
3675 register valueT use;
3676 register valueT mask;
3678 register valueT unmask;
3680 /* JF << of >= number of bits in the object is undefined. In
3681 particular SPARC (Sun 4) has problems. */
3682 if (nbytes >= sizeof (valueT))
3685 if (nbytes > sizeof (valueT))
3688 hibit = (valueT) 1 << (nbytes * BITS_PER_CHAR - 1);
3692 /* Don't store these bits. */
3693 mask = ~(valueT) 0 << (BITS_PER_CHAR * nbytes);
3694 hibit = (valueT) 1 << (nbytes * BITS_PER_CHAR - 1);
3697 unmask = ~mask; /* Do store these bits. */
3700 "Do this mod if you want every overflow check to assume SIGNED 2's complement data.";
3701 mask = ~(unmask >> 1); /* Includes sign bit now. */
3704 get = exp->X_add_number;
3706 if ((get & mask) != 0
3707 && ((get & mask) != mask
3708 || (get & hibit) == 0))
3709 { /* Leading bits contain both 0s & 1s. */
3710 as_warn (_("value 0x%lx truncated to 0x%lx"),
3711 (unsigned long) get, (unsigned long) use);
3713 /* Put bytes in right order. */
3714 md_number_to_chars (p, use, (int) nbytes);
3716 else if (op == O_big)
3719 LITTLENUM_TYPE *nums;
3721 know (nbytes % CHARS_PER_LITTLENUM == 0);
3723 size = exp->X_add_number * CHARS_PER_LITTLENUM;
3726 as_warn (_("bignum truncated to %d bytes"), nbytes);
3730 if (target_big_endian)
3732 while (nbytes > size)
3734 md_number_to_chars (p, extra_digit, CHARS_PER_LITTLENUM);
3735 nbytes -= CHARS_PER_LITTLENUM;
3736 p += CHARS_PER_LITTLENUM;
3739 nums = generic_bignum + size / CHARS_PER_LITTLENUM;
3740 while (size >= CHARS_PER_LITTLENUM)
3743 md_number_to_chars (p, (valueT) *nums, CHARS_PER_LITTLENUM);
3744 size -= CHARS_PER_LITTLENUM;
3745 p += CHARS_PER_LITTLENUM;
3750 nums = generic_bignum;
3751 while (size >= CHARS_PER_LITTLENUM)
3753 md_number_to_chars (p, (valueT) *nums, CHARS_PER_LITTLENUM);
3755 size -= CHARS_PER_LITTLENUM;
3756 p += CHARS_PER_LITTLENUM;
3757 nbytes -= CHARS_PER_LITTLENUM;
3760 while (nbytes >= CHARS_PER_LITTLENUM)
3762 md_number_to_chars (p, extra_digit, CHARS_PER_LITTLENUM);
3763 nbytes -= CHARS_PER_LITTLENUM;
3764 p += CHARS_PER_LITTLENUM;
3770 memset (p, 0, nbytes);
3772 /* Now we need to generate a fixS to record the symbol value.
3773 This is easy for BFD. For other targets it can be more
3774 complex. For very complex cases (currently, the HPPA and
3775 NS32K), you can define TC_CONS_FIX_NEW to do whatever you
3776 want. For simpler cases, you can define TC_CONS_RELOC to be
3777 the name of the reloc code that should be stored in the fixS.
3778 If neither is defined, the code uses NO_RELOC if it is
3779 defined, and otherwise uses 0. */
3781 #ifdef BFD_ASSEMBLER
3782 #ifdef TC_CONS_FIX_NEW
3783 TC_CONS_FIX_NEW (frag_now, p - frag_now->fr_literal, nbytes, exp);
3786 bfd_reloc_code_real_type r;
3803 as_bad (_("unsupported BFD relocation size %u"), nbytes);
3807 fix_new_exp (frag_now, p - frag_now->fr_literal, (int) nbytes, exp,
3812 #ifdef TC_CONS_FIX_NEW
3813 TC_CONS_FIX_NEW (frag_now, p - frag_now->fr_literal, nbytes, exp);
3815 /* Figure out which reloc number to use. Use TC_CONS_RELOC if
3816 it is defined, otherwise use NO_RELOC if it is defined,
3818 #ifndef TC_CONS_RELOC
3820 #define TC_CONS_RELOC NO_RELOC
3822 #define TC_CONS_RELOC 0
3825 fix_new_exp (frag_now, p - frag_now->fr_literal, (int) nbytes, exp, 0,
3827 #endif /* TC_CONS_FIX_NEW */
3828 #endif /* BFD_ASSEMBLER */
3832 #ifdef BITFIELD_CONS_EXPRESSIONS
3834 /* i960 assemblers, (eg, asm960), allow bitfields after ".byte" as
3835 w:x,y:z, where w and y are bitwidths and x and y are values. They
3836 then pack them all together. We do a little better in that we allow
3837 them in words, longs, etc. and we'll pack them in target byte order
3840 The rules are: pack least significant bit first, if a field doesn't
3841 entirely fit, put it in the next unit. Overflowing the bitfield is
3842 explicitly *not* even a warning. The bitwidth should be considered
3845 To use this function the tc-XXX.h file should define
3846 BITFIELD_CONS_EXPRESSIONS. */
3849 parse_bitfield_cons (exp, nbytes)
3851 unsigned int nbytes;
3853 unsigned int bits_available = BITS_PER_CHAR * nbytes;
3854 char *hold = input_line_pointer;
3856 (void) expression (exp);
3858 if (*input_line_pointer == ':')
3865 unsigned long width;
3867 if (*input_line_pointer != ':')
3869 input_line_pointer = hold;
3871 } /* Next piece is not a bitfield. */
3873 /* In the general case, we can't allow
3874 full expressions with symbol
3875 differences and such. The relocation
3876 entries for symbols not defined in this
3877 assembly would require arbitrary field
3878 widths, positions, and masks which most
3879 of our current object formats don't
3882 In the specific case where a symbol
3883 *is* defined in this assembly, we
3884 *could* build fixups and track it, but
3885 this could lead to confusion for the
3886 backends. I'm lazy. I'll take any
3887 SEG_ABSOLUTE. I think that means that
3888 you can use a previous .set or
3889 .equ type symbol. xoxorich. */
3891 if (exp->X_op == O_absent)
3893 as_warn (_("using a bit field width of zero"));
3894 exp->X_add_number = 0;
3895 exp->X_op = O_constant;
3896 } /* Implied zero width bitfield. */
3898 if (exp->X_op != O_constant)
3900 *input_line_pointer = '\0';
3901 as_bad (_("field width \"%s\" too complex for a bitfield"), hold);
3902 *input_line_pointer = ':';
3903 demand_empty_rest_of_line ();
3905 } /* Too complex. */
3907 if ((width = exp->X_add_number) > (BITS_PER_CHAR * nbytes))
3909 as_warn (_("field width %lu too big to fit in %d bytes: truncated to %d bits"),
3910 width, nbytes, (BITS_PER_CHAR * nbytes));
3911 width = BITS_PER_CHAR * nbytes;
3914 if (width > bits_available)
3916 /* FIXME-SOMEDAY: backing up and reparsing is wasteful. */
3917 input_line_pointer = hold;
3918 exp->X_add_number = value;
3923 hold = ++input_line_pointer;
3925 (void) expression (exp);
3926 if (exp->X_op != O_constant)
3928 char cache = *input_line_pointer;
3930 *input_line_pointer = '\0';
3931 as_bad (_("field value \"%s\" too complex for a bitfield"), hold);
3932 *input_line_pointer = cache;
3933 demand_empty_rest_of_line ();
3935 } /* Too complex. */
3937 value |= ((~(-1 << width) & exp->X_add_number)
3938 << ((BITS_PER_CHAR * nbytes) - bits_available));
3940 if ((bits_available -= width) == 0
3941 || is_it_end_of_statement ()
3942 || *input_line_pointer != ',')
3945 } /* All the bitfields we're gonna get. */
3947 hold = ++input_line_pointer;
3948 (void) expression (exp);
3951 exp->X_add_number = value;
3952 exp->X_op = O_constant;
3953 exp->X_unsigned = 1;
3957 #endif /* BITFIELD_CONS_EXPRESSIONS */
3959 /* Handle an MRI style string expression. */
3963 parse_mri_cons (exp, nbytes)
3965 unsigned int nbytes;
3967 if (*input_line_pointer != '\''
3968 && (input_line_pointer[1] != '\''
3969 || (*input_line_pointer != 'A'
3970 && *input_line_pointer != 'E')))
3971 TC_PARSE_CONS_EXPRESSION (exp, nbytes);
3975 unsigned int result = 0;
3977 /* An MRI style string. Cut into as many bytes as will fit into
3978 a nbyte chunk, left justify if necessary, and separate with
3979 commas so we can try again later. */
3980 if (*input_line_pointer == 'A')
3981 ++input_line_pointer;
3982 else if (*input_line_pointer == 'E')
3984 as_bad (_("EBCDIC constants are not supported"));
3985 ++input_line_pointer;
3988 input_line_pointer++;
3989 for (scan = 0; scan < nbytes; scan++)
3991 if (*input_line_pointer == '\'')
3993 if (input_line_pointer[1] == '\'')
3995 input_line_pointer++;
4000 result = (result << 8) | (*input_line_pointer++);
4004 while (scan < nbytes)
4010 /* Create correct expression. */
4011 exp->X_op = O_constant;
4012 exp->X_add_number = result;
4014 /* Fake it so that we can read the next char too. */
4015 if (input_line_pointer[0] != '\'' ||
4016 (input_line_pointer[0] == '\'' && input_line_pointer[1] == '\''))
4018 input_line_pointer -= 2;
4019 input_line_pointer[0] = ',';
4020 input_line_pointer[1] = '\'';
4023 input_line_pointer++;
4026 #endif /* TC_M68K */
4028 #ifdef REPEAT_CONS_EXPRESSIONS
4030 /* Parse a repeat expression for cons. This is used by the MIPS
4031 assembler. The format is NUMBER:COUNT; NUMBER appears in the
4032 object file COUNT times.
4034 To use this for a target, define REPEAT_CONS_EXPRESSIONS. */
4037 parse_repeat_cons (exp, nbytes)
4039 unsigned int nbytes;
4046 if (*input_line_pointer != ':')
4048 /* No repeat count. */
4052 ++input_line_pointer;
4053 expression (&count);
4054 if (count.X_op != O_constant
4055 || count.X_add_number <= 0)
4057 as_warn (_("unresolvable or nonpositive repeat count; using 1"));
4061 /* The cons function is going to output this expression once. So we
4062 output it count - 1 times. */
4063 for (i = count.X_add_number - 1; i > 0; i--)
4064 emit_expr (exp, nbytes);
4067 #endif /* REPEAT_CONS_EXPRESSIONS */
4069 /* Parse a floating point number represented as a hex constant. This
4070 permits users to specify the exact bits they want in the floating
4074 hex_float (int float_type, char *bytes)
4106 as_bad (_("unknown floating type type '%c'"), float_type);
4110 /* It would be nice if we could go through expression to parse the
4111 hex constant, but if we get a bignum it's a pain to sort it into
4112 the buffer correctly. */
4114 while (hex_p (*input_line_pointer) || *input_line_pointer == '_')
4118 /* The MRI assembler accepts arbitrary underscores strewn about
4119 through the hex constant, so we ignore them as well. */
4120 if (*input_line_pointer == '_')
4122 ++input_line_pointer;
4128 as_warn (_("floating point constant too large"));
4131 d = hex_value (*input_line_pointer) << 4;
4132 ++input_line_pointer;
4133 while (*input_line_pointer == '_')
4134 ++input_line_pointer;
4135 if (hex_p (*input_line_pointer))
4137 d += hex_value (*input_line_pointer);
4138 ++input_line_pointer;
4140 if (target_big_endian)
4143 bytes[length - i - 1] = d;
4149 if (target_big_endian)
4150 memset (bytes + i, 0, length - i);
4152 memset (bytes, 0, length - i);
4160 CONStruct some more frag chars of .floats .ffloats etc.
4161 Makes 0 or more new frags.
4162 If need_pass_2 == 1, no frags are emitted.
4163 This understands only floating literals, not expressions. Sorry.
4165 A floating constant is defined by atof_generic(), except it is preceded
4166 by 0d 0f 0g or 0h. After observing the STRANGE way my BSD AS does its
4167 reading, I decided to be incompatible. This always tries to give you
4168 rounded bits to the precision of the pseudo-op. Former AS did premature
4169 truncation, restored noisy bits instead of trailing 0s AND gave you
4170 a choice of 2 flavours of noise according to which of 2 floating-point
4171 scanners you directed AS to use.
4173 In: input_line_pointer->whitespace before, or '0' of flonum. */
4176 float_cons (/* Clobbers input_line-pointer, checks end-of-line. */
4177 register int float_type /* 'f':.ffloat ... 'F':.float ... */)
4180 int length; /* Number of chars in an object. */
4181 register char *err; /* Error from scanning floating literal. */
4182 char temp[MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT];
4184 if (is_it_end_of_statement ())
4186 demand_empty_rest_of_line ();
4190 #ifdef md_flush_pending_output
4191 md_flush_pending_output ();
4196 /* input_line_pointer->1st char of a flonum (we hope!). */
4199 /* Skip any 0{letter} that may be present. Don't even check if the
4200 letter is legal. Someone may invent a "z" format and this routine
4201 has no use for such information. Lusers beware: you get
4202 diagnostics if your input is ill-conditioned. */
4203 if (input_line_pointer[0] == '0'
4204 && ISALPHA (input_line_pointer[1]))
4205 input_line_pointer += 2;
4207 /* Accept :xxxx, where the x's are hex digits, for a floating
4208 point with the exact digits specified. */
4209 if (input_line_pointer[0] == ':')
4211 ++input_line_pointer;
4212 length = hex_float (float_type, temp);
4215 ignore_rest_of_line ();
4221 err = md_atof (float_type, temp, &length);
4222 know (length <= MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT);
4226 as_bad (_("bad floating literal: %s"), err);
4227 ignore_rest_of_line ();
4238 #ifdef REPEAT_CONS_EXPRESSIONS
4239 if (*input_line_pointer == ':')
4241 expressionS count_exp;
4243 ++input_line_pointer;
4244 expression (&count_exp);
4246 if (count_exp.X_op != O_constant
4247 || count_exp.X_add_number <= 0)
4248 as_warn (_("unresolvable or nonpositive repeat count; using 1"));
4250 count = count_exp.X_add_number;
4254 while (--count >= 0)
4256 p = frag_more (length);
4257 memcpy (p, temp, (unsigned int) length);
4262 while (*input_line_pointer++ == ',');
4264 /* Put terminator back into stream. */
4265 --input_line_pointer;
4266 demand_empty_rest_of_line ();
4269 /* Return the size of a LEB128 value. */
4272 sizeof_sleb128 (offsetT value)
4274 register int size = 0;
4275 register unsigned byte;
4279 byte = (value & 0x7f);
4280 /* Sadly, we cannot rely on typical arithmetic right shift behaviour.
4281 Fortunately, we can structure things so that the extra work reduces
4282 to a noop on systems that do things "properly". */
4283 value = (value >> 7) | ~(-(offsetT)1 >> 7);
4286 while (!(((value == 0) && ((byte & 0x40) == 0))
4287 || ((value == -1) && ((byte & 0x40) != 0))));
4293 sizeof_uleb128 (valueT value)
4295 register int size = 0;
4296 register unsigned byte;
4300 byte = (value & 0x7f);
4310 sizeof_leb128 (valueT value, int sign)
4313 return sizeof_sleb128 ((offsetT) value);
4315 return sizeof_uleb128 (value);
4318 /* Output a LEB128 value. */
4321 output_sleb128 (char *p, offsetT value)
4323 register char *orig = p;
4328 unsigned byte = (value & 0x7f);
4330 /* Sadly, we cannot rely on typical arithmetic right shift behaviour.
4331 Fortunately, we can structure things so that the extra work reduces
4332 to a noop on systems that do things "properly". */
4333 value = (value >> 7) | ~(-(offsetT)1 >> 7);
4335 more = !((((value == 0) && ((byte & 0x40) == 0))
4336 || ((value == -1) && ((byte & 0x40) != 0))));
4348 output_uleb128 (char *p, valueT value)
4354 unsigned byte = (value & 0x7f);
4357 /* More bytes to follow. */
4368 output_leb128 (char *p, valueT value, int sign)
4371 return output_sleb128 (p, (offsetT) value);
4373 return output_uleb128 (p, value);
4376 /* Do the same for bignums. We combine sizeof with output here in that
4377 we don't output for NULL values of P. It isn't really as critical as
4378 for "normal" values that this be streamlined. */
4381 output_big_sleb128 (char *p, LITTLENUM_TYPE *bignum, int size)
4388 /* Strip leading sign extensions off the bignum. */
4390 && bignum[size - 1] == LITTLENUM_MASK
4391 && bignum[size - 2] > LITTLENUM_MASK / 2)
4396 /* OR in the next part of the littlenum. */
4397 val |= (*bignum << loaded);
4398 loaded += LITTLENUM_NUMBER_OF_BITS;
4402 /* Add bytes until there are less than 7 bits left in VAL
4403 or until every non-sign bit has been written. */
4410 || val != ((byte & 0x40) == 0 ? 0 : ((valueT) 1 << loaded) - 1))
4417 while ((byte & 0x80) != 0 && loaded >= 7);
4421 /* Mop up any left-over bits (of which there will be less than 7). */
4422 if ((byte & 0x80) != 0)
4424 /* Sign-extend VAL. */
4425 if (val & (1 << (loaded - 1)))
4426 val |= ~0 << loaded;
4436 output_big_uleb128 (char *p, LITTLENUM_TYPE *bignum, int size)
4443 /* Strip leading zeros off the bignum. */
4444 /* XXX: Is this needed? */
4445 while (size > 0 && bignum[size - 1] == 0)
4450 if (loaded < 7 && size > 0)
4452 val |= (*bignum << loaded);
4453 loaded += 8 * CHARS_PER_LITTLENUM;
4462 if (size > 0 || val)
4469 while (byte & 0x80);
4475 output_big_leb128 (char *p, LITTLENUM_TYPE *bignum, int size, int sign)
4478 return output_big_sleb128 (p, bignum, size);
4480 return output_big_uleb128 (p, bignum, size);
4483 /* Generate the appropriate fragments for a given expression to emit a
4487 emit_leb128_expr (expressionS *exp, int sign)
4489 operatorT op = exp->X_op;
4490 unsigned int nbytes;
4492 if (op == O_absent || op == O_illegal)
4494 as_warn (_("zero assumed for missing expression"));
4495 exp->X_add_number = 0;
4498 else if (op == O_big && exp->X_add_number <= 0)
4500 as_bad (_("floating point number invalid"));
4501 exp->X_add_number = 0;
4504 else if (op == O_register)
4506 as_warn (_("register value used as expression"));
4509 else if (op == O_constant
4511 && (exp->X_add_number < 0) != !exp->X_unsigned)
4513 /* We're outputting a signed leb128 and the sign of X_add_number
4514 doesn't reflect the sign of the original value. Convert EXP
4515 to a correctly-extended bignum instead. */
4516 convert_to_bignum (exp);
4520 /* Let check_eh_frame know that data is being emitted. nbytes == -1 is
4521 a signal that this is leb128 data. It shouldn't optimize this away. */
4522 nbytes = (unsigned int) -1;
4523 if (check_eh_frame (exp, &nbytes))
4526 /* Let the backend know that subsequent data may be byte aligned. */
4527 #ifdef md_cons_align
4531 if (op == O_constant)
4533 /* If we've got a constant, emit the thing directly right now. */
4535 valueT value = exp->X_add_number;
4539 size = sizeof_leb128 (value, sign);
4540 p = frag_more (size);
4541 output_leb128 (p, value, sign);
4543 else if (op == O_big)
4545 /* O_big is a different sort of constant. */
4550 size = output_big_leb128 (NULL, generic_bignum, exp->X_add_number, sign);
4551 p = frag_more (size);
4552 output_big_leb128 (p, generic_bignum, exp->X_add_number, sign);
4556 /* Otherwise, we have to create a variable sized fragment and
4557 resolve things later. */
4559 frag_var (rs_leb128, sizeof_uleb128 (~(valueT) 0), 0, sign,
4560 make_expr_symbol (exp), 0, (char *) NULL);
4564 /* Parse the .sleb128 and .uleb128 pseudos. */
4571 #ifdef md_flush_pending_output
4572 md_flush_pending_output ();
4578 emit_leb128_expr (&exp, sign);
4580 while (*input_line_pointer++ == ',');
4582 input_line_pointer--;
4583 demand_empty_rest_of_line ();
4586 /* We read 0 or more ',' separated, double-quoted strings.
4587 Caller should have checked need_pass_2 is FALSE because we don't
4591 stringer (/* Worker to do .ascii etc statements. */
4592 /* Checks end-of-line. */
4593 register int append_zero /* 0: don't append '\0', else 1. */)
4595 register unsigned int c;
4598 #ifdef md_flush_pending_output
4599 md_flush_pending_output ();
4602 /* The following awkward logic is to parse ZERO or more strings,
4603 comma separated. Recall a string expression includes spaces
4604 before the opening '\"' and spaces after the closing '\"'.
4605 We fake a leading ',' if there is (supposed to be)
4606 a 1st, expression. We keep demanding expressions for each ','. */
4607 if (is_it_end_of_statement ())
4609 c = 0; /* Skip loop. */
4610 ++input_line_pointer; /* Compensate for end of loop. */
4614 c = ','; /* Do loop. */
4616 /* If we have been switched into the abs_section then we
4617 will not have an obstack onto which we can hang strings. */
4618 if (now_seg == absolute_section)
4620 as_bad (_("strings must be placed into a section"));
4622 ignore_rest_of_line ();
4625 while (c == ',' || c == '<' || c == '"')
4628 switch (*input_line_pointer)
4631 ++input_line_pointer; /*->1st char of string. */
4632 start = input_line_pointer;
4633 while (is_a_char (c = next_char_of_string ()))
4635 FRAG_APPEND_1_CHAR (c);
4639 FRAG_APPEND_1_CHAR (0);
4641 know (input_line_pointer[-1] == '\"');
4645 /* In ELF, when gcc is emitting DWARF 1 debugging output, it
4646 will emit .string with a filename in the .debug section
4647 after a sequence of constants. See the comment in
4648 emit_expr for the sequence. emit_expr will set
4649 dwarf_file_string to non-zero if this string might be a
4650 source file name. */
4651 if (strcmp (segment_name (now_seg), ".debug") != 0)
4652 dwarf_file_string = 0;
4653 else if (dwarf_file_string)
4655 c = input_line_pointer[-1];
4656 input_line_pointer[-1] = '\0';
4657 listing_source_file (start);
4658 input_line_pointer[-1] = c;
4665 input_line_pointer++;
4666 c = get_single_number ();
4667 FRAG_APPEND_1_CHAR (c);
4668 if (*input_line_pointer != '>')
4670 as_bad (_("expected <nn>"));
4672 input_line_pointer++;
4675 input_line_pointer++;
4679 c = *input_line_pointer;
4682 demand_empty_rest_of_line ();
4685 /* FIXME-SOMEDAY: I had trouble here on characters with the
4686 high bits set. We'll probably also have trouble with
4687 multibyte chars, wide chars, etc. Also be careful about
4688 returning values bigger than 1 byte. xoxorich. */
4691 next_char_of_string (void)
4693 register unsigned int c;
4695 c = *input_line_pointer++ & CHAR_MASK;
4703 as_warn (_("unterminated string; newline inserted"));
4704 bump_line_counters ();
4707 #ifndef NO_STRING_ESCAPES
4709 switch (c = *input_line_pointer++)
4737 break; /* As itself. */
4753 for (i = 0, number = 0;
4754 ISDIGIT (c) && i < 3;
4755 c = *input_line_pointer++, i++)
4757 number = number * 8 + c - '0';
4762 --input_line_pointer;
4771 c = *input_line_pointer++;
4772 while (ISXDIGIT (c))
4775 number = number * 16 + c - '0';
4776 else if (ISUPPER (c))
4777 number = number * 16 + c - 'A' + 10;
4779 number = number * 16 + c - 'a' + 10;
4780 c = *input_line_pointer++;
4783 --input_line_pointer;
4788 /* To be compatible with BSD 4.2 as: give the luser a linefeed!! */
4789 as_warn (_("unterminated string; newline inserted"));
4791 bump_line_counters ();
4796 #ifdef ONLY_STANDARD_ESCAPES
4797 as_bad (_("bad escaped character in string"));
4799 #endif /* ONLY_STANDARD_ESCAPES */
4804 #endif /* ! defined (NO_STRING_ESCAPES) */
4813 get_segmented_expression (register expressionS *expP)
4815 register segT retval;
4817 retval = expression (expP);
4818 if (expP->X_op == O_illegal
4819 || expP->X_op == O_absent
4820 || expP->X_op == O_big)
4822 as_bad (_("expected address expression"));
4823 expP->X_op = O_constant;
4824 expP->X_add_number = 0;
4825 retval = absolute_section;
4831 get_known_segmented_expression (register expressionS *expP)
4833 register segT retval;
4835 if ((retval = get_segmented_expression (expP)) == undefined_section)
4837 /* There is no easy way to extract the undefined symbol from the
4839 if (expP->X_add_symbol != NULL
4840 && S_GET_SEGMENT (expP->X_add_symbol) != expr_section)
4841 as_warn (_("symbol \"%s\" undefined; zero assumed"),
4842 S_GET_NAME (expP->X_add_symbol));
4844 as_warn (_("some symbol undefined; zero assumed"));
4845 retval = absolute_section;
4846 expP->X_op = O_constant;
4847 expP->X_add_number = 0;
4849 know (retval == absolute_section || SEG_NORMAL (retval));
4853 char /* Return terminator. */
4854 get_absolute_expression_and_terminator (long *val_pointer /* Return value of expression. */)
4856 /* FIXME: val_pointer should probably be offsetT *. */
4857 *val_pointer = (long) get_absolute_expression ();
4858 return (*input_line_pointer++);
4861 /* Like demand_copy_string, but return NULL if the string contains any '\0's.
4862 Give a warning if that happens. */
4865 demand_copy_C_string (int *len_pointer)
4869 if ((s = demand_copy_string (len_pointer)) != 0)
4873 for (len = *len_pointer; len > 0; len--)
4880 as_bad (_("this string may not contain \'\\0\'"));
4888 /* Demand string, but return a safe (=private) copy of the string.
4889 Return NULL if we can't read a string here. */
4892 demand_copy_string (int *lenP)
4894 register unsigned int c;
4900 if (*input_line_pointer == '\"')
4902 input_line_pointer++; /* Skip opening quote. */
4904 while (is_a_char (c = next_char_of_string ()))
4906 obstack_1grow (¬es, c);
4909 /* JF this next line is so demand_copy_C_string will return a
4910 null terminated string. */
4911 obstack_1grow (¬es, '\0');
4912 retval = obstack_finish (¬es);
4916 as_bad (_("missing string"));
4918 ignore_rest_of_line ();
4924 /* In: Input_line_pointer->next character.
4926 Do: Skip input_line_pointer over all whitespace.
4928 Out: 1 if input_line_pointer->end-of-line. */
4931 is_it_end_of_statement (void)
4934 return (is_end_of_line[(unsigned char) *input_line_pointer]);
4938 equals (char *sym_name, int reassign)
4943 input_line_pointer++;
4944 if (*input_line_pointer == '=')
4945 input_line_pointer++;
4947 while (*input_line_pointer == ' ' || *input_line_pointer == '\t')
4948 input_line_pointer++;
4951 stop = mri_comment_field (&stopc);
4953 assign_symbol (sym_name, !reassign);
4957 demand_empty_rest_of_line ();
4958 mri_comment_end (stop, stopc);
4962 /* .incbin -- include a file verbatim at the current location. */
4965 s_incbin (int x ATTRIBUTE_UNUSED)
4976 #ifdef md_flush_pending_output
4977 md_flush_pending_output ();
4981 filename = demand_copy_string (& len);
4982 if (filename == NULL)
4987 /* Look for optional skip and count. */
4988 if (* input_line_pointer == ',')
4990 ++ input_line_pointer;
4991 skip = get_absolute_expression ();
4995 if (* input_line_pointer == ',')
4997 ++ input_line_pointer;
4999 count = get_absolute_expression ();
5001 as_warn (_(".incbin count zero, ignoring `%s'"), filename);
5007 demand_empty_rest_of_line ();
5009 /* Try opening absolute path first, then try include dirs. */
5010 binfile = fopen (filename, FOPEN_RB);
5011 if (binfile == NULL)
5015 path = xmalloc ((unsigned long) len + include_dir_maxlen + 5);
5017 for (i = 0; i < include_dir_count; i++)
5019 sprintf (path, "%s/%s", include_dirs[i], filename);
5021 binfile = fopen (path, FOPEN_RB);
5022 if (binfile != NULL)
5026 if (binfile == NULL)
5027 as_bad (_("file not found: %s"), filename);
5030 path = xstrdup (filename);
5036 register_dependency (path);
5038 /* Compute the length of the file. */
5039 if (fseek (binfile, 0, SEEK_END) != 0)
5041 as_bad (_("seek to end of .incbin file failed `%s'"), path);
5044 file_len = ftell (binfile);
5046 /* If a count was not specified use the remainder of the file. */
5048 count = file_len - skip;
5050 if (skip < 0 || count < 0 || file_len < 0 || skip + count > file_len)
5052 as_bad (_("skip (%ld) or count (%ld) invalid for file size (%ld)"),
5053 skip, count, file_len);
5057 if (fseek (binfile, skip, SEEK_SET) != 0)
5059 as_bad (_("could not skip to %ld in file `%s'"), skip, path);
5063 /* Allocate frag space and store file contents in it. */
5064 binfrag = frag_more (count);
5066 bytes = fread (binfrag, 1, count, binfile);
5068 as_warn (_("truncated file `%s', %ld of %ld bytes read"),
5069 path, bytes, count);
5072 if (binfile != NULL)
5078 /* .include -- include a file at this point. */
5081 s_include (int arg ATTRIBUTE_UNUSED)
5090 filename = demand_copy_string (&i);
5091 if (filename == NULL)
5093 /* demand_copy_string has already printed an error and
5094 called ignore_rest_of_line. */
5102 while (!is_end_of_line[(unsigned char) *input_line_pointer]
5103 && *input_line_pointer != ' '
5104 && *input_line_pointer != '\t')
5106 obstack_1grow (¬es, *input_line_pointer);
5107 ++input_line_pointer;
5111 obstack_1grow (¬es, '\0');
5112 filename = obstack_finish (¬es);
5113 while (!is_end_of_line[(unsigned char) *input_line_pointer])
5114 ++input_line_pointer;
5117 demand_empty_rest_of_line ();
5118 path = xmalloc ((unsigned long) i + include_dir_maxlen + 5 /* slop */ );
5120 for (i = 0; i < include_dir_count; i++)
5122 strcpy (path, include_dirs[i]);
5124 strcat (path, filename);
5125 if (0 != (try = fopen (path, FOPEN_RT)))
5135 /* malloc Storage leak when file is found on path. FIXME-SOMEDAY. */
5136 register_dependency (path);
5137 input_scrub_insert_file (path);
5141 add_include_dir (char *path)
5145 if (include_dir_count == 0)
5147 include_dirs = (char **) xmalloc (2 * sizeof (*include_dirs));
5148 include_dirs[0] = "."; /* Current dir. */
5149 include_dir_count = 2;
5153 include_dir_count++;
5155 (char **) realloc (include_dirs,
5156 include_dir_count * sizeof (*include_dirs));
5159 include_dirs[include_dir_count - 1] = path; /* New one. */
5162 if (i > include_dir_maxlen)
5163 include_dir_maxlen = i;
5166 /* Output debugging information to denote the source file. */
5169 generate_file_debug (void)
5171 if (debug_type == DEBUG_STABS)
5172 stabs_generate_asm_file ();
5175 /* Output line number debugging information for the current source line. */
5178 generate_lineno_debug (void)
5182 case DEBUG_UNSPECIFIED:
5187 stabs_generate_asm_lineno ();
5190 ecoff_generate_asm_lineno ();
5193 /* ??? We could here indicate to dwarf2dbg.c that something
5194 has changed. However, since there is additional backend
5195 support that is required (calling dwarf2_emit_insn), we
5196 let dwarf2dbg.c call as_where on its own. */
5201 /* Output debugging information to mark a function entry point or end point.
5202 END_P is zero for .func, and non-zero for .endfunc. */
5207 do_s_func (end_p, NULL);
5210 /* Subroutine of s_func so targets can choose a different default prefix.
5211 If DEFAULT_PREFIX is NULL, use the target's "leading char". */
5214 do_s_func (int end_p, const char *default_prefix)
5216 /* Record the current function so that we can issue an error message for
5217 misplaced .func,.endfunc, and also so that .endfunc needs no
5219 static char *current_name;
5220 static char *current_label;
5224 if (current_name == NULL)
5226 as_bad (_("missing .func"));
5227 ignore_rest_of_line ();
5231 if (debug_type == DEBUG_STABS)
5232 stabs_generate_asm_endfunc (current_name, current_label);
5234 current_name = current_label = NULL;
5239 char delim1, delim2;
5241 if (current_name != NULL)
5243 as_bad (_(".endfunc missing for previous .func"));
5244 ignore_rest_of_line ();
5248 name = input_line_pointer;
5249 delim1 = get_symbol_end ();
5250 name = xstrdup (name);
5251 *input_line_pointer = delim1;
5253 if (*input_line_pointer != ',')
5256 asprintf (&label, "%s%s", default_prefix, name);
5259 char leading_char = 0;
5260 #ifdef BFD_ASSEMBLER
5261 leading_char = bfd_get_symbol_leading_char (stdoutput);
5263 /* Missing entry point, use function's name with the leading
5266 asprintf (&label, "%c%s", leading_char, name);
5273 ++input_line_pointer;
5275 label = input_line_pointer;
5276 delim2 = get_symbol_end ();
5277 label = xstrdup (label);
5278 *input_line_pointer = delim2;
5281 if (debug_type == DEBUG_STABS)
5282 stabs_generate_asm_func (name, label);
5284 current_name = name;
5285 current_label = label;
5288 demand_empty_rest_of_line ();
5292 s_ignore (int arg ATTRIBUTE_UNUSED)
5294 while (!is_end_of_line[(unsigned char) *input_line_pointer])
5296 ++input_line_pointer;
5298 ++input_line_pointer;
5302 read_print_statistics (FILE *file)
5304 hash_print_statistics (file, "pseudo-op table", po_hash);
5307 /* Inserts the given line into the input stream.
5309 This call avoids macro/conditionals nesting checking, since the contents of
5310 the line are assumed to replace the contents of a line already scanned.
5312 An appropriate use of this function would be substitution of input lines when
5313 called by md_start_line_hook(). The given line is assumed to already be
5314 properly scrubbed. */
5317 input_scrub_insert_line (const char *line)
5321 sb_add_string (&newline, line);
5322 input_scrub_include_sb (&newline, input_line_pointer, 0);
5324 buffer_limit = input_scrub_next_buffer (&input_line_pointer);
5327 /* Insert a file into the input stream; the path must resolve to an actual
5328 file; no include path searching or dependency registering is performed. */
5331 input_scrub_insert_file (char *path)
5333 input_scrub_include_file (path, input_line_pointer);
5334 buffer_limit = input_scrub_next_buffer (&input_line_pointer);