1 /* read.c - read a source file -
2 Copyright 1986, 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
4 Free Software Foundation, Inc.
6 This file is part of GAS, the GNU Assembler.
8 GAS is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2, or (at your option)
13 GAS is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with GAS; see the file COPYING. If not, write to the Free
20 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
23 /* If your chars aren't 8 bits, you will change this a bit (eg. to 0xFF).
24 But then, GNU isn't spozed to run on your machine anyway.
25 (RMS is so shortsighted sometimes.) */
26 #define MASK_CHAR ((int)(unsigned char) -1)
28 /* This is the largest known floating point format (for now). It will
29 grow when we do 4361 style flonums. */
30 #define MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT (16)
32 /* Routines that read assembler source text to build spaghetti in memory.
33 Another group of these functions is in the expr.c module. */
36 #include "safe-ctype.h"
43 #include "dw2gencfi.h"
45 #ifndef TC_START_LABEL
46 #define TC_START_LABEL(x,y) (x == ':')
49 /* Set by the object-format or the target. */
50 #ifndef TC_IMPLICIT_LCOMM_ALIGNMENT
51 #define TC_IMPLICIT_LCOMM_ALIGNMENT(SIZE, P2VAR) \
56 else if ((SIZE) >= 4) \
58 else if ((SIZE) >= 2) \
66 char *input_line_pointer; /*->next char of source file to parse. */
68 #if BITS_PER_CHAR != 8
69 /* The following table is indexed by[(char)] and will break if
70 a char does not have exactly 256 states (hopefully 0:255!)! */
75 /* The m88k unfortunately uses @ as a label beginner. */
80 /* The RS/6000 assembler uses {,},[,] as parts of symbol names. */
85 /* The Delta 68k assembler permits % inside label names. */
90 /* The PowerPC Windows NT assemblers permits ? inside label names. */
95 /* The IA-64 assembler uses # as a suffix designating a symbol. We include
96 it in the symbol and strip it out in tc_canonicalize_symbol_name. */
101 /* The a29k assembler does not permits labels to start with $. */
106 /* The Delta 68k assembler permits ~ at start of label names. */
110 /* Used by is_... macros. our ctype[]. */
111 char lex_type[256] = {
112 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* @ABCDEFGHIJKLMNO */
113 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* PQRSTUVWXYZ[\]^_ */
114 0, 0, 0, LEX_HASH, LEX_DOLLAR, LEX_PCT, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, /* _!"#$%&'()*+,-./ */
115 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, LEX_QM, /* 0123456789:;<=>? */
116 LEX_AT, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* @ABCDEFGHIJKLMNO */
117 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, LEX_BR, 0, LEX_BR, 0, 3, /* PQRSTUVWXYZ[\]^_ */
118 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* `abcdefghijklmno */
119 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, LEX_BR, 0, LEX_BR, LEX_TILDE, 0, /* pqrstuvwxyz{|}~. */
120 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
121 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
122 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
123 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
124 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
125 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
126 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
127 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3
131 Out: 1 if this character ends a line. */
132 char is_end_of_line[256] = {
134 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, /* @abcdefghijklmno */
136 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, /* @abcdefghijklmno */
138 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
139 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* _!"#$%&'()*+,-./ */
140 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0123456789:;<=>? */
141 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
142 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
143 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
144 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
145 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
146 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
147 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
148 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
149 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
150 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
151 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
152 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /* */
155 #ifndef TC_CASE_SENSITIVE
156 char original_case_string[128];
159 /* Functions private to this file. */
161 static char *buffer; /* 1st char of each buffer of lines is here. */
162 static char *buffer_limit; /*->1 + last char in buffer. */
164 /* TARGET_BYTES_BIG_ENDIAN is required to be defined to either 0 or 1
165 in the tc-<CPU>.h file. See the "Porting GAS" section of the
167 int target_big_endian = TARGET_BYTES_BIG_ENDIAN;
169 /* Variables for handling include file directory table. */
171 /* Table of pointers to directories to search for .include's. */
174 /* How many are in the table. */
175 int include_dir_count;
177 /* Length of longest in table. */
178 int include_dir_maxlen = 1;
180 #ifndef WORKING_DOT_WORD
181 struct broken_word *broken_words;
182 int new_broken_words;
185 /* The current offset into the absolute section. We don't try to
186 build frags in the absolute section, since no data can be stored
187 there. We just keep track of the current offset. */
188 addressT abs_section_offset;
190 /* If this line had an MRI style label, it is stored in this variable.
191 This is used by some of the MRI pseudo-ops. */
194 /* This global variable is used to support MRI common sections. We
195 translate such sections into a common symbol. This variable is
196 non-NULL when we are in an MRI common section. */
197 symbolS *mri_common_symbol;
199 /* In MRI mode, after a dc.b pseudo-op with an odd number of bytes, we
200 need to align to an even byte boundary unless the next pseudo-op is
201 dc.b, ds.b, or dcb.b. This variable is set to 1 if an alignment
203 static int mri_pending_align;
207 /* This variable is set to be non-zero if the next string we see might
208 be the name of the source file in DWARF debugging information. See
209 the comment in emit_expr for the format we look for. */
210 static int dwarf_file_string;
214 static void do_align (int, char *, int, int);
215 static void s_align (int, int);
216 static void s_altmacro (int);
217 static void s_bad_end (int);
218 static int hex_float (int, char *);
219 static segT get_known_segmented_expression (expressionS * expP);
220 static void pobegin (void);
221 static int get_line_sb (sb *);
222 static void generate_file_debug (void);
230 obj_read_begin_hook ();
232 /* Something close -- but not too close -- to a multiple of 1024.
233 The debugging malloc I'm using has 24 bytes of overhead. */
234 obstack_begin (¬es, chunksize);
235 obstack_begin (&cond_obstack, chunksize);
237 /* Use machine dependent syntax. */
238 for (p = line_separator_chars; *p; p++)
239 is_end_of_line[(unsigned char) *p] = 1;
240 /* Use more. FIXME-SOMEDAY. */
246 /* Set up pseudo-op tables. */
248 static struct hash_control *po_hash;
250 static const pseudo_typeS potable[] = {
251 {"abort", s_abort, 0},
252 {"align", s_align_ptwo, 0},
253 {"altmacro", s_altmacro, 1},
254 {"ascii", stringer, 0},
255 {"asciz", stringer, 1},
256 {"balign", s_align_bytes, 0},
257 {"balignw", s_align_bytes, -2},
258 {"balignl", s_align_bytes, -4},
262 {"common", s_mri_common, 0},
263 {"common.s", s_mri_common, 1},
267 {"dc.d", float_cons, 'd'},
269 {"dc.s", float_cons, 'f'},
271 {"dc.x", float_cons, 'x'},
273 {"dcb.b", s_space, 1},
274 {"dcb.d", s_float_space, 'd'},
275 {"dcb.l", s_space, 4},
276 {"dcb.s", s_float_space, 'f'},
277 {"dcb.w", s_space, 2},
278 {"dcb.x", s_float_space, 'x'},
280 {"ds.b", s_space, 1},
281 {"ds.d", s_space, 8},
282 {"ds.l", s_space, 4},
283 {"ds.p", s_space, 12},
284 {"ds.s", s_space, 4},
285 {"ds.w", s_space, 2},
286 {"ds.x", s_space, 12},
287 {"debug", s_ignore, 0},
292 {"double", float_cons, 'd'},
294 {"eject", listing_eject, 0}, /* Formfeed listing. */
296 {"elsec", s_else, 0},
297 {"elseif", s_elseif, (int) O_ne},
299 {"endc", s_endif, 0},
300 {"endfunc", s_func, 1},
301 {"endif", s_endif, 0},
302 {"endm", s_bad_end, 0},
303 {"endr", s_bad_end, 1},
308 {"error", s_errwarn, 1},
309 {"exitm", s_mexit, 0},
311 {"extern", s_ignore, 0}, /* We treat all undef as ext. */
312 {"appfile", s_app_file, 1},
313 {"appline", s_app_line, 0},
315 {"file", s_app_file, 0},
317 {"float", float_cons, 'f'},
318 {"format", s_ignore, 0},
320 {"global", s_globl, 0},
321 {"globl", s_globl, 0},
323 {"if", s_if, (int) O_ne},
325 {"ifdef", s_ifdef, 0},
326 {"ifeq", s_if, (int) O_eq},
327 {"ifeqs", s_ifeqs, 0},
328 {"ifge", s_if, (int) O_ge},
329 {"ifgt", s_if, (int) O_gt},
330 {"ifle", s_if, (int) O_le},
331 {"iflt", s_if, (int) O_lt},
333 {"ifndef", s_ifdef, 1},
334 {"ifne", s_if, (int) O_ne},
335 {"ifnes", s_ifeqs, 1},
336 {"ifnotdef", s_ifdef, 1},
337 {"incbin", s_incbin, 0},
338 {"include", s_include, 0},
344 {"lcomm", s_lcomm, 0},
345 {"lflags", listing_flags, 0}, /* Listing flags. */
346 {"linkonce", s_linkonce, 0},
347 {"list", listing_list, 1}, /* Turn listing on. */
348 {"llen", listing_psize, 1},
351 {"macro", s_macro, 0},
352 {"mexit", s_mexit, 0},
354 {".mri", s_mri, 0}, /* Special case so .mri works in MRI mode. */
355 {"name", s_ignore, 0},
356 {"noaltmacro", s_altmacro, 0},
357 {"noformat", s_ignore, 0},
358 {"nolist", listing_list, 0}, /* Turn listing off. */
359 {"nopage", listing_nopage, 0},
361 {"offset", s_struct, 0},
363 {"p2align", s_align_ptwo, 0},
364 {"p2alignw", s_align_ptwo, -2},
365 {"p2alignl", s_align_ptwo, -4},
366 {"page", listing_eject, 0},
367 {"plen", listing_psize, 0},
368 {"print", s_print, 0},
369 {"psize", listing_psize, 0}, /* Set paper size. */
370 {"purgem", s_purgem, 0},
375 {"sbttl", listing_title, 1}, /* Subtitle of listing. */
380 {"single", float_cons, 'f'},
382 {"space", s_space, 0},
383 {"skip", s_space, 0},
384 {"sleb128", s_leb128, 1},
385 {"spc", s_ignore, 0},
386 {"stabd", s_stab, 'd'},
387 {"stabn", s_stab, 'n'},
388 {"stabs", s_stab, 's'},
389 {"string", stringer, 1},
390 {"struct", s_struct, 0},
394 /* This is for gcc to use. It's only just been added (2/94), so gcc
395 won't be able to use it for a while -- probably a year or more.
396 But once this has been released, check with gcc maintainers
397 before deleting it or even changing the spelling. */
398 {"this_GCC_requires_the_GNU_assembler", s_ignore, 0},
399 /* If we're folding case -- done for some targets, not necessarily
400 all -- the above string in an input file will be converted to
401 this one. Match it either way... */
402 {"this_gcc_requires_the_gnu_assembler", s_ignore, 0},
404 {"title", listing_title, 0}, /* Listing title. */
405 {"ttl", listing_title, 0},
407 {"uleb128", s_leb128, 0},
411 {"xdef", s_globl, 0},
412 {"xref", s_ignore, 0},
413 {"xstabs", s_xstab, 's'},
414 {"warning", s_errwarn, 0},
416 {"zero", s_space, 0},
417 {NULL, NULL, 0} /* End sentinel. */
420 static int pop_override_ok = 0;
421 static const char *pop_table_name;
424 pop_insert (const pseudo_typeS *table)
427 const pseudo_typeS *pop;
428 for (pop = table; pop->poc_name; pop++)
430 errtxt = hash_insert (po_hash, pop->poc_name, (char *) pop);
431 if (errtxt && (!pop_override_ok || strcmp (errtxt, "exists")))
432 as_fatal (_("error constructing %s pseudo-op table: %s"), pop_table_name,
437 #ifndef md_pop_insert
438 #define md_pop_insert() pop_insert(md_pseudo_table)
441 #ifndef obj_pop_insert
442 #define obj_pop_insert() pop_insert(obj_pseudo_table)
445 #ifndef cfi_pop_insert
446 #define cfi_pop_insert() pop_insert(cfi_pseudo_table)
452 po_hash = hash_new ();
454 /* Do the target-specific pseudo ops. */
455 pop_table_name = "md";
458 /* Now object specific. Skip any that were in the target table. */
459 pop_table_name = "obj";
463 /* Now portable ones. Skip any that we've seen already. */
464 pop_table_name = "standard";
465 pop_insert (potable);
467 #ifdef TARGET_USE_CFIPOP
468 pop_table_name = "cfi";
474 #define HANDLE_CONDITIONAL_ASSEMBLY() \
475 if (ignore_input ()) \
477 while (!is_end_of_line[(unsigned char) *input_line_pointer++]) \
478 if (input_line_pointer == buffer_limit) \
483 /* This function is used when scrubbing the characters between #APP
486 static char *scrub_string;
487 static char *scrub_string_end;
490 scrub_from_string (char *buf, int buflen)
494 copy = scrub_string_end - scrub_string;
497 memcpy (buf, scrub_string, copy);
498 scrub_string += copy;
502 /* We read the file, putting things into a web that represents what we
503 have been reading. */
505 read_a_source_file (char *name)
508 register char *s; /* String of symbol, '\0' appended. */
516 buffer = input_scrub_new_file (name);
519 listing_newline (NULL);
520 register_dependency (name);
522 /* Generate debugging information before we've read anything in to denote
523 this file as the "main" source file and not a subordinate one
524 (e.g. N_SO vs N_SOL in stabs). */
525 generate_file_debug ();
527 while ((buffer_limit = input_scrub_next_buffer (&input_line_pointer)) != 0)
528 { /* We have another line to parse. */
529 know (buffer_limit[-1] == '\n'); /* Must have a sentinel. */
531 while (input_line_pointer < buffer_limit)
533 /* We have more of this buffer to parse. */
535 /* We now have input_line_pointer->1st char of next line.
536 If input_line_pointer [-1] == '\n' then we just
537 scanned another line: so bump line counters. */
538 if (is_end_of_line[(unsigned char) input_line_pointer[-1]])
540 #ifdef md_start_line_hook
541 md_start_line_hook ();
543 if (input_line_pointer[-1] == '\n')
544 bump_line_counters ();
548 if (LABELS_WITHOUT_COLONS || flag_m68k_mri)
550 /* Text at the start of a line must be a label, we
551 run down and stick a colon in. */
552 if (is_name_beginner (*input_line_pointer))
554 char *line_start = input_line_pointer;
559 HANDLE_CONDITIONAL_ASSEMBLY ();
561 c = get_symbol_end ();
563 /* In MRI mode, the EQU and MACRO pseudoops must
564 be handled specially. */
568 char *rest = input_line_pointer + 1;
572 if (*rest == ' ' || *rest == '\t')
574 if ((strncasecmp (rest, "EQU", 3) == 0
575 || strncasecmp (rest, "SET", 3) == 0)
576 && (rest[3] == ' ' || rest[3] == '\t'))
578 input_line_pointer = rest + 3;
580 strncasecmp (rest, "SET", 3) == 0);
583 if (strncasecmp (rest, "MACRO", 5) == 0
586 || is_end_of_line[(unsigned char) rest[5]]))
590 /* In MRI mode, we need to handle the MACRO
591 pseudo-op specially: we don't want to put the
592 symbol in the symbol table. */
594 #ifdef TC_START_LABEL_WITHOUT_COLON
595 && TC_START_LABEL_WITHOUT_COLON(c,
599 line_label = colon (line_start);
601 line_label = symbol_create (line_start,
606 *input_line_pointer = c;
608 input_line_pointer++;
613 /* We are at the beginning of a line, or similar place.
614 We expect a well-formed assembler statement.
615 A "symbol-name:" is a statement.
617 Depending on what compiler is used, the order of these tests
618 may vary to catch most common case 1st.
619 Each test is independent of all other tests at the (top) level.
620 PLEASE make a compiler that doesn't use this assembler.
621 It is crufty to waste a compiler's time encoding things for this
622 assembler, which then wastes more time decoding it.
623 (And communicating via (linear) files is silly!
624 If you must pass stuff, please pass a tree!) */
625 if ((c = *input_line_pointer++) == '\t'
629 c = *input_line_pointer++;
631 know (c != ' '); /* No further leading whitespace. */
634 /* If listing is on, and we are expanding a macro, then give
635 the listing code the contents of the expanded line. */
638 if ((listing & LISTING_MACEXP) && macro_nest > 0)
643 /* Find the end of the current expanded macro line. */
644 for (s = input_line_pointer - 1; *s; ++s)
645 if (is_end_of_line[(unsigned char) *s])
648 /* Copy it for safe keeping. Also give an indication of
649 how much macro nesting is involved at this point. */
650 len = s - (input_line_pointer - 1);
651 copy = (char *) xmalloc (len + macro_nest + 2);
652 memset (copy, '>', macro_nest);
653 copy[macro_nest] = ' ';
654 memcpy (copy + macro_nest + 1, input_line_pointer - 1, len);
655 copy[macro_nest + 1 + len] = '\0';
657 /* Install the line with the listing facility. */
658 listing_newline (copy);
661 listing_newline (NULL);
664 /* C is the 1st significant character.
665 Input_line_pointer points after that character. */
666 if (is_name_beginner (c))
668 /* Want user-defined label or pseudo/opcode. */
669 HANDLE_CONDITIONAL_ASSEMBLY ();
671 s = --input_line_pointer;
672 c = get_symbol_end (); /* name's delimiter. */
674 /* C is character after symbol.
675 That character's place in the input line is now '\0'.
676 S points to the beginning of the symbol.
677 [In case of pseudo-op, s->'.'.]
678 Input_line_pointer->'\0' where c was. */
679 if (TC_START_LABEL (c, input_line_pointer))
683 char *rest = input_line_pointer + 1;
685 /* In MRI mode, \tsym: set 0 is permitted. */
689 if (*rest == ' ' || *rest == '\t')
692 if ((strncasecmp (rest, "EQU", 3) == 0
693 || strncasecmp (rest, "SET", 3) == 0)
694 && (rest[3] == ' ' || rest[3] == '\t'))
696 input_line_pointer = rest + 3;
702 line_label = colon (s); /* User-defined label. */
703 /* Put ':' back for error messages' sake. */
704 *input_line_pointer++ = ':';
705 #ifdef tc_check_label
706 tc_check_label (line_label);
708 /* Input_line_pointer->after ':'. */
712 || ((c == ' ' || c == '\t')
713 && input_line_pointer[1] == '='
714 #ifdef TC_EQUAL_IN_INSN
715 && !TC_EQUAL_IN_INSN (c, input_line_pointer)
720 demand_empty_rest_of_line ();
724 /* Expect pseudo-op or machine instruction. */
727 #ifndef TC_CASE_SENSITIVE
731 strncpy (original_case_string, s2, sizeof (original_case_string));
732 original_case_string[sizeof (original_case_string) - 1] = 0;
741 if (NO_PSEUDO_DOT || flag_m68k_mri)
743 /* The MRI assembler and the m88k use pseudo-ops
745 pop = (pseudo_typeS *) hash_find (po_hash, s);
746 if (pop != NULL && pop->poc_handler == NULL)
751 || (!flag_m68k_mri && *s == '.'))
755 WARNING: c has next char, which may be end-of-line.
756 We lookup the pseudo-op table with s+1 because we
757 already know that the pseudo-op begins with a '.'. */
760 pop = (pseudo_typeS *) hash_find (po_hash, s + 1);
761 if (pop && !pop->poc_handler)
764 /* In MRI mode, we may need to insert an
765 automatic alignment directive. What a hack
767 if (mri_pending_align
769 || !((pop->poc_handler == cons
770 && pop->poc_val == 1)
771 || (pop->poc_handler == s_space
772 && pop->poc_val == 1)
773 #ifdef tc_conditional_pseudoop
774 || tc_conditional_pseudoop (pop)
776 || pop->poc_handler == s_if
777 || pop->poc_handler == s_ifdef
778 || pop->poc_handler == s_ifc
779 || pop->poc_handler == s_ifeqs
780 || pop->poc_handler == s_else
781 || pop->poc_handler == s_endif
782 || pop->poc_handler == s_globl
783 || pop->poc_handler == s_ignore)))
785 do_align (1, (char *) NULL, 0, 0);
786 mri_pending_align = 0;
788 if (line_label != NULL)
790 symbol_set_frag (line_label, frag_now);
791 S_SET_VALUE (line_label, frag_now_fix ());
795 /* Print the error msg now, while we still can. */
798 as_bad (_("unknown pseudo-op: `%s'"), s);
799 *input_line_pointer = c;
804 /* Put it back for error messages etc. */
805 *input_line_pointer = c;
806 /* The following skip of whitespace is compulsory.
807 A well shaped space is sometimes all that separates
808 keyword from operands. */
809 if (c == ' ' || c == '\t')
810 input_line_pointer++;
812 /* Input_line is restored.
813 Input_line_pointer->1st non-blank char
814 after pseudo-operation. */
815 (*pop->poc_handler) (pop->poc_val);
817 /* If that was .end, just get out now. */
818 if (pop->poc_handler == s_end)
824 #ifdef QUOTES_IN_INSN
828 /* WARNING: c has char, which may be end-of-line. */
829 /* Also: input_line_pointer->`\0` where c was. */
830 *input_line_pointer = c;
831 while (!is_end_of_line[(unsigned char) *input_line_pointer]
833 #ifdef TC_EOL_IN_INSN
834 || TC_EOL_IN_INSN (input_line_pointer)
838 if (flag_m68k_mri && *input_line_pointer == '\'')
840 #ifdef QUOTES_IN_INSN
843 else if (*input_line_pointer == '"')
845 else if (*input_line_pointer == '\\')
848 input_line_pointer++;
851 c = *input_line_pointer;
852 *input_line_pointer = '\0';
854 generate_lineno_debug ();
862 if (check_macro (s, &out, &err, ¯o))
866 *input_line_pointer++ = c;
867 input_scrub_include_sb (&out,
868 input_line_pointer, 1);
871 input_scrub_next_buffer (&input_line_pointer);
873 md_macro_info (macro);
879 if (mri_pending_align)
881 do_align (1, (char *) NULL, 0, 0);
882 mri_pending_align = 0;
883 if (line_label != NULL)
885 symbol_set_frag (line_label, frag_now);
886 S_SET_VALUE (line_label, frag_now_fix ());
890 md_assemble (s); /* Assemble 1 instruction. */
892 *input_line_pointer++ = c;
894 /* We resume loop AFTER the end-of-line from
901 /* Empty statement? */
902 if (is_end_of_line[(unsigned char) c])
905 if ((LOCAL_LABELS_DOLLAR || LOCAL_LABELS_FB) && ISDIGIT (c))
907 /* local label ("4:") */
908 char *backup = input_line_pointer;
910 HANDLE_CONDITIONAL_ASSEMBLY ();
914 /* Read the whole number. */
915 while (ISDIGIT (*input_line_pointer))
917 temp = (temp * 10) + *input_line_pointer - '0';
918 ++input_line_pointer;
921 if (LOCAL_LABELS_DOLLAR
922 && *input_line_pointer == '$'
923 && *(input_line_pointer + 1) == ':')
925 input_line_pointer += 2;
927 if (dollar_label_defined (temp))
929 as_fatal (_("label \"%d$\" redefined"), temp);
932 define_dollar_label (temp);
933 colon (dollar_label_name (temp, 0));
938 && *input_line_pointer++ == ':')
940 fb_label_instance_inc (temp);
941 colon (fb_label_name (temp, 0));
945 input_line_pointer = backup;
946 } /* local label ("4:") */
948 if (c && strchr (line_comment_chars, c))
949 { /* Its a comment. Better say APP or NO_APP. */
954 unsigned int new_length;
957 bump_line_counters ();
958 s = input_line_pointer;
959 if (strncmp (s, "APP\n", 4))
960 continue; /* We ignore it */
964 ends = strstr (s, "#NO_APP\n");
968 unsigned int tmp_len;
971 /* The end of the #APP wasn't in this buffer. We
972 keep reading in buffers until we find the #NO_APP
973 that goes with this #APP There is one. The specs
975 tmp_len = buffer_limit - s;
976 tmp_buf = xmalloc (tmp_len + 1);
977 memcpy (tmp_buf, s, tmp_len);
980 new_tmp = input_scrub_next_buffer (&buffer);
984 buffer_limit = new_tmp;
985 input_line_pointer = buffer;
986 ends = strstr (buffer, "#NO_APP\n");
990 num = buffer_limit - buffer;
992 tmp_buf = xrealloc (tmp_buf, tmp_len + num);
993 memcpy (tmp_buf + tmp_len, buffer, num);
998 input_line_pointer = ends ? ends + 8 : NULL;
1006 input_line_pointer = ends + 8;
1010 scrub_string_end = ends;
1012 new_length = ends - s;
1013 new_buf = (char *) xmalloc (new_length);
1020 space = (new_buf + new_length) - new_tmp;
1021 size = do_scrub_chars (scrub_from_string, new_tmp, space);
1029 new_buf = xrealloc (new_buf, new_length + 100);
1030 new_tmp = new_buf + new_length;
1037 /* We've "scrubbed" input to the preferred format. In the
1038 process we may have consumed the whole of the remaining
1039 file (and included files). We handle this formatted
1040 input similar to that of macro expansion, letting
1041 actual macro expansion (possibly nested) and other
1042 input expansion work. Beware that in messages, line
1043 numbers and possibly file names will be incorrect. */
1044 sb_add_string (&sbuf, new_buf);
1045 input_scrub_include_sb (&sbuf, input_line_pointer, 0);
1047 buffer_limit = input_scrub_next_buffer (&input_line_pointer);
1052 HANDLE_CONDITIONAL_ASSEMBLY ();
1054 #ifdef tc_unrecognized_line
1055 if (tc_unrecognized_line (c))
1058 input_line_pointer--;
1059 /* Report unknown char as ignored. */
1060 demand_empty_rest_of_line ();
1063 #ifdef md_after_pass_hook
1064 md_after_pass_hook ();
1073 /* Close the input file. */
1074 input_scrub_close ();
1075 #ifdef WARN_COMMENTS
1077 if (warn_comment && found_comment)
1078 as_warn_where (found_comment_file, found_comment,
1079 "first comment found here");
1084 /* Convert O_constant expression EXP into the equivalent O_big representation.
1085 Take the sign of the number from X_unsigned rather than X_add_number. */
1088 convert_to_bignum (expressionS *exp)
1093 value = exp->X_add_number;
1094 for (i = 0; i < sizeof (exp->X_add_number) / CHARS_PER_LITTLENUM; i++)
1096 generic_bignum[i] = value & LITTLENUM_MASK;
1097 value >>= LITTLENUM_NUMBER_OF_BITS;
1099 /* Add a sequence of sign bits if the top bit of X_add_number is not
1100 the sign of the original value. */
1101 if ((exp->X_add_number < 0) != !exp->X_unsigned)
1102 generic_bignum[i++] = exp->X_unsigned ? 0 : LITTLENUM_MASK;
1104 exp->X_add_number = i;
1107 /* For most MRI pseudo-ops, the line actually ends at the first
1108 nonquoted space. This function looks for that point, stuffs a null
1109 in, and sets *STOPCP to the character that used to be there, and
1110 returns the location.
1112 Until I hear otherwise, I am going to assume that this is only true
1113 for the m68k MRI assembler. */
1116 mri_comment_field (char *stopcp)
1122 know (flag_m68k_mri);
1124 for (s = input_line_pointer;
1125 ((!is_end_of_line[(unsigned char) *s] && *s != ' ' && *s != '\t')
1133 for (s = input_line_pointer;
1134 !is_end_of_line[(unsigned char) *s];
1144 /* Skip to the end of an MRI comment field. */
1147 mri_comment_end (char *stop, int stopc)
1151 input_line_pointer = stop;
1153 while (!is_end_of_line[(unsigned char) *input_line_pointer])
1154 ++input_line_pointer;
1158 s_abort (int ignore ATTRIBUTE_UNUSED)
1160 as_fatal (_(".abort detected. Abandoning ship."));
1163 /* Guts of .align directive. N is the power of two to which to align.
1164 FILL may be NULL, or it may point to the bytes of the fill pattern.
1165 LEN is the length of whatever FILL points to, if anything. MAX is
1166 the maximum number of characters to skip when doing the alignment,
1167 or 0 if there is no maximum. */
1170 do_align (int n, char *fill, int len, int max)
1172 if (now_seg == absolute_section)
1176 if (*fill++ != '\0')
1178 as_warn (_("ignoring fill value in absolute section"));
1185 #ifdef md_flush_pending_output
1186 md_flush_pending_output ();
1189 md_do_align (n, fill, len, max, just_record_alignment);
1192 /* Only make a frag if we HAVE to... */
1193 if (n != 0 && !need_pass_2)
1197 if (subseg_text_p (now_seg))
1198 frag_align_code (n, max);
1200 frag_align (n, 0, max);
1203 frag_align (n, *fill, max);
1205 frag_align_pattern (n, fill, len, max);
1209 just_record_alignment: ATTRIBUTE_UNUSED_LABEL
1212 record_alignment (now_seg, n - OCTETS_PER_BYTE_POWER);
1215 /* Handle the .align pseudo-op. A positive ARG is a default alignment
1216 (in bytes). A negative ARG is the negative of the length of the
1217 fill pattern. BYTES_P is non-zero if the alignment value should be
1218 interpreted as the byte boundary, rather than the power of 2. */
1220 #ifdef BFD_ASSEMBLER
1221 #define ALIGN_LIMIT (stdoutput->arch_info->bits_per_address - 1)
1223 #define ALIGN_LIMIT 15
1227 s_align (int arg, int bytes_p)
1229 unsigned int align_limit = ALIGN_LIMIT;
1238 stop = mri_comment_field (&stopc);
1240 if (is_end_of_line[(unsigned char) *input_line_pointer])
1245 align = arg; /* Default value from pseudo-op table. */
1249 align = get_absolute_expression ();
1255 /* Convert to a power of 2. */
1260 for (i = 0; (align & 1) == 0; align >>= 1, ++i)
1263 as_bad (_("alignment not a power of 2"));
1269 if (align > align_limit)
1271 align = align_limit;
1272 as_warn (_("alignment too large: %u assumed"), align);
1275 if (*input_line_pointer != ',')
1282 ++input_line_pointer;
1283 if (*input_line_pointer == ',')
1287 fill = get_absolute_expression ();
1292 if (*input_line_pointer != ',')
1296 ++input_line_pointer;
1297 max = get_absolute_expression ();
1304 as_warn (_("expected fill pattern missing"));
1305 do_align (align, (char *) NULL, 0, max);
1320 do_align (align, &fill_char, fill_len, max);
1326 if ((size_t) fill_len > sizeof ab)
1328 md_number_to_chars (ab, fill, fill_len);
1329 do_align (align, ab, fill_len, max);
1333 demand_empty_rest_of_line ();
1336 mri_comment_end (stop, stopc);
1339 /* Handle the .align pseudo-op on machines where ".align 4" means
1340 align to a 4 byte boundary. */
1343 s_align_bytes (int arg)
1348 /* Handle the .align pseudo-op on machines where ".align 4" means align
1349 to a 2**4 boundary. */
1352 s_align_ptwo (int arg)
1357 /* Switch in and out of alternate macro mode. */
1362 demand_empty_rest_of_line ();
1363 macro_set_alternate (on);
1367 s_comm_internal (int param,
1368 symbolS *(*comm_parse_extra) (int, symbolS *, addressT))
1374 symbolS *symbolP = NULL;
1380 stop = mri_comment_field (&stopc);
1382 name = input_line_pointer;
1383 c = get_symbol_end ();
1384 /* Just after name is now '\0'. */
1385 p = input_line_pointer;
1390 as_bad (_("expected symbol name"));
1391 discard_rest_of_line ();
1397 /* Accept an optional comma after the name. The comma used to be
1398 required, but Irix 5 cc does not generate it for .lcomm. */
1399 if (*input_line_pointer == ',')
1400 input_line_pointer++;
1402 temp = get_absolute_expr (&exp);
1404 #ifdef BFD_ASSEMBLER
1405 size &= ((offsetT) 2 << (stdoutput->arch_info->bits_per_address - 1)) - 1;
1407 if (exp.X_op == O_absent)
1409 as_bad (_("missing size expression"));
1410 ignore_rest_of_line ();
1413 else if (temp != size || !exp.X_unsigned)
1415 as_warn (_("size (%ld) out of range, ignored"), (long) temp);
1416 ignore_rest_of_line ();
1421 symbolP = symbol_find_or_make (name);
1422 if (S_IS_DEFINED (symbolP) && !S_IS_COMMON (symbolP))
1425 as_bad (_("symbol `%s' is already defined"), name);
1427 ignore_rest_of_line ();
1431 size = S_GET_VALUE (symbolP);
1434 else if (size != temp)
1435 as_warn (_("size of \"%s\" is already %ld; not changing to %ld"),
1436 name, (long) size, (long) temp);
1439 if (comm_parse_extra != NULL)
1440 symbolP = (*comm_parse_extra) (param, symbolP, size);
1443 S_SET_VALUE (symbolP, (valueT) size);
1444 S_SET_EXTERNAL (symbolP);
1447 extern int flag_one;
1448 if (size == 0 || !flag_one)
1449 S_GET_OTHER (symbolP) = const_flag;
1454 know (symbolP == NULL || symbolP->sy_frag == &zero_address_frag);
1455 demand_empty_rest_of_line ();
1458 mri_comment_end (stop, stopc);
1465 s_comm_internal (ignore, NULL);
1468 /* The MRI COMMON pseudo-op. We handle this by creating a common
1469 symbol with the appropriate name. We make s_space do the right
1470 thing by increasing the size. */
1473 s_mri_common (int small ATTRIBUTE_UNUSED)
1489 stop = mri_comment_field (&stopc);
1493 name = input_line_pointer;
1494 if (!ISDIGIT (*name))
1495 c = get_symbol_end ();
1500 ++input_line_pointer;
1502 while (ISDIGIT (*input_line_pointer));
1504 c = *input_line_pointer;
1505 *input_line_pointer = '\0';
1507 if (line_label != NULL)
1509 alc = (char *) xmalloc (strlen (S_GET_NAME (line_label))
1510 + (input_line_pointer - name)
1512 sprintf (alc, "%s%s", name, S_GET_NAME (line_label));
1517 sym = symbol_find_or_make (name);
1518 *input_line_pointer = c;
1522 if (*input_line_pointer != ',')
1526 ++input_line_pointer;
1527 align = get_absolute_expression ();
1530 if (S_IS_DEFINED (sym) && !S_IS_COMMON (sym))
1532 as_bad (_("symbol `%s' is already defined"), S_GET_NAME (sym));
1533 ignore_rest_of_line ();
1534 mri_comment_end (stop, stopc);
1538 S_SET_EXTERNAL (sym);
1539 mri_common_symbol = sym;
1543 S_SET_ALIGN (sym, align);
1546 if (line_label != NULL)
1549 exp.X_op = O_symbol;
1550 exp.X_add_symbol = sym;
1551 exp.X_add_number = 0;
1552 symbol_set_value_expression (line_label, &exp);
1553 symbol_set_frag (line_label, &zero_address_frag);
1554 S_SET_SEGMENT (line_label, expr_section);
1557 /* FIXME: We just ignore the small argument, which distinguishes
1558 COMMON and COMMON.S. I don't know what we can do about it. */
1560 /* Ignore the type and hptype. */
1561 if (*input_line_pointer == ',')
1562 input_line_pointer += 2;
1563 if (*input_line_pointer == ',')
1564 input_line_pointer += 2;
1566 demand_empty_rest_of_line ();
1568 mri_comment_end (stop, stopc);
1572 s_data (int ignore ATTRIBUTE_UNUSED)
1577 temp = get_absolute_expression ();
1578 if (flag_readonly_data_in_text)
1580 section = text_section;
1584 section = data_section;
1586 subseg_set (section, (subsegT) temp);
1591 demand_empty_rest_of_line ();
1594 /* Handle the .appfile pseudo-op. This is automatically generated by
1595 do_scrub_chars when a preprocessor # line comment is seen with a
1596 file name. This default definition may be overridden by the object
1597 or CPU specific pseudo-ops. This function is also the default
1598 definition for .file; the APPFILE argument is 1 for .appfile, 0 for
1602 s_app_file_string (char *file, int appfile)
1606 listing_source_file (file);
1608 register_dependency (file);
1610 obj_app_file (file, appfile);
1615 s_app_file (int appfile)
1620 /* Some assemblers tolerate immediately following '"'. */
1621 if ((s = demand_copy_string (&length)) != 0)
1623 /* If this is a fake .appfile, a fake newline was inserted into
1624 the buffer. Passing -2 to new_logical_line tells it to
1627 = (!new_logical_line (s, appfile ? -2 : -1) && appfile);
1629 /* In MRI mode, the preprocessor may have inserted an extraneous
1632 && *input_line_pointer == '\''
1633 && is_end_of_line[(unsigned char) input_line_pointer[1]])
1634 ++input_line_pointer;
1636 demand_empty_rest_of_line ();
1638 s_app_file_string (s, appfile);
1642 /* Handle the .appline pseudo-op. This is automatically generated by
1643 do_scrub_chars when a preprocessor # line comment is seen. This
1644 default definition may be overridden by the object or CPU specific
1648 s_app_line (int ignore ATTRIBUTE_UNUSED)
1652 /* The given number is that of the next line. */
1653 l = get_absolute_expression () - 1;
1655 /* Some of the back ends can't deal with non-positive line numbers.
1656 Besides, it's silly. */
1657 as_warn (_("line numbers must be positive; line number %d rejected"),
1661 new_logical_line ((char *) NULL, l);
1664 listing_source_line (l);
1667 demand_empty_rest_of_line ();
1670 /* Handle the .end pseudo-op. Actually, the real work is done in
1671 read_a_source_file. */
1674 s_end (int ignore ATTRIBUTE_UNUSED)
1678 /* The MRI assembler permits the start symbol to follow .end,
1679 but we don't support that. */
1681 if (!is_end_of_line[(unsigned char) *input_line_pointer]
1682 && *input_line_pointer != '*'
1683 && *input_line_pointer != '!')
1684 as_warn (_("start address not supported"));
1688 /* Handle the .err pseudo-op. */
1691 s_err (int ignore ATTRIBUTE_UNUSED)
1693 as_bad (_(".err encountered"));
1694 demand_empty_rest_of_line ();
1697 /* Handle the .error and .warning pseudo-ops. */
1703 /* The purpose for the conditional assignment is not to
1704 internationalize the directive itself, but that we need a
1705 self-contained message, one that can be passed like the
1706 demand_copy_C_string return value, and with no assumption on the
1707 location of the name of the directive within the message. */
1709 = (err ? _(".error directive invoked in source file")
1710 : _(".warning directive invoked in source file"));
1712 if (!is_it_end_of_statement ())
1714 if (*input_line_pointer != '\"')
1716 as_bad (_("%s argument must be a string"),
1717 err ? ".error" : ".warning");
1718 discard_rest_of_line ();
1722 msg = demand_copy_C_string (&len);
1730 as_warn ("%s", msg);
1731 demand_empty_rest_of_line ();
1734 /* Handle the MRI fail pseudo-op. */
1737 s_fail (int ignore ATTRIBUTE_UNUSED)
1744 stop = mri_comment_field (&stopc);
1746 temp = get_absolute_expression ();
1748 as_warn (_(".fail %ld encountered"), (long) temp);
1750 as_bad (_(".fail %ld encountered"), (long) temp);
1752 demand_empty_rest_of_line ();
1755 mri_comment_end (stop, stopc);
1759 s_fill (int ignore ATTRIBUTE_UNUSED)
1761 expressionS rep_exp;
1763 register long fill = 0;
1766 #ifdef md_flush_pending_output
1767 md_flush_pending_output ();
1770 get_known_segmented_expression (&rep_exp);
1771 if (*input_line_pointer == ',')
1773 input_line_pointer++;
1774 size = get_absolute_expression ();
1775 if (*input_line_pointer == ',')
1777 input_line_pointer++;
1778 fill = get_absolute_expression ();
1782 /* This is to be compatible with BSD 4.2 AS, not for any rational reason. */
1783 #define BSD_FILL_SIZE_CROCK_8 (8)
1784 if (size > BSD_FILL_SIZE_CROCK_8)
1786 as_warn (_(".fill size clamped to %d"), BSD_FILL_SIZE_CROCK_8);
1787 size = BSD_FILL_SIZE_CROCK_8;
1791 as_warn (_("size negative; .fill ignored"));
1794 else if (rep_exp.X_op == O_constant && rep_exp.X_add_number <= 0)
1796 if (rep_exp.X_add_number < 0)
1797 as_warn (_("repeat < 0; .fill ignored"));
1801 if (size && !need_pass_2)
1803 if (rep_exp.X_op == O_constant)
1805 p = frag_var (rs_fill, (int) size, (int) size,
1806 (relax_substateT) 0, (symbolS *) 0,
1807 (offsetT) rep_exp.X_add_number,
1812 /* We don't have a constant repeat count, so we can't use
1813 rs_fill. We can get the same results out of rs_space,
1814 but its argument is in bytes, so we must multiply the
1815 repeat count by size. */
1818 rep_sym = make_expr_symbol (&rep_exp);
1821 expressionS size_exp;
1822 size_exp.X_op = O_constant;
1823 size_exp.X_add_number = size;
1825 rep_exp.X_op = O_multiply;
1826 rep_exp.X_add_symbol = rep_sym;
1827 rep_exp.X_op_symbol = make_expr_symbol (&size_exp);
1828 rep_exp.X_add_number = 0;
1829 rep_sym = make_expr_symbol (&rep_exp);
1832 p = frag_var (rs_space, (int) size, (int) size,
1833 (relax_substateT) 0, rep_sym, (offsetT) 0, (char *) 0);
1836 memset (p, 0, (unsigned int) size);
1838 /* The magic number BSD_FILL_SIZE_CROCK_4 is from BSD 4.2 VAX
1839 flavoured AS. The following bizarre behaviour is to be
1840 compatible with above. I guess they tried to take up to 8
1841 bytes from a 4-byte expression and they forgot to sign
1843 #define BSD_FILL_SIZE_CROCK_4 (4)
1844 md_number_to_chars (p, (valueT) fill,
1845 (size > BSD_FILL_SIZE_CROCK_4
1846 ? BSD_FILL_SIZE_CROCK_4
1848 /* Note: .fill (),0 emits no frag (since we are asked to .fill 0 bytes)
1849 but emits no error message because it seems a legal thing to do.
1850 It is a degenerate case of .fill but could be emitted by a
1853 demand_empty_rest_of_line ();
1857 s_globl (int ignore ATTRIBUTE_UNUSED)
1866 stop = mri_comment_field (&stopc);
1870 name = input_line_pointer;
1871 c = get_symbol_end ();
1872 symbolP = symbol_find_or_make (name);
1873 S_SET_EXTERNAL (symbolP);
1875 *input_line_pointer = c;
1877 c = *input_line_pointer;
1880 input_line_pointer++;
1882 if (is_end_of_line[(unsigned char) *input_line_pointer])
1888 demand_empty_rest_of_line ();
1891 mri_comment_end (stop, stopc);
1894 /* Handle the MRI IRP and IRPC pseudo-ops. */
1905 as_where (&file, &line);
1908 while (!is_end_of_line[(unsigned char) *input_line_pointer])
1909 sb_add_char (&s, *input_line_pointer++);
1913 err = expand_irp (irpc, 0, &s, &out, get_line_sb);
1915 as_bad_where (file, line, "%s", err);
1919 input_scrub_include_sb (&out, input_line_pointer, 1);
1921 buffer_limit = input_scrub_next_buffer (&input_line_pointer);
1924 /* Handle the .linkonce pseudo-op. This tells the assembler to mark
1925 the section to only be linked once. However, this is not supported
1926 by most object file formats. This takes an optional argument,
1927 which is what to do about duplicates. */
1930 s_linkonce (int ignore ATTRIBUTE_UNUSED)
1932 enum linkonce_type type;
1936 type = LINKONCE_DISCARD;
1938 if (!is_end_of_line[(unsigned char) *input_line_pointer])
1943 s = input_line_pointer;
1944 c = get_symbol_end ();
1945 if (strcasecmp (s, "discard") == 0)
1946 type = LINKONCE_DISCARD;
1947 else if (strcasecmp (s, "one_only") == 0)
1948 type = LINKONCE_ONE_ONLY;
1949 else if (strcasecmp (s, "same_size") == 0)
1950 type = LINKONCE_SAME_SIZE;
1951 else if (strcasecmp (s, "same_contents") == 0)
1952 type = LINKONCE_SAME_CONTENTS;
1954 as_warn (_("unrecognized .linkonce type `%s'"), s);
1956 *input_line_pointer = c;
1959 #ifdef obj_handle_link_once
1960 obj_handle_link_once (type);
1961 #else /* ! defined (obj_handle_link_once) */
1962 #ifdef BFD_ASSEMBLER
1966 if ((bfd_applicable_section_flags (stdoutput) & SEC_LINK_ONCE) == 0)
1967 as_warn (_(".linkonce is not supported for this object file format"));
1969 flags = bfd_get_section_flags (stdoutput, now_seg);
1970 flags |= SEC_LINK_ONCE;
1975 case LINKONCE_DISCARD:
1976 flags |= SEC_LINK_DUPLICATES_DISCARD;
1978 case LINKONCE_ONE_ONLY:
1979 flags |= SEC_LINK_DUPLICATES_ONE_ONLY;
1981 case LINKONCE_SAME_SIZE:
1982 flags |= SEC_LINK_DUPLICATES_SAME_SIZE;
1984 case LINKONCE_SAME_CONTENTS:
1985 flags |= SEC_LINK_DUPLICATES_SAME_CONTENTS;
1988 if (!bfd_set_section_flags (stdoutput, now_seg, flags))
1989 as_bad (_("bfd_set_section_flags: %s"),
1990 bfd_errmsg (bfd_get_error ()));
1992 #else /* ! defined (BFD_ASSEMBLER) */
1993 as_warn (_(".linkonce is not supported for this object file format"));
1994 #endif /* ! defined (BFD_ASSEMBLER) */
1995 #endif /* ! defined (obj_handle_link_once) */
1997 demand_empty_rest_of_line ();
2001 bss_alloc (symbolS *symbolP, addressT size, int align)
2004 segT current_seg = now_seg;
2005 subsegT current_subseg = now_subseg;
2006 segT bss_seg = bss_section;
2008 #if defined (TC_MIPS) || defined (TC_ALPHA)
2009 if (OUTPUT_FLAVOR == bfd_target_ecoff_flavour
2010 || OUTPUT_FLAVOR == bfd_target_elf_flavour)
2012 /* For MIPS and Alpha ECOFF or ELF, small objects are put in .sbss. */
2013 if (size <= bfd_get_gp_size (stdoutput))
2015 bss_seg = subseg_new (".sbss", 1);
2016 seg_info (bss_seg)->bss = 1;
2017 #ifdef BFD_ASSEMBLER
2018 if (!bfd_set_section_flags (stdoutput, bss_seg, SEC_ALLOC))
2019 as_warn (_("error setting flags for \".sbss\": %s"),
2020 bfd_errmsg (bfd_get_error ()));
2025 subseg_set (bss_seg, 1);
2029 record_alignment (bss_seg, align);
2030 frag_align (align, 0, 0);
2033 /* Detach from old frag. */
2034 if (S_GET_SEGMENT (symbolP) == bss_seg)
2035 symbol_get_frag (symbolP)->fr_symbol = NULL;
2037 symbol_set_frag (symbolP, frag_now);
2038 pfrag = frag_var (rs_org, 1, 1, 0, symbolP, size, NULL);
2042 S_SET_SIZE (symbolP, size);
2044 S_SET_SEGMENT (symbolP, bss_seg);
2047 /* The symbol may already have been created with a preceding
2048 ".globl" directive -- be careful not to step on storage class
2049 in that case. Otherwise, set it to static. */
2050 if (S_GET_STORAGE_CLASS (symbolP) != C_EXT)
2051 S_SET_STORAGE_CLASS (symbolP, C_STAT);
2052 #endif /* OBJ_COFF */
2054 subseg_set (current_seg, current_subseg);
2058 parse_align (int align_bytes)
2064 if (*input_line_pointer != ',')
2067 as_bad (_("expected alignment after size"));
2068 ignore_rest_of_line ();
2072 input_line_pointer++;
2075 align = get_absolute_expr (&exp);
2076 if (exp.X_op == O_absent)
2079 if (!exp.X_unsigned)
2081 as_warn (_("alignment negative; 0 assumed"));
2085 if (align_bytes && align != 0)
2087 /* convert to a power of 2 alignment */
2088 unsigned int alignp2 = 0;
2089 while ((align & 1) == 0)
2090 align >>= 1, ++alignp2;
2093 as_bad (_("alignment not a power of 2"));
2094 ignore_rest_of_line ();
2102 /* Called from s_comm_internal after symbol name and size have been
2103 parsed. NEEDS_ALIGN is 0 if it was an ".lcomm" (2 args only),
2104 1 if this was a ".bss" directive which has a 3rd argument
2105 (alignment as a power of 2), or 2 if this was a ".bss" directive
2106 with alignment in bytes. */
2109 s_lcomm_internal (int needs_align, symbolS *symbolP, addressT size)
2115 align = parse_align (needs_align - 1);
2116 if (align == (addressT) -1)
2120 /* Assume some objects may require alignment on some systems. */
2121 TC_IMPLICIT_LCOMM_ALIGNMENT (size, align);
2123 bss_alloc (symbolP, size, align);
2128 s_lcomm (int needs_align)
2130 s_comm_internal (needs_align, s_lcomm_internal);
2134 s_lcomm_bytes (int needs_align)
2136 s_comm_internal (needs_align * 2, s_lcomm_internal);
2140 s_lsym (int ignore ATTRIBUTE_UNUSED)
2142 register char *name;
2146 register symbolS *symbolP;
2148 /* We permit ANY defined expression: BSD4.2 demands constants. */
2149 name = input_line_pointer;
2150 c = get_symbol_end ();
2151 p = input_line_pointer;
2156 as_bad (_("expected symbol name"));
2157 discard_rest_of_line ();
2163 if (*input_line_pointer != ',')
2166 as_bad (_("expected comma after \"%s\""), name);
2168 ignore_rest_of_line ();
2172 input_line_pointer++;
2175 if (exp.X_op != O_constant
2176 && exp.X_op != O_register)
2178 as_bad (_("bad expression"));
2179 ignore_rest_of_line ();
2184 symbolP = symbol_find_or_make (name);
2186 /* FIXME-SOON I pulled a (&& symbolP->sy_other == 0 &&
2187 symbolP->sy_desc == 0) out of this test because coff doesn't have
2188 those fields, and I can't see when they'd ever be tripped. I
2189 don't think I understand why they were here so I may have
2190 introduced a bug. As recently as 1.37 didn't have this test
2191 anyway. xoxorich. */
2193 if (S_GET_SEGMENT (symbolP) == undefined_section
2194 && S_GET_VALUE (symbolP) == 0)
2196 /* The name might be an undefined .global symbol; be sure to
2197 keep the "external" bit. */
2198 S_SET_SEGMENT (symbolP,
2199 (exp.X_op == O_constant
2202 S_SET_VALUE (symbolP, (valueT) exp.X_add_number);
2206 as_bad (_("symbol `%s' is already defined"), name);
2210 demand_empty_rest_of_line ();
2213 /* Read a line into an sb. Returns the character that ended the line
2214 or zero if there are no more lines. */
2217 get_line_sb (sb *line)
2219 char quote1, quote2, inquote;
2222 if (input_line_pointer[-1] == '\n')
2223 bump_line_counters ();
2225 if (input_line_pointer >= buffer_limit)
2227 buffer_limit = input_scrub_next_buffer (&input_line_pointer);
2228 if (buffer_limit == 0)
2232 /* If app.c sets any other characters to LEX_IS_STRINGQUOTE, this
2233 code needs to be changed. */
2242 #ifdef LEX_IS_STRINGQUOTE
2248 while ((c = * input_line_pointer ++) != 0
2249 && (!is_end_of_line[c]
2250 || (inquote != '\0' && c != '\n')))
2254 else if (inquote == '\0')
2258 else if (c == quote2)
2262 sb_add_char (line, c);
2265 /* Don't skip multiple end-of-line characters, because that breaks support
2266 for the IA-64 stop bit (;;) which looks like two consecutive end-of-line
2267 characters but isn't. Instead just skip one end of line character and
2268 return the character skipped so that the caller can re-insert it if
2273 /* Define a macro. This is an interface to macro.c. */
2276 s_macro (int ignore ATTRIBUTE_UNUSED)
2285 as_where (&file, &line);
2288 while (!is_end_of_line[(unsigned char) *input_line_pointer])
2289 sb_add_char (&s, *input_line_pointer++);
2292 if (line_label != NULL)
2293 sb_add_string (&label, S_GET_NAME (line_label));
2295 err = define_macro (0, &s, &label, get_line_sb, &name);
2297 as_bad_where (file, line, "%s", err);
2300 if (line_label != NULL)
2302 S_SET_SEGMENT (line_label, undefined_section);
2303 S_SET_VALUE (line_label, 0);
2304 symbol_set_frag (line_label, &zero_address_frag);
2307 if (((NO_PSEUDO_DOT || flag_m68k_mri)
2308 && hash_find (po_hash, name) != NULL)
2311 && hash_find (po_hash, name + 1) != NULL))
2312 as_warn (_("attempt to redefine pseudo-op `%s' ignored"),
2319 /* Handle the .mexit pseudo-op, which immediately exits a macro
2323 s_mexit (int ignore ATTRIBUTE_UNUSED)
2325 cond_exit_macro (macro_nest);
2326 buffer_limit = input_scrub_next_buffer (&input_line_pointer);
2329 /* Switch in and out of MRI mode. */
2332 s_mri (int ignore ATTRIBUTE_UNUSED)
2336 on = get_absolute_expression ();
2337 old_flag = flag_mri;
2355 /* Operator precedence changes in m68k MRI mode, so we need to
2356 update the operator rankings. */
2357 expr_set_precedence ();
2359 #ifdef MRI_MODE_CHANGE
2361 MRI_MODE_CHANGE (on);
2364 demand_empty_rest_of_line ();
2367 /* Handle changing the location counter. */
2370 do_org (segT segment, expressionS *exp, int fill)
2372 if (segment != now_seg && segment != absolute_section)
2373 as_bad (_("invalid segment \"%s\""), segment_name (segment));
2375 if (now_seg == absolute_section)
2378 as_warn (_("ignoring fill value in absolute section"));
2379 if (exp->X_op != O_constant)
2381 as_bad (_("only constant offsets supported in absolute section"));
2382 exp->X_add_number = 0;
2384 abs_section_offset = exp->X_add_number;
2389 symbolS *sym = exp->X_add_symbol;
2390 offsetT off = exp->X_add_number * OCTETS_PER_BYTE;
2392 if (exp->X_op != O_constant && exp->X_op != O_symbol)
2394 /* Handle complex expressions. */
2395 sym = make_expr_symbol (exp);
2399 p = frag_var (rs_org, 1, 1, (relax_substateT) 0, sym, off, (char *) 0);
2405 s_org (int ignore ATTRIBUTE_UNUSED)
2407 register segT segment;
2409 register long temp_fill;
2411 #ifdef md_flush_pending_output
2412 md_flush_pending_output ();
2415 /* The m68k MRI assembler has a different meaning for .org. It
2416 means to create an absolute section at a given address. We can't
2417 support that--use a linker script instead. */
2420 as_bad (_("MRI style ORG pseudo-op not supported"));
2421 ignore_rest_of_line ();
2425 /* Don't believe the documentation of BSD 4.2 AS. There is no such
2426 thing as a sub-segment-relative origin. Any absolute origin is
2427 given a warning, then assumed to be segment-relative. Any
2428 segmented origin expression ("foo+42") had better be in the right
2429 segment or the .org is ignored.
2431 BSD 4.2 AS warns if you try to .org backwards. We cannot because
2432 we never know sub-segment sizes when we are reading code. BSD
2433 will crash trying to emit negative numbers of filler bytes in
2434 certain .orgs. We don't crash, but see as-write for that code.
2436 Don't make frag if need_pass_2==1. */
2437 segment = get_known_segmented_expression (&exp);
2438 if (*input_line_pointer == ',')
2440 input_line_pointer++;
2441 temp_fill = get_absolute_expression ();
2447 do_org (segment, &exp, temp_fill);
2449 demand_empty_rest_of_line ();
2452 /* Handle parsing for the MRI SECT/SECTION pseudo-op. This should be
2453 called by the obj-format routine which handles section changing
2454 when in MRI mode. It will create a new section, and return it. It
2455 will set *TYPE to the section type: one of 'C' (code), 'D' (data),
2456 'M' (mixed), or 'R' (romable). If BFD_ASSEMBLER is defined, the
2457 flags will be set in the section. */
2460 s_mri_sect (char *type ATTRIBUTE_UNUSED)
2470 name = input_line_pointer;
2471 if (!ISDIGIT (*name))
2472 c = get_symbol_end ();
2477 ++input_line_pointer;
2479 while (ISDIGIT (*input_line_pointer));
2481 c = *input_line_pointer;
2482 *input_line_pointer = '\0';
2485 name = xstrdup (name);
2487 *input_line_pointer = c;
2489 seg = subseg_new (name, 0);
2491 if (*input_line_pointer == ',')
2495 ++input_line_pointer;
2496 align = get_absolute_expression ();
2497 record_alignment (seg, align);
2501 if (*input_line_pointer == ',')
2503 c = *++input_line_pointer;
2505 if (c == 'C' || c == 'D' || c == 'M' || c == 'R')
2508 as_bad (_("unrecognized section type"));
2509 ++input_line_pointer;
2511 #ifdef BFD_ASSEMBLER
2515 flags = SEC_NO_FLAGS;
2517 flags = SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_CODE;
2518 else if (*type == 'D' || *type == 'M')
2519 flags = SEC_ALLOC | SEC_LOAD | SEC_DATA;
2520 else if (*type == 'R')
2521 flags = SEC_ALLOC | SEC_LOAD | SEC_DATA | SEC_READONLY | SEC_ROM;
2522 if (flags != SEC_NO_FLAGS)
2524 if (!bfd_set_section_flags (stdoutput, seg, flags))
2525 as_warn (_("error setting flags for \"%s\": %s"),
2526 bfd_section_name (stdoutput, seg),
2527 bfd_errmsg (bfd_get_error ()));
2533 /* Ignore the HP type. */
2534 if (*input_line_pointer == ',')
2535 input_line_pointer += 2;
2537 demand_empty_rest_of_line ();
2539 #else /* ! TC_M68K */
2548 name = input_line_pointer;
2549 c = get_symbol_end ();
2551 name = xstrdup (name);
2553 *input_line_pointer = c;
2555 seg = subseg_new (name, 0);
2557 if (*input_line_pointer != ',')
2563 ++input_line_pointer;
2565 sectype = input_line_pointer;
2566 c = get_symbol_end ();
2567 if (*sectype == '\0')
2569 else if (strcasecmp (sectype, "text") == 0)
2571 else if (strcasecmp (sectype, "data") == 0)
2573 else if (strcasecmp (sectype, "romdata") == 0)
2576 as_warn (_("unrecognized section type `%s'"), sectype);
2577 *input_line_pointer = c;
2580 if (*input_line_pointer == ',')
2584 ++input_line_pointer;
2586 seccmd = input_line_pointer;
2587 c = get_symbol_end ();
2588 if (strcasecmp (seccmd, "absolute") == 0)
2590 as_bad (_("absolute sections are not supported"));
2591 *input_line_pointer = c;
2592 ignore_rest_of_line ();
2595 else if (strcasecmp (seccmd, "align") == 0)
2599 *input_line_pointer = c;
2600 align = get_absolute_expression ();
2601 record_alignment (seg, align);
2605 as_warn (_("unrecognized section command `%s'"), seccmd);
2606 *input_line_pointer = c;
2610 demand_empty_rest_of_line ();
2612 #else /* ! TC_I960 */
2613 /* The MRI assembler seems to use different forms of .sect for
2614 different targets. */
2615 as_bad ("MRI mode not supported for this target");
2616 ignore_rest_of_line ();
2617 #endif /* ! TC_I960 */
2618 #endif /* ! TC_M68K */
2621 /* Handle the .print pseudo-op. */
2624 s_print (int ignore ATTRIBUTE_UNUSED)
2629 s = demand_copy_C_string (&len);
2632 demand_empty_rest_of_line ();
2635 /* Handle the .purgem pseudo-op. */
2638 s_purgem (int ignore ATTRIBUTE_UNUSED)
2640 if (is_it_end_of_statement ())
2642 demand_empty_rest_of_line ();
2652 name = input_line_pointer;
2653 c = get_symbol_end ();
2654 delete_macro (name);
2655 *input_line_pointer = c;
2658 while (*input_line_pointer++ == ',');
2660 --input_line_pointer;
2661 demand_empty_rest_of_line ();
2664 /* Handle the .endm/.endr pseudo-ops. */
2667 s_bad_end (int endr)
2669 as_warn (_(".end%c encountered without preceeding %s"),
2671 endr ? ".rept, .irp, or .irpc" : ".macro");
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);