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
24 /* If your chars aren't 8 bits, you will change this a bit.
25 But then, GNU isn't spozed to run on your machine anyway.
26 (RMS is so shortsighted sometimes.) */
27 #define MASK_CHAR (0xFF)
29 #define MASK_CHAR ((int)(unsigned char) -1)
32 /* This is the largest known floating point format (for now). It will
33 grow when we do 4361 style flonums. */
34 #define MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT (16)
36 /* Routines that read assembler source text to build spaghetti in memory.
37 Another group of these functions is in the expr.c module. */
40 #include "safe-ctype.h"
47 #include "dw2gencfi.h"
49 #ifndef TC_START_LABEL
50 #define TC_START_LABEL(x,y) (x == ':')
53 /* Set by the object-format or the target. */
54 #ifndef TC_IMPLICIT_LCOMM_ALIGNMENT
55 #define TC_IMPLICIT_LCOMM_ALIGNMENT(SIZE, P2VAR) \
60 else if ((SIZE) >= 4) \
62 else if ((SIZE) >= 2) \
70 char *input_line_pointer; /*->next char of source file to parse. */
72 #if BITS_PER_CHAR != 8
73 /* The following table is indexed by[(char)] and will break if
74 a char does not have exactly 256 states (hopefully 0:255!)! */
79 /* The m88k unfortunately uses @ as a label beginner. */
84 /* The RS/6000 assembler uses {,},[,] as parts of symbol names. */
89 /* The Delta 68k assembler permits % inside label names. */
94 /* The PowerPC Windows NT assemblers permits ? inside label names. */
99 /* The IA-64 assembler uses # as a suffix designating a symbol. We include
100 it in the symbol and strip it out in tc_canonicalize_symbol_name. */
105 /* The a29k assembler does not permits labels to start with $. */
110 /* The Delta 68k assembler permits ~ at start of label names. */
114 /* Used by is_... macros. our ctype[]. */
115 char lex_type[256] = {
116 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* @ABCDEFGHIJKLMNO */
117 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* PQRSTUVWXYZ[\]^_ */
118 0, 0, 0, LEX_HASH, LEX_DOLLAR, LEX_PCT, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, /* _!"#$%&'()*+,-./ */
119 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, LEX_QM, /* 0123456789:;<=>? */
120 LEX_AT, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* @ABCDEFGHIJKLMNO */
121 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, LEX_BR, 0, LEX_BR, 0, 3, /* PQRSTUVWXYZ[\]^_ */
122 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* `abcdefghijklmno */
123 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, LEX_BR, 0, LEX_BR, LEX_TILDE, 0, /* pqrstuvwxyz{|}~. */
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,
128 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
129 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
130 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
131 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3
135 Out: 1 if this character ends a line. */
136 char is_end_of_line[256] = {
138 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, /* @abcdefghijklmno */
140 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, /* @abcdefghijklmno */
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, /* 0123456789:;<=>? */
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, /* */
153 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
154 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
155 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
156 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /* */
159 #ifndef TC_CASE_SENSITIVE
160 char original_case_string[128];
163 /* Functions private to this file. */
165 static char *buffer; /* 1st char of each buffer of lines is here. */
166 static char *buffer_limit; /*->1 + last char in buffer. */
168 /* TARGET_BYTES_BIG_ENDIAN is required to be defined to either 0 or 1
169 in the tc-<CPU>.h file. See the "Porting GAS" section of the
171 int target_big_endian = TARGET_BYTES_BIG_ENDIAN;
173 /* Variables for handling include file directory table. */
175 /* Table of pointers to directories to search for .include's. */
178 /* How many are in the table. */
179 int include_dir_count;
181 /* Length of longest in table. */
182 int include_dir_maxlen = 1;
184 #ifndef WORKING_DOT_WORD
185 struct broken_word *broken_words;
186 int new_broken_words;
189 /* The current offset into the absolute section. We don't try to
190 build frags in the absolute section, since no data can be stored
191 there. We just keep track of the current offset. */
192 addressT abs_section_offset;
194 /* If this line had an MRI style label, it is stored in this variable.
195 This is used by some of the MRI pseudo-ops. */
198 /* This global variable is used to support MRI common sections. We
199 translate such sections into a common symbol. This variable is
200 non-NULL when we are in an MRI common section. */
201 symbolS *mri_common_symbol;
203 /* In MRI mode, after a dc.b pseudo-op with an odd number of bytes, we
204 need to align to an even byte boundary unless the next pseudo-op is
205 dc.b, ds.b, or dcb.b. This variable is set to 1 if an alignment
207 static int mri_pending_align;
211 /* This variable is set to be non-zero if the next string we see might
212 be the name of the source file in DWARF debugging information. See
213 the comment in emit_expr for the format we look for. */
214 static int dwarf_file_string;
218 static void do_align (int, char *, int, int);
219 static void s_align (int, int);
220 static void s_altmacro (int);
221 static int hex_float (int, char *);
222 static segT get_known_segmented_expression (expressionS * expP);
223 static void pobegin (void);
224 static int get_line_sb (sb *);
225 static void generate_file_debug (void);
233 obj_read_begin_hook ();
235 /* Something close -- but not too close -- to a multiple of 1024.
236 The debugging malloc I'm using has 24 bytes of overhead. */
237 obstack_begin (¬es, chunksize);
238 obstack_begin (&cond_obstack, chunksize);
240 /* Use machine dependent syntax. */
241 for (p = line_separator_chars; *p; p++)
242 is_end_of_line[(unsigned char) *p] = 1;
243 /* Use more. FIXME-SOMEDAY. */
249 /* Set up pseudo-op tables. */
251 static struct hash_control *po_hash;
253 static const pseudo_typeS potable[] = {
254 {"abort", s_abort, 0},
255 {"align", s_align_ptwo, 0},
256 {"altmacro", s_altmacro, 1},
257 {"ascii", stringer, 0},
258 {"asciz", stringer, 1},
259 {"balign", s_align_bytes, 0},
260 {"balignw", s_align_bytes, -2},
261 {"balignl", s_align_bytes, -4},
265 {"common", s_mri_common, 0},
266 {"common.s", s_mri_common, 1},
270 {"dc.d", float_cons, 'd'},
272 {"dc.s", float_cons, 'f'},
274 {"dc.x", float_cons, 'x'},
276 {"dcb.b", s_space, 1},
277 {"dcb.d", s_float_space, 'd'},
278 {"dcb.l", s_space, 4},
279 {"dcb.s", s_float_space, 'f'},
280 {"dcb.w", s_space, 2},
281 {"dcb.x", s_float_space, 'x'},
283 {"ds.b", s_space, 1},
284 {"ds.d", s_space, 8},
285 {"ds.l", s_space, 4},
286 {"ds.p", s_space, 12},
287 {"ds.s", s_space, 4},
288 {"ds.w", s_space, 2},
289 {"ds.x", s_space, 12},
290 {"debug", s_ignore, 0},
295 {"double", float_cons, 'd'},
297 {"eject", listing_eject, 0}, /* Formfeed listing. */
299 {"elsec", s_else, 0},
300 {"elseif", s_elseif, (int) O_ne},
302 {"endc", s_endif, 0},
303 {"endfunc", s_func, 1},
304 {"endif", s_endif, 0},
305 {"endr", s_bad_endr, 0},
310 {"error", s_errwarn, 1},
311 {"exitm", s_mexit, 0},
313 {"extern", s_ignore, 0}, /* We treat all undef as ext. */
314 {"appfile", s_app_file, 1},
315 {"appline", s_app_line, 0},
317 {"file", s_app_file, 0},
319 {"float", float_cons, 'f'},
320 {"format", s_ignore, 0},
322 {"global", s_globl, 0},
323 {"globl", s_globl, 0},
325 {"if", s_if, (int) O_ne},
327 {"ifdef", s_ifdef, 0},
328 {"ifeq", s_if, (int) O_eq},
329 {"ifeqs", s_ifeqs, 0},
330 {"ifge", s_if, (int) O_ge},
331 {"ifgt", s_if, (int) O_gt},
332 {"ifle", s_if, (int) O_le},
333 {"iflt", s_if, (int) O_lt},
335 {"ifndef", s_ifdef, 1},
336 {"ifne", s_if, (int) O_ne},
337 {"ifnes", s_ifeqs, 1},
338 {"ifnotdef", s_ifdef, 1},
339 {"incbin", s_incbin, 0},
340 {"include", s_include, 0},
346 {"lcomm", s_lcomm, 0},
347 {"lflags", listing_flags, 0}, /* Listing flags. */
348 {"linkonce", s_linkonce, 0},
349 {"list", listing_list, 1}, /* Turn listing on. */
350 {"llen", listing_psize, 1},
353 {"macro", s_macro, 0},
354 {"mexit", s_mexit, 0},
356 {".mri", s_mri, 0}, /* Special case so .mri works in MRI mode. */
357 {"name", s_ignore, 0},
358 {"noaltmacro", s_altmacro, 0},
359 {"noformat", s_ignore, 0},
360 {"nolist", listing_list, 0}, /* Turn listing off. */
361 {"nopage", listing_nopage, 0},
363 {"offset", s_struct, 0},
365 {"p2align", s_align_ptwo, 0},
366 {"p2alignw", s_align_ptwo, -2},
367 {"p2alignl", s_align_ptwo, -4},
368 {"page", listing_eject, 0},
369 {"plen", listing_psize, 0},
370 {"print", s_print, 0},
371 {"psize", listing_psize, 0}, /* Set paper size. */
372 {"purgem", s_purgem, 0},
377 {"sbttl", listing_title, 1}, /* Subtitle of listing. */
382 {"single", float_cons, 'f'},
384 {"space", s_space, 0},
385 {"skip", s_space, 0},
386 {"sleb128", s_leb128, 1},
387 {"spc", s_ignore, 0},
388 {"stabd", s_stab, 'd'},
389 {"stabn", s_stab, 'n'},
390 {"stabs", s_stab, 's'},
391 {"string", stringer, 1},
392 {"struct", s_struct, 0},
396 /* This is for gcc to use. It's only just been added (2/94), so gcc
397 won't be able to use it for a while -- probably a year or more.
398 But once this has been released, check with gcc maintainers
399 before deleting it or even changing the spelling. */
400 {"this_GCC_requires_the_GNU_assembler", s_ignore, 0},
401 /* If we're folding case -- done for some targets, not necessarily
402 all -- the above string in an input file will be converted to
403 this one. Match it either way... */
404 {"this_gcc_requires_the_gnu_assembler", s_ignore, 0},
406 {"title", listing_title, 0}, /* Listing title. */
407 {"ttl", listing_title, 0},
409 {"uleb128", s_leb128, 0},
413 {"xdef", s_globl, 0},
414 {"xref", s_ignore, 0},
415 {"xstabs", s_xstab, 's'},
416 {"warning", s_errwarn, 0},
418 {"zero", s_space, 0},
419 {NULL, NULL, 0} /* End sentinel. */
422 static int pop_override_ok = 0;
423 static const char *pop_table_name;
426 pop_insert (const pseudo_typeS *table)
429 const pseudo_typeS *pop;
430 for (pop = table; pop->poc_name; pop++)
432 errtxt = hash_insert (po_hash, pop->poc_name, (char *) pop);
433 if (errtxt && (!pop_override_ok || strcmp (errtxt, "exists")))
434 as_fatal (_("error constructing %s pseudo-op table: %s"), pop_table_name,
439 #ifndef md_pop_insert
440 #define md_pop_insert() pop_insert(md_pseudo_table)
443 #ifndef obj_pop_insert
444 #define obj_pop_insert() pop_insert(obj_pseudo_table)
447 #ifndef cfi_pop_insert
448 #define cfi_pop_insert() pop_insert(cfi_pseudo_table)
454 po_hash = hash_new ();
456 /* Do the target-specific pseudo ops. */
457 pop_table_name = "md";
460 /* Now object specific. Skip any that were in the target table. */
461 pop_table_name = "obj";
465 /* Now portable ones. Skip any that we've seen already. */
466 pop_table_name = "standard";
467 pop_insert (potable);
469 #ifdef TARGET_USE_CFIPOP
470 pop_table_name = "cfi";
476 #define HANDLE_CONDITIONAL_ASSEMBLY() \
477 if (ignore_input ()) \
479 while (!is_end_of_line[(unsigned char) *input_line_pointer++]) \
480 if (input_line_pointer == buffer_limit) \
485 /* This function is used when scrubbing the characters between #APP
488 static char *scrub_string;
489 static char *scrub_string_end;
492 scrub_from_string (char *buf, int buflen)
496 copy = scrub_string_end - scrub_string;
499 memcpy (buf, scrub_string, copy);
500 scrub_string += copy;
504 /* We read the file, putting things into a web that represents what we
505 have been reading. */
507 read_a_source_file (char *name)
510 register char *s; /* String of symbol, '\0' appended. */
518 buffer = input_scrub_new_file (name);
521 listing_newline (NULL);
522 register_dependency (name);
524 /* Generate debugging information before we've read anything in to denote
525 this file as the "main" source file and not a subordinate one
526 (e.g. N_SO vs N_SOL in stabs). */
527 generate_file_debug ();
529 while ((buffer_limit = input_scrub_next_buffer (&input_line_pointer)) != 0)
530 { /* We have another line to parse. */
531 know (buffer_limit[-1] == '\n'); /* Must have a sentinel. */
533 while (input_line_pointer < buffer_limit)
535 /* We have more of this buffer to parse. */
537 /* We now have input_line_pointer->1st char of next line.
538 If input_line_pointer [-1] == '\n' then we just
539 scanned another line: so bump line counters. */
540 if (is_end_of_line[(unsigned char) input_line_pointer[-1]])
542 #ifdef md_start_line_hook
543 md_start_line_hook ();
545 if (input_line_pointer[-1] == '\n')
546 bump_line_counters ();
550 if (LABELS_WITHOUT_COLONS || flag_m68k_mri)
552 /* Text at the start of a line must be a label, we
553 run down and stick a colon in. */
554 if (is_name_beginner (*input_line_pointer))
556 char *line_start = input_line_pointer;
561 HANDLE_CONDITIONAL_ASSEMBLY ();
563 c = get_symbol_end ();
565 /* In MRI mode, the EQU and MACRO pseudoops must
566 be handled specially. */
570 char *rest = input_line_pointer + 1;
574 if (*rest == ' ' || *rest == '\t')
576 if ((strncasecmp (rest, "EQU", 3) == 0
577 || strncasecmp (rest, "SET", 3) == 0)
578 && (rest[3] == ' ' || rest[3] == '\t'))
580 input_line_pointer = rest + 3;
582 strncasecmp (rest, "SET", 3) == 0);
585 if (strncasecmp (rest, "MACRO", 5) == 0
588 || is_end_of_line[(unsigned char) rest[5]]))
592 /* In MRI mode, we need to handle the MACRO
593 pseudo-op specially: we don't want to put the
594 symbol in the symbol table. */
596 #ifdef TC_START_LABEL_WITHOUT_COLON
597 && TC_START_LABEL_WITHOUT_COLON(c,
601 line_label = colon (line_start);
603 line_label = symbol_create (line_start,
608 *input_line_pointer = c;
610 input_line_pointer++;
615 /* We are at the beginning of a line, or similar place.
616 We expect a well-formed assembler statement.
617 A "symbol-name:" is a statement.
619 Depending on what compiler is used, the order of these tests
620 may vary to catch most common case 1st.
621 Each test is independent of all other tests at the (top) level.
622 PLEASE make a compiler that doesn't use this assembler.
623 It is crufty to waste a compiler's time encoding things for this
624 assembler, which then wastes more time decoding it.
625 (And communicating via (linear) files is silly!
626 If you must pass stuff, please pass a tree!) */
627 if ((c = *input_line_pointer++) == '\t'
631 c = *input_line_pointer++;
633 know (c != ' '); /* No further leading whitespace. */
636 /* If listing is on, and we are expanding a macro, then give
637 the listing code the contents of the expanded line. */
640 if ((listing & LISTING_MACEXP) && macro_nest > 0)
645 /* Find the end of the current expanded macro line. */
646 for (s = input_line_pointer - 1; *s; ++s)
647 if (is_end_of_line[(unsigned char) *s])
650 /* Copy it for safe keeping. Also give an indication of
651 how much macro nesting is involved at this point. */
652 len = s - (input_line_pointer - 1);
653 copy = (char *) xmalloc (len + macro_nest + 2);
654 memset (copy, '>', macro_nest);
655 copy[macro_nest] = ' ';
656 memcpy (copy + macro_nest + 1, input_line_pointer - 1, len);
657 copy[macro_nest + 1 + len] = '\0';
659 /* Install the line with the listing facility. */
660 listing_newline (copy);
663 listing_newline (NULL);
666 /* C is the 1st significant character.
667 Input_line_pointer points after that character. */
668 if (is_name_beginner (c))
670 /* Want user-defined label or pseudo/opcode. */
671 HANDLE_CONDITIONAL_ASSEMBLY ();
673 s = --input_line_pointer;
674 c = get_symbol_end (); /* name's delimiter. */
676 /* C is character after symbol.
677 That character's place in the input line is now '\0'.
678 S points to the beginning of the symbol.
679 [In case of pseudo-op, s->'.'.]
680 Input_line_pointer->'\0' where c was. */
681 if (TC_START_LABEL (c, input_line_pointer))
685 char *rest = input_line_pointer + 1;
687 /* In MRI mode, \tsym: set 0 is permitted. */
691 if (*rest == ' ' || *rest == '\t')
694 if ((strncasecmp (rest, "EQU", 3) == 0
695 || strncasecmp (rest, "SET", 3) == 0)
696 && (rest[3] == ' ' || rest[3] == '\t'))
698 input_line_pointer = rest + 3;
704 line_label = colon (s); /* User-defined label. */
705 /* Put ':' back for error messages' sake. */
706 *input_line_pointer++ = ':';
707 #ifdef tc_check_label
708 tc_check_label (line_label);
710 /* Input_line_pointer->after ':'. */
714 || ((c == ' ' || c == '\t')
715 && input_line_pointer[1] == '='
716 #ifdef TC_EQUAL_IN_INSN
717 && !TC_EQUAL_IN_INSN (c, input_line_pointer)
722 demand_empty_rest_of_line ();
726 /* Expect pseudo-op or machine instruction. */
729 #ifndef TC_CASE_SENSITIVE
733 strncpy (original_case_string, s2, sizeof (original_case_string));
734 original_case_string[sizeof (original_case_string) - 1] = 0;
743 if (NO_PSEUDO_DOT || flag_m68k_mri)
745 /* The MRI assembler and the m88k use pseudo-ops
747 pop = (pseudo_typeS *) hash_find (po_hash, s);
748 if (pop != NULL && pop->poc_handler == NULL)
753 || (!flag_m68k_mri && *s == '.'))
757 WARNING: c has next char, which may be end-of-line.
758 We lookup the pseudo-op table with s+1 because we
759 already know that the pseudo-op begins with a '.'. */
762 pop = (pseudo_typeS *) hash_find (po_hash, s + 1);
763 if (pop && !pop->poc_handler)
766 /* In MRI mode, we may need to insert an
767 automatic alignment directive. What a hack
769 if (mri_pending_align
771 || !((pop->poc_handler == cons
772 && pop->poc_val == 1)
773 || (pop->poc_handler == s_space
774 && pop->poc_val == 1)
775 #ifdef tc_conditional_pseudoop
776 || tc_conditional_pseudoop (pop)
778 || pop->poc_handler == s_if
779 || pop->poc_handler == s_ifdef
780 || pop->poc_handler == s_ifc
781 || pop->poc_handler == s_ifeqs
782 || pop->poc_handler == s_else
783 || pop->poc_handler == s_endif
784 || pop->poc_handler == s_globl
785 || pop->poc_handler == s_ignore)))
787 do_align (1, (char *) NULL, 0, 0);
788 mri_pending_align = 0;
790 if (line_label != NULL)
792 symbol_set_frag (line_label, frag_now);
793 S_SET_VALUE (line_label, frag_now_fix ());
797 /* Print the error msg now, while we still can. */
800 as_bad (_("unknown pseudo-op: `%s'"), s);
801 *input_line_pointer = c;
806 /* Put it back for error messages etc. */
807 *input_line_pointer = c;
808 /* The following skip of whitespace is compulsory.
809 A well shaped space is sometimes all that separates
810 keyword from operands. */
811 if (c == ' ' || c == '\t')
812 input_line_pointer++;
814 /* Input_line is restored.
815 Input_line_pointer->1st non-blank char
816 after pseudo-operation. */
817 (*pop->poc_handler) (pop->poc_val);
819 /* If that was .end, just get out now. */
820 if (pop->poc_handler == s_end)
826 #ifdef QUOTES_IN_INSN
830 /* WARNING: c has char, which may be end-of-line. */
831 /* Also: input_line_pointer->`\0` where c was. */
832 *input_line_pointer = c;
833 while (!is_end_of_line[(unsigned char) *input_line_pointer]
835 #ifdef TC_EOL_IN_INSN
836 || TC_EOL_IN_INSN (input_line_pointer)
840 if (flag_m68k_mri && *input_line_pointer == '\'')
842 #ifdef QUOTES_IN_INSN
845 else if (*input_line_pointer == '"')
847 else if (*input_line_pointer == '\\')
850 input_line_pointer++;
853 c = *input_line_pointer;
854 *input_line_pointer = '\0';
856 generate_lineno_debug ();
864 if (check_macro (s, &out, &err, ¯o))
868 *input_line_pointer++ = c;
869 input_scrub_include_sb (&out,
870 input_line_pointer, 1);
873 input_scrub_next_buffer (&input_line_pointer);
875 md_macro_info (macro);
881 if (mri_pending_align)
883 do_align (1, (char *) NULL, 0, 0);
884 mri_pending_align = 0;
885 if (line_label != NULL)
887 symbol_set_frag (line_label, frag_now);
888 S_SET_VALUE (line_label, frag_now_fix ());
892 md_assemble (s); /* Assemble 1 instruction. */
894 *input_line_pointer++ = c;
896 /* We resume loop AFTER the end-of-line from
903 /* Empty statement? */
904 if (is_end_of_line[(unsigned char) c])
907 if ((LOCAL_LABELS_DOLLAR || LOCAL_LABELS_FB) && ISDIGIT (c))
909 /* local label ("4:") */
910 char *backup = input_line_pointer;
912 HANDLE_CONDITIONAL_ASSEMBLY ();
916 /* Read the whole number. */
917 while (ISDIGIT (*input_line_pointer))
919 temp = (temp * 10) + *input_line_pointer - '0';
920 ++input_line_pointer;
923 if (LOCAL_LABELS_DOLLAR
924 && *input_line_pointer == '$'
925 && *(input_line_pointer + 1) == ':')
927 input_line_pointer += 2;
929 if (dollar_label_defined (temp))
931 as_fatal (_("label \"%d$\" redefined"), temp);
934 define_dollar_label (temp);
935 colon (dollar_label_name (temp, 0));
940 && *input_line_pointer++ == ':')
942 fb_label_instance_inc (temp);
943 colon (fb_label_name (temp, 0));
947 input_line_pointer = backup;
948 } /* local label ("4:") */
950 if (c && strchr (line_comment_chars, c))
951 { /* Its a comment. Better say APP or NO_APP. */
956 unsigned int new_length;
959 bump_line_counters ();
960 s = input_line_pointer;
961 if (strncmp (s, "APP\n", 4))
962 continue; /* We ignore it */
966 ends = strstr (s, "#NO_APP\n");
970 unsigned int tmp_len;
973 /* The end of the #APP wasn't in this buffer. We
974 keep reading in buffers until we find the #NO_APP
975 that goes with this #APP There is one. The specs
977 tmp_len = buffer_limit - s;
978 tmp_buf = xmalloc (tmp_len + 1);
979 memcpy (tmp_buf, s, tmp_len);
982 new_tmp = input_scrub_next_buffer (&buffer);
986 buffer_limit = new_tmp;
987 input_line_pointer = buffer;
988 ends = strstr (buffer, "#NO_APP\n");
992 num = buffer_limit - buffer;
994 tmp_buf = xrealloc (tmp_buf, tmp_len + num);
995 memcpy (tmp_buf + tmp_len, buffer, num);
1000 input_line_pointer = ends ? ends + 8 : NULL;
1008 input_line_pointer = ends + 8;
1012 scrub_string_end = ends;
1014 new_length = ends - s;
1015 new_buf = (char *) xmalloc (new_length);
1022 space = (new_buf + new_length) - new_tmp;
1023 size = do_scrub_chars (scrub_from_string, new_tmp, space);
1031 new_buf = xrealloc (new_buf, new_length + 100);
1032 new_tmp = new_buf + new_length;
1039 /* We've "scrubbed" input to the preferred format. In the
1040 process we may have consumed the whole of the remaining
1041 file (and included files). We handle this formatted
1042 input similar to that of macro expansion, letting
1043 actual macro expansion (possibly nested) and other
1044 input expansion work. Beware that in messages, line
1045 numbers and possibly file names will be incorrect. */
1046 sb_add_string (&sbuf, new_buf);
1047 input_scrub_include_sb (&sbuf, input_line_pointer, 0);
1049 buffer_limit = input_scrub_next_buffer (&input_line_pointer);
1054 HANDLE_CONDITIONAL_ASSEMBLY ();
1056 #ifdef tc_unrecognized_line
1057 if (tc_unrecognized_line (c))
1060 input_line_pointer--;
1061 /* Report unknown char as ignored. */
1062 demand_empty_rest_of_line ();
1065 #ifdef md_after_pass_hook
1066 md_after_pass_hook ();
1075 /* Close the input file. */
1076 input_scrub_close ();
1077 #ifdef WARN_COMMENTS
1079 if (warn_comment && found_comment)
1080 as_warn_where (found_comment_file, found_comment,
1081 "first comment found here");
1086 /* Convert O_constant expression EXP into the equivalent O_big representation.
1087 Take the sign of the number from X_unsigned rather than X_add_number. */
1090 convert_to_bignum (expressionS *exp)
1095 value = exp->X_add_number;
1096 for (i = 0; i < sizeof (exp->X_add_number) / CHARS_PER_LITTLENUM; i++)
1098 generic_bignum[i] = value & LITTLENUM_MASK;
1099 value >>= LITTLENUM_NUMBER_OF_BITS;
1101 /* Add a sequence of sign bits if the top bit of X_add_number is not
1102 the sign of the original value. */
1103 if ((exp->X_add_number < 0) != !exp->X_unsigned)
1104 generic_bignum[i++] = exp->X_unsigned ? 0 : LITTLENUM_MASK;
1106 exp->X_add_number = i;
1109 /* For most MRI pseudo-ops, the line actually ends at the first
1110 nonquoted space. This function looks for that point, stuffs a null
1111 in, and sets *STOPCP to the character that used to be there, and
1112 returns the location.
1114 Until I hear otherwise, I am going to assume that this is only true
1115 for the m68k MRI assembler. */
1118 mri_comment_field (char *stopcp)
1124 know (flag_m68k_mri);
1126 for (s = input_line_pointer;
1127 ((!is_end_of_line[(unsigned char) *s] && *s != ' ' && *s != '\t')
1135 for (s = input_line_pointer;
1136 !is_end_of_line[(unsigned char) *s];
1146 /* Skip to the end of an MRI comment field. */
1149 mri_comment_end (char *stop, int stopc)
1153 input_line_pointer = stop;
1155 while (!is_end_of_line[(unsigned char) *input_line_pointer])
1156 ++input_line_pointer;
1160 s_abort (int ignore ATTRIBUTE_UNUSED)
1162 as_fatal (_(".abort detected. Abandoning ship."));
1165 /* Guts of .align directive. N is the power of two to which to align.
1166 FILL may be NULL, or it may point to the bytes of the fill pattern.
1167 LEN is the length of whatever FILL points to, if anything. MAX is
1168 the maximum number of characters to skip when doing the alignment,
1169 or 0 if there is no maximum. */
1172 do_align (int n, char *fill, int len, int max)
1174 if (now_seg == absolute_section)
1178 if (*fill++ != '\0')
1180 as_warn (_("ignoring fill value in absolute section"));
1187 #ifdef md_flush_pending_output
1188 md_flush_pending_output ();
1191 md_do_align (n, fill, len, max, just_record_alignment);
1194 /* Only make a frag if we HAVE to... */
1195 if (n != 0 && !need_pass_2)
1199 if (subseg_text_p (now_seg))
1200 frag_align_code (n, max);
1202 frag_align (n, 0, max);
1205 frag_align (n, *fill, max);
1207 frag_align_pattern (n, fill, len, max);
1211 just_record_alignment: ATTRIBUTE_UNUSED_LABEL
1214 record_alignment (now_seg, n - OCTETS_PER_BYTE_POWER);
1217 /* Handle the .align pseudo-op. A positive ARG is a default alignment
1218 (in bytes). A negative ARG is the negative of the length of the
1219 fill pattern. BYTES_P is non-zero if the alignment value should be
1220 interpreted as the byte boundary, rather than the power of 2. */
1222 #ifdef BFD_ASSEMBLER
1223 #define ALIGN_LIMIT (stdoutput->arch_info->bits_per_address - 1)
1225 #define ALIGN_LIMIT 15
1229 s_align (int arg, int bytes_p)
1231 unsigned int align_limit = ALIGN_LIMIT;
1240 stop = mri_comment_field (&stopc);
1242 if (is_end_of_line[(unsigned char) *input_line_pointer])
1247 align = arg; /* Default value from pseudo-op table. */
1251 align = get_absolute_expression ();
1257 /* Convert to a power of 2. */
1262 for (i = 0; (align & 1) == 0; align >>= 1, ++i)
1265 as_bad (_("alignment not a power of 2"));
1271 if (align > align_limit)
1273 align = align_limit;
1274 as_warn (_("alignment too large: %u assumed"), align);
1277 if (*input_line_pointer != ',')
1284 ++input_line_pointer;
1285 if (*input_line_pointer == ',')
1289 fill = get_absolute_expression ();
1294 if (*input_line_pointer != ',')
1298 ++input_line_pointer;
1299 max = get_absolute_expression ();
1306 as_warn (_("expected fill pattern missing"));
1307 do_align (align, (char *) NULL, 0, max);
1322 do_align (align, &fill_char, fill_len, max);
1328 if ((size_t) fill_len > sizeof ab)
1330 md_number_to_chars (ab, fill, fill_len);
1331 do_align (align, ab, fill_len, max);
1335 demand_empty_rest_of_line ();
1338 mri_comment_end (stop, stopc);
1341 /* Handle the .align pseudo-op on machines where ".align 4" means
1342 align to a 4 byte boundary. */
1345 s_align_bytes (int arg)
1350 /* Handle the .align pseudo-op on machines where ".align 4" means align
1351 to a 2**4 boundary. */
1354 s_align_ptwo (int arg)
1359 /* Switch in and out of alternate macro mode. */
1364 demand_empty_rest_of_line ();
1365 macro_set_alternate (on);
1369 s_comm_internal (int param,
1370 symbolS *(*comm_parse_extra) (int, symbolS *, addressT))
1376 symbolS *symbolP = NULL;
1382 stop = mri_comment_field (&stopc);
1384 name = input_line_pointer;
1385 c = get_symbol_end ();
1386 /* Just after name is now '\0'. */
1387 p = input_line_pointer;
1392 as_bad (_("expected symbol name"));
1393 discard_rest_of_line ();
1399 /* Accept an optional comma after the name. The comma used to be
1400 required, but Irix 5 cc does not generate it for .lcomm. */
1401 if (*input_line_pointer == ',')
1402 input_line_pointer++;
1404 temp = get_absolute_expr (&exp);
1406 #ifdef BFD_ASSEMBLER
1407 size &= ((offsetT) 2 << (stdoutput->arch_info->bits_per_address - 1)) - 1;
1409 if (exp.X_op == O_absent)
1411 as_bad (_("missing size expression"));
1412 ignore_rest_of_line ();
1415 else if (temp != size || !exp.X_unsigned)
1417 as_warn (_("size (%ld) out of range, ignored"), (long) temp);
1418 ignore_rest_of_line ();
1423 symbolP = symbol_find_or_make (name);
1424 if (S_IS_DEFINED (symbolP) && !S_IS_COMMON (symbolP))
1427 as_bad (_("symbol `%s' is already defined"), name);
1429 ignore_rest_of_line ();
1433 size = S_GET_VALUE (symbolP);
1436 else if (size != temp)
1437 as_warn (_("size of \"%s\" is already %ld; not changing to %ld"),
1438 name, (long) size, (long) temp);
1441 if (comm_parse_extra != NULL)
1442 symbolP = (*comm_parse_extra) (param, symbolP, size);
1445 S_SET_VALUE (symbolP, (valueT) size);
1446 S_SET_EXTERNAL (symbolP);
1449 extern int flag_one;
1450 if (size == 0 || !flag_one)
1451 S_GET_OTHER (symbolP) = const_flag;
1456 know (symbolP == NULL || symbolP->sy_frag == &zero_address_frag);
1457 demand_empty_rest_of_line ();
1460 mri_comment_end (stop, stopc);
1467 s_comm_internal (ignore, NULL);
1470 /* The MRI COMMON pseudo-op. We handle this by creating a common
1471 symbol with the appropriate name. We make s_space do the right
1472 thing by increasing the size. */
1475 s_mri_common (int small ATTRIBUTE_UNUSED)
1491 stop = mri_comment_field (&stopc);
1495 name = input_line_pointer;
1496 if (!ISDIGIT (*name))
1497 c = get_symbol_end ();
1502 ++input_line_pointer;
1504 while (ISDIGIT (*input_line_pointer));
1506 c = *input_line_pointer;
1507 *input_line_pointer = '\0';
1509 if (line_label != NULL)
1511 alc = (char *) xmalloc (strlen (S_GET_NAME (line_label))
1512 + (input_line_pointer - name)
1514 sprintf (alc, "%s%s", name, S_GET_NAME (line_label));
1519 sym = symbol_find_or_make (name);
1520 *input_line_pointer = c;
1524 if (*input_line_pointer != ',')
1528 ++input_line_pointer;
1529 align = get_absolute_expression ();
1532 if (S_IS_DEFINED (sym) && !S_IS_COMMON (sym))
1534 as_bad (_("symbol `%s' is already defined"), S_GET_NAME (sym));
1535 ignore_rest_of_line ();
1536 mri_comment_end (stop, stopc);
1540 S_SET_EXTERNAL (sym);
1541 mri_common_symbol = sym;
1545 S_SET_ALIGN (sym, align);
1548 if (line_label != NULL)
1551 exp.X_op = O_symbol;
1552 exp.X_add_symbol = sym;
1553 exp.X_add_number = 0;
1554 symbol_set_value_expression (line_label, &exp);
1555 symbol_set_frag (line_label, &zero_address_frag);
1556 S_SET_SEGMENT (line_label, expr_section);
1559 /* FIXME: We just ignore the small argument, which distinguishes
1560 COMMON and COMMON.S. I don't know what we can do about it. */
1562 /* Ignore the type and hptype. */
1563 if (*input_line_pointer == ',')
1564 input_line_pointer += 2;
1565 if (*input_line_pointer == ',')
1566 input_line_pointer += 2;
1568 demand_empty_rest_of_line ();
1570 mri_comment_end (stop, stopc);
1574 s_data (int ignore ATTRIBUTE_UNUSED)
1579 temp = get_absolute_expression ();
1580 if (flag_readonly_data_in_text)
1582 section = text_section;
1586 section = data_section;
1588 subseg_set (section, (subsegT) temp);
1593 demand_empty_rest_of_line ();
1596 /* Handle the .appfile pseudo-op. This is automatically generated by
1597 do_scrub_chars when a preprocessor # line comment is seen with a
1598 file name. This default definition may be overridden by the object
1599 or CPU specific pseudo-ops. This function is also the default
1600 definition for .file; the APPFILE argument is 1 for .appfile, 0 for
1604 s_app_file_string (char *file, int appfile)
1608 listing_source_file (file);
1610 register_dependency (file);
1612 obj_app_file (file, appfile);
1617 s_app_file (int appfile)
1622 /* Some assemblers tolerate immediately following '"'. */
1623 if ((s = demand_copy_string (&length)) != 0)
1625 /* If this is a fake .appfile, a fake newline was inserted into
1626 the buffer. Passing -2 to new_logical_line tells it to
1629 = (!new_logical_line (s, appfile ? -2 : -1) && appfile);
1631 /* In MRI mode, the preprocessor may have inserted an extraneous
1634 && *input_line_pointer == '\''
1635 && is_end_of_line[(unsigned char) input_line_pointer[1]])
1636 ++input_line_pointer;
1638 demand_empty_rest_of_line ();
1640 s_app_file_string (s, appfile);
1644 /* Handle the .appline pseudo-op. This is automatically generated by
1645 do_scrub_chars when a preprocessor # line comment is seen. This
1646 default definition may be overridden by the object or CPU specific
1650 s_app_line (int ignore ATTRIBUTE_UNUSED)
1654 /* The given number is that of the next line. */
1655 l = get_absolute_expression () - 1;
1657 /* Some of the back ends can't deal with non-positive line numbers.
1658 Besides, it's silly. */
1659 as_warn (_("line numbers must be positive; line number %d rejected"),
1663 new_logical_line ((char *) NULL, l);
1666 listing_source_line (l);
1669 demand_empty_rest_of_line ();
1672 /* Handle the .end pseudo-op. Actually, the real work is done in
1673 read_a_source_file. */
1676 s_end (int ignore ATTRIBUTE_UNUSED)
1680 /* The MRI assembler permits the start symbol to follow .end,
1681 but we don't support that. */
1683 if (!is_end_of_line[(unsigned char) *input_line_pointer]
1684 && *input_line_pointer != '*'
1685 && *input_line_pointer != '!')
1686 as_warn (_("start address not supported"));
1690 /* Handle the .err pseudo-op. */
1693 s_err (int ignore ATTRIBUTE_UNUSED)
1695 as_bad (_(".err encountered"));
1696 demand_empty_rest_of_line ();
1699 /* Handle the .error and .warning pseudo-ops. */
1705 /* The purpose for the conditional assignment is not to
1706 internationalize the directive itself, but that we need a
1707 self-contained message, one that can be passed like the
1708 demand_copy_C_string return value, and with no assumption on the
1709 location of the name of the directive within the message. */
1711 = (err ? _(".error directive invoked in source file")
1712 : _(".warning directive invoked in source file"));
1714 if (!is_it_end_of_statement ())
1716 if (*input_line_pointer != '\"')
1718 as_bad (_("%s argument must be a string"),
1719 err ? ".error" : ".warning");
1720 discard_rest_of_line ();
1724 msg = demand_copy_C_string (&len);
1732 as_warn ("%s", msg);
1733 demand_empty_rest_of_line ();
1736 /* Handle the MRI fail pseudo-op. */
1739 s_fail (int ignore ATTRIBUTE_UNUSED)
1746 stop = mri_comment_field (&stopc);
1748 temp = get_absolute_expression ();
1750 as_warn (_(".fail %ld encountered"), (long) temp);
1752 as_bad (_(".fail %ld encountered"), (long) temp);
1754 demand_empty_rest_of_line ();
1757 mri_comment_end (stop, stopc);
1761 s_fill (int ignore ATTRIBUTE_UNUSED)
1763 expressionS rep_exp;
1765 register long fill = 0;
1768 #ifdef md_flush_pending_output
1769 md_flush_pending_output ();
1772 get_known_segmented_expression (&rep_exp);
1773 if (*input_line_pointer == ',')
1775 input_line_pointer++;
1776 size = get_absolute_expression ();
1777 if (*input_line_pointer == ',')
1779 input_line_pointer++;
1780 fill = get_absolute_expression ();
1784 /* This is to be compatible with BSD 4.2 AS, not for any rational reason. */
1785 #define BSD_FILL_SIZE_CROCK_8 (8)
1786 if (size > BSD_FILL_SIZE_CROCK_8)
1788 as_warn (_(".fill size clamped to %d"), BSD_FILL_SIZE_CROCK_8);
1789 size = BSD_FILL_SIZE_CROCK_8;
1793 as_warn (_("size negative; .fill ignored"));
1796 else if (rep_exp.X_op == O_constant && rep_exp.X_add_number <= 0)
1798 if (rep_exp.X_add_number < 0)
1799 as_warn (_("repeat < 0; .fill ignored"));
1803 if (size && !need_pass_2)
1805 if (rep_exp.X_op == O_constant)
1807 p = frag_var (rs_fill, (int) size, (int) size,
1808 (relax_substateT) 0, (symbolS *) 0,
1809 (offsetT) rep_exp.X_add_number,
1814 /* We don't have a constant repeat count, so we can't use
1815 rs_fill. We can get the same results out of rs_space,
1816 but its argument is in bytes, so we must multiply the
1817 repeat count by size. */
1820 rep_sym = make_expr_symbol (&rep_exp);
1823 expressionS size_exp;
1824 size_exp.X_op = O_constant;
1825 size_exp.X_add_number = size;
1827 rep_exp.X_op = O_multiply;
1828 rep_exp.X_add_symbol = rep_sym;
1829 rep_exp.X_op_symbol = make_expr_symbol (&size_exp);
1830 rep_exp.X_add_number = 0;
1831 rep_sym = make_expr_symbol (&rep_exp);
1834 p = frag_var (rs_space, (int) size, (int) size,
1835 (relax_substateT) 0, rep_sym, (offsetT) 0, (char *) 0);
1838 memset (p, 0, (unsigned int) size);
1840 /* The magic number BSD_FILL_SIZE_CROCK_4 is from BSD 4.2 VAX
1841 flavoured AS. The following bizarre behaviour is to be
1842 compatible with above. I guess they tried to take up to 8
1843 bytes from a 4-byte expression and they forgot to sign
1845 #define BSD_FILL_SIZE_CROCK_4 (4)
1846 md_number_to_chars (p, (valueT) fill,
1847 (size > BSD_FILL_SIZE_CROCK_4
1848 ? BSD_FILL_SIZE_CROCK_4
1850 /* Note: .fill (),0 emits no frag (since we are asked to .fill 0 bytes)
1851 but emits no error message because it seems a legal thing to do.
1852 It is a degenerate case of .fill but could be emitted by a
1855 demand_empty_rest_of_line ();
1859 s_globl (int ignore ATTRIBUTE_UNUSED)
1868 stop = mri_comment_field (&stopc);
1872 name = input_line_pointer;
1873 c = get_symbol_end ();
1874 symbolP = symbol_find_or_make (name);
1875 S_SET_EXTERNAL (symbolP);
1877 *input_line_pointer = c;
1879 c = *input_line_pointer;
1882 input_line_pointer++;
1884 if (is_end_of_line[(unsigned char) *input_line_pointer])
1890 demand_empty_rest_of_line ();
1893 mri_comment_end (stop, stopc);
1896 /* Handle the MRI IRP and IRPC pseudo-ops. */
1907 as_where (&file, &line);
1910 while (!is_end_of_line[(unsigned char) *input_line_pointer])
1911 sb_add_char (&s, *input_line_pointer++);
1915 err = expand_irp (irpc, 0, &s, &out, get_line_sb);
1917 as_bad_where (file, line, "%s", err);
1921 input_scrub_include_sb (&out, input_line_pointer, 1);
1923 buffer_limit = input_scrub_next_buffer (&input_line_pointer);
1926 /* Handle the .linkonce pseudo-op. This tells the assembler to mark
1927 the section to only be linked once. However, this is not supported
1928 by most object file formats. This takes an optional argument,
1929 which is what to do about duplicates. */
1932 s_linkonce (int ignore ATTRIBUTE_UNUSED)
1934 enum linkonce_type type;
1938 type = LINKONCE_DISCARD;
1940 if (!is_end_of_line[(unsigned char) *input_line_pointer])
1945 s = input_line_pointer;
1946 c = get_symbol_end ();
1947 if (strcasecmp (s, "discard") == 0)
1948 type = LINKONCE_DISCARD;
1949 else if (strcasecmp (s, "one_only") == 0)
1950 type = LINKONCE_ONE_ONLY;
1951 else if (strcasecmp (s, "same_size") == 0)
1952 type = LINKONCE_SAME_SIZE;
1953 else if (strcasecmp (s, "same_contents") == 0)
1954 type = LINKONCE_SAME_CONTENTS;
1956 as_warn (_("unrecognized .linkonce type `%s'"), s);
1958 *input_line_pointer = c;
1961 #ifdef obj_handle_link_once
1962 obj_handle_link_once (type);
1963 #else /* ! defined (obj_handle_link_once) */
1964 #ifdef BFD_ASSEMBLER
1968 if ((bfd_applicable_section_flags (stdoutput) & SEC_LINK_ONCE) == 0)
1969 as_warn (_(".linkonce is not supported for this object file format"));
1971 flags = bfd_get_section_flags (stdoutput, now_seg);
1972 flags |= SEC_LINK_ONCE;
1977 case LINKONCE_DISCARD:
1978 flags |= SEC_LINK_DUPLICATES_DISCARD;
1980 case LINKONCE_ONE_ONLY:
1981 flags |= SEC_LINK_DUPLICATES_ONE_ONLY;
1983 case LINKONCE_SAME_SIZE:
1984 flags |= SEC_LINK_DUPLICATES_SAME_SIZE;
1986 case LINKONCE_SAME_CONTENTS:
1987 flags |= SEC_LINK_DUPLICATES_SAME_CONTENTS;
1990 if (!bfd_set_section_flags (stdoutput, now_seg, flags))
1991 as_bad (_("bfd_set_section_flags: %s"),
1992 bfd_errmsg (bfd_get_error ()));
1994 #else /* ! defined (BFD_ASSEMBLER) */
1995 as_warn (_(".linkonce is not supported for this object file format"));
1996 #endif /* ! defined (BFD_ASSEMBLER) */
1997 #endif /* ! defined (obj_handle_link_once) */
1999 demand_empty_rest_of_line ();
2003 bss_alloc (symbolS *symbolP, addressT size, int align)
2006 segT current_seg = now_seg;
2007 subsegT current_subseg = now_subseg;
2008 segT bss_seg = bss_section;
2010 #if defined (TC_MIPS) || defined (TC_ALPHA)
2011 if (OUTPUT_FLAVOR == bfd_target_ecoff_flavour
2012 || OUTPUT_FLAVOR == bfd_target_elf_flavour)
2014 /* For MIPS and Alpha ECOFF or ELF, small objects are put in .sbss. */
2015 if (size <= bfd_get_gp_size (stdoutput))
2017 bss_seg = subseg_new (".sbss", 1);
2018 seg_info (bss_seg)->bss = 1;
2019 #ifdef BFD_ASSEMBLER
2020 if (!bfd_set_section_flags (stdoutput, bss_seg, SEC_ALLOC))
2021 as_warn (_("error setting flags for \".sbss\": %s"),
2022 bfd_errmsg (bfd_get_error ()));
2027 subseg_set (bss_seg, 1);
2031 record_alignment (bss_seg, align);
2032 frag_align (align, 0, 0);
2035 /* Detach from old frag. */
2036 if (S_GET_SEGMENT (symbolP) == bss_seg)
2037 symbol_get_frag (symbolP)->fr_symbol = NULL;
2039 symbol_set_frag (symbolP, frag_now);
2040 pfrag = frag_var (rs_org, 1, 1, 0, symbolP, size, NULL);
2044 S_SET_SIZE (symbolP, size);
2046 S_SET_SEGMENT (symbolP, bss_seg);
2049 /* The symbol may already have been created with a preceding
2050 ".globl" directive -- be careful not to step on storage class
2051 in that case. Otherwise, set it to static. */
2052 if (S_GET_STORAGE_CLASS (symbolP) != C_EXT)
2053 S_SET_STORAGE_CLASS (symbolP, C_STAT);
2054 #endif /* OBJ_COFF */
2056 subseg_set (current_seg, current_subseg);
2060 parse_align (int align_bytes)
2066 if (*input_line_pointer != ',')
2069 as_bad (_("expected alignment after size"));
2070 ignore_rest_of_line ();
2074 input_line_pointer++;
2077 align = get_absolute_expr (&exp);
2078 if (exp.X_op == O_absent)
2081 if (!exp.X_unsigned)
2083 as_warn (_("alignment negative; 0 assumed"));
2087 if (align_bytes && align != 0)
2089 /* convert to a power of 2 alignment */
2090 unsigned int alignp2 = 0;
2091 while ((align & 1) == 0)
2092 align >>= 1, ++alignp2;
2095 as_bad (_("alignment not a power of 2"));
2096 ignore_rest_of_line ();
2104 /* Called from s_comm_internal after symbol name and size have been
2105 parsed. NEEDS_ALIGN is 0 if it was an ".lcomm" (2 args only),
2106 1 if this was a ".bss" directive which has a 3rd argument
2107 (alignment as a power of 2), or 2 if this was a ".bss" directive
2108 with alignment in bytes. */
2111 s_lcomm_internal (int needs_align, symbolS *symbolP, addressT size)
2117 align = parse_align (needs_align - 1);
2118 if (align == (addressT) -1)
2122 /* Assume some objects may require alignment on some systems. */
2123 TC_IMPLICIT_LCOMM_ALIGNMENT (size, align);
2125 bss_alloc (symbolP, size, align);
2130 s_lcomm (int needs_align)
2132 s_comm_internal (needs_align, s_lcomm_internal);
2136 s_lcomm_bytes (int needs_align)
2138 s_comm_internal (needs_align * 2, s_lcomm_internal);
2142 s_lsym (int ignore ATTRIBUTE_UNUSED)
2144 register char *name;
2148 register symbolS *symbolP;
2150 /* We permit ANY defined expression: BSD4.2 demands constants. */
2151 name = input_line_pointer;
2152 c = get_symbol_end ();
2153 p = input_line_pointer;
2158 as_bad (_("expected symbol name"));
2159 discard_rest_of_line ();
2165 if (*input_line_pointer != ',')
2168 as_bad (_("expected comma after \"%s\""), name);
2170 ignore_rest_of_line ();
2174 input_line_pointer++;
2177 if (exp.X_op != O_constant
2178 && exp.X_op != O_register)
2180 as_bad (_("bad expression"));
2181 ignore_rest_of_line ();
2186 symbolP = symbol_find_or_make (name);
2188 /* FIXME-SOON I pulled a (&& symbolP->sy_other == 0 &&
2189 symbolP->sy_desc == 0) out of this test because coff doesn't have
2190 those fields, and I can't see when they'd ever be tripped. I
2191 don't think I understand why they were here so I may have
2192 introduced a bug. As recently as 1.37 didn't have this test
2193 anyway. xoxorich. */
2195 if (S_GET_SEGMENT (symbolP) == undefined_section
2196 && S_GET_VALUE (symbolP) == 0)
2198 /* The name might be an undefined .global symbol; be sure to
2199 keep the "external" bit. */
2200 S_SET_SEGMENT (symbolP,
2201 (exp.X_op == O_constant
2204 S_SET_VALUE (symbolP, (valueT) exp.X_add_number);
2208 as_bad (_("symbol `%s' is already defined"), name);
2212 demand_empty_rest_of_line ();
2215 /* Read a line into an sb. Returns the character that ended the line
2216 or zero if there are no more lines. */
2219 get_line_sb (sb *line)
2221 char quote1, quote2, inquote;
2224 if (input_line_pointer[-1] == '\n')
2225 bump_line_counters ();
2227 if (input_line_pointer >= buffer_limit)
2229 buffer_limit = input_scrub_next_buffer (&input_line_pointer);
2230 if (buffer_limit == 0)
2234 /* If app.c sets any other characters to LEX_IS_STRINGQUOTE, this
2235 code needs to be changed. */
2244 #ifdef LEX_IS_STRINGQUOTE
2250 while ((c = * input_line_pointer ++) != 0
2251 && (!is_end_of_line[c]
2252 || (inquote != '\0' && c != '\n')))
2256 else if (inquote == '\0')
2260 else if (c == quote2)
2264 sb_add_char (line, c);
2267 /* Don't skip multiple end-of-line characters, because that breaks support
2268 for the IA-64 stop bit (;;) which looks like two consecutive end-of-line
2269 characters but isn't. Instead just skip one end of line character and
2270 return the character skipped so that the caller can re-insert it if
2275 /* Define a macro. This is an interface to macro.c. */
2278 s_macro (int ignore ATTRIBUTE_UNUSED)
2287 as_where (&file, &line);
2290 while (!is_end_of_line[(unsigned char) *input_line_pointer])
2291 sb_add_char (&s, *input_line_pointer++);
2294 if (line_label != NULL)
2295 sb_add_string (&label, S_GET_NAME (line_label));
2297 err = define_macro (0, &s, &label, get_line_sb, &name);
2299 as_bad_where (file, line, "%s", err);
2302 if (line_label != NULL)
2304 S_SET_SEGMENT (line_label, undefined_section);
2305 S_SET_VALUE (line_label, 0);
2306 symbol_set_frag (line_label, &zero_address_frag);
2309 if (((NO_PSEUDO_DOT || flag_m68k_mri)
2310 && hash_find (po_hash, name) != NULL)
2313 && hash_find (po_hash, name + 1) != NULL))
2314 as_warn (_("attempt to redefine pseudo-op `%s' ignored"),
2321 /* Handle the .mexit pseudo-op, which immediately exits a macro
2325 s_mexit (int ignore ATTRIBUTE_UNUSED)
2327 cond_exit_macro (macro_nest);
2328 buffer_limit = input_scrub_next_buffer (&input_line_pointer);
2331 /* Switch in and out of MRI mode. */
2334 s_mri (int ignore ATTRIBUTE_UNUSED)
2338 on = get_absolute_expression ();
2339 old_flag = flag_mri;
2357 /* Operator precedence changes in m68k MRI mode, so we need to
2358 update the operator rankings. */
2359 expr_set_precedence ();
2361 #ifdef MRI_MODE_CHANGE
2363 MRI_MODE_CHANGE (on);
2366 demand_empty_rest_of_line ();
2369 /* Handle changing the location counter. */
2372 do_org (segT segment, expressionS *exp, int fill)
2374 if (segment != now_seg && segment != absolute_section)
2375 as_bad (_("invalid segment \"%s\""), segment_name (segment));
2377 if (now_seg == absolute_section)
2380 as_warn (_("ignoring fill value in absolute section"));
2381 if (exp->X_op != O_constant)
2383 as_bad (_("only constant offsets supported in absolute section"));
2384 exp->X_add_number = 0;
2386 abs_section_offset = exp->X_add_number;
2391 symbolS *sym = exp->X_add_symbol;
2392 offsetT off = exp->X_add_number * OCTETS_PER_BYTE;
2394 if (exp->X_op != O_constant && exp->X_op != O_symbol)
2396 /* Handle complex expressions. */
2397 sym = make_expr_symbol (exp);
2401 p = frag_var (rs_org, 1, 1, (relax_substateT) 0, sym, off, (char *) 0);
2407 s_org (int ignore ATTRIBUTE_UNUSED)
2409 register segT segment;
2411 register long temp_fill;
2413 #ifdef md_flush_pending_output
2414 md_flush_pending_output ();
2417 /* The m68k MRI assembler has a different meaning for .org. It
2418 means to create an absolute section at a given address. We can't
2419 support that--use a linker script instead. */
2422 as_bad (_("MRI style ORG pseudo-op not supported"));
2423 ignore_rest_of_line ();
2427 /* Don't believe the documentation of BSD 4.2 AS. There is no such
2428 thing as a sub-segment-relative origin. Any absolute origin is
2429 given a warning, then assumed to be segment-relative. Any
2430 segmented origin expression ("foo+42") had better be in the right
2431 segment or the .org is ignored.
2433 BSD 4.2 AS warns if you try to .org backwards. We cannot because
2434 we never know sub-segment sizes when we are reading code. BSD
2435 will crash trying to emit negative numbers of filler bytes in
2436 certain .orgs. We don't crash, but see as-write for that code.
2438 Don't make frag if need_pass_2==1. */
2439 segment = get_known_segmented_expression (&exp);
2440 if (*input_line_pointer == ',')
2442 input_line_pointer++;
2443 temp_fill = get_absolute_expression ();
2449 do_org (segment, &exp, temp_fill);
2451 demand_empty_rest_of_line ();
2454 /* Handle parsing for the MRI SECT/SECTION pseudo-op. This should be
2455 called by the obj-format routine which handles section changing
2456 when in MRI mode. It will create a new section, and return it. It
2457 will set *TYPE to the section type: one of 'C' (code), 'D' (data),
2458 'M' (mixed), or 'R' (romable). If BFD_ASSEMBLER is defined, the
2459 flags will be set in the section. */
2462 s_mri_sect (char *type ATTRIBUTE_UNUSED)
2472 name = input_line_pointer;
2473 if (!ISDIGIT (*name))
2474 c = get_symbol_end ();
2479 ++input_line_pointer;
2481 while (ISDIGIT (*input_line_pointer));
2483 c = *input_line_pointer;
2484 *input_line_pointer = '\0';
2487 name = xstrdup (name);
2489 *input_line_pointer = c;
2491 seg = subseg_new (name, 0);
2493 if (*input_line_pointer == ',')
2497 ++input_line_pointer;
2498 align = get_absolute_expression ();
2499 record_alignment (seg, align);
2503 if (*input_line_pointer == ',')
2505 c = *++input_line_pointer;
2507 if (c == 'C' || c == 'D' || c == 'M' || c == 'R')
2510 as_bad (_("unrecognized section type"));
2511 ++input_line_pointer;
2513 #ifdef BFD_ASSEMBLER
2517 flags = SEC_NO_FLAGS;
2519 flags = SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_CODE;
2520 else if (*type == 'D' || *type == 'M')
2521 flags = SEC_ALLOC | SEC_LOAD | SEC_DATA;
2522 else if (*type == 'R')
2523 flags = SEC_ALLOC | SEC_LOAD | SEC_DATA | SEC_READONLY | SEC_ROM;
2524 if (flags != SEC_NO_FLAGS)
2526 if (!bfd_set_section_flags (stdoutput, seg, flags))
2527 as_warn (_("error setting flags for \"%s\": %s"),
2528 bfd_section_name (stdoutput, seg),
2529 bfd_errmsg (bfd_get_error ()));
2535 /* Ignore the HP type. */
2536 if (*input_line_pointer == ',')
2537 input_line_pointer += 2;
2539 demand_empty_rest_of_line ();
2541 #else /* ! TC_M68K */
2550 name = input_line_pointer;
2551 c = get_symbol_end ();
2553 name = xstrdup (name);
2555 *input_line_pointer = c;
2557 seg = subseg_new (name, 0);
2559 if (*input_line_pointer != ',')
2565 ++input_line_pointer;
2567 sectype = input_line_pointer;
2568 c = get_symbol_end ();
2569 if (*sectype == '\0')
2571 else if (strcasecmp (sectype, "text") == 0)
2573 else if (strcasecmp (sectype, "data") == 0)
2575 else if (strcasecmp (sectype, "romdata") == 0)
2578 as_warn (_("unrecognized section type `%s'"), sectype);
2579 *input_line_pointer = c;
2582 if (*input_line_pointer == ',')
2586 ++input_line_pointer;
2588 seccmd = input_line_pointer;
2589 c = get_symbol_end ();
2590 if (strcasecmp (seccmd, "absolute") == 0)
2592 as_bad (_("absolute sections are not supported"));
2593 *input_line_pointer = c;
2594 ignore_rest_of_line ();
2597 else if (strcasecmp (seccmd, "align") == 0)
2601 *input_line_pointer = c;
2602 align = get_absolute_expression ();
2603 record_alignment (seg, align);
2607 as_warn (_("unrecognized section command `%s'"), seccmd);
2608 *input_line_pointer = c;
2612 demand_empty_rest_of_line ();
2614 #else /* ! TC_I960 */
2615 /* The MRI assembler seems to use different forms of .sect for
2616 different targets. */
2617 as_bad ("MRI mode not supported for this target");
2618 ignore_rest_of_line ();
2619 #endif /* ! TC_I960 */
2620 #endif /* ! TC_M68K */
2623 /* Handle the .print pseudo-op. */
2626 s_print (int ignore ATTRIBUTE_UNUSED)
2631 s = demand_copy_C_string (&len);
2634 demand_empty_rest_of_line ();
2637 /* Handle the .purgem pseudo-op. */
2640 s_purgem (int ignore ATTRIBUTE_UNUSED)
2642 if (is_it_end_of_statement ())
2644 demand_empty_rest_of_line ();
2654 name = input_line_pointer;
2655 c = get_symbol_end ();
2656 delete_macro (name);
2657 *input_line_pointer = c;
2660 while (*input_line_pointer++ == ',');
2662 --input_line_pointer;
2663 demand_empty_rest_of_line ();
2666 /* Handle the .rept pseudo-op. */
2669 s_bad_endr (int ignore ATTRIBUTE_UNUSED)
2671 as_warn (_(".endr encountered without preceeding .rept, .irc, or .irp"));
2672 demand_empty_rest_of_line ();
2675 /* Handle the .rept pseudo-op. */
2678 s_rept (int ignore ATTRIBUTE_UNUSED)
2682 count = get_absolute_expression ();
2684 do_repeat (count, "REPT", "ENDR");
2687 /* This function provides a generic repeat block implementation. It allows
2688 different directives to be used as the start/end keys. */
2691 do_repeat (int count, const char *start, const char *end)
2697 if (!buffer_and_nest (start, end, &one, get_line_sb))
2699 as_bad (_("%s without %s"), start, end);
2705 sb_add_sb (&many, &one);
2709 input_scrub_include_sb (&many, input_line_pointer, 1);
2711 buffer_limit = input_scrub_next_buffer (&input_line_pointer);
2714 /* Skip to end of current repeat loop; EXTRA indicates how many additional
2715 input buffers to skip. Assumes that conditionals preceding the loop end
2716 are properly nested.
2718 This function makes it easier to implement a premature "break" out of the
2719 loop. The EXTRA arg accounts for other buffers we might have inserted,
2720 such as line substitutions. */
2723 end_repeat (int extra)
2725 cond_exit_macro (macro_nest);
2726 while (extra-- >= 0)
2727 buffer_limit = input_scrub_next_buffer (&input_line_pointer);
2730 /* Handle the .equ, .equiv and .set directives. If EQUIV is 1, then
2731 this is .equiv, and it is an error if the symbol is already
2737 register char *name;
2738 register char delim;
2739 register char *end_name;
2740 register symbolS *symbolP;
2742 /* Especial apologies for the random logic:
2743 this just grew, and could be parsed much more simply!
2745 name = input_line_pointer;
2746 delim = get_symbol_end ();
2747 end_name = input_line_pointer;
2750 if (name == end_name)
2752 as_bad (_("expected symbol name"));
2753 discard_rest_of_line ();
2759 if (*input_line_pointer != ',')
2762 as_bad (_("expected comma after \"%s\""), name);
2764 ignore_rest_of_line ();
2768 input_line_pointer++;
2771 if (name[0] == '.' && name[1] == '\0')
2773 /* Turn '. = mumble' into a .org mumble. */
2774 register segT segment;
2777 segment = get_known_segmented_expression (&exp);
2780 do_org (segment, &exp, 0);
2786 if ((symbolP = symbol_find (name)) == NULL
2787 && (symbolP = md_undefined_symbol (name)) == NULL)
2790 /* When doing symbol listings, play games with dummy fragments living
2791 outside the normal fragment chain to record the file and line info
2793 if (listing & LISTING_SYMBOLS)
2795 extern struct list_info_struct *listing_tail;
2796 fragS *dummy_frag = (fragS *) xmalloc (sizeof (fragS));
2797 memset (dummy_frag, 0, sizeof (fragS));
2798 dummy_frag->fr_type = rs_fill;
2799 dummy_frag->line = listing_tail;
2800 symbolP = symbol_new (name, undefined_section, 0, dummy_frag);
2801 dummy_frag->fr_symbol = symbolP;
2805 symbolP = symbol_new (name, undefined_section, 0, &zero_address_frag);
2808 /* "set" symbols are local unless otherwise specified. */
2809 SF_SET_LOCAL (symbolP);
2810 #endif /* OBJ_COFF */
2813 symbol_table_insert (symbolP);
2818 && S_IS_DEFINED (symbolP)
2819 && S_GET_SEGMENT (symbolP) != reg_section)
2820 as_bad (_("symbol `%s' is already defined"), S_GET_NAME (symbolP));
2822 pseudo_set (symbolP);
2823 demand_empty_rest_of_line ();
2836 #ifdef md_flush_pending_output
2837 md_flush_pending_output ();
2841 stop = mri_comment_field (&stopc);
2843 /* In m68k MRI mode, we need to align to a word boundary, unless
2845 if (flag_m68k_mri && mult > 1)
2847 if (now_seg == absolute_section)
2849 abs_section_offset += abs_section_offset & 1;
2850 if (line_label != NULL)
2851 S_SET_VALUE (line_label, abs_section_offset);
2853 else if (mri_common_symbol != NULL)
2857 val = S_GET_VALUE (mri_common_symbol);
2860 S_SET_VALUE (mri_common_symbol, val + 1);
2861 if (line_label != NULL)
2863 expressionS *symexp;
2865 symexp = symbol_get_value_expression (line_label);
2866 know (symexp->X_op == O_symbol);
2867 know (symexp->X_add_symbol == mri_common_symbol);
2868 symexp->X_add_number += 1;
2874 do_align (1, (char *) NULL, 0, 0);
2875 if (line_label != NULL)
2877 symbol_set_frag (line_label, frag_now);
2878 S_SET_VALUE (line_label, frag_now_fix ());
2888 if (*input_line_pointer == ',')
2890 ++input_line_pointer;
2895 val.X_op = O_constant;
2896 val.X_add_number = 0;
2899 if (val.X_op != O_constant
2900 || val.X_add_number < - 0x80
2901 || val.X_add_number > 0xff
2902 || (mult != 0 && mult != 1 && val.X_add_number != 0))
2904 if (exp.X_op != O_constant)
2905 as_bad (_("unsupported variable size or fill value"));
2912 bytes = mult * exp.X_add_number;
2913 for (i = 0; i < exp.X_add_number; i++)
2914 emit_expr (&val, mult);
2919 if (exp.X_op == O_constant)
2923 repeat = exp.X_add_number;
2930 as_warn (_(".space repeat count is zero, ignored"));
2931 else if (repeat < 0)
2932 as_warn (_(".space repeat count is negative, ignored"));
2936 /* If we are in the absolute section, just bump the offset. */
2937 if (now_seg == absolute_section)
2939 abs_section_offset += repeat;
2943 /* If we are secretly in an MRI common section, then
2944 creating space just increases the size of the common
2946 if (mri_common_symbol != NULL)
2948 S_SET_VALUE (mri_common_symbol,
2949 S_GET_VALUE (mri_common_symbol) + repeat);
2954 p = frag_var (rs_fill, 1, 1, (relax_substateT) 0, (symbolS *) 0,
2955 (offsetT) repeat, (char *) 0);
2959 if (now_seg == absolute_section)
2961 as_bad (_("space allocation too complex in absolute section"));
2962 subseg_set (text_section, 0);
2965 if (mri_common_symbol != NULL)
2967 as_bad (_("space allocation too complex in common section"));
2968 mri_common_symbol = NULL;
2972 p = frag_var (rs_space, 1, 1, (relax_substateT) 0,
2973 make_expr_symbol (&exp), (offsetT) 0, (char *) 0);
2977 *p = val.X_add_number;
2982 /* In MRI mode, after an odd number of bytes, we must align to an
2983 even word boundary, unless the next instruction is a dc.b, ds.b
2985 if (flag_mri && (bytes & 1) != 0)
2986 mri_pending_align = 1;
2988 demand_empty_rest_of_line ();
2991 mri_comment_end (stop, stopc);
2994 /* This is like s_space, but the value is a floating point number with
2995 the given precision. This is for the MRI dcb.s pseudo-op and
2999 s_float_space (int float_type)
3003 char temp[MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT];
3008 stop = mri_comment_field (&stopc);
3010 count = get_absolute_expression ();
3013 if (*input_line_pointer != ',')
3015 as_bad (_("missing value"));
3016 ignore_rest_of_line ();
3018 mri_comment_end (stop, stopc);
3022 ++input_line_pointer;
3026 /* Skip any 0{letter} that may be present. Don't even check if the
3027 * letter is legal. */
3028 if (input_line_pointer[0] == '0'
3029 && ISALPHA (input_line_pointer[1]))
3030 input_line_pointer += 2;
3032 /* Accept :xxxx, where the x's are hex digits, for a floating point
3033 with the exact digits specified. */
3034 if (input_line_pointer[0] == ':')
3036 flen = hex_float (float_type, temp);
3039 ignore_rest_of_line ();
3041 mri_comment_end (stop, stopc);
3049 err = md_atof (float_type, temp, &flen);
3050 know (flen <= MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT);
3054 as_bad (_("bad floating literal: %s"), err);
3055 ignore_rest_of_line ();
3057 mri_comment_end (stop, stopc);
3062 while (--count >= 0)
3066 p = frag_more (flen);
3067 memcpy (p, temp, (unsigned int) flen);
3070 demand_empty_rest_of_line ();
3073 mri_comment_end (stop, stopc);
3076 /* Handle the .struct pseudo-op, as found in MIPS assemblers. */
3079 s_struct (int ignore ATTRIBUTE_UNUSED)
3085 stop = mri_comment_field (&stopc);
3086 abs_section_offset = get_absolute_expression ();
3087 subseg_set (absolute_section, 0);
3088 demand_empty_rest_of_line ();
3090 mri_comment_end (stop, stopc);
3094 s_text (int ignore ATTRIBUTE_UNUSED)
3098 temp = get_absolute_expression ();
3099 subseg_set (text_section, (subsegT) temp);
3100 demand_empty_rest_of_line ();
3102 const_flag &= ~IN_DEFAULT_SECTION;
3107 /* Verify that we are at the end of a line. If not, issue an error and
3111 demand_empty_rest_of_line (void)
3114 if (is_end_of_line[(unsigned char) *input_line_pointer])
3115 input_line_pointer++;
3118 if (ISPRINT (*input_line_pointer))
3119 as_bad (_("junk at end of line, first unrecognized character is `%c'"),
3120 *input_line_pointer);
3122 as_bad (_("junk at end of line, first unrecognized character valued 0x%x"),
3123 *input_line_pointer);
3124 ignore_rest_of_line ();
3127 /* Return pointing just after end-of-line. */
3128 know (is_end_of_line[(unsigned char) input_line_pointer[-1]]);
3131 /* Silently advance to the end of line. Use this after already having
3132 issued an error about something bad. */
3135 ignore_rest_of_line (void)
3137 while (input_line_pointer < buffer_limit
3138 && !is_end_of_line[(unsigned char) *input_line_pointer])
3139 input_line_pointer++;
3141 input_line_pointer++;
3143 /* Return pointing just after end-of-line. */
3144 know (is_end_of_line[(unsigned char) input_line_pointer[-1]]);
3148 discard_rest_of_line (void)
3150 while (input_line_pointer < buffer_limit
3151 && !is_end_of_line[(unsigned char) *input_line_pointer])
3152 input_line_pointer++;
3154 input_line_pointer++;
3156 /* Return pointing just after end-of-line. */
3157 know (is_end_of_line[(unsigned char) input_line_pointer[-1]]);
3160 /* In: Pointer to a symbol.
3161 Input_line_pointer->expression.
3163 Out: Input_line_pointer->just after any whitespace after expression.
3164 Tried to set symbol to value of expression.
3165 Will change symbols type, value, and frag; */
3168 pseudo_set (symbolS *symbolP)
3171 #if (defined (OBJ_AOUT) || defined (OBJ_BOUT)) && ! defined (BFD_ASSEMBLER)
3173 #endif /* OBJ_AOUT or OBJ_BOUT */
3175 know (symbolP); /* NULL pointer is logic error. */
3176 #if (defined (OBJ_AOUT) || defined (OBJ_BOUT)) && ! defined (BFD_ASSEMBLER)
3177 ext = S_IS_EXTERNAL (symbolP);
3178 #endif /* OBJ_AOUT or OBJ_BOUT */
3180 (void) expression (&exp);
3182 if (exp.X_op == O_illegal)
3183 as_bad (_("illegal expression"));
3184 else if (exp.X_op == O_absent)
3185 as_bad (_("missing expression"));
3186 else if (exp.X_op == O_big)
3188 if (exp.X_add_number > 0)
3189 as_bad (_("bignum invalid"));
3191 as_bad (_("floating point number invalid"));
3193 else if (exp.X_op == O_subtract
3194 && SEG_NORMAL (S_GET_SEGMENT (exp.X_add_symbol))
3195 && (symbol_get_frag (exp.X_add_symbol)
3196 == symbol_get_frag (exp.X_op_symbol)))
3198 exp.X_op = O_constant;
3199 exp.X_add_number = (S_GET_VALUE (exp.X_add_symbol)
3200 - S_GET_VALUE (exp.X_op_symbol));
3208 exp.X_add_number = 0;
3211 S_SET_SEGMENT (symbolP, absolute_section);
3212 #if (defined (OBJ_AOUT) || defined (OBJ_BOUT)) && ! defined (BFD_ASSEMBLER)
3214 S_SET_EXTERNAL (symbolP);
3216 S_CLEAR_EXTERNAL (symbolP);
3217 #endif /* OBJ_AOUT or OBJ_BOUT */
3218 S_SET_VALUE (symbolP, (valueT) exp.X_add_number);
3219 if (exp.X_op != O_constant)
3220 symbol_set_frag (symbolP, &zero_address_frag);
3224 S_SET_SEGMENT (symbolP, reg_section);
3225 S_SET_VALUE (symbolP, (valueT) exp.X_add_number);
3226 symbol_set_frag (symbolP, &zero_address_frag);
3230 if (S_GET_SEGMENT (exp.X_add_symbol) == undefined_section
3231 || exp.X_add_number != 0)
3232 symbol_set_value_expression (symbolP, &exp);
3233 else if (symbol_section_p (symbolP))
3234 as_bad ("attempt to set value of section symbol");
3237 symbolS *s = exp.X_add_symbol;
3239 S_SET_SEGMENT (symbolP, S_GET_SEGMENT (s));
3240 #if (defined (OBJ_AOUT) || defined (OBJ_BOUT)) && ! defined (BFD_ASSEMBLER)
3242 S_SET_EXTERNAL (symbolP);
3244 S_CLEAR_EXTERNAL (symbolP);
3245 #endif /* OBJ_AOUT or OBJ_BOUT */
3246 S_SET_VALUE (symbolP,
3247 exp.X_add_number + S_GET_VALUE (s));
3248 symbol_set_frag (symbolP, symbol_get_frag (s));
3249 copy_symbol_attributes (symbolP, s);
3254 /* The value is some complex expression.
3255 FIXME: Should we set the segment to anything? */
3256 symbol_set_value_expression (symbolP, &exp);
3263 CONStruct more frag of .bytes, or .words etc.
3264 Should need_pass_2 be 1 then emit no frag(s).
3265 This understands EXPRESSIONS.
3269 This has a split personality. We use expression() to read the
3270 value. We can detect if the value won't fit in a byte or word.
3271 But we can't detect if expression() discarded significant digits
3272 in the case of a long. Not worth the crocks required to fix it. */
3274 /* Select a parser for cons expressions. */
3276 /* Some targets need to parse the expression in various fancy ways.
3277 You can define TC_PARSE_CONS_EXPRESSION to do whatever you like
3278 (for example, the HPPA does this). Otherwise, you can define
3279 BITFIELD_CONS_EXPRESSIONS to permit bitfields to be specified, or
3280 REPEAT_CONS_EXPRESSIONS to permit repeat counts. If none of these
3281 are defined, which is the normal case, then only simple expressions
3286 parse_mri_cons (expressionS *exp, unsigned int nbytes);
3289 #ifndef TC_PARSE_CONS_EXPRESSION
3290 #ifdef BITFIELD_CONS_EXPRESSIONS
3291 #define TC_PARSE_CONS_EXPRESSION(EXP, NBYTES) parse_bitfield_cons (EXP, NBYTES)
3293 parse_bitfield_cons (expressionS *exp, unsigned int nbytes);
3295 #ifdef REPEAT_CONS_EXPRESSIONS
3296 #define TC_PARSE_CONS_EXPRESSION(EXP, NBYTES) parse_repeat_cons (EXP, NBYTES)
3298 parse_repeat_cons (expressionS *exp, unsigned int nbytes);
3301 /* If we haven't gotten one yet, just call expression. */
3302 #ifndef TC_PARSE_CONS_EXPRESSION
3303 #define TC_PARSE_CONS_EXPRESSION(EXP, NBYTES) expression (EXP)
3308 do_parse_cons_expression (expressionS *exp,
3309 int nbytes ATTRIBUTE_UNUSED)
3311 TC_PARSE_CONS_EXPRESSION (exp, nbytes);
3315 /* Worker to do .byte etc statements.
3316 Clobbers input_line_pointer and checks end-of-line. */
3319 cons_worker (register int nbytes, /* 1=.byte, 2=.word, 4=.long. */
3327 #ifdef md_flush_pending_output
3328 md_flush_pending_output ();
3332 stop = mri_comment_field (&stopc);
3334 if (is_it_end_of_statement ())
3336 demand_empty_rest_of_line ();
3338 mri_comment_end (stop, stopc);
3342 #ifdef md_cons_align
3343 md_cons_align (nbytes);
3351 parse_mri_cons (&exp, (unsigned int) nbytes);
3354 TC_PARSE_CONS_EXPRESSION (&exp, (unsigned int) nbytes);
3358 if (exp.X_op == O_symbol)
3359 exp.X_op = O_symbol_rva;
3361 as_fatal (_("rva without symbol"));
3363 emit_expr (&exp, (unsigned int) nbytes);
3366 while (*input_line_pointer++ == ',');
3368 /* In MRI mode, after an odd number of bytes, we must align to an
3369 even word boundary, unless the next instruction is a dc.b, ds.b
3371 if (flag_mri && nbytes == 1 && (c & 1) != 0)
3372 mri_pending_align = 1;
3374 input_line_pointer--; /* Put terminator back into stream. */
3376 demand_empty_rest_of_line ();
3379 mri_comment_end (stop, stopc);
3385 cons_worker (size, 0);
3391 cons_worker (size, 1);
3394 /* Put the contents of expression EXP into the object file using
3395 NBYTES bytes. If need_pass_2 is 1, this does nothing. */
3398 emit_expr (expressionS *exp, unsigned int nbytes)
3402 valueT extra_digit = 0;
3404 /* Don't do anything if we are going to make another pass. */
3408 dot_value = frag_now_fix ();
3412 /* When gcc emits DWARF 1 debugging pseudo-ops, a line number will
3413 appear as a four byte positive constant in the .line section,
3414 followed by a 2 byte 0xffff. Look for that case here. */
3416 static int dwarf_line = -1;
3418 if (strcmp (segment_name (now_seg), ".line") != 0)
3420 else if (dwarf_line >= 0
3422 && exp->X_op == O_constant
3423 && (exp->X_add_number == -1 || exp->X_add_number == 0xffff))
3424 listing_source_line ((unsigned int) dwarf_line);
3425 else if (nbytes == 4
3426 && exp->X_op == O_constant
3427 && exp->X_add_number >= 0)
3428 dwarf_line = exp->X_add_number;
3433 /* When gcc emits DWARF 1 debugging pseudo-ops, a file name will
3434 appear as a 2 byte TAG_compile_unit (0x11) followed by a 2 byte
3435 AT_sibling (0x12) followed by a four byte address of the sibling
3436 followed by a 2 byte AT_name (0x38) followed by the name of the
3437 file. We look for that case here. */
3439 static int dwarf_file = 0;
3441 if (strcmp (segment_name (now_seg), ".debug") != 0)
3443 else if (dwarf_file == 0
3445 && exp->X_op == O_constant
3446 && exp->X_add_number == 0x11)
3448 else if (dwarf_file == 1
3450 && exp->X_op == O_constant
3451 && exp->X_add_number == 0x12)
3453 else if (dwarf_file == 2
3456 else if (dwarf_file == 3
3458 && exp->X_op == O_constant
3459 && exp->X_add_number == 0x38)
3464 /* The variable dwarf_file_string tells stringer that the string
3465 may be the name of the source file. */
3466 if (dwarf_file == 4)
3467 dwarf_file_string = 1;
3469 dwarf_file_string = 0;
3474 if (check_eh_frame (exp, &nbytes))
3479 /* Allow `.word 0' in the absolute section. */
3480 if (now_seg == absolute_section)
3482 if (op != O_constant || exp->X_add_number != 0)
3483 as_bad (_("attempt to store value in absolute section"));
3484 abs_section_offset += nbytes;
3488 /* Handle a negative bignum. */
3490 && exp->X_add_number == 0
3491 && symbol_get_value_expression (exp->X_add_symbol)->X_op == O_big
3492 && symbol_get_value_expression (exp->X_add_symbol)->X_add_number > 0)
3495 unsigned long carry;
3497 exp = symbol_get_value_expression (exp->X_add_symbol);
3499 /* Negate the bignum: one's complement each digit and add 1. */
3501 for (i = 0; i < exp->X_add_number; i++)
3505 next = (((~(generic_bignum[i] & LITTLENUM_MASK))
3508 generic_bignum[i] = next & LITTLENUM_MASK;
3509 carry = next >> LITTLENUM_NUMBER_OF_BITS;
3512 /* We can ignore any carry out, because it will be handled by
3513 extra_digit if it is needed. */
3515 extra_digit = (valueT) -1;
3519 if (op == O_absent || op == O_illegal)
3521 as_warn (_("zero assumed for missing expression"));
3522 exp->X_add_number = 0;
3525 else if (op == O_big && exp->X_add_number <= 0)
3527 as_bad (_("floating point number invalid"));
3528 exp->X_add_number = 0;
3531 else if (op == O_register)
3533 as_warn (_("register value used as expression"));
3537 p = frag_more ((int) nbytes);
3539 #ifndef WORKING_DOT_WORD
3540 /* If we have the difference of two symbols in a word, save it on
3541 the broken_words list. See the code in write.c. */
3542 if (op == O_subtract && nbytes == 2)
3544 struct broken_word *x;
3546 x = (struct broken_word *) xmalloc (sizeof (struct broken_word));
3547 x->next_broken_word = broken_words;
3550 x->subseg = now_subseg;
3552 x->word_goes_here = p;
3554 x->add = exp->X_add_symbol;
3555 x->sub = exp->X_op_symbol;
3556 x->addnum = exp->X_add_number;
3564 /* If we have an integer, but the number of bytes is too large to
3565 pass to md_number_to_chars, handle it as a bignum. */
3566 if (op == O_constant && nbytes > sizeof (valueT))
3568 extra_digit = exp->X_unsigned ? 0 : -1;
3569 convert_to_bignum (exp);
3573 if (op == O_constant)
3575 register valueT get;
3576 register valueT use;
3577 register valueT mask;
3579 register valueT unmask;
3581 /* JF << of >= number of bits in the object is undefined. In
3582 particular SPARC (Sun 4) has problems. */
3583 if (nbytes >= sizeof (valueT))
3586 if (nbytes > sizeof (valueT))
3589 hibit = (valueT) 1 << (nbytes * BITS_PER_CHAR - 1);
3593 /* Don't store these bits. */
3594 mask = ~(valueT) 0 << (BITS_PER_CHAR * nbytes);
3595 hibit = (valueT) 1 << (nbytes * BITS_PER_CHAR - 1);
3598 unmask = ~mask; /* Do store these bits. */
3601 "Do this mod if you want every overflow check to assume SIGNED 2's complement data.";
3602 mask = ~(unmask >> 1); /* Includes sign bit now. */
3605 get = exp->X_add_number;
3607 if ((get & mask) != 0
3608 && ((get & mask) != mask
3609 || (get & hibit) == 0))
3610 { /* Leading bits contain both 0s & 1s. */
3611 as_warn (_("value 0x%lx truncated to 0x%lx"),
3612 (unsigned long) get, (unsigned long) use);
3614 /* Put bytes in right order. */
3615 md_number_to_chars (p, use, (int) nbytes);
3617 else if (op == O_big)
3620 LITTLENUM_TYPE *nums;
3622 know (nbytes % CHARS_PER_LITTLENUM == 0);
3624 size = exp->X_add_number * CHARS_PER_LITTLENUM;
3627 as_warn (_("bignum truncated to %d bytes"), nbytes);
3631 if (target_big_endian)
3633 while (nbytes > size)
3635 md_number_to_chars (p, extra_digit, CHARS_PER_LITTLENUM);
3636 nbytes -= CHARS_PER_LITTLENUM;
3637 p += CHARS_PER_LITTLENUM;
3640 nums = generic_bignum + size / CHARS_PER_LITTLENUM;
3641 while (size >= CHARS_PER_LITTLENUM)
3644 md_number_to_chars (p, (valueT) *nums, CHARS_PER_LITTLENUM);
3645 size -= CHARS_PER_LITTLENUM;
3646 p += CHARS_PER_LITTLENUM;
3651 nums = generic_bignum;
3652 while (size >= CHARS_PER_LITTLENUM)
3654 md_number_to_chars (p, (valueT) *nums, CHARS_PER_LITTLENUM);
3656 size -= CHARS_PER_LITTLENUM;
3657 p += CHARS_PER_LITTLENUM;
3658 nbytes -= CHARS_PER_LITTLENUM;
3661 while (nbytes >= CHARS_PER_LITTLENUM)
3663 md_number_to_chars (p, extra_digit, CHARS_PER_LITTLENUM);
3664 nbytes -= CHARS_PER_LITTLENUM;
3665 p += CHARS_PER_LITTLENUM;
3671 memset (p, 0, nbytes);
3673 /* Now we need to generate a fixS to record the symbol value.
3674 This is easy for BFD. For other targets it can be more
3675 complex. For very complex cases (currently, the HPPA and
3676 NS32K), you can define TC_CONS_FIX_NEW to do whatever you
3677 want. For simpler cases, you can define TC_CONS_RELOC to be
3678 the name of the reloc code that should be stored in the fixS.
3679 If neither is defined, the code uses NO_RELOC if it is
3680 defined, and otherwise uses 0. */
3682 #ifdef BFD_ASSEMBLER
3683 #ifdef TC_CONS_FIX_NEW
3684 TC_CONS_FIX_NEW (frag_now, p - frag_now->fr_literal, nbytes, exp);
3687 bfd_reloc_code_real_type r;
3704 as_bad (_("unsupported BFD relocation size %u"), nbytes);
3708 fix_new_exp (frag_now, p - frag_now->fr_literal, (int) nbytes, exp,
3713 #ifdef TC_CONS_FIX_NEW
3714 TC_CONS_FIX_NEW (frag_now, p - frag_now->fr_literal, nbytes, exp);
3716 /* Figure out which reloc number to use. Use TC_CONS_RELOC if
3717 it is defined, otherwise use NO_RELOC if it is defined,
3719 #ifndef TC_CONS_RELOC
3721 #define TC_CONS_RELOC NO_RELOC
3723 #define TC_CONS_RELOC 0
3726 fix_new_exp (frag_now, p - frag_now->fr_literal, (int) nbytes, exp, 0,
3728 #endif /* TC_CONS_FIX_NEW */
3729 #endif /* BFD_ASSEMBLER */
3733 #ifdef BITFIELD_CONS_EXPRESSIONS
3735 /* i960 assemblers, (eg, asm960), allow bitfields after ".byte" as
3736 w:x,y:z, where w and y are bitwidths and x and y are values. They
3737 then pack them all together. We do a little better in that we allow
3738 them in words, longs, etc. and we'll pack them in target byte order
3741 The rules are: pack least significant bit first, if a field doesn't
3742 entirely fit, put it in the next unit. Overflowing the bitfield is
3743 explicitly *not* even a warning. The bitwidth should be considered
3746 To use this function the tc-XXX.h file should define
3747 BITFIELD_CONS_EXPRESSIONS. */
3750 parse_bitfield_cons (exp, nbytes)
3752 unsigned int nbytes;
3754 unsigned int bits_available = BITS_PER_CHAR * nbytes;
3755 char *hold = input_line_pointer;
3757 (void) expression (exp);
3759 if (*input_line_pointer == ':')
3766 unsigned long width;
3768 if (*input_line_pointer != ':')
3770 input_line_pointer = hold;
3772 } /* Next piece is not a bitfield. */
3774 /* In the general case, we can't allow
3775 full expressions with symbol
3776 differences and such. The relocation
3777 entries for symbols not defined in this
3778 assembly would require arbitrary field
3779 widths, positions, and masks which most
3780 of our current object formats don't
3783 In the specific case where a symbol
3784 *is* defined in this assembly, we
3785 *could* build fixups and track it, but
3786 this could lead to confusion for the
3787 backends. I'm lazy. I'll take any
3788 SEG_ABSOLUTE. I think that means that
3789 you can use a previous .set or
3790 .equ type symbol. xoxorich. */
3792 if (exp->X_op == O_absent)
3794 as_warn (_("using a bit field width of zero"));
3795 exp->X_add_number = 0;
3796 exp->X_op = O_constant;
3797 } /* Implied zero width bitfield. */
3799 if (exp->X_op != O_constant)
3801 *input_line_pointer = '\0';
3802 as_bad (_("field width \"%s\" too complex for a bitfield"), hold);
3803 *input_line_pointer = ':';
3804 demand_empty_rest_of_line ();
3806 } /* Too complex. */
3808 if ((width = exp->X_add_number) > (BITS_PER_CHAR * nbytes))
3810 as_warn (_("field width %lu too big to fit in %d bytes: truncated to %d bits"),
3811 width, nbytes, (BITS_PER_CHAR * nbytes));
3812 width = BITS_PER_CHAR * nbytes;
3815 if (width > bits_available)
3817 /* FIXME-SOMEDAY: backing up and reparsing is wasteful. */
3818 input_line_pointer = hold;
3819 exp->X_add_number = value;
3824 hold = ++input_line_pointer;
3826 (void) expression (exp);
3827 if (exp->X_op != O_constant)
3829 char cache = *input_line_pointer;
3831 *input_line_pointer = '\0';
3832 as_bad (_("field value \"%s\" too complex for a bitfield"), hold);
3833 *input_line_pointer = cache;
3834 demand_empty_rest_of_line ();
3836 } /* Too complex. */
3838 value |= ((~(-1 << width) & exp->X_add_number)
3839 << ((BITS_PER_CHAR * nbytes) - bits_available));
3841 if ((bits_available -= width) == 0
3842 || is_it_end_of_statement ()
3843 || *input_line_pointer != ',')
3846 } /* All the bitfields we're gonna get. */
3848 hold = ++input_line_pointer;
3849 (void) expression (exp);
3852 exp->X_add_number = value;
3853 exp->X_op = O_constant;
3854 exp->X_unsigned = 1;
3858 #endif /* BITFIELD_CONS_EXPRESSIONS */
3860 /* Handle an MRI style string expression. */
3864 parse_mri_cons (exp, nbytes)
3866 unsigned int nbytes;
3868 if (*input_line_pointer != '\''
3869 && (input_line_pointer[1] != '\''
3870 || (*input_line_pointer != 'A'
3871 && *input_line_pointer != 'E')))
3872 TC_PARSE_CONS_EXPRESSION (exp, nbytes);
3876 unsigned int result = 0;
3878 /* An MRI style string. Cut into as many bytes as will fit into
3879 a nbyte chunk, left justify if necessary, and separate with
3880 commas so we can try again later. */
3881 if (*input_line_pointer == 'A')
3882 ++input_line_pointer;
3883 else if (*input_line_pointer == 'E')
3885 as_bad (_("EBCDIC constants are not supported"));
3886 ++input_line_pointer;
3889 input_line_pointer++;
3890 for (scan = 0; scan < nbytes; scan++)
3892 if (*input_line_pointer == '\'')
3894 if (input_line_pointer[1] == '\'')
3896 input_line_pointer++;
3901 result = (result << 8) | (*input_line_pointer++);
3905 while (scan < nbytes)
3911 /* Create correct expression. */
3912 exp->X_op = O_constant;
3913 exp->X_add_number = result;
3915 /* Fake it so that we can read the next char too. */
3916 if (input_line_pointer[0] != '\'' ||
3917 (input_line_pointer[0] == '\'' && input_line_pointer[1] == '\''))
3919 input_line_pointer -= 2;
3920 input_line_pointer[0] = ',';
3921 input_line_pointer[1] = '\'';
3924 input_line_pointer++;
3927 #endif /* TC_M68K */
3929 #ifdef REPEAT_CONS_EXPRESSIONS
3931 /* Parse a repeat expression for cons. This is used by the MIPS
3932 assembler. The format is NUMBER:COUNT; NUMBER appears in the
3933 object file COUNT times.
3935 To use this for a target, define REPEAT_CONS_EXPRESSIONS. */
3938 parse_repeat_cons (exp, nbytes)
3940 unsigned int nbytes;
3947 if (*input_line_pointer != ':')
3949 /* No repeat count. */
3953 ++input_line_pointer;
3954 expression (&count);
3955 if (count.X_op != O_constant
3956 || count.X_add_number <= 0)
3958 as_warn (_("unresolvable or nonpositive repeat count; using 1"));
3962 /* The cons function is going to output this expression once. So we
3963 output it count - 1 times. */
3964 for (i = count.X_add_number - 1; i > 0; i--)
3965 emit_expr (exp, nbytes);
3968 #endif /* REPEAT_CONS_EXPRESSIONS */
3970 /* Parse a floating point number represented as a hex constant. This
3971 permits users to specify the exact bits they want in the floating
3975 hex_float (int float_type, char *bytes)
4007 as_bad (_("unknown floating type type '%c'"), float_type);
4011 /* It would be nice if we could go through expression to parse the
4012 hex constant, but if we get a bignum it's a pain to sort it into
4013 the buffer correctly. */
4015 while (hex_p (*input_line_pointer) || *input_line_pointer == '_')
4019 /* The MRI assembler accepts arbitrary underscores strewn about
4020 through the hex constant, so we ignore them as well. */
4021 if (*input_line_pointer == '_')
4023 ++input_line_pointer;
4029 as_warn (_("floating point constant too large"));
4032 d = hex_value (*input_line_pointer) << 4;
4033 ++input_line_pointer;
4034 while (*input_line_pointer == '_')
4035 ++input_line_pointer;
4036 if (hex_p (*input_line_pointer))
4038 d += hex_value (*input_line_pointer);
4039 ++input_line_pointer;
4041 if (target_big_endian)
4044 bytes[length - i - 1] = d;
4050 if (target_big_endian)
4051 memset (bytes + i, 0, length - i);
4053 memset (bytes, 0, length - i);
4061 CONStruct some more frag chars of .floats .ffloats etc.
4062 Makes 0 or more new frags.
4063 If need_pass_2 == 1, no frags are emitted.
4064 This understands only floating literals, not expressions. Sorry.
4066 A floating constant is defined by atof_generic(), except it is preceded
4067 by 0d 0f 0g or 0h. After observing the STRANGE way my BSD AS does its
4068 reading, I decided to be incompatible. This always tries to give you
4069 rounded bits to the precision of the pseudo-op. Former AS did premature
4070 truncation, restored noisy bits instead of trailing 0s AND gave you
4071 a choice of 2 flavours of noise according to which of 2 floating-point
4072 scanners you directed AS to use.
4074 In: input_line_pointer->whitespace before, or '0' of flonum. */
4077 float_cons (/* Clobbers input_line-pointer, checks end-of-line. */
4078 register int float_type /* 'f':.ffloat ... 'F':.float ... */)
4081 int length; /* Number of chars in an object. */
4082 register char *err; /* Error from scanning floating literal. */
4083 char temp[MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT];
4085 if (is_it_end_of_statement ())
4087 demand_empty_rest_of_line ();
4091 #ifdef md_flush_pending_output
4092 md_flush_pending_output ();
4097 /* input_line_pointer->1st char of a flonum (we hope!). */
4100 /* Skip any 0{letter} that may be present. Don't even check if the
4101 letter is legal. Someone may invent a "z" format and this routine
4102 has no use for such information. Lusers beware: you get
4103 diagnostics if your input is ill-conditioned. */
4104 if (input_line_pointer[0] == '0'
4105 && ISALPHA (input_line_pointer[1]))
4106 input_line_pointer += 2;
4108 /* Accept :xxxx, where the x's are hex digits, for a floating
4109 point with the exact digits specified. */
4110 if (input_line_pointer[0] == ':')
4112 ++input_line_pointer;
4113 length = hex_float (float_type, temp);
4116 ignore_rest_of_line ();
4122 err = md_atof (float_type, temp, &length);
4123 know (length <= MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT);
4127 as_bad (_("bad floating literal: %s"), err);
4128 ignore_rest_of_line ();
4139 #ifdef REPEAT_CONS_EXPRESSIONS
4140 if (*input_line_pointer == ':')
4142 expressionS count_exp;
4144 ++input_line_pointer;
4145 expression (&count_exp);
4147 if (count_exp.X_op != O_constant
4148 || count_exp.X_add_number <= 0)
4149 as_warn (_("unresolvable or nonpositive repeat count; using 1"));
4151 count = count_exp.X_add_number;
4155 while (--count >= 0)
4157 p = frag_more (length);
4158 memcpy (p, temp, (unsigned int) length);
4163 while (*input_line_pointer++ == ',');
4165 /* Put terminator back into stream. */
4166 --input_line_pointer;
4167 demand_empty_rest_of_line ();
4170 /* Return the size of a LEB128 value. */
4173 sizeof_sleb128 (offsetT value)
4175 register int size = 0;
4176 register unsigned byte;
4180 byte = (value & 0x7f);
4181 /* Sadly, we cannot rely on typical arithmetic right shift behaviour.
4182 Fortunately, we can structure things so that the extra work reduces
4183 to a noop on systems that do things "properly". */
4184 value = (value >> 7) | ~(-(offsetT)1 >> 7);
4187 while (!(((value == 0) && ((byte & 0x40) == 0))
4188 || ((value == -1) && ((byte & 0x40) != 0))));
4194 sizeof_uleb128 (valueT value)
4196 register int size = 0;
4197 register unsigned byte;
4201 byte = (value & 0x7f);
4211 sizeof_leb128 (valueT value, int sign)
4214 return sizeof_sleb128 ((offsetT) value);
4216 return sizeof_uleb128 (value);
4219 /* Output a LEB128 value. */
4222 output_sleb128 (char *p, offsetT value)
4224 register char *orig = p;
4229 unsigned byte = (value & 0x7f);
4231 /* Sadly, we cannot rely on typical arithmetic right shift behaviour.
4232 Fortunately, we can structure things so that the extra work reduces
4233 to a noop on systems that do things "properly". */
4234 value = (value >> 7) | ~(-(offsetT)1 >> 7);
4236 more = !((((value == 0) && ((byte & 0x40) == 0))
4237 || ((value == -1) && ((byte & 0x40) != 0))));
4249 output_uleb128 (char *p, valueT value)
4255 unsigned byte = (value & 0x7f);
4258 /* More bytes to follow. */
4269 output_leb128 (char *p, valueT value, int sign)
4272 return output_sleb128 (p, (offsetT) value);
4274 return output_uleb128 (p, value);
4277 /* Do the same for bignums. We combine sizeof with output here in that
4278 we don't output for NULL values of P. It isn't really as critical as
4279 for "normal" values that this be streamlined. */
4282 output_big_sleb128 (char *p, LITTLENUM_TYPE *bignum, int size)
4289 /* Strip leading sign extensions off the bignum. */
4291 && bignum[size - 1] == LITTLENUM_MASK
4292 && bignum[size - 2] > LITTLENUM_MASK / 2)
4297 /* OR in the next part of the littlenum. */
4298 val |= (*bignum << loaded);
4299 loaded += LITTLENUM_NUMBER_OF_BITS;
4303 /* Add bytes until there are less than 7 bits left in VAL
4304 or until every non-sign bit has been written. */
4311 || val != ((byte & 0x40) == 0 ? 0 : ((valueT) 1 << loaded) - 1))
4318 while ((byte & 0x80) != 0 && loaded >= 7);
4322 /* Mop up any left-over bits (of which there will be less than 7). */
4323 if ((byte & 0x80) != 0)
4325 /* Sign-extend VAL. */
4326 if (val & (1 << (loaded - 1)))
4327 val |= ~0 << loaded;
4337 output_big_uleb128 (char *p, LITTLENUM_TYPE *bignum, int size)
4344 /* Strip leading zeros off the bignum. */
4345 /* XXX: Is this needed? */
4346 while (size > 0 && bignum[size - 1] == 0)
4351 if (loaded < 7 && size > 0)
4353 val |= (*bignum << loaded);
4354 loaded += 8 * CHARS_PER_LITTLENUM;
4363 if (size > 0 || val)
4370 while (byte & 0x80);
4376 output_big_leb128 (char *p, LITTLENUM_TYPE *bignum, int size, int sign)
4379 return output_big_sleb128 (p, bignum, size);
4381 return output_big_uleb128 (p, bignum, size);
4384 /* Generate the appropriate fragments for a given expression to emit a
4388 emit_leb128_expr (expressionS *exp, int sign)
4390 operatorT op = exp->X_op;
4393 if (op == O_absent || op == O_illegal)
4395 as_warn (_("zero assumed for missing expression"));
4396 exp->X_add_number = 0;
4399 else if (op == O_big && exp->X_add_number <= 0)
4401 as_bad (_("floating point number invalid"));
4402 exp->X_add_number = 0;
4405 else if (op == O_register)
4407 as_warn (_("register value used as expression"));
4410 else if (op == O_constant
4412 && (exp->X_add_number < 0) != !exp->X_unsigned)
4414 /* We're outputting a signed leb128 and the sign of X_add_number
4415 doesn't reflect the sign of the original value. Convert EXP
4416 to a correctly-extended bignum instead. */
4417 convert_to_bignum (exp);
4421 /* Let check_eh_frame know that data is being emitted. nbytes == -1 is
4422 a signal that this is leb128 data. It shouldn't optimize this away. */
4424 if (check_eh_frame (exp, &nbytes))
4427 /* Let the backend know that subsequent data may be byte aligned. */
4428 #ifdef md_cons_align
4432 if (op == O_constant)
4434 /* If we've got a constant, emit the thing directly right now. */
4436 valueT value = exp->X_add_number;
4440 size = sizeof_leb128 (value, sign);
4441 p = frag_more (size);
4442 output_leb128 (p, value, sign);
4444 else if (op == O_big)
4446 /* O_big is a different sort of constant. */
4451 size = output_big_leb128 (NULL, generic_bignum, exp->X_add_number, sign);
4452 p = frag_more (size);
4453 output_big_leb128 (p, generic_bignum, exp->X_add_number, sign);
4457 /* Otherwise, we have to create a variable sized fragment and
4458 resolve things later. */
4460 frag_var (rs_leb128, sizeof_uleb128 (~(valueT) 0), 0, sign,
4461 make_expr_symbol (exp), 0, (char *) NULL);
4465 /* Parse the .sleb128 and .uleb128 pseudos. */
4472 #ifdef md_flush_pending_output
4473 md_flush_pending_output ();
4479 emit_leb128_expr (&exp, sign);
4481 while (*input_line_pointer++ == ',');
4483 input_line_pointer--;
4484 demand_empty_rest_of_line ();
4487 /* We read 0 or more ',' separated, double-quoted strings.
4488 Caller should have checked need_pass_2 is FALSE because we don't
4492 stringer (/* Worker to do .ascii etc statements. */
4493 /* Checks end-of-line. */
4494 register int append_zero /* 0: don't append '\0', else 1. */)
4496 register unsigned int c;
4499 #ifdef md_flush_pending_output
4500 md_flush_pending_output ();
4503 /* The following awkward logic is to parse ZERO or more strings,
4504 comma separated. Recall a string expression includes spaces
4505 before the opening '\"' and spaces after the closing '\"'.
4506 We fake a leading ',' if there is (supposed to be)
4507 a 1st, expression. We keep demanding expressions for each ','. */
4508 if (is_it_end_of_statement ())
4510 c = 0; /* Skip loop. */
4511 ++input_line_pointer; /* Compensate for end of loop. */
4515 c = ','; /* Do loop. */
4517 /* If we have been switched into the abs_section then we
4518 will not have an obstack onto which we can hang strings. */
4519 if (now_seg == absolute_section)
4521 as_bad (_("strings must be placed into a section"));
4523 ignore_rest_of_line ();
4526 while (c == ',' || c == '<' || c == '"')
4529 switch (*input_line_pointer)
4532 ++input_line_pointer; /*->1st char of string. */
4533 start = input_line_pointer;
4534 while (is_a_char (c = next_char_of_string ()))
4536 FRAG_APPEND_1_CHAR (c);
4540 FRAG_APPEND_1_CHAR (0);
4542 know (input_line_pointer[-1] == '\"');
4546 /* In ELF, when gcc is emitting DWARF 1 debugging output, it
4547 will emit .string with a filename in the .debug section
4548 after a sequence of constants. See the comment in
4549 emit_expr for the sequence. emit_expr will set
4550 dwarf_file_string to non-zero if this string might be a
4551 source file name. */
4552 if (strcmp (segment_name (now_seg), ".debug") != 0)
4553 dwarf_file_string = 0;
4554 else if (dwarf_file_string)
4556 c = input_line_pointer[-1];
4557 input_line_pointer[-1] = '\0';
4558 listing_source_file (start);
4559 input_line_pointer[-1] = c;
4566 input_line_pointer++;
4567 c = get_single_number ();
4568 FRAG_APPEND_1_CHAR (c);
4569 if (*input_line_pointer != '>')
4571 as_bad (_("expected <nn>"));
4573 input_line_pointer++;
4576 input_line_pointer++;
4580 c = *input_line_pointer;
4583 demand_empty_rest_of_line ();
4586 /* FIXME-SOMEDAY: I had trouble here on characters with the
4587 high bits set. We'll probably also have trouble with
4588 multibyte chars, wide chars, etc. Also be careful about
4589 returning values bigger than 1 byte. xoxorich. */
4592 next_char_of_string (void)
4594 register unsigned int c;
4596 c = *input_line_pointer++ & CHAR_MASK;
4604 as_warn (_("unterminated string; newline inserted"));
4605 bump_line_counters ();
4608 #ifndef NO_STRING_ESCAPES
4610 switch (c = *input_line_pointer++)
4638 break; /* As itself. */
4654 for (i = 0, number = 0;
4655 ISDIGIT (c) && i < 3;
4656 c = *input_line_pointer++, i++)
4658 number = number * 8 + c - '0';
4663 --input_line_pointer;
4672 c = *input_line_pointer++;
4673 while (ISXDIGIT (c))
4676 number = number * 16 + c - '0';
4677 else if (ISUPPER (c))
4678 number = number * 16 + c - 'A' + 10;
4680 number = number * 16 + c - 'a' + 10;
4681 c = *input_line_pointer++;
4684 --input_line_pointer;
4689 /* To be compatible with BSD 4.2 as: give the luser a linefeed!! */
4690 as_warn (_("unterminated string; newline inserted"));
4692 bump_line_counters ();
4697 #ifdef ONLY_STANDARD_ESCAPES
4698 as_bad (_("bad escaped character in string"));
4700 #endif /* ONLY_STANDARD_ESCAPES */
4705 #endif /* ! defined (NO_STRING_ESCAPES) */
4714 get_segmented_expression (register expressionS *expP)
4716 register segT retval;
4718 retval = expression (expP);
4719 if (expP->X_op == O_illegal
4720 || expP->X_op == O_absent
4721 || expP->X_op == O_big)
4723 as_bad (_("expected address expression"));
4724 expP->X_op = O_constant;
4725 expP->X_add_number = 0;
4726 retval = absolute_section;
4732 get_known_segmented_expression (register expressionS *expP)
4734 register segT retval;
4736 if ((retval = get_segmented_expression (expP)) == undefined_section)
4738 /* There is no easy way to extract the undefined symbol from the
4740 if (expP->X_add_symbol != NULL
4741 && S_GET_SEGMENT (expP->X_add_symbol) != expr_section)
4742 as_warn (_("symbol \"%s\" undefined; zero assumed"),
4743 S_GET_NAME (expP->X_add_symbol));
4745 as_warn (_("some symbol undefined; zero assumed"));
4746 retval = absolute_section;
4747 expP->X_op = O_constant;
4748 expP->X_add_number = 0;
4750 know (retval == absolute_section || SEG_NORMAL (retval));
4755 get_absolute_expr (expressionS *exp)
4758 if (exp->X_op != O_constant)
4760 if (exp->X_op != O_absent)
4761 as_bad (_("bad or irreducible absolute expression"));
4762 exp->X_add_number = 0;
4764 return exp->X_add_number;
4768 get_absolute_expression (void)
4772 return get_absolute_expr (&exp);
4775 char /* Return terminator. */
4776 get_absolute_expression_and_terminator (long *val_pointer /* Return value of expression. */)
4778 /* FIXME: val_pointer should probably be offsetT *. */
4779 *val_pointer = (long) get_absolute_expression ();
4780 return (*input_line_pointer++);
4783 /* Like demand_copy_string, but return NULL if the string contains any '\0's.
4784 Give a warning if that happens. */
4787 demand_copy_C_string (int *len_pointer)
4791 if ((s = demand_copy_string (len_pointer)) != 0)
4795 for (len = *len_pointer; len > 0; len--)
4802 as_bad (_("this string may not contain \'\\0\'"));
4810 /* Demand string, but return a safe (=private) copy of the string.
4811 Return NULL if we can't read a string here. */
4814 demand_copy_string (int *lenP)
4816 register unsigned int c;
4822 if (*input_line_pointer == '\"')
4824 input_line_pointer++; /* Skip opening quote. */
4826 while (is_a_char (c = next_char_of_string ()))
4828 obstack_1grow (¬es, c);
4831 /* JF this next line is so demand_copy_C_string will return a
4832 null terminated string. */
4833 obstack_1grow (¬es, '\0');
4834 retval = obstack_finish (¬es);
4838 as_bad (_("missing string"));
4840 ignore_rest_of_line ();
4846 /* In: Input_line_pointer->next character.
4848 Do: Skip input_line_pointer over all whitespace.
4850 Out: 1 if input_line_pointer->end-of-line. */
4853 is_it_end_of_statement (void)
4856 return (is_end_of_line[(unsigned char) *input_line_pointer]);
4860 equals (char *sym_name, int reassign)
4862 register symbolS *symbolP; /* Symbol we are working with. */
4866 input_line_pointer++;
4867 if (*input_line_pointer == '=')
4868 input_line_pointer++;
4870 while (*input_line_pointer == ' ' || *input_line_pointer == '\t')
4871 input_line_pointer++;
4874 stop = mri_comment_field (&stopc);
4876 if (sym_name[0] == '.' && sym_name[1] == '\0')
4878 /* Turn '. = mumble' into a .org mumble. */
4879 register segT segment;
4882 segment = get_known_segmented_expression (&exp);
4884 do_org (segment, &exp, 0);
4891 symbolP = symbol_find (sym_name);
4892 local = symbolP == NULL;
4894 #endif /* OBJ_COFF */
4895 symbolP = symbol_find_or_make (sym_name);
4896 /* Permit register names to be redefined. */
4898 && S_IS_DEFINED (symbolP)
4899 && S_GET_SEGMENT (symbolP) != reg_section)
4900 as_bad (_("symbol `%s' is already defined"), S_GET_NAME (symbolP));
4903 /* "set" symbols are local unless otherwise specified. */
4905 SF_SET_LOCAL (symbolP);
4906 #endif /* OBJ_COFF */
4908 pseudo_set (symbolP);
4913 /* Check garbage after the expression. */
4914 demand_empty_rest_of_line ();
4915 mri_comment_end (stop, stopc);
4919 /* .incbin -- include a file verbatim at the current location. */
4922 s_incbin (int x ATTRIBUTE_UNUSED)
4933 #ifdef md_flush_pending_output
4934 md_flush_pending_output ();
4938 filename = demand_copy_string (& len);
4939 if (filename == NULL)
4944 /* Look for optional skip and count. */
4945 if (* input_line_pointer == ',')
4947 ++ input_line_pointer;
4948 skip = get_absolute_expression ();
4952 if (* input_line_pointer == ',')
4954 ++ input_line_pointer;
4956 count = get_absolute_expression ();
4958 as_warn (_(".incbin count zero, ignoring `%s'"), filename);
4964 demand_empty_rest_of_line ();
4966 /* Try opening absolute path first, then try include dirs. */
4967 binfile = fopen (filename, FOPEN_RB);
4968 if (binfile == NULL)
4972 path = xmalloc ((unsigned long) len + include_dir_maxlen + 5);
4974 for (i = 0; i < include_dir_count; i++)
4976 sprintf (path, "%s/%s", include_dirs[i], filename);
4978 binfile = fopen (path, FOPEN_RB);
4979 if (binfile != NULL)
4983 if (binfile == NULL)
4984 as_bad (_("file not found: %s"), filename);
4987 path = xstrdup (filename);
4993 register_dependency (path);
4995 /* Compute the length of the file. */
4996 if (fseek (binfile, 0, SEEK_END) != 0)
4998 as_bad (_("seek to end of .incbin file failed `%s'"), path);
5001 file_len = ftell (binfile);
5003 /* If a count was not specified use the remainder of the file. */
5005 count = file_len - skip;
5007 if (skip < 0 || count < 0 || file_len < 0 || skip + count > file_len)
5009 as_bad (_("skip (%ld) or count (%ld) invalid for file size (%ld)"),
5010 skip, count, file_len);
5014 if (fseek (binfile, skip, SEEK_SET) != 0)
5016 as_bad (_("could not skip to %ld in file `%s'"), skip, path);
5020 /* Allocate frag space and store file contents in it. */
5021 binfrag = frag_more (count);
5023 bytes = fread (binfrag, 1, count, binfile);
5025 as_warn (_("truncated file `%s', %ld of %ld bytes read"),
5026 path, bytes, count);
5029 if (binfile != NULL)
5035 /* .include -- include a file at this point. */
5038 s_include (int arg ATTRIBUTE_UNUSED)
5047 filename = demand_copy_string (&i);
5048 if (filename == NULL)
5050 /* demand_copy_string has already printed an error and
5051 called ignore_rest_of_line. */
5059 while (!is_end_of_line[(unsigned char) *input_line_pointer]
5060 && *input_line_pointer != ' '
5061 && *input_line_pointer != '\t')
5063 obstack_1grow (¬es, *input_line_pointer);
5064 ++input_line_pointer;
5068 obstack_1grow (¬es, '\0');
5069 filename = obstack_finish (¬es);
5070 while (!is_end_of_line[(unsigned char) *input_line_pointer])
5071 ++input_line_pointer;
5074 demand_empty_rest_of_line ();
5075 path = xmalloc ((unsigned long) i + include_dir_maxlen + 5 /* slop */ );
5077 for (i = 0; i < include_dir_count; i++)
5079 strcpy (path, include_dirs[i]);
5081 strcat (path, filename);
5082 if (0 != (try = fopen (path, FOPEN_RT)))
5092 /* malloc Storage leak when file is found on path. FIXME-SOMEDAY. */
5093 register_dependency (path);
5094 input_scrub_insert_file (path);
5098 add_include_dir (char *path)
5102 if (include_dir_count == 0)
5104 include_dirs = (char **) xmalloc (2 * sizeof (*include_dirs));
5105 include_dirs[0] = "."; /* Current dir. */
5106 include_dir_count = 2;
5110 include_dir_count++;
5112 (char **) realloc (include_dirs,
5113 include_dir_count * sizeof (*include_dirs));
5116 include_dirs[include_dir_count - 1] = path; /* New one. */
5119 if (i > include_dir_maxlen)
5120 include_dir_maxlen = i;
5123 /* Output debugging information to denote the source file. */
5126 generate_file_debug (void)
5128 if (debug_type == DEBUG_STABS)
5129 stabs_generate_asm_file ();
5132 /* Output line number debugging information for the current source line. */
5135 generate_lineno_debug (void)
5139 case DEBUG_UNSPECIFIED:
5144 stabs_generate_asm_lineno ();
5147 ecoff_generate_asm_lineno ();
5150 /* ??? We could here indicate to dwarf2dbg.c that something
5151 has changed. However, since there is additional backend
5152 support that is required (calling dwarf2_emit_insn), we
5153 let dwarf2dbg.c call as_where on its own. */
5158 /* Output debugging information to mark a function entry point or end point.
5159 END_P is zero for .func, and non-zero for .endfunc. */
5164 do_s_func (end_p, NULL);
5167 /* Subroutine of s_func so targets can choose a different default prefix.
5168 If DEFAULT_PREFIX is NULL, use the target's "leading char". */
5171 do_s_func (int end_p, const char *default_prefix)
5173 /* Record the current function so that we can issue an error message for
5174 misplaced .func,.endfunc, and also so that .endfunc needs no
5176 static char *current_name;
5177 static char *current_label;
5181 if (current_name == NULL)
5183 as_bad (_("missing .func"));
5184 ignore_rest_of_line ();
5188 if (debug_type == DEBUG_STABS)
5189 stabs_generate_asm_endfunc (current_name, current_label);
5191 current_name = current_label = NULL;
5196 char delim1, delim2;
5198 if (current_name != NULL)
5200 as_bad (_(".endfunc missing for previous .func"));
5201 ignore_rest_of_line ();
5205 name = input_line_pointer;
5206 delim1 = get_symbol_end ();
5207 name = xstrdup (name);
5208 *input_line_pointer = delim1;
5210 if (*input_line_pointer != ',')
5213 asprintf (&label, "%s%s", default_prefix, name);
5216 char leading_char = 0;
5217 #ifdef BFD_ASSEMBLER
5218 leading_char = bfd_get_symbol_leading_char (stdoutput);
5220 /* Missing entry point, use function's name with the leading
5223 asprintf (&label, "%c%s", leading_char, name);
5230 ++input_line_pointer;
5232 label = input_line_pointer;
5233 delim2 = get_symbol_end ();
5234 label = xstrdup (label);
5235 *input_line_pointer = delim2;
5238 if (debug_type == DEBUG_STABS)
5239 stabs_generate_asm_func (name, label);
5241 current_name = name;
5242 current_label = label;
5245 demand_empty_rest_of_line ();
5249 s_ignore (int arg ATTRIBUTE_UNUSED)
5251 while (!is_end_of_line[(unsigned char) *input_line_pointer])
5253 ++input_line_pointer;
5255 ++input_line_pointer;
5259 read_print_statistics (FILE *file)
5261 hash_print_statistics (file, "pseudo-op table", po_hash);
5264 /* Inserts the given line into the input stream.
5266 This call avoids macro/conditionals nesting checking, since the contents of
5267 the line are assumed to replace the contents of a line already scanned.
5269 An appropriate use of this function would be substitution of input lines when
5270 called by md_start_line_hook(). The given line is assumed to already be
5271 properly scrubbed. */
5274 input_scrub_insert_line (const char *line)
5278 sb_add_string (&newline, line);
5279 input_scrub_include_sb (&newline, input_line_pointer, 0);
5281 buffer_limit = input_scrub_next_buffer (&input_line_pointer);
5284 /* Insert a file into the input stream; the path must resolve to an actual
5285 file; no include path searching or dependency registering is performed. */
5288 input_scrub_insert_file (char *path)
5290 input_scrub_include_file (path, input_line_pointer);
5291 buffer_limit = input_scrub_next_buffer (&input_line_pointer);