1 /* read.c - read a source file -
2 Copyright (C) 1986-2024 Free Software Foundation, Inc.
4 This file is part of GAS, the GNU Assembler.
6 GAS is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3, or (at your option)
11 GAS is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GAS; see the file COPYING. If not, write to the Free
18 Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
21 /* If your chars aren't 8 bits, you will change this a bit (eg. to 0xFF).
22 But then, GNU isn't supposed to run on your machine anyway.
23 (RMS is so shortsighted sometimes.) */
24 #define MASK_CHAR ((int)(unsigned char) -1)
26 /* This is the largest known floating point format (for now). It will
27 grow when we do 4361 style flonums. */
28 #define MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT (16)
30 /* Routines that read assembler source text to build spaghetti in memory.
31 Another group of these functions is in the expr.c module. */
34 #include "safe-ctype.h"
40 #include "dw2gencfi.h"
41 #include "scfidw2gen.h"
44 #include "filenames.h"
49 #ifndef TC_START_LABEL
50 #define TC_START_LABEL(STR, NUL_CHAR, NEXT_CHAR) (NEXT_CHAR == ':')
53 /* Set by the object-format or the target. */
54 #ifndef TC_IMPLICIT_LCOMM_ALIGNMENT
55 #define TC_IMPLICIT_LCOMM_ALIGNMENT(SIZE, P2VAR) \
60 else if ((SIZE) >= 4) \
62 else if ((SIZE) >= 2) \
70 char *input_line_pointer
; /*->next char of source file to parse. */
71 bool input_from_string
= false;
73 #if BITS_PER_CHAR != 8
74 /* The following table is indexed by[(char)] and will break if
75 a char does not have exactly 256 states (hopefully 0:255!)! */
84 /* The RS/6000 assembler uses {,},[,] as parts of symbol names. */
89 /* The Delta 68k assembler permits % inside label names. */
94 /* The PowerPC Windows NT assemblers permits ? inside label names. */
99 /* The IA-64 assembler uses # as a suffix designating a symbol. We include
100 it in the symbol and strip it out in tc_canonicalize_symbol_name. */
109 /* The Delta 68k assembler permits ~ at start of label names. */
113 /* Used by is_... macros. our ctype[]. */
114 char lex_type
[256] = {
115 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* @ABCDEFGHIJKLMNO */
116 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* PQRSTUVWXYZ[\]^_ */
117 0, 0, 0, LEX_HASH
, LEX_DOLLAR
, LEX_PCT
, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, /* _!"#$%&'()*+,-./ */
118 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, LEX_QM
, /* 0123456789:;<=>? */
119 LEX_AT
, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* @ABCDEFGHIJKLMNO */
120 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, LEX_BR
, 0, LEX_BR
, 0, 3, /* PQRSTUVWXYZ[\]^_ */
121 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* `abcdefghijklmno */
122 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, LEX_BR
, 0, LEX_BR
, LEX_TILDE
, 0, /* pqrstuvwxyz{|}~. */
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,
128 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
129 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
130 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3
134 Out: 1 if this character ends a line.
135 2 if this character is a line separator. */
136 char is_end_of_line
[256] = {
138 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, /* @abcdefghijklmno */
140 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, /* @abcdefghijklmno */
142 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
143 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* _!"#$%&'()*+,-./ */
144 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0123456789:;<=>? */
145 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
146 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
147 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
148 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
149 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
150 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
151 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
152 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
153 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
154 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
155 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
156 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /* */
159 #ifndef TC_CASE_SENSITIVE
160 char original_case_string
[128];
163 /* Functions private to this file. */
165 static char *buffer
; /* 1st char of each buffer of lines is here. */
166 static char *buffer_limit
; /*->1 + last char in buffer. */
168 /* TARGET_BYTES_BIG_ENDIAN is required to be defined to either 0 or 1
169 in the tc-<CPU>.h file. See the "Porting GAS" section of the
171 int target_big_endian
= TARGET_BYTES_BIG_ENDIAN
;
173 /* Variables for handling include file directory table. */
175 /* Table of pointers to directories to search for .include's. */
176 const char **include_dirs
;
178 /* How many are in the table. */
179 size_t include_dir_count
;
181 /* Length of longest in table. */
182 size_t include_dir_maxlen
;
184 #ifndef WORKING_DOT_WORD
185 struct broken_word
*broken_words
;
186 int new_broken_words
;
189 /* The current offset into the absolute section. We don't try to
190 build frags in the absolute section, since no data can be stored
191 there. We just keep track of the current offset. */
192 addressT abs_section_offset
;
194 /* If this line had an MRI style label, it is stored in this variable.
195 This is used by some of the MRI pseudo-ops. */
198 /* This global variable is used to support MRI common sections. We
199 translate such sections into a common symbol. This variable is
200 non-NULL when we are in an MRI common section. */
201 symbolS
*mri_common_symbol
;
203 /* In MRI mode, after a dc.b pseudo-op with an odd number of bytes, we
204 need to align to an even byte boundary unless the next pseudo-op is
205 dc.b, ds.b, or dcb.b. This variable is set to 1 if an alignment
207 static int mri_pending_align
;
209 /* Record the current function so that we can issue an error message for
210 misplaced .func,.endfunc, and also so that .endfunc needs no
212 static char *current_name
;
213 static char *current_label
;
217 static int dwarf_file
;
218 static int dwarf_line
;
220 /* This variable is set to be non-zero if the next string we see might
221 be the name of the source file in DWARF debugging information. See
222 the comment in emit_expr for the format we look for. */
223 static int dwarf_file_string
;
227 /* If the target defines the md_frag_max_var hook then we know
228 enough to implement the .bundle_align_mode features. */
229 #ifdef md_frag_max_var
230 # define HANDLE_BUNDLE
234 /* .bundle_align_mode sets this. Normally it's zero. When nonzero,
235 it's the exponent of the bundle size, and aligned instruction bundle
236 mode is in effect. */
237 static unsigned int bundle_align_p2
;
239 /* These are set by .bundle_lock and .bundle_unlock. .bundle_lock sets
240 bundle_lock_frag to frag_now and then starts a new frag with
241 frag_align_code. At the same time, bundle_lock_frain gets frchain_now,
242 so that .bundle_unlock can verify that we didn't change segments.
243 .bundle_unlock resets both to NULL. If we detect a bundling violation,
244 then we reset bundle_lock_frchain to NULL as an indicator that we've
245 already diagnosed the error with as_bad and don't need a cascade of
246 redundant errors, but bundle_lock_frag remains set to indicate that
247 we are expecting to see .bundle_unlock. */
248 static fragS
*bundle_lock_frag
;
249 static frchainS
*bundle_lock_frchain
;
251 /* This is incremented by .bundle_lock and decremented by .bundle_unlock,
253 static unsigned int bundle_lock_depth
;
256 static void do_s_func (int end_p
, const char *default_prefix
);
257 static void s_align (int, int);
258 static void s_altmacro (int);
259 static void s_bad_end (int);
260 static void s_reloc (int);
261 static int hex_float (int, char *);
262 static segT
get_known_segmented_expression (expressionS
* expP
);
263 static void pobegin (void);
264 static void poend (void);
265 static size_t get_macro_line_sb (sb
*);
266 static void generate_file_debug (void);
267 static char *_find_end_of_line (char *, int, int, int);
275 obj_read_begin_hook ();
277 obstack_begin (&cond_obstack
, chunksize
);
279 #ifndef tc_line_separator_chars
280 #define tc_line_separator_chars line_separator_chars
282 /* Use machine dependent syntax. */
283 for (p
= tc_line_separator_chars
; *p
; p
++)
284 is_end_of_line
[(unsigned char) *p
] = 2;
285 /* Use more. FIXME-SOMEDAY. */
288 lex_type
['?'] = LEX_BEGIN_NAME
| LEX_NAME
;
292 #ifndef WORKING_DOT_WORD
294 new_broken_words
= 0;
297 abs_section_offset
= 0;
300 mri_common_symbol
= NULL
;
301 mri_pending_align
= 0;
304 current_label
= NULL
;
310 dwarf_file_string
= 0;
316 bundle_lock_frag
= NULL
;
317 bundle_lock_frchain
= NULL
;
318 bundle_lock_depth
= 0;
327 _obstack_free (&cond_obstack
, NULL
);
329 free (current_label
);
332 #ifndef TC_ADDRESS_BYTES
333 #define TC_ADDRESS_BYTES address_bytes
338 /* Choose smallest of 1, 2, 4, 8 bytes that is large enough to
339 contain an address. */
340 int n
= (stdoutput
->arch_info
->bits_per_address
- 1) / 8;
348 /* Set up pseudo-op tables. */
350 static htab_t po_hash
;
352 static const pseudo_typeS potable
[] = {
353 {"abort", s_abort
, 0},
354 {"align", s_align_ptwo
, 0},
355 {"altmacro", s_altmacro
, 1},
356 {"ascii", stringer
, 8+0},
357 {"asciz", stringer
, 8+1},
358 {"balign", s_align_bytes
, 0},
359 {"balignw", s_align_bytes
, -2},
360 {"balignl", s_align_bytes
, -4},
361 {"base64", s_base64
, 0},
364 {"bundle_align_mode", s_bundle_align_mode
, 0},
365 {"bundle_lock", s_bundle_lock
, 0},
366 {"bundle_unlock", s_bundle_unlock
, 0},
370 {"common", s_mri_common
, 0},
371 {"common.s", s_mri_common
, 1},
376 {"dc.d", float_cons
, 'd'},
378 {"dc.s", float_cons
, 'f'},
380 {"dc.x", float_cons
, 'x'},
382 {"dcb.b", s_space
, 1},
383 {"dcb.d", s_float_space
, 'd'},
384 {"dcb.l", s_space
, 4},
385 {"dcb.s", s_float_space
, 'f'},
386 {"dcb.w", s_space
, 2},
387 {"dcb.x", s_float_space
, 'x'},
389 {"ds.b", s_space
, 1},
390 {"ds.d", s_space
, 8},
391 {"ds.l", s_space
, 4},
392 {"ds.p", s_space
, 'p'},
393 {"ds.s", s_space
, 4},
394 {"ds.w", s_space
, 2},
395 {"ds.x", s_space
, 'x'},
396 {"debug", s_ignore
, 0},
401 {"double", float_cons
, 'd'},
403 {"eject", listing_eject
, 0}, /* Formfeed listing. */
405 {"elsec", s_else
, 0},
406 {"elseif", s_elseif
, (int) O_ne
},
408 {"endc", s_endif
, 0},
409 {"endfunc", s_func
, 1},
410 {"endif", s_endif
, 0},
411 {"endm", s_bad_end
, 0},
412 {"endr", s_bad_end
, 1},
418 {"error", s_errwarn
, 1},
419 {"exitm", s_mexit
, 0},
421 {"extern", s_ignore
, 0}, /* We treat all undef as ext. */
425 {"float", float_cons
, 'f'},
426 {"format", s_ignore
, 0},
428 {"global", s_globl
, 0},
429 {"globl", s_globl
, 0},
431 {"if", s_if
, (int) O_ne
},
434 {"ifdef", s_ifdef
, 0},
435 {"ifeq", s_if
, (int) O_eq
},
436 {"ifeqs", s_ifeqs
, 0},
437 {"ifge", s_if
, (int) O_ge
},
438 {"ifgt", s_if
, (int) O_gt
},
439 {"ifle", s_if
, (int) O_le
},
440 {"iflt", s_if
, (int) O_lt
},
443 {"ifndef", s_ifdef
, 1},
444 {"ifne", s_if
, (int) O_ne
},
445 {"ifnes", s_ifeqs
, 1},
446 {"ifnotdef", s_ifdef
, 1},
447 {"incbin", s_incbin
, 0},
448 {"include", s_include
, 0},
454 {"lcomm", s_lcomm
, 0},
455 {"lflags", s_ignore
, 0}, /* Listing flags. */
456 {"linefile", s_linefile
, 0},
457 {"linkonce", s_linkonce
, 0},
458 {"list", listing_list
, 1}, /* Turn listing on. */
459 {"llen", listing_psize
, 1},
462 {"macro", s_macro
, 0},
463 {"mexit", s_mexit
, 0},
465 {".mri", s_mri
, 0}, /* Special case so .mri works in MRI mode. */
466 {"name", s_ignore
, 0},
467 {"noaltmacro", s_altmacro
, 0},
468 {"noformat", s_ignore
, 0},
469 {"nolist", listing_list
, 0}, /* Turn listing off. */
470 {"nopage", listing_nopage
, 0},
474 {"offset", s_struct
, 0},
476 {"p2align", s_align_ptwo
, 0},
477 {"p2alignw", s_align_ptwo
, -2},
478 {"p2alignl", s_align_ptwo
, -4},
479 {"page", listing_eject
, 0},
480 {"plen", listing_psize
, 0},
481 {"print", s_print
, 0},
482 {"psize", listing_psize
, 0}, /* Set paper size. */
483 {"purgem", s_purgem
, 0},
485 {"reloc", s_reloc
, 0},
489 {"sbttl", listing_title
, 1}, /* Subtitle of listing. */
494 {"single", float_cons
, 'f'},
496 {"space", s_space
, 0},
497 {"skip", s_space
, 0},
498 {"sleb128", s_leb128
, 1},
499 {"spc", s_ignore
, 0},
500 {"stabd", s_stab
, 'd'},
501 {"stabn", s_stab
, 'n'},
502 {"stabs", s_stab
, 's'},
503 {"string", stringer
, 8+1},
504 {"string8", stringer
, 8+1},
505 {"string16", stringer
, 16+1},
506 {"string32", stringer
, 32+1},
507 {"string64", stringer
, 64+1},
508 {"struct", s_struct
, 0},
512 /* This is for gcc to use. It's only just been added (2/94), so gcc
513 won't be able to use it for a while -- probably a year or more.
514 But once this has been released, check with gcc maintainers
515 before deleting it or even changing the spelling. */
516 {"this_GCC_requires_the_GNU_assembler", s_ignore
, 0},
517 /* If we're folding case -- done for some targets, not necessarily
518 all -- the above string in an input file will be converted to
519 this one. Match it either way... */
520 {"this_gcc_requires_the_gnu_assembler", s_ignore
, 0},
522 {"title", listing_title
, 0}, /* Listing title. */
523 {"ttl", listing_title
, 0},
525 {"uleb128", s_leb128
, 0},
529 {"xdef", s_globl
, 0},
530 {"xref", s_ignore
, 0},
531 {"xstabs", s_xstab
, 's'},
532 {"warning", s_errwarn
, 0},
533 {"weakref", s_weakref
, 0},
535 {"zero", s_space
, 0},
539 {NULL
, NULL
, 0} /* End sentinel. */
543 get_absolute_expr (expressionS
*exp
)
545 expression_and_evaluate (exp
);
547 if (exp
->X_op
!= O_constant
)
549 if (exp
->X_op
!= O_absent
)
550 as_bad (_("bad or irreducible absolute expression"));
551 exp
->X_add_number
= 0;
553 return exp
->X_add_number
;
557 get_absolute_expression (void)
561 return get_absolute_expr (&exp
);
564 static int pop_override_ok
;
565 static const char *pop_table_name
;
568 pop_insert (const pseudo_typeS
*table
)
570 const pseudo_typeS
*pop
;
571 for (pop
= table
; pop
->poc_name
; pop
++)
573 if (str_hash_insert (po_hash
, pop
->poc_name
, pop
, 0) != NULL
)
575 if (!pop_override_ok
)
576 as_fatal (_("error constructing %s pseudo-op table"),
582 #ifndef md_pop_insert
583 #define md_pop_insert() pop_insert(md_pseudo_table)
586 #ifndef obj_pop_insert
587 #define obj_pop_insert() pop_insert(obj_pseudo_table)
590 #ifndef cfi_pop_insert
591 #define cfi_pop_insert() pop_insert(cfi_pseudo_table)
594 #ifndef scfi_pop_insert
595 #define scfi_pop_insert() pop_insert(scfi_pseudo_table)
601 po_hash
= str_htab_create ();
603 /* Do the target-specific pseudo ops. */
604 pop_table_name
= "md";
608 /* Now object specific. Skip any that were in the target table. */
609 pop_table_name
= "obj";
613 /* Now portable ones. Skip any that we've seen already. */
614 pop_table_name
= "standard";
615 pop_insert (potable
);
618 #if defined (TARGET_USE_SCFI) && defined (TARGET_USE_GINSN)
621 pop_table_name
= "scfi";
627 pop_table_name
= "cfi";
635 htab_delete (po_hash
);
638 #define HANDLE_CONDITIONAL_ASSEMBLY(num_read) \
639 if (ignore_input ()) \
641 char *eol = find_end_of_line (input_line_pointer - (num_read), \
643 input_line_pointer = (input_line_pointer <= buffer_limit \
644 && eol >= buffer_limit) \
650 /* Helper function of read_a_source_file, which tries to expand a macro. */
652 try_macro (char term
, const char *line
)
658 if (check_macro (line
, &out
, &err
, ¯o
))
662 *input_line_pointer
++ = term
;
663 input_scrub_include_sb (&out
,
664 input_line_pointer
, expanding_macro
);
667 input_scrub_next_buffer (&input_line_pointer
);
669 md_macro_info (macro
);
677 /* Start a new instruction bundle. Returns the rs_align_code frag that
678 will be used to align the new bundle. */
682 fragS
*frag
= frag_now
;
684 frag_align_code (0, 0);
686 while (frag
->fr_type
!= rs_align_code
)
687 frag
= frag
->fr_next
;
689 gas_assert (frag
!= frag_now
);
694 /* Calculate the maximum size after relaxation of the region starting
695 at the given frag and extending through frag_now (which is unfinished). */
697 pending_bundle_size (fragS
*frag
)
699 unsigned int offset
= frag
->fr_fix
;
700 unsigned int size
= 0;
702 gas_assert (frag
!= frag_now
);
703 gas_assert (frag
->fr_type
== rs_align_code
);
705 while (frag
!= frag_now
)
707 /* This should only happen in what will later become an error case. */
711 size
+= frag
->fr_fix
;
712 if (frag
->fr_type
== rs_machine_dependent
)
713 size
+= md_frag_max_var (frag
);
715 frag
= frag
->fr_next
;
718 gas_assert (frag
== frag_now
);
719 size
+= frag_now_fix ();
720 if (frag
->fr_type
== rs_machine_dependent
)
721 size
+= md_frag_max_var (frag
);
723 gas_assert (size
>= offset
);
725 return size
- offset
;
728 /* Finish off the frag created to ensure bundle alignment. */
730 finish_bundle (fragS
*frag
, unsigned int size
)
732 gas_assert (bundle_align_p2
> 0);
733 gas_assert (frag
->fr_type
== rs_align_code
);
737 /* If there is more than a single byte, then we need to set up the
738 alignment frag. Otherwise we leave it at its initial state from
739 calling frag_align_code (0, 0), so that it does nothing. */
740 frag
->fr_offset
= bundle_align_p2
;
741 frag
->fr_subtype
= size
- 1;
744 /* We do this every time rather than just in s_bundle_align_mode
745 so that we catch any affected section without needing hooks all
746 over for all paths that do section changes. It's cheap enough. */
747 if (bundle_align_p2
> OCTETS_PER_BYTE_POWER
)
748 record_alignment (now_seg
, bundle_align_p2
- OCTETS_PER_BYTE_POWER
);
751 /* Assemble one instruction. This takes care of the bundle features
752 around calling md_assemble. */
754 assemble_one (char *line
)
756 fragS
*insn_start_frag
= NULL
;
758 if (bundle_lock_frchain
!= NULL
&& bundle_lock_frchain
!= frchain_now
)
760 as_bad (_("cannot change section or subsection inside .bundle_lock"));
761 /* Clearing this serves as a marker that we have already complained. */
762 bundle_lock_frchain
= NULL
;
765 if (bundle_lock_frchain
== NULL
&& bundle_align_p2
> 0)
766 insn_start_frag
= start_bundle ();
770 if (bundle_lock_frchain
!= NULL
)
772 /* Make sure this hasn't pushed the locked sequence
773 past the bundle size. */
774 unsigned int bundle_size
= pending_bundle_size (bundle_lock_frag
);
775 if (bundle_size
> 1U << bundle_align_p2
)
776 as_bad (_ (".bundle_lock sequence at %u bytes, "
777 "but .bundle_align_mode limit is %u bytes"),
778 bundle_size
, 1U << bundle_align_p2
);
780 else if (bundle_align_p2
> 0)
782 unsigned int insn_size
= pending_bundle_size (insn_start_frag
);
784 if (insn_size
> 1U << bundle_align_p2
)
785 as_bad (_("single instruction is %u bytes long, "
786 "but .bundle_align_mode limit is %u bytes"),
787 insn_size
, 1U << bundle_align_p2
);
789 finish_bundle (insn_start_frag
, insn_size
);
793 #else /* !HANDLE_BUNDLE */
795 # define assemble_one(line) md_assemble(line)
797 #endif /* HANDLE_BUNDLE */
802 flagword flags
= bfd_section_flags (now_seg
);
804 return (flags
& SEC_ALLOC
) && !(flags
& (SEC_LOAD
| SEC_HAS_CONTENTS
));
807 /* Guts of .align directive:
808 N is the power of two to which to align. A value of zero is accepted but
809 ignored: the default alignment of the section will be at least this.
810 FILL may be NULL, or it may point to the bytes of the fill pattern.
811 LEN is the length of whatever FILL points to, if anything. If LEN is zero
812 but FILL is not NULL then LEN is treated as if it were one.
813 MAX is the maximum number of characters to skip when doing the alignment,
814 or 0 if there is no maximum. */
817 do_align (unsigned int n
, char *fill
, unsigned int len
, unsigned int max
)
819 if (now_seg
== absolute_section
|| in_bss ())
825 if (now_seg
== absolute_section
)
826 as_warn (_("ignoring fill value in absolute section"));
828 as_warn (_("ignoring fill value in section `%s'"),
829 segment_name (now_seg
));
836 #ifdef md_flush_pending_output
837 md_flush_pending_output ();
841 md_do_align (n
, fill
, len
, max
, just_record_alignment
);
844 /* Only make a frag if we HAVE to... */
845 if ((n
> OCTETS_PER_BYTE_POWER
) && !need_pass_2
)
849 if (subseg_text_p (now_seg
))
850 frag_align_code (n
, max
);
852 frag_align (n
, 0, max
);
855 frag_align (n
, *fill
, max
);
857 frag_align_pattern (n
, fill
, len
, max
);
861 just_record_alignment
: ATTRIBUTE_UNUSED_LABEL
864 if (n
> OCTETS_PER_BYTE_POWER
)
865 record_alignment (now_seg
, n
- OCTETS_PER_BYTE_POWER
);
868 /* Find first <eol><next_char>NO_APP<eol>, if any, in the supplied buffer.
869 Return NULL if there's none, or else the position of <next_char>. */
871 find_no_app (const char *s
, char next_char
)
873 const char *start
= s
;
874 const char srch
[] = { next_char
, 'N', 'O', '_', 'A', 'P', 'P', '\0' };
878 char *ends
= strstr (s
, srch
);
882 if (is_end_of_line (ends
[sizeof (srch
) - 1])
883 && (ends
== start
|| is_end_of_line (ends
[-1])))
885 s
= ends
+ sizeof (srch
) - 1;
891 /* We read the file, putting things into a web that represents what we
892 have been reading. */
894 read_a_source_file (const char *name
)
898 char *s
; /* String of symbol, '\0' appended. */
900 const pseudo_typeS
*pop
;
906 buffer
= input_scrub_new_file (name
);
909 listing_newline (NULL
);
910 register_dependency (name
);
912 /* Generate debugging information before we've read anything in to denote
913 this file as the "main" source file and not a subordinate one
914 (e.g. N_SO vs N_SOL in stabs). */
915 generate_file_debug ();
917 while ((buffer_limit
= input_scrub_next_buffer (&input_line_pointer
)) != 0)
918 { /* We have another line to parse. */
920 /* In order to avoid listing macro expansion lines with labels
921 multiple times, keep track of which line was last issued. */
922 char *last_eol
= NULL
;
925 while (input_line_pointer
< buffer_limit
)
928 /* We have more of this buffer to parse. */
930 /* We now have input_line_pointer->1st char of next line.
931 If input_line_pointer [-1] == '\n' then we just
932 scanned another line: so bump line counters. */
933 was_new_line
= is_end_of_line
[(unsigned char) input_line_pointer
[-1]];
936 symbol_set_value_now (&dot_symbol
);
937 #ifdef md_start_line_hook
938 md_start_line_hook ();
940 if (input_line_pointer
[-1] == '\n')
941 bump_line_counters ();
945 /* If listing is on, and we are expanding a macro, then give
946 the listing code the contents of the expanded line. */
949 if ((listing
& LISTING_MACEXP
) && macro_nest
> 0)
951 /* Find the end of the current expanded macro line. */
952 s
= find_end_of_line (input_line_pointer
, flag_m68k_mri
);
955 && !startswith (input_line_pointer
,
956 !flag_m68k_mri
? " .linefile "
963 /* Copy it for safe keeping. Also give an indication of
964 how much macro nesting is involved at this point. */
965 len
= s
- input_line_pointer
;
966 copy
= XNEWVEC (char, len
+ macro_nest
+ 2);
967 memset (copy
, '>', macro_nest
);
968 copy
[macro_nest
] = ' ';
969 memcpy (copy
+ macro_nest
+ 1, input_line_pointer
, len
);
970 copy
[macro_nest
+ 1 + len
] = '\0';
972 /* Install the line with the listing facility. */
973 listing_newline (copy
);
977 listing_newline (NULL
);
981 next_char
= *input_line_pointer
;
982 if (was_new_line
== 1
983 && (strchr (line_comment_chars
, '#')
985 : next_char
&& strchr (line_comment_chars
, next_char
)))
987 /* Its a comment. Check for APP followed by NO_APP. */
992 s
= input_line_pointer
+ 1;
993 if (!startswith (s
, "APP") || !is_end_of_line (s
[3]))
995 /* We ignore it. Note: Not ignore_rest_of_line ()! */
996 while (s
<= buffer_limit
)
997 if (is_end_of_line (*s
++))
999 input_line_pointer
= s
;
1004 ends
= find_no_app (s
, next_char
);
1005 len
= ends
? ends
- s
: buffer_limit
- s
;
1007 sb_build (&sbuf
, len
+ 100);
1008 sb_add_buffer (&sbuf
, s
, len
);
1011 /* The end of the #APP wasn't in this buffer. We
1012 keep reading in buffers until we find the #NO_APP
1013 that goes with this #APP There is one. The specs
1017 buffer_limit
= input_scrub_next_buffer (&buffer
);
1020 ends
= find_no_app (buffer
, next_char
);
1021 len
= ends
? ends
- buffer
: buffer_limit
- buffer
;
1022 sb_add_buffer (&sbuf
, buffer
, len
);
1026 sb_add_char (&sbuf
, '\n');
1028 input_line_pointer
= ends
? ends
+ 8 : NULL
;
1029 input_scrub_include_sb (&sbuf
, input_line_pointer
, expanding_app
);
1031 buffer_limit
= input_scrub_next_buffer (&input_line_pointer
);
1039 if (LABELS_WITHOUT_COLONS
|| flag_m68k_mri
)
1041 next_char
= * input_line_pointer
;
1042 /* Text at the start of a line must be a label, we
1043 run down and stick a colon in. */
1044 if (is_name_beginner (next_char
) || next_char
== '"')
1049 HANDLE_CONDITIONAL_ASSEMBLY (0);
1051 nul_char
= get_symbol_name (& line_start
);
1052 next_char
= (nul_char
== '"' ? input_line_pointer
[1] : nul_char
);
1054 /* In MRI mode, the EQU and MACRO pseudoops must
1055 be handled specially. */
1059 char *rest
= input_line_pointer
+ 1;
1063 if (*rest
== ' ' || *rest
== '\t')
1065 if ((strncasecmp (rest
, "EQU", 3) == 0
1066 || strncasecmp (rest
, "SET", 3) == 0)
1067 && (rest
[3] == ' ' || rest
[3] == '\t'))
1069 input_line_pointer
= rest
+ 3;
1071 strncasecmp (rest
, "SET", 3) == 0);
1074 if (strncasecmp (rest
, "MACRO", 5) == 0
1077 || is_end_of_line
[(unsigned char) rest
[5]]))
1081 /* In MRI mode, we need to handle the MACRO
1082 pseudo-op specially: we don't want to put the
1083 symbol in the symbol table. */
1085 #ifdef TC_START_LABEL_WITHOUT_COLON
1086 && TC_START_LABEL_WITHOUT_COLON (nul_char
, next_char
)
1089 line_label
= colon (line_start
);
1091 line_label
= symbol_create (line_start
,
1093 &zero_address_frag
, 0);
1095 next_char
= restore_line_pointer (nul_char
);
1096 if (next_char
== ':')
1097 input_line_pointer
++;
1102 /* We are at the beginning of a line, or similar place.
1103 We expect a well-formed assembler statement.
1104 A "symbol-name:" is a statement.
1106 Depending on what compiler is used, the order of these tests
1107 may vary to catch most common case 1st.
1108 Each test is independent of all other tests at the (top)
1111 nul_char
= next_char
= *input_line_pointer
++;
1112 while (next_char
== '\t' || next_char
== ' ' || next_char
== '\f');
1114 /* C is the 1st significant character.
1115 Input_line_pointer points after that character. */
1116 if (is_name_beginner (next_char
) || next_char
== '"')
1120 /* Want user-defined label or pseudo/opcode. */
1121 HANDLE_CONDITIONAL_ASSEMBLY (1);
1123 --input_line_pointer
;
1124 nul_char
= get_symbol_name (& s
); /* name's delimiter. */
1125 next_char
= (nul_char
== '"' ? input_line_pointer
[1] : nul_char
);
1126 rest
= input_line_pointer
+ (nul_char
== '"' ? 2 : 1);
1128 /* NEXT_CHAR is character after symbol.
1129 The end of symbol in the input line is now '\0'.
1130 S points to the beginning of the symbol.
1131 [In case of pseudo-op, s->'.'.]
1132 Input_line_pointer->'\0' where NUL_CHAR was. */
1133 if (TC_START_LABEL (s
, nul_char
, next_char
))
1137 /* In MRI mode, \tsym: set 0 is permitted. */
1141 if (*rest
== ' ' || *rest
== '\t')
1144 if ((strncasecmp (rest
, "EQU", 3) == 0
1145 || strncasecmp (rest
, "SET", 3) == 0)
1146 && (rest
[3] == ' ' || rest
[3] == '\t'))
1148 input_line_pointer
= rest
+ 3;
1154 line_label
= colon (s
); /* User-defined label. */
1155 restore_line_pointer (nul_char
);
1156 ++ input_line_pointer
;
1157 #ifdef tc_check_label
1158 tc_check_label (line_label
);
1160 /* Input_line_pointer->after ':'. */
1163 else if ((next_char
== '=' && *rest
== '=')
1164 || ((next_char
== ' ' || next_char
== '\t')
1169 demand_empty_rest_of_line ();
1171 else if ((next_char
== '='
1172 || ((next_char
== ' ' || next_char
== '\t')
1174 #ifdef TC_EQUAL_IN_INSN
1175 && !TC_EQUAL_IN_INSN (next_char
, s
)
1180 demand_empty_rest_of_line ();
1184 /* Expect pseudo-op or machine instruction. */
1187 #ifndef TC_CASE_SENSITIVE
1191 strncpy (original_case_string
, s2
,
1192 sizeof (original_case_string
) - 1);
1193 original_case_string
[sizeof (original_case_string
) - 1] = 0;
1197 *s2
= TOLOWER (*s2
);
1202 if (NO_PSEUDO_DOT
|| flag_m68k_mri
)
1204 /* The MRI assembler uses pseudo-ops without
1206 pop
= str_hash_find (po_hash
, s
);
1207 if (pop
!= NULL
&& pop
->poc_handler
== NULL
)
1212 || (!flag_m68k_mri
&& *s
== '.'))
1216 WARNING: next_char may be end-of-line.
1217 We lookup the pseudo-op table with s+1 because we
1218 already know that the pseudo-op begins with a '.'. */
1221 pop
= str_hash_find (po_hash
, s
+ 1);
1222 if (pop
&& !pop
->poc_handler
)
1225 /* In MRI mode, we may need to insert an
1226 automatic alignment directive. What a hack
1228 if (mri_pending_align
1230 || !((pop
->poc_handler
== cons
1231 && pop
->poc_val
== 1)
1232 || (pop
->poc_handler
== s_space
1233 && pop
->poc_val
== 1)
1234 #ifdef tc_conditional_pseudoop
1235 || tc_conditional_pseudoop (pop
)
1237 || pop
->poc_handler
== s_if
1238 || pop
->poc_handler
== s_ifdef
1239 || pop
->poc_handler
== s_ifc
1240 || pop
->poc_handler
== s_ifeqs
1241 || pop
->poc_handler
== s_else
1242 || pop
->poc_handler
== s_endif
1243 || pop
->poc_handler
== s_globl
1244 || pop
->poc_handler
== s_ignore
)))
1246 do_align (1, (char *) NULL
, 0, 0);
1247 mri_pending_align
= 0;
1249 if (line_label
!= NULL
)
1251 symbol_set_frag (line_label
, frag_now
);
1252 S_SET_VALUE (line_label
, frag_now_fix ());
1256 /* Print the error msg now, while we still can. */
1259 char *end
= input_line_pointer
;
1261 (void) restore_line_pointer (nul_char
);
1263 nul_char
= next_char
= *--input_line_pointer
;
1264 *input_line_pointer
= '\0';
1265 if (! macro_defined
|| ! try_macro (next_char
, s
))
1268 as_bad (_("unknown pseudo-op: `%s'"), s
);
1269 *input_line_pointer
++ = nul_char
;
1274 /* Put it back for error messages etc. */
1275 next_char
= restore_line_pointer (nul_char
);
1276 /* The following skip of whitespace is compulsory.
1277 A well shaped space is sometimes all that separates
1278 keyword from operands. */
1279 if (next_char
== ' ' || next_char
== '\t')
1280 input_line_pointer
++;
1282 /* Input_line is restored.
1283 Input_line_pointer->1st non-blank char
1284 after pseudo-operation. */
1285 (*pop
->poc_handler
) (pop
->poc_val
);
1287 /* If that was .end, just get out now. */
1288 if (pop
->poc_handler
== s_end
)
1293 /* WARNING: next_char may be end-of-line. */
1294 /* Also: input_line_pointer->`\0` where nul_char was. */
1295 (void) restore_line_pointer (nul_char
);
1296 input_line_pointer
= _find_end_of_line (input_line_pointer
, flag_m68k_mri
, 1, 0);
1297 next_char
= nul_char
= *input_line_pointer
;
1298 *input_line_pointer
= '\0';
1300 generate_lineno_debug ();
1302 if (macro_defined
&& try_macro (next_char
, s
))
1305 if (mri_pending_align
)
1307 do_align (1, (char *) NULL
, 0, 0);
1308 mri_pending_align
= 0;
1309 if (line_label
!= NULL
)
1311 symbol_set_frag (line_label
, frag_now
);
1312 S_SET_VALUE (line_label
, frag_now_fix ());
1316 assemble_one (s
); /* Assemble 1 instruction. */
1318 /* PR 19630: The backend may have set ilp to NULL
1319 if it encountered a catastrophic failure. */
1320 if (input_line_pointer
== NULL
)
1321 as_fatal (_("unable to continue with assembly."));
1323 *input_line_pointer
++ = nul_char
;
1325 /* We resume loop AFTER the end-of-line from
1326 this instruction. */
1332 /* Empty statement? */
1333 if (is_end_of_line
[(unsigned char) next_char
])
1336 if ((LOCAL_LABELS_DOLLAR
|| LOCAL_LABELS_FB
) && ISDIGIT (next_char
))
1338 /* local label ("4:") */
1339 char *backup
= input_line_pointer
;
1341 HANDLE_CONDITIONAL_ASSEMBLY (1);
1343 temp
= next_char
- '0';
1345 /* Read the whole number. */
1346 while (ISDIGIT (*input_line_pointer
))
1348 const long digit
= *input_line_pointer
- '0';
1350 /* Don't accept labels which look like octal numbers. */
1353 if (temp
> (INT_MAX
- digit
) / 10)
1355 as_bad (_("local label too large near %s"), backup
);
1359 temp
= temp
* 10 + digit
;
1360 ++input_line_pointer
;
1363 /* Overflow: stop processing the label. */
1366 ignore_rest_of_line ();
1370 if (LOCAL_LABELS_DOLLAR
1371 && *input_line_pointer
== '$'
1372 && *(input_line_pointer
+ 1) == ':')
1374 input_line_pointer
+= 2;
1376 if (dollar_label_defined (temp
))
1378 as_fatal (_("label \"%ld$\" redefined"), temp
);
1381 define_dollar_label (temp
);
1382 colon (dollar_label_name (temp
, 0));
1387 && *input_line_pointer
++ == ':')
1389 fb_label_instance_inc (temp
);
1390 colon (fb_label_name (temp
, 0));
1394 input_line_pointer
= backup
;
1397 if (next_char
&& strchr (line_comment_chars
, next_char
))
1399 /* Its a comment, ignore it. Note: Not ignore_rest_of_line ()! */
1400 while (s
<= buffer_limit
)
1401 if (is_end_of_line (*s
++))
1403 input_line_pointer
= s
;
1407 HANDLE_CONDITIONAL_ASSEMBLY (1);
1409 #ifdef tc_unrecognized_line
1410 if (tc_unrecognized_line (next_char
))
1413 input_line_pointer
--;
1414 /* Report unknown char as error. */
1415 demand_empty_rest_of_line ();
1420 symbol_set_value_now (&dot_symbol
);
1422 #ifdef HANDLE_BUNDLE
1423 if (bundle_lock_frag
!= NULL
)
1425 as_bad_where (bundle_lock_frag
->fr_file
, bundle_lock_frag
->fr_line
,
1426 _(".bundle_lock with no matching .bundle_unlock"));
1427 bundle_lock_frag
= NULL
;
1428 bundle_lock_frchain
= NULL
;
1429 bundle_lock_depth
= 0;
1434 ginsn_data_end (symbol_temp_new_now ());
1439 /* Close the input file. */
1440 input_scrub_close ();
1441 #ifdef WARN_COMMENTS
1443 if (warn_comment
&& found_comment
)
1444 as_warn_where (found_comment_file
, found_comment
,
1445 "first comment found here");
1450 /* Convert O_constant expression EXP into the equivalent O_big representation.
1451 Take the sign of the number from SIGN rather than X_add_number. */
1454 convert_to_bignum (expressionS
*exp
, int sign
)
1459 value
= exp
->X_add_number
;
1460 for (i
= 0; i
< sizeof (exp
->X_add_number
) / CHARS_PER_LITTLENUM
; i
++)
1462 generic_bignum
[i
] = value
& LITTLENUM_MASK
;
1463 value
>>= LITTLENUM_NUMBER_OF_BITS
;
1465 /* Add a sequence of sign bits if the top bit of X_add_number is not
1466 the sign of the original value. */
1467 if ((exp
->X_add_number
< 0) == !sign
)
1468 generic_bignum
[i
++] = sign
? LITTLENUM_MASK
: 0;
1470 exp
->X_add_number
= i
;
1473 /* For most MRI pseudo-ops, the line actually ends at the first
1474 nonquoted space. This function looks for that point, stuffs a null
1475 in, and sets *STOPCP to the character that used to be there, and
1476 returns the location.
1478 Until I hear otherwise, I am going to assume that this is only true
1479 for the m68k MRI assembler. */
1482 mri_comment_field (char *stopcp
)
1488 know (flag_m68k_mri
);
1490 for (s
= input_line_pointer
;
1491 ((!is_end_of_line
[(unsigned char) *s
] && *s
!= ' ' && *s
!= '\t')
1499 for (s
= input_line_pointer
;
1500 !is_end_of_line
[(unsigned char) *s
];
1510 /* Skip to the end of an MRI comment field. */
1513 mri_comment_end (char *stop
, int stopc
)
1517 input_line_pointer
= stop
;
1519 while (!is_end_of_line
[(unsigned char) *input_line_pointer
])
1520 ++input_line_pointer
;
1524 s_abort (int ignore ATTRIBUTE_UNUSED
)
1526 as_fatal (_(".abort detected. Abandoning ship."));
1529 /* Handle the .align pseudo-op. A positive ARG is a default alignment
1530 (in bytes). A negative ARG is the negative of the length of the
1531 fill pattern. BYTES_P is non-zero if the alignment value should be
1532 interpreted as the byte boundary, rather than the power of 2. */
1533 #ifndef TC_ALIGN_LIMIT
1534 #define TC_ALIGN_LIMIT (stdoutput->arch_info->bits_per_address - 1)
1538 s_align (signed int arg
, int bytes_p
)
1540 unsigned int align_limit
= TC_ALIGN_LIMIT
;
1549 stop
= mri_comment_field (&stopc
);
1551 if (is_end_of_line
[(unsigned char) *input_line_pointer
])
1556 align
= arg
; /* Default value from pseudo-op table. */
1560 align
= get_absolute_expression ();
1563 #ifdef TC_ALIGN_ZERO_IS_DEFAULT
1564 if (arg
> 0 && align
== 0)
1571 /* Convert to a power of 2. */
1576 for (i
= 0; (align
& 1) == 0; align
>>= 1, ++i
)
1579 as_bad (_("alignment not a power of 2"));
1585 if (align
> align_limit
)
1587 align
= align_limit
;
1588 as_warn (_("alignment too large: %u assumed"), align_limit
);
1591 if (*input_line_pointer
!= ',')
1598 ++input_line_pointer
;
1599 if (*input_line_pointer
== ',')
1603 fill
= get_absolute_expression ();
1608 if (*input_line_pointer
!= ',')
1612 ++input_line_pointer
;
1613 max
= get_absolute_expression ();
1620 as_warn (_("expected fill pattern missing"));
1621 do_align (align
, (char *) NULL
, 0, max
);
1625 unsigned int fill_len
;
1637 do_align (align
, &fill_char
, fill_len
, max
);
1643 if ((size_t) fill_len
> sizeof ab
)
1645 as_warn (_("fill pattern too long, truncating to %u"),
1646 (unsigned) sizeof ab
);
1647 fill_len
= sizeof ab
;
1650 md_number_to_chars (ab
, fill
, fill_len
);
1651 do_align (align
, ab
, fill_len
, max
);
1655 demand_empty_rest_of_line ();
1658 mri_comment_end (stop
, stopc
);
1661 /* Handle the .align pseudo-op on machines where ".align 4" means
1662 align to a 4 byte boundary. */
1665 s_align_bytes (int arg
)
1670 /* Handle the .align pseudo-op on machines where ".align 4" means align
1671 to a 2**4 boundary. */
1674 s_align_ptwo (int arg
)
1679 /* Switch in and out of alternate macro mode. */
1684 demand_empty_rest_of_line ();
1685 flag_macro_alternate
= on
;
1688 /* Read a symbol name from input_line_pointer.
1690 Stores the symbol name in a buffer and returns a pointer to this buffer.
1691 The buffer is xalloc'ed. It is the caller's responsibility to free
1694 The name is not left in the i_l_p buffer as it may need processing
1695 to handle escape characters.
1697 Advances i_l_p to the next non-whitespace character.
1699 If a symbol name could not be read, the routine issues an error
1700 messages, skips to the end of the line and returns NULL. */
1703 read_symbol_name (void)
1709 c
= *input_line_pointer
++;
1713 #define SYM_NAME_CHUNK_LEN 128
1714 ptrdiff_t len
= SYM_NAME_CHUNK_LEN
;
1718 start
= name
= XNEWVEC (char, len
+ 1);
1720 name_end
= name
+ SYM_NAME_CHUNK_LEN
;
1722 while (is_a_char (C
= next_char_of_string ()))
1724 if (name
>= name_end
)
1728 sofar
= name
- start
;
1729 len
+= SYM_NAME_CHUNK_LEN
;
1730 start
= XRESIZEVEC (char, start
, len
+ 1);
1731 name_end
= start
+ len
;
1732 name
= start
+ sofar
;
1739 /* Since quoted symbol names can contain non-ASCII characters,
1740 check the string and warn if it cannot be recognised by the
1741 current character set. */
1742 /* PR 29447: mbstowcs ignores the third (length) parameter when
1743 the first (destination) parameter is NULL. For clarity sake
1744 therefore we pass 0 rather than 'len' as the third parameter. */
1745 if (mbstowcs (NULL
, name
, 0) == (size_t) -1)
1746 as_warn (_("symbol name not recognised in the current locale"));
1748 else if (is_name_beginner (c
) || (input_from_string
&& c
== FAKE_LABEL_CHAR
))
1752 name
= input_line_pointer
- 1;
1754 /* We accept FAKE_LABEL_CHAR in a name in case this is
1755 being called with a constructed string. */
1756 while (is_part_of_name (c
= *input_line_pointer
++)
1757 || (input_from_string
&& c
== FAKE_LABEL_CHAR
))
1760 len
= (input_line_pointer
- name
) - 1;
1761 start
= XNEWVEC (char, len
+ 1);
1763 memcpy (start
, name
, len
);
1766 /* Skip a name ender char if one is present. */
1767 if (! is_name_ender (c
))
1768 --input_line_pointer
;
1771 name
= start
= NULL
;
1775 as_bad (_("expected symbol name"));
1776 ignore_rest_of_line ();
1788 s_comm_internal (int param
,
1789 symbolS
*(*comm_parse_extra
) (int, symbolS
*, addressT
))
1793 symbolS
*symbolP
= NULL
;
1799 stop
= mri_comment_field (&stopc
);
1801 if ((name
= read_symbol_name ()) == NULL
)
1804 /* Accept an optional comma after the name. The comma used to be
1805 required, but Irix 5 cc does not generate it for .lcomm. */
1806 if (*input_line_pointer
== ',')
1807 input_line_pointer
++;
1809 temp
= get_absolute_expr (&exp
);
1811 size
&= ((addressT
) 2 << (stdoutput
->arch_info
->bits_per_address
- 1)) - 1;
1812 if (exp
.X_op
== O_absent
)
1814 as_bad (_("missing size expression"));
1815 ignore_rest_of_line ();
1818 else if (temp
!= size
|| (!exp
.X_unsigned
&& exp
.X_add_number
< 0))
1820 as_warn (_("size (%ld) out of range, ignored"), (long) temp
);
1821 ignore_rest_of_line ();
1825 symbolP
= symbol_find_or_make (name
);
1826 if ((S_IS_DEFINED (symbolP
) || symbol_equated_p (symbolP
))
1827 && !S_IS_COMMON (symbolP
))
1829 if (!S_IS_VOLATILE (symbolP
))
1832 as_bad (_("symbol `%s' is already defined"), name
);
1833 ignore_rest_of_line ();
1836 symbolP
= symbol_clone (symbolP
, 1);
1837 S_SET_SEGMENT (symbolP
, undefined_section
);
1838 S_SET_VALUE (symbolP
, 0);
1839 symbol_set_frag (symbolP
, &zero_address_frag
);
1840 S_CLEAR_VOLATILE (symbolP
);
1843 size
= S_GET_VALUE (symbolP
);
1846 else if (size
!= temp
)
1847 as_warn (_("size of \"%s\" is already %ld; not changing to %ld"),
1848 name
, (long) size
, (long) temp
);
1850 if (comm_parse_extra
!= NULL
)
1851 symbolP
= (*comm_parse_extra
) (param
, symbolP
, size
);
1854 S_SET_VALUE (symbolP
, (valueT
) size
);
1855 S_SET_EXTERNAL (symbolP
);
1856 S_SET_SEGMENT (symbolP
, bfd_com_section_ptr
);
1859 demand_empty_rest_of_line ();
1862 mri_comment_end (stop
, stopc
);
1870 s_comm_internal (ignore
, NULL
);
1873 /* The MRI COMMON pseudo-op. We handle this by creating a common
1874 symbol with the appropriate name. We make s_space do the right
1875 thing by increasing the size. */
1878 s_mri_common (int small ATTRIBUTE_UNUSED
)
1894 stop
= mri_comment_field (&stopc
);
1898 name
= input_line_pointer
;
1899 if (!ISDIGIT (*name
))
1900 c
= get_symbol_name (& name
);
1905 ++input_line_pointer
;
1907 while (ISDIGIT (*input_line_pointer
));
1909 c
= *input_line_pointer
;
1910 *input_line_pointer
= '\0';
1912 if (line_label
!= NULL
)
1914 alc
= XNEWVEC (char, strlen (S_GET_NAME (line_label
))
1915 + (input_line_pointer
- name
) + 1);
1916 sprintf (alc
, "%s%s", name
, S_GET_NAME (line_label
));
1921 sym
= symbol_find_or_make (name
);
1922 c
= restore_line_pointer (c
);
1925 if (*input_line_pointer
!= ',')
1929 ++input_line_pointer
;
1930 align
= get_absolute_expression ();
1933 if (S_IS_DEFINED (sym
) && !S_IS_COMMON (sym
))
1935 as_bad (_("symbol `%s' is already defined"), S_GET_NAME (sym
));
1936 mri_comment_end (stop
, stopc
);
1940 S_SET_EXTERNAL (sym
);
1941 S_SET_SEGMENT (sym
, bfd_com_section_ptr
);
1942 mri_common_symbol
= sym
;
1946 S_SET_ALIGN (sym
, align
);
1951 if (line_label
!= NULL
)
1954 exp
.X_op
= O_symbol
;
1955 exp
.X_add_symbol
= sym
;
1956 exp
.X_add_number
= 0;
1957 symbol_set_value_expression (line_label
, &exp
);
1958 symbol_set_frag (line_label
, &zero_address_frag
);
1959 S_SET_SEGMENT (line_label
, expr_section
);
1962 /* FIXME: We just ignore the small argument, which distinguishes
1963 COMMON and COMMON.S. I don't know what we can do about it. */
1965 /* Ignore the type and hptype. */
1966 if (*input_line_pointer
== ',')
1967 input_line_pointer
+= 2;
1968 if (*input_line_pointer
== ',')
1969 input_line_pointer
+= 2;
1971 demand_empty_rest_of_line ();
1973 mri_comment_end (stop
, stopc
);
1977 s_data (int ignore ATTRIBUTE_UNUSED
)
1982 temp
= get_absolute_expression ();
1983 if (flag_readonly_data_in_text
)
1985 section
= text_section
;
1989 section
= data_section
;
1991 subseg_set (section
, (subsegT
) temp
);
1993 demand_empty_rest_of_line ();
1996 /* Handle the .file pseudo-op. This default definition may be overridden by
1997 the object or CPU specific pseudo-ops. */
2000 s_file_string (char *file
)
2004 listing_source_file (file
);
2006 register_dependency (file
);
2008 obj_app_file (file
);
2013 s_file (int ignore ATTRIBUTE_UNUSED
)
2018 /* Some assemblers tolerate immediately following '"'. */
2019 if ((s
= demand_copy_string (&length
)) != 0)
2021 new_logical_line_flags (s
, -1, 1);
2023 /* In MRI mode, the preprocessor may have inserted an extraneous
2026 && *input_line_pointer
== '\''
2027 && is_end_of_line
[(unsigned char) input_line_pointer
[1]])
2028 ++input_line_pointer
;
2030 demand_empty_rest_of_line ();
2036 get_linefile_number (int *flag
)
2042 if (*input_line_pointer
< '0' || *input_line_pointer
> '9')
2045 /* Don't mistakenly interpret octal numbers as line numbers. */
2046 if (*input_line_pointer
== '0')
2049 ++input_line_pointer
;
2053 expression_and_evaluate (&exp
);
2054 if (exp
.X_op
!= O_constant
)
2057 #if defined (BFD64) || LONG_MAX > INT_MAX
2058 if (exp
.X_add_number
< INT_MIN
|| exp
.X_add_number
> INT_MAX
)
2062 *flag
= exp
.X_add_number
;
2067 /* Handle the .linefile pseudo-op. This is automatically generated by
2068 do_scrub_chars when a preprocessor # line comment is seen. This
2069 default definition may be overridden by the object or CPU specific
2073 s_linefile (int ignore ATTRIBUTE_UNUSED
)
2076 int linenum
, flags
= 0;
2078 /* The given number is that of the next line. */
2079 if (!get_linefile_number (&linenum
))
2081 ignore_rest_of_line ();
2086 /* Some of the back ends can't deal with non-positive line numbers.
2087 Besides, it's silly. GCC however will generate a line number of
2088 zero when it is pre-processing builtins for assembler-with-cpp files:
2092 We do not want to barf on this, especially since such files are used
2093 in the GCC and GDB testsuites. So we check for negative line numbers
2094 rather than non-positive line numbers. */
2095 as_warn (_("line numbers must be positive; line number %d rejected"),
2103 if (*input_line_pointer
== '"')
2104 file
= demand_copy_string (&length
);
2105 else if (*input_line_pointer
== '.')
2107 /* buffer_and_nest() may insert this form. */
2108 ++input_line_pointer
;
2116 while (get_linefile_number (&this_flag
))
2119 /* From GCC's cpp documentation:
2120 1: start of a new file.
2121 2: returning to a file after having included another file.
2122 3: following text comes from a system header file.
2123 4: following text should be treated as extern "C".
2125 4 is nonsensical for the assembler; 3, we don't care about,
2126 so we ignore it just in case a system header file is
2127 included while preprocessing assembly. So 1 and 2 are all
2128 we care about, and they are mutually incompatible.
2129 new_logical_line_flags() demands this. */
2132 if (flags
&& flags
!= (1 << this_flag
))
2133 as_warn (_("incompatible flag %i in line directive"),
2136 flags
|= 1 << this_flag
;
2141 /* We ignore these. */
2145 as_warn (_("unsupported flag %i in line directive"),
2150 if (!is_end_of_line
[(unsigned char)*input_line_pointer
])
2156 demand_empty_rest_of_line ();
2158 /* read_a_source_file() will bump the line number only if the line
2159 is terminated by '\n'. */
2160 if (input_line_pointer
[-1] == '\n')
2163 new_logical_line_flags (file
, linenum
, flags
);
2166 listing_source_line (linenum
);
2171 ignore_rest_of_line ();
2174 /* Handle the .end pseudo-op. Actually, the real work is done in
2175 read_a_source_file. */
2178 s_end (int ignore ATTRIBUTE_UNUSED
)
2182 /* The MRI assembler permits the start symbol to follow .end,
2183 but we don't support that. */
2185 if (!is_end_of_line
[(unsigned char) *input_line_pointer
]
2186 && *input_line_pointer
!= '*'
2187 && *input_line_pointer
!= '!')
2188 as_warn (_("start address not supported"));
2192 /* Handle the .err pseudo-op. */
2195 s_err (int ignore ATTRIBUTE_UNUSED
)
2197 as_bad (_(".err encountered"));
2198 demand_empty_rest_of_line ();
2201 /* Handle the .error and .warning pseudo-ops. */
2207 /* The purpose for the conditional assignment is not to
2208 internationalize the directive itself, but that we need a
2209 self-contained message, one that can be passed like the
2210 demand_copy_C_string return value, and with no assumption on the
2211 location of the name of the directive within the message. */
2213 = (err
? _(".error directive invoked in source file")
2214 : _(".warning directive invoked in source file"));
2216 if (!is_it_end_of_statement ())
2218 if (*input_line_pointer
!= '\"')
2220 as_bad (_("%s argument must be a string"),
2221 err
? ".error" : ".warning");
2222 ignore_rest_of_line ();
2226 msg
= demand_copy_C_string (&len
);
2234 as_warn ("%s", msg
);
2235 demand_empty_rest_of_line ();
2238 /* Handle the MRI fail pseudo-op. */
2241 s_fail (int ignore ATTRIBUTE_UNUSED
)
2248 stop
= mri_comment_field (&stopc
);
2250 temp
= get_absolute_expression ();
2252 as_warn (_(".fail %ld encountered"), (long) temp
);
2254 as_bad (_(".fail %ld encountered"), (long) temp
);
2256 demand_empty_rest_of_line ();
2259 mri_comment_end (stop
, stopc
);
2263 s_fill (int ignore ATTRIBUTE_UNUSED
)
2265 expressionS rep_exp
;
2270 #ifdef md_flush_pending_output
2271 md_flush_pending_output ();
2274 #ifdef md_cons_align
2278 expression (&rep_exp
);
2279 if (*input_line_pointer
== ',')
2281 input_line_pointer
++;
2282 size
= get_absolute_expression ();
2283 if (*input_line_pointer
== ',')
2285 input_line_pointer
++;
2286 fill
= get_absolute_expression ();
2290 /* This is to be compatible with BSD 4.2 AS, not for any rational reason. */
2291 #define BSD_FILL_SIZE_CROCK_8 (8)
2292 if (size
> BSD_FILL_SIZE_CROCK_8
)
2294 as_warn (_(".fill size clamped to %d"), BSD_FILL_SIZE_CROCK_8
);
2295 size
= BSD_FILL_SIZE_CROCK_8
;
2299 as_warn (_("size negative; .fill ignored"));
2302 else if (rep_exp
.X_op
== O_constant
&& rep_exp
.X_add_number
<= 0)
2304 if (rep_exp
.X_add_number
< 0)
2305 as_warn (_("repeat < 0; .fill ignored"));
2308 else if (size
&& !need_pass_2
)
2310 if (now_seg
== absolute_section
&& rep_exp
.X_op
!= O_constant
)
2312 as_bad (_("non-constant fill count for absolute section"));
2315 else if (now_seg
== absolute_section
&& fill
&& rep_exp
.X_add_number
!= 0)
2317 as_bad (_("attempt to fill absolute section with non-zero value"));
2321 && (rep_exp
.X_op
!= O_constant
|| rep_exp
.X_add_number
!= 0)
2324 as_bad (_("attempt to fill section `%s' with non-zero value"),
2325 segment_name (now_seg
));
2330 if (size
&& !need_pass_2
)
2332 if (now_seg
== absolute_section
)
2333 abs_section_offset
+= rep_exp
.X_add_number
* size
;
2335 if (rep_exp
.X_op
== O_constant
)
2337 p
= frag_var (rs_fill
, (int) size
, (int) size
,
2338 (relax_substateT
) 0, (symbolS
*) 0,
2339 (offsetT
) rep_exp
.X_add_number
,
2344 /* We don't have a constant repeat count, so we can't use
2345 rs_fill. We can get the same results out of rs_space,
2346 but its argument is in bytes, so we must multiply the
2347 repeat count by size. */
2350 rep_sym
= make_expr_symbol (&rep_exp
);
2353 expressionS size_exp
;
2354 size_exp
.X_op
= O_constant
;
2355 size_exp
.X_add_number
= size
;
2357 rep_exp
.X_op
= O_multiply
;
2358 rep_exp
.X_add_symbol
= rep_sym
;
2359 rep_exp
.X_op_symbol
= make_expr_symbol (&size_exp
);
2360 rep_exp
.X_add_number
= 0;
2361 rep_sym
= make_expr_symbol (&rep_exp
);
2364 p
= frag_var (rs_space
, (int) size
, (int) size
,
2365 (relax_substateT
) 0, rep_sym
, (offsetT
) 0, (char *) 0);
2368 memset (p
, 0, (unsigned int) size
);
2370 /* The magic number BSD_FILL_SIZE_CROCK_4 is from BSD 4.2 VAX
2371 flavoured AS. The following bizarre behaviour is to be
2372 compatible with above. I guess they tried to take up to 8
2373 bytes from a 4-byte expression and they forgot to sign
2375 #define BSD_FILL_SIZE_CROCK_4 (4)
2376 md_number_to_chars (p
, (valueT
) fill
,
2377 (size
> BSD_FILL_SIZE_CROCK_4
2378 ? BSD_FILL_SIZE_CROCK_4
2380 /* Note: .fill (),0 emits no frag (since we are asked to .fill 0 bytes)
2381 but emits no error message because it seems a legal thing to do.
2382 It is a degenerate case of .fill but could be emitted by a
2385 demand_empty_rest_of_line ();
2389 s_globl (int ignore ATTRIBUTE_UNUSED
)
2398 stop
= mri_comment_field (&stopc
);
2402 if ((name
= read_symbol_name ()) == NULL
)
2405 symbolP
= symbol_find_or_make (name
);
2406 S_SET_EXTERNAL (symbolP
);
2409 c
= *input_line_pointer
;
2412 input_line_pointer
++;
2414 if (is_end_of_line
[(unsigned char) *input_line_pointer
])
2422 demand_empty_rest_of_line ();
2425 mri_comment_end (stop
, stopc
);
2428 /* Handle the MRI IRP and IRPC pseudo-ops. */
2440 file
= as_where (&line
);
2442 eol
= find_end_of_line (input_line_pointer
, 0);
2443 sb_build (&s
, eol
- input_line_pointer
);
2444 sb_add_buffer (&s
, input_line_pointer
, eol
- input_line_pointer
);
2445 input_line_pointer
= eol
;
2449 err
= expand_irp (irpc
, 0, &s
, &out
, get_macro_line_sb
);
2451 as_bad_where (file
, line
, "%s", err
);
2455 input_scrub_include_sb (&out
, input_line_pointer
, expanding_repeat
);
2457 buffer_limit
= input_scrub_next_buffer (&input_line_pointer
);
2460 /* Handle the .linkonce pseudo-op. This tells the assembler to mark
2461 the section to only be linked once. However, this is not supported
2462 by most object file formats. This takes an optional argument,
2463 which is what to do about duplicates. */
2466 s_linkonce (int ignore ATTRIBUTE_UNUSED
)
2468 enum linkonce_type type
;
2472 type
= LINKONCE_DISCARD
;
2474 if (!is_end_of_line
[(unsigned char) *input_line_pointer
])
2479 c
= get_symbol_name (& s
);
2480 if (strcasecmp (s
, "discard") == 0)
2481 type
= LINKONCE_DISCARD
;
2482 else if (strcasecmp (s
, "one_only") == 0)
2483 type
= LINKONCE_ONE_ONLY
;
2484 else if (strcasecmp (s
, "same_size") == 0)
2485 type
= LINKONCE_SAME_SIZE
;
2486 else if (strcasecmp (s
, "same_contents") == 0)
2487 type
= LINKONCE_SAME_CONTENTS
;
2489 as_warn (_("unrecognized .linkonce type `%s'"), s
);
2491 (void) restore_line_pointer (c
);
2494 #ifdef obj_handle_link_once
2495 obj_handle_link_once (type
);
2496 #else /* ! defined (obj_handle_link_once) */
2500 if ((bfd_applicable_section_flags (stdoutput
) & SEC_LINK_ONCE
) == 0)
2501 as_warn (_(".linkonce is not supported for this object file format"));
2503 flags
= bfd_section_flags (now_seg
);
2504 flags
|= SEC_LINK_ONCE
;
2509 case LINKONCE_DISCARD
:
2510 flags
|= SEC_LINK_DUPLICATES_DISCARD
;
2512 case LINKONCE_ONE_ONLY
:
2513 flags
|= SEC_LINK_DUPLICATES_ONE_ONLY
;
2515 case LINKONCE_SAME_SIZE
:
2516 flags
|= SEC_LINK_DUPLICATES_SAME_SIZE
;
2518 case LINKONCE_SAME_CONTENTS
:
2519 flags
|= SEC_LINK_DUPLICATES_SAME_CONTENTS
;
2522 if (!bfd_set_section_flags (now_seg
, flags
))
2523 as_bad (_("bfd_set_section_flags: %s"),
2524 bfd_errmsg (bfd_get_error ()));
2526 #endif /* ! defined (obj_handle_link_once) */
2528 demand_empty_rest_of_line ();
2532 bss_alloc (symbolS
*symbolP
, addressT size
, unsigned int align
)
2535 segT current_seg
= now_seg
;
2536 subsegT current_subseg
= now_subseg
;
2537 segT bss_seg
= bss_section
;
2539 #if defined (TC_MIPS) || defined (TC_ALPHA)
2540 if (OUTPUT_FLAVOR
== bfd_target_ecoff_flavour
2541 || OUTPUT_FLAVOR
== bfd_target_elf_flavour
)
2543 /* For MIPS and Alpha ECOFF or ELF, small objects are put in .sbss. */
2544 if (size
<= bfd_get_gp_size (stdoutput
))
2546 bss_seg
= subseg_new (".sbss", 1);
2547 seg_info (bss_seg
)->bss
= 1;
2548 if (!bfd_set_section_flags (bss_seg
, SEC_ALLOC
| SEC_SMALL_DATA
))
2549 as_warn (_("error setting flags for \".sbss\": %s"),
2550 bfd_errmsg (bfd_get_error ()));
2554 subseg_set (bss_seg
, 1);
2556 if (align
> OCTETS_PER_BYTE_POWER
)
2558 record_alignment (bss_seg
, align
);
2559 frag_align (align
, 0, 0);
2562 /* Detach from old frag. */
2563 if (S_GET_SEGMENT (symbolP
) == bss_seg
)
2564 symbol_get_frag (symbolP
)->fr_symbol
= NULL
;
2566 symbol_set_frag (symbolP
, frag_now
);
2567 pfrag
= frag_var (rs_org
, 1, 1, 0, symbolP
, size
* OCTETS_PER_BYTE
, NULL
);
2571 S_SET_SIZE (symbolP
, size
);
2573 S_SET_SEGMENT (symbolP
, bss_seg
);
2576 /* The symbol may already have been created with a preceding
2577 ".globl" directive -- be careful not to step on storage class
2578 in that case. Otherwise, set it to static. */
2579 if (S_GET_STORAGE_CLASS (symbolP
) != C_EXT
)
2580 S_SET_STORAGE_CLASS (symbolP
, C_STAT
);
2581 #endif /* OBJ_COFF */
2583 subseg_set (current_seg
, current_subseg
);
2587 parse_align (int align_bytes
)
2593 if (*input_line_pointer
!= ',')
2596 as_bad (_("expected alignment after size"));
2597 ignore_rest_of_line ();
2601 input_line_pointer
++;
2604 align
= get_absolute_expr (&exp
);
2605 if (exp
.X_op
== O_absent
)
2608 if (!exp
.X_unsigned
&& exp
.X_add_number
< 0)
2610 as_warn (_("alignment negative; 0 assumed"));
2614 if (align_bytes
&& align
!= 0)
2616 /* convert to a power of 2 alignment */
2617 unsigned int alignp2
= 0;
2618 while ((align
& 1) == 0)
2619 align
>>= 1, ++alignp2
;
2622 as_bad (_("alignment not a power of 2"));
2623 ignore_rest_of_line ();
2631 /* Called from s_comm_internal after symbol name and size have been
2632 parsed. NEEDS_ALIGN is 0 if it was an ".lcomm" (2 args only),
2633 1 if this was a ".bss" directive which has a 3rd argument
2634 (alignment as a power of 2), or 2 if this was a ".bss" directive
2635 with alignment in bytes. */
2638 s_lcomm_internal (int needs_align
, symbolS
*symbolP
, addressT size
)
2644 align
= parse_align (needs_align
- 1);
2645 if (align
== (addressT
) -1)
2649 /* Assume some objects may require alignment on some systems. */
2650 TC_IMPLICIT_LCOMM_ALIGNMENT (size
, align
);
2652 bss_alloc (symbolP
, size
, align
);
2657 s_lcomm (int needs_align
)
2659 s_comm_internal (needs_align
, s_lcomm_internal
);
2663 s_lcomm_bytes (int needs_align
)
2665 s_comm_internal (needs_align
* 2, s_lcomm_internal
);
2669 s_lsym (int ignore ATTRIBUTE_UNUSED
)
2675 /* We permit ANY defined expression: BSD4.2 demands constants. */
2676 if ((name
= read_symbol_name ()) == NULL
)
2679 if (*input_line_pointer
!= ',')
2681 as_bad (_("expected comma after \"%s\""), name
);
2685 input_line_pointer
++;
2686 expression_and_evaluate (&exp
);
2688 if (exp
.X_op
!= O_constant
2689 && exp
.X_op
!= O_register
)
2691 as_bad (_("bad expression"));
2695 symbolP
= symbol_find_or_make (name
);
2697 if (S_GET_SEGMENT (symbolP
) == undefined_section
)
2699 /* The name might be an undefined .global symbol; be sure to
2700 keep the "external" bit. */
2701 S_SET_SEGMENT (symbolP
,
2702 (exp
.X_op
== O_constant
2705 S_SET_VALUE (symbolP
, (valueT
) exp
.X_add_number
);
2709 as_bad (_("symbol `%s' is already defined"), name
);
2712 demand_empty_rest_of_line ();
2717 ignore_rest_of_line ();
2722 /* Read a line into an sb. Returns the character that ended the line
2723 or zero if there are no more lines. */
2726 get_line_sb (sb
*line
, int in_macro
)
2730 if (input_line_pointer
[-1] == '\n')
2731 bump_line_counters ();
2733 if (input_line_pointer
>= buffer_limit
)
2735 buffer_limit
= input_scrub_next_buffer (&input_line_pointer
);
2736 if (buffer_limit
== 0)
2740 eol
= _find_end_of_line (input_line_pointer
, flag_m68k_mri
, 0, in_macro
);
2741 sb_add_buffer (line
, input_line_pointer
, eol
- input_line_pointer
);
2742 input_line_pointer
= eol
;
2744 /* Don't skip multiple end-of-line characters, because that breaks support
2745 for the IA-64 stop bit (;;) which looks like two consecutive end-of-line
2746 characters but isn't. Instead just skip one end of line character and
2747 return the character skipped so that the caller can re-insert it if
2749 return *input_line_pointer
++;
2753 get_non_macro_line_sb (sb
*line
)
2755 return get_line_sb (line
, 0);
2759 get_macro_line_sb (sb
*line
)
2761 return get_line_sb (line
, 1);
2764 /* Define a macro. This is an interface to macro.c. */
2767 s_macro (int ignore ATTRIBUTE_UNUSED
)
2773 eol
= find_end_of_line (input_line_pointer
, 0);
2774 sb_build (&s
, eol
- input_line_pointer
);
2775 sb_add_buffer (&s
, input_line_pointer
, eol
- input_line_pointer
);
2776 input_line_pointer
= eol
;
2778 if (line_label
!= NULL
)
2784 name
= S_GET_NAME (line_label
);
2785 len
= strlen (name
);
2786 sb_build (&label
, len
);
2787 sb_add_buffer (&label
, name
, len
);
2788 macro
= define_macro (&s
, &label
, get_macro_line_sb
);
2792 macro
= define_macro (&s
, NULL
, get_macro_line_sb
);
2795 if (line_label
!= NULL
)
2797 S_SET_SEGMENT (line_label
, absolute_section
);
2798 S_SET_VALUE (line_label
, 0);
2799 symbol_set_frag (line_label
, &zero_address_frag
);
2802 if (((NO_PSEUDO_DOT
|| flag_m68k_mri
)
2803 && str_hash_find (po_hash
, macro
->name
) != NULL
)
2805 && macro
->name
[0] == '.'
2806 && str_hash_find (po_hash
, macro
->name
+ 1) != NULL
))
2808 as_warn_where (macro
->file
, macro
->line
,
2809 _("attempt to redefine pseudo-op `%s' ignored"),
2811 str_hash_delete (macro_hash
, macro
->name
);
2818 /* Handle the .mexit pseudo-op, which immediately exits a macro
2822 s_mexit (int ignore ATTRIBUTE_UNUSED
)
2826 cond_exit_macro (macro_nest
);
2827 buffer_limit
= input_scrub_next_buffer (&input_line_pointer
);
2830 as_warn (_("ignoring macro exit outside a macro definition."));
2833 /* Switch in and out of MRI mode. */
2836 s_mri (int ignore ATTRIBUTE_UNUSED
)
2839 #ifdef MRI_MODE_CHANGE
2843 on
= get_absolute_expression ();
2844 #ifdef MRI_MODE_CHANGE
2845 old_flag
= flag_mri
;
2853 lex_type
['?'] = LEX_BEGIN_NAME
| LEX_NAME
;
2861 lex_type
['?'] = LEX_QM
;
2864 /* Operator precedence changes in m68k MRI mode, so we need to
2865 update the operator rankings. */
2866 expr_set_precedence ();
2868 #ifdef MRI_MODE_CHANGE
2870 MRI_MODE_CHANGE (on
);
2873 demand_empty_rest_of_line ();
2876 /* Handle changing the location counter. */
2879 do_org (segT segment
, expressionS
*exp
, int fill
)
2881 if (segment
!= now_seg
2882 && segment
!= absolute_section
2883 && segment
!= expr_section
)
2884 as_bad (_("invalid segment \"%s\""), segment_name (segment
));
2886 if (now_seg
== absolute_section
)
2889 as_warn (_("ignoring fill value in absolute section"));
2890 if (exp
->X_op
!= O_constant
)
2892 as_bad (_("only constant offsets supported in absolute section"));
2893 exp
->X_add_number
= 0;
2895 abs_section_offset
= exp
->X_add_number
;
2900 symbolS
*sym
= exp
->X_add_symbol
;
2901 offsetT off
= exp
->X_add_number
* OCTETS_PER_BYTE
;
2903 if (fill
&& in_bss ())
2904 as_warn (_("ignoring fill value in section `%s'"),
2905 segment_name (now_seg
));
2907 if (exp
->X_op
!= O_constant
&& exp
->X_op
!= O_symbol
)
2909 /* Handle complex expressions. */
2910 sym
= make_expr_symbol (exp
);
2914 p
= frag_var (rs_org
, 1, 1, (relax_substateT
) 0, sym
, off
, (char *) 0);
2920 s_org (int ignore ATTRIBUTE_UNUSED
)
2926 #ifdef md_flush_pending_output
2927 md_flush_pending_output ();
2930 /* The m68k MRI assembler has a different meaning for .org. It
2931 means to create an absolute section at a given address. We can't
2932 support that--use a linker script instead. */
2935 as_bad (_("MRI style ORG pseudo-op not supported"));
2936 ignore_rest_of_line ();
2940 /* Don't believe the documentation of BSD 4.2 AS. There is no such
2941 thing as a sub-segment-relative origin. Any absolute origin is
2942 given a warning, then assumed to be segment-relative. Any
2943 segmented origin expression ("foo+42") had better be in the right
2944 segment or the .org is ignored.
2946 BSD 4.2 AS warns if you try to .org backwards. We cannot because
2947 we never know sub-segment sizes when we are reading code. BSD
2948 will crash trying to emit negative numbers of filler bytes in
2949 certain .orgs. We don't crash, but see as-write for that code.
2951 Don't make frag if need_pass_2==1. */
2952 segment
= get_known_segmented_expression (&exp
);
2953 if (*input_line_pointer
== ',')
2955 input_line_pointer
++;
2956 temp_fill
= get_absolute_expression ();
2962 do_org (segment
, &exp
, temp_fill
);
2964 demand_empty_rest_of_line ();
2967 /* Handle parsing for the MRI SECT/SECTION pseudo-op. This should be
2968 called by the obj-format routine which handles section changing
2969 when in MRI mode. It will create a new section, and return it. It
2970 will set *TYPE to the section type: one of 'C' (code), 'D' (data),
2971 'M' (mixed), or 'R' (romable). The flags will be set in the section. */
2974 s_mri_sect (char *type ATTRIBUTE_UNUSED
)
2984 name
= input_line_pointer
;
2985 if (!ISDIGIT (*name
))
2986 c
= get_symbol_name (& name
);
2991 ++input_line_pointer
;
2993 while (ISDIGIT (*input_line_pointer
));
2995 c
= *input_line_pointer
;
2996 *input_line_pointer
= '\0';
2999 name
= xstrdup (name
);
3001 c
= restore_line_pointer (c
);
3003 seg
= subseg_new (name
, 0);
3009 ++input_line_pointer
;
3010 align
= get_absolute_expression ();
3011 record_alignment (seg
, align
);
3015 if (*input_line_pointer
== ',')
3017 c
= *++input_line_pointer
;
3019 if (c
== 'C' || c
== 'D' || c
== 'M' || c
== 'R')
3022 as_bad (_("unrecognized section type"));
3023 ++input_line_pointer
;
3028 flags
= SEC_NO_FLAGS
;
3030 flags
= SEC_ALLOC
| SEC_LOAD
| SEC_READONLY
| SEC_CODE
;
3031 else if (*type
== 'D' || *type
== 'M')
3032 flags
= SEC_ALLOC
| SEC_LOAD
| SEC_DATA
;
3033 else if (*type
== 'R')
3034 flags
= SEC_ALLOC
| SEC_LOAD
| SEC_DATA
| SEC_READONLY
| SEC_ROM
;
3035 if (flags
!= SEC_NO_FLAGS
)
3037 if (!bfd_set_section_flags (seg
, flags
))
3038 as_warn (_("error setting flags for \"%s\": %s"),
3039 bfd_section_name (seg
),
3040 bfd_errmsg (bfd_get_error ()));
3045 /* Ignore the HP type. */
3046 if (*input_line_pointer
== ',')
3047 input_line_pointer
+= 2;
3049 demand_empty_rest_of_line ();
3051 #else /* ! TC_M68K */
3052 /* The MRI assembler seems to use different forms of .sect for
3053 different targets. */
3054 as_bad ("MRI mode not supported for this target");
3055 ignore_rest_of_line ();
3056 #endif /* ! TC_M68K */
3059 /* Handle the .print pseudo-op. */
3062 s_print (int ignore ATTRIBUTE_UNUSED
)
3067 s
= demand_copy_C_string (&len
);
3070 demand_empty_rest_of_line ();
3073 /* Handle the .purgem pseudo-op. */
3076 s_purgem (int ignore ATTRIBUTE_UNUSED
)
3078 if (is_it_end_of_statement ())
3080 demand_empty_rest_of_line ();
3090 c
= get_symbol_name (& name
);
3091 delete_macro (name
);
3092 *input_line_pointer
= c
;
3093 SKIP_WHITESPACE_AFTER_NAME ();
3095 while (*input_line_pointer
++ == ',');
3097 --input_line_pointer
;
3098 demand_empty_rest_of_line ();
3101 /* Handle the .endm/.endr pseudo-ops. */
3104 s_bad_end (int endr
)
3106 as_warn (_(".end%c encountered without preceding %s"),
3108 endr
? ".rept, .irp, or .irpc" : ".macro");
3109 demand_empty_rest_of_line ();
3112 /* Handle the .rept pseudo-op. */
3115 s_rept (int expand_count
)
3119 count
= (size_t) get_absolute_expression ();
3121 do_repeat (count
, "REPT", "ENDR", expand_count
? "" : NULL
);
3124 /* This function provides a generic repeat block implementation. It allows
3125 different directives to be used as the start/end keys. Any text matching
3126 the optional EXPANDER in the block is replaced by the remaining iteration
3127 count. Except when EXPANDER is the empty string, in which case \+ will
3128 be looked for (as also recognized in macros as well as .irp and .irpc),
3129 where the replacement will be the number of iterations done so far. */
3132 do_repeat (size_t count
, const char *start
, const char *end
,
3133 const char *expander
)
3138 if (((ssize_t
) count
) < 0)
3140 as_bad (_("negative count for %s - ignored"), start
);
3145 if (!buffer_and_nest (start
, end
, &one
, get_non_macro_line_sb
))
3147 as_bad (_("%s without %s"), start
, end
);
3152 sb_terminate (&one
);
3154 if (expander
!= NULL
&& !*expander
&& strstr (one
.ptr
, "\\+") != NULL
)
3156 /* The 3 here and below are arbitrary, added in an attempt to limit
3157 re-allocation needs in sb_add_...() for moderate repeat counts. */
3158 sb_build (&many
, count
* (one
.len
+ 3));
3160 for (size_t done
= 0; count
-- > 0; ++done
)
3162 const char *ptr
, *bs
;
3165 sb_build (&processed
, one
.len
+ 3);
3167 for (ptr
= one
.ptr
; (bs
= strchr (ptr
, '\\')) != NULL
; )
3169 sb_add_buffer (&processed
, ptr
, bs
- ptr
);
3175 sb_add_char (&processed
, '\\');
3176 sb_add_char (&processed
, bs
[1]);
3181 as_warn (_("`\\' at end of line/statement; ignored"));
3186 sb_add_char (&processed
, '\\');
3191 snprintf (scratch
, ARRAY_SIZE (scratch
), "%zu", done
);
3192 sb_add_string (&processed
, scratch
);
3198 sb_add_string (&processed
, ptr
);
3200 sb_add_sb (&many
, &processed
);
3201 sb_kill (&processed
);
3204 else if (expander
== NULL
|| !*expander
|| strstr (one
.ptr
, expander
) == NULL
)
3206 sb_build (&many
, count
* one
.len
);
3208 sb_add_sb (&many
, &one
);
3214 while (count
-- > 0)
3220 sb_build (& processed
, one
.len
);
3221 sb_add_sb (& processed
, & one
);
3222 sub
= strstr (processed
.ptr
, expander
);
3223 len
= sprintf (sub
, "%lu", (unsigned long) count
);
3224 gas_assert (len
< 8);
3225 memmove (sub
+ len
, sub
+ 8,
3226 processed
.ptr
+ processed
.len
- (sub
+ 8));
3227 processed
.len
-= (8 - len
);
3228 sb_add_sb (& many
, & processed
);
3229 sb_kill (& processed
);
3235 input_scrub_include_sb (&many
, input_line_pointer
, expanding_repeat
);
3237 buffer_limit
= input_scrub_next_buffer (&input_line_pointer
);
3240 /* Skip to end of current repeat loop; EXTRA indicates how many additional
3241 input buffers to skip. Assumes that conditionals preceding the loop end
3242 are properly nested.
3244 This function makes it easier to implement a premature "break" out of the
3245 loop. The EXTRA arg accounts for other buffers we might have inserted,
3246 such as line substitutions. */
3249 end_repeat (int extra
)
3251 cond_exit_macro (macro_nest
);
3252 while (extra
-- >= 0)
3253 buffer_limit
= input_scrub_next_buffer (&input_line_pointer
);
3257 assign_symbol (char *name
, int mode
)
3261 if (name
[0] == '.' && name
[1] == '\0')
3263 /* Turn '. = mumble' into a .org mumble. */
3267 segment
= get_known_segmented_expression (&exp
);
3270 do_org (segment
, &exp
, 0);
3275 if ((symbolP
= symbol_find (name
)) == NULL
3276 && (symbolP
= md_undefined_symbol (name
)) == NULL
)
3278 symbolP
= symbol_find_or_make (name
);
3280 /* When doing symbol listings, play games with dummy fragments living
3281 outside the normal fragment chain to record the file and line info
3283 if (listing
& LISTING_SYMBOLS
)
3285 extern struct list_info_struct
*listing_tail
;
3286 fragS
*dummy_frag
= notes_calloc (1, sizeof (*dummy_frag
));
3287 dummy_frag
->line
= listing_tail
;
3288 dummy_frag
->fr_symbol
= symbolP
;
3289 symbol_set_frag (symbolP
, dummy_frag
);
3292 #if defined (OBJ_COFF) && !defined (TE_PE)
3293 /* "set" symbols are local unless otherwise specified. */
3294 SF_SET_LOCAL (symbolP
);
3298 if (S_IS_DEFINED (symbolP
) || symbol_equated_p (symbolP
))
3300 if ((mode
!= 0 || !S_IS_VOLATILE (symbolP
))
3301 && !S_CAN_BE_REDEFINED (symbolP
))
3303 as_bad (_("symbol `%s' is already defined"), name
);
3304 ignore_rest_of_line ();
3305 input_line_pointer
--;
3308 /* If the symbol is volatile, copy the symbol and replace the
3309 original with the copy, so that previous uses of the symbol will
3310 retain the value of the symbol at the point of use. */
3311 else if (S_IS_VOLATILE (symbolP
))
3312 symbolP
= symbol_clone (symbolP
, 1);
3316 S_SET_VOLATILE (symbolP
);
3318 S_SET_FORWARD_REF (symbolP
);
3320 pseudo_set (symbolP
);
3323 /* Handle the .equ, .equiv, .eqv, and .set directives. If EQUIV is 1,
3324 then this is .equiv, and it is an error if the symbol is already
3325 defined. If EQUIV is -1, the symbol additionally is a forward
3333 /* Especial apologies for the random logic:
3334 this just grew, and could be parsed much more simply!
3336 if ((name
= read_symbol_name ()) == NULL
)
3339 if (*input_line_pointer
!= ',')
3341 as_bad (_("expected comma after \"%s\""), name
);
3342 ignore_rest_of_line ();
3347 input_line_pointer
++;
3348 assign_symbol (name
, equiv
);
3349 demand_empty_rest_of_line ();
3363 #ifdef md_flush_pending_output
3364 md_flush_pending_output ();
3371 # ifndef P_PRECISION
3372 # define P_PRECISION X_PRECISION
3373 # define P_PRECISION_PAD X_PRECISION_PAD
3375 mult
= (X_PRECISION
+ X_PRECISION_PAD
) * sizeof (LITTLENUM_TYPE
);
3383 mult
= (P_PRECISION
+ P_PRECISION_PAD
) * sizeof (LITTLENUM_TYPE
);
3390 #ifdef md_cons_align
3395 stop
= mri_comment_field (&stopc
);
3397 /* In m68k MRI mode, we need to align to a word boundary, unless
3399 if (flag_m68k_mri
&& mult
> 1)
3401 if (now_seg
== absolute_section
)
3403 abs_section_offset
+= abs_section_offset
& 1;
3404 if (line_label
!= NULL
)
3405 S_SET_VALUE (line_label
, abs_section_offset
);
3407 else if (mri_common_symbol
!= NULL
)
3411 mri_val
= S_GET_VALUE (mri_common_symbol
);
3412 if ((mri_val
& 1) != 0)
3414 S_SET_VALUE (mri_common_symbol
, mri_val
+ 1);
3415 if (line_label
!= NULL
)
3417 expressionS
*symexp
;
3419 symexp
= symbol_get_value_expression (line_label
);
3420 know (symexp
->X_op
== O_symbol
);
3421 know (symexp
->X_add_symbol
== mri_common_symbol
);
3422 symexp
->X_add_number
+= 1;
3428 do_align (1, (char *) NULL
, 0, 0);
3429 if (line_label
!= NULL
)
3431 symbol_set_frag (line_label
, frag_now
);
3432 S_SET_VALUE (line_label
, frag_now_fix ());
3442 if (*input_line_pointer
== ',')
3444 ++input_line_pointer
;
3449 val
.X_op
= O_constant
;
3450 val
.X_add_number
= 0;
3453 if ((val
.X_op
!= O_constant
3454 || val
.X_add_number
< - 0x80
3455 || val
.X_add_number
> 0xff
3456 || (mult
!= 0 && mult
!= 1 && val
.X_add_number
!= 0))
3457 && (now_seg
!= absolute_section
&& !in_bss ()))
3459 resolve_expression (&exp
);
3460 if (exp
.X_op
!= O_constant
)
3461 as_bad (_("unsupported variable size or fill value"));
3466 /* PR 20901: Check for excessive values.
3467 FIXME: 1<<10 is an arbitrary limit. Maybe use maxpagesize instead ? */
3468 if (exp
.X_add_number
< 0 || exp
.X_add_number
> (1 << 10))
3469 as_bad (_("size value for space directive too large: %lx"),
3470 (long) exp
.X_add_number
);
3475 bytes
= mult
* exp
.X_add_number
;
3477 for (i
= 0; i
< exp
.X_add_number
; i
++)
3478 emit_expr (&val
, mult
);
3484 if (now_seg
== absolute_section
|| mri_common_symbol
!= NULL
)
3485 resolve_expression (&exp
);
3487 if (exp
.X_op
== O_constant
)
3489 addressT repeat
= exp
.X_add_number
;
3493 if ((offsetT
) repeat
< 0)
3495 as_warn (_(".space repeat count is negative, ignored"));
3501 as_warn (_(".space repeat count is zero, ignored"));
3504 if ((unsigned int) mult
<= 1)
3506 else if (gas_mul_overflow (repeat
, mult
, &total
)
3507 || (offsetT
) total
< 0)
3509 as_warn (_(".space repeat count overflow, ignored"));
3514 /* If we are in the absolute section, just bump the offset. */
3515 if (now_seg
== absolute_section
)
3517 if (val
.X_op
!= O_constant
|| val
.X_add_number
!= 0)
3518 as_warn (_("ignoring fill value in absolute section"));
3519 abs_section_offset
+= total
;
3523 /* If we are secretly in an MRI common section, then
3524 creating space just increases the size of the common
3526 if (mri_common_symbol
!= NULL
)
3528 S_SET_VALUE (mri_common_symbol
,
3529 S_GET_VALUE (mri_common_symbol
) + total
);
3534 p
= frag_var (rs_fill
, 1, 1, (relax_substateT
) 0, (symbolS
*) 0,
3535 (offsetT
) total
, (char *) 0);
3539 if (now_seg
== absolute_section
)
3541 as_bad (_("space allocation too complex in absolute section"));
3542 subseg_set (text_section
, 0);
3545 if (mri_common_symbol
!= NULL
)
3547 as_bad (_("space allocation too complex in common section"));
3548 mri_common_symbol
= NULL
;
3552 p
= frag_var (rs_space
, 1, 1, (relax_substateT
) 0,
3553 make_expr_symbol (&exp
), (offsetT
) 0, (char *) 0);
3556 if ((val
.X_op
!= O_constant
|| val
.X_add_number
!= 0) && in_bss ())
3557 as_warn (_("ignoring fill value in section `%s'"),
3558 segment_name (now_seg
));
3560 *p
= val
.X_add_number
;
3565 /* In MRI mode, after an odd number of bytes, we must align to an
3566 even word boundary, unless the next instruction is a dc.b, ds.b
3568 if (flag_mri
&& (bytes
& 1) != 0)
3569 mri_pending_align
= 1;
3571 demand_empty_rest_of_line ();
3574 mri_comment_end (stop
, stopc
);
3578 s_nop (int ignore ATTRIBUTE_UNUSED
)
3585 #ifdef md_flush_pending_output
3586 md_flush_pending_output ();
3591 demand_empty_rest_of_line ();
3594 start_off
= frag_now_fix ();
3597 #ifdef md_emit_single_noop
3598 md_emit_single_noop
;
3602 #ifndef md_single_noop_insn
3603 #define md_single_noop_insn "nop"
3605 /* md_assemble might modify its argument, so
3606 we must pass it a string that is writable. */
3607 if (asprintf (&nop
, "%s", md_single_noop_insn
) < 0)
3608 as_fatal ("%s", xstrerror (errno
));
3610 /* Some targets assume that they can update input_line_pointer
3611 inside md_assemble, and, worse, that they can leave it
3612 assigned to the string pointer that was provided as an
3613 argument. So preserve ilp here. */
3614 char *saved_ilp
= input_line_pointer
;
3616 input_line_pointer
= saved_ilp
;
3619 #ifdef md_flush_pending_output
3620 md_flush_pending_output ();
3622 } while (exp
.X_op
== O_constant
3623 && exp
.X_add_number
> 0
3624 && frag_offset_ignore_align_p (start
, frag_now
, &frag_off
)
3625 && frag_off
+ frag_now_fix () < start_off
+ exp
.X_add_number
);
3629 s_nops (int ignore ATTRIBUTE_UNUSED
)
3634 #ifdef md_flush_pending_output
3635 md_flush_pending_output ();
3640 /* Note - this expression is tested for an absolute value in
3641 write.c:relax_segment(). */
3644 if (*input_line_pointer
== ',')
3646 ++input_line_pointer
;
3651 val
.X_op
= O_constant
;
3652 val
.X_add_number
= 0;
3655 if (val
.X_op
!= O_constant
)
3657 as_bad (_("unsupported variable nop control in .nops directive"));
3658 val
.X_op
= O_constant
;
3659 val
.X_add_number
= 0;
3661 else if (val
.X_add_number
< 0)
3663 as_warn (_("negative nop control byte, ignored"));
3664 val
.X_add_number
= 0;
3667 demand_empty_rest_of_line ();
3670 /* Ignore this directive if we are going to perform a second pass. */
3673 /* Store the no-op instruction control byte in the first byte of frag. */
3675 symbolS
*sym
= make_expr_symbol (&exp
);
3676 p
= frag_var (rs_space_nop
, 1, 1, (relax_substateT
) 0,
3677 sym
, (offsetT
) 0, (char *) 0);
3678 *p
= val
.X_add_number
;
3681 /* Obtain the size of a floating point number, given a type. */
3684 float_length (int float_type
, int *pad_p
)
3686 int length
, pad
= 0;
3714 length
= X_PRECISION
* sizeof (LITTLENUM_TYPE
);
3715 pad
= X_PRECISION_PAD
* sizeof (LITTLENUM_TYPE
);
3724 length
= P_PRECISION
* sizeof (LITTLENUM_TYPE
);
3725 pad
= P_PRECISION_PAD
* sizeof (LITTLENUM_TYPE
);
3732 as_bad (_("unknown floating type '%c'"), float_type
);
3744 parse_one_float (int float_type
, char temp
[MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT
])
3750 /* Skip any 0{letter} that may be present. Don't even check if the
3751 letter is legal. Someone may invent a "z" format and this routine
3752 has no use for such information. Lusers beware: you get
3753 diagnostics if your input is ill-conditioned. */
3754 if (input_line_pointer
[0] == '0'
3755 && ISALPHA (input_line_pointer
[1]))
3756 input_line_pointer
+= 2;
3758 /* Accept :xxxx, where the x's are hex digits, for a floating point
3759 with the exact digits specified. */
3760 if (input_line_pointer
[0] == ':')
3762 ++input_line_pointer
;
3763 length
= hex_float (float_type
, temp
);
3766 ignore_rest_of_line ();
3774 err
= md_atof (float_type
, temp
, &length
);
3775 know (length
<= MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT
);
3776 know (err
!= NULL
|| length
> 0);
3779 as_bad (_("bad floating literal: %s"), err
);
3780 ignore_rest_of_line ();
3788 /* This is like s_space, but the value is a floating point number with
3789 the given precision. This is for the MRI dcb.s pseudo-op and
3793 s_float_space (int float_type
)
3797 char temp
[MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT
];
3801 #ifdef md_cons_align
3806 stop
= mri_comment_field (&stopc
);
3808 count
= get_absolute_expression ();
3811 if (*input_line_pointer
!= ',')
3815 flen
= float_length (float_type
, &pad
);
3817 memset (temp
, 0, flen
+= pad
);
3821 ++input_line_pointer
;
3823 flen
= parse_one_float (float_type
, temp
);
3829 mri_comment_end (stop
, stopc
);
3833 while (--count
>= 0)
3837 p
= frag_more (flen
);
3838 memcpy (p
, temp
, (unsigned int) flen
);
3841 demand_empty_rest_of_line ();
3844 mri_comment_end (stop
, stopc
);
3847 /* Handle the .struct pseudo-op, as found in MIPS assemblers. */
3850 s_struct (int ignore ATTRIBUTE_UNUSED
)
3856 stop
= mri_comment_field (&stopc
);
3857 abs_section_offset
= get_absolute_expression ();
3858 #if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)
3859 /* The ELF backend needs to know that we are changing sections, so
3860 that .previous works correctly. */
3862 obj_elf_section_change_hook ();
3864 subseg_set (absolute_section
, 0);
3865 demand_empty_rest_of_line ();
3867 mri_comment_end (stop
, stopc
);
3871 s_text (int ignore ATTRIBUTE_UNUSED
)
3875 temp
= get_absolute_expression ();
3876 subseg_set (text_section
, (subsegT
) temp
);
3877 demand_empty_rest_of_line ();
3880 /* .weakref x, y sets x as an alias to y that, as long as y is not
3881 referenced directly, will cause y to become a weak symbol. */
3883 s_weakref (int ignore ATTRIBUTE_UNUSED
)
3890 if ((name
= read_symbol_name ()) == NULL
)
3893 symbolP
= symbol_find_or_make (name
);
3895 if (S_IS_DEFINED (symbolP
) || symbol_equated_p (symbolP
))
3897 if (!S_IS_VOLATILE (symbolP
))
3899 as_bad (_("symbol `%s' is already defined"), name
);
3902 symbolP
= symbol_clone (symbolP
, 1);
3903 S_CLEAR_VOLATILE (symbolP
);
3908 if (*input_line_pointer
!= ',')
3910 as_bad (_("expected comma after \"%s\""), name
);
3914 input_line_pointer
++;
3919 if ((name
= read_symbol_name ()) == NULL
)
3922 if ((symbolP2
= symbol_find_noref (name
, 1)) == NULL
3923 && (symbolP2
= md_undefined_symbol (name
)) == NULL
)
3925 symbolP2
= symbol_find_or_make (name
);
3926 S_SET_WEAKREFD (symbolP2
);
3930 symbolS
*symp
= symbolP2
;
3932 while (S_IS_WEAKREFR (symp
) && symp
!= symbolP
)
3934 expressionS
*expP
= symbol_get_value_expression (symp
);
3936 gas_assert (expP
->X_op
== O_symbol
3937 && expP
->X_add_number
== 0);
3938 symp
= expP
->X_add_symbol
;
3940 if (symp
== symbolP
)
3944 loop
= concat (S_GET_NAME (symbolP
),
3945 " => ", S_GET_NAME (symbolP2
), (const char *) NULL
);
3948 while (symp
!= symbolP
)
3950 char *old_loop
= loop
;
3952 symp
= symbol_get_value_expression (symp
)->X_add_symbol
;
3953 loop
= concat (loop
, " => ", S_GET_NAME (symp
),
3954 (const char *) NULL
);
3958 as_bad (_("%s: would close weakref loop: %s"),
3959 S_GET_NAME (symbolP
), loop
);
3963 ignore_rest_of_line ();
3967 /* Short-circuiting instead of just checking here might speed
3968 things up a tiny little bit, but loop error messages would
3969 miss intermediate links. */
3970 /* symbolP2 = symp; */
3973 memset (&exp
, 0, sizeof (exp
));
3974 exp
.X_op
= O_symbol
;
3975 exp
.X_add_symbol
= symbolP2
;
3977 S_SET_SEGMENT (symbolP
, undefined_section
);
3978 symbol_set_value_expression (symbolP
, &exp
);
3979 symbol_set_frag (symbolP
, &zero_address_frag
);
3980 S_SET_WEAKREFR (symbolP
);
3982 demand_empty_rest_of_line ();
3987 ignore_rest_of_line ();
3993 /* Verify that we are at the end of a line. If not, issue an error and
3994 skip to EOL. This function may leave input_line_pointer one past
3995 buffer_limit, so should not be called from places that may
3996 dereference input_line_pointer unconditionally. Note that when the
3997 gas parser is switched to handling a string (where buffer_limit
3998 should be the size of the string excluding the NUL terminator) this
3999 will be one past the NUL; is_end_of_line(0) returns true. */
4002 demand_empty_rest_of_line (void)
4005 if (input_line_pointer
> buffer_limit
)
4007 if (is_end_of_line
[(unsigned char) *input_line_pointer
])
4008 input_line_pointer
++;
4011 if (ISPRINT (*input_line_pointer
))
4012 as_bad (_("junk at end of line, first unrecognized character is `%c'"),
4013 *input_line_pointer
);
4015 as_bad (_("junk at end of line, first unrecognized character valued 0x%x"),
4016 *input_line_pointer
);
4017 ignore_rest_of_line ();
4019 /* Return pointing just after end-of-line. */
4022 /* Silently advance to the end of a statement. Use this after already having
4023 issued an error about something bad. Like demand_empty_rest_of_line,
4024 this function may leave input_line_pointer one after buffer_limit;
4025 Don't call it from within expression parsing code in an attempt to
4026 silence further errors. */
4029 ignore_rest_of_line (void)
4031 while (input_line_pointer
<= buffer_limit
)
4032 if (is_end_of_stmt (*input_line_pointer
++))
4034 /* Return pointing just after end-of-statement. */
4037 /* Sets frag for given symbol to zero_address_frag, except when the
4038 symbol frag is already set to a dummy listing frag. */
4041 set_zero_frag (symbolS
*symbolP
)
4043 if (symbol_get_frag (symbolP
)->fr_type
!= rs_dummy
)
4044 symbol_set_frag (symbolP
, &zero_address_frag
);
4047 /* In: Pointer to a symbol.
4048 Input_line_pointer->expression.
4050 Out: Input_line_pointer->just after any whitespace after expression.
4051 Tried to set symbol to value of expression.
4052 Will change symbols type, value, and frag; */
4055 pseudo_set (symbolS
*symbolP
)
4060 know (symbolP
); /* NULL pointer is logic error. */
4062 if (!S_IS_FORWARD_REF (symbolP
))
4063 (void) expression (&exp
);
4065 (void) deferred_expression (&exp
);
4067 if (exp
.X_op
== O_illegal
)
4068 as_bad (_("illegal expression"));
4069 else if (exp
.X_op
== O_absent
)
4070 as_bad (_("missing expression"));
4071 else if (exp
.X_op
== O_big
)
4073 if (exp
.X_add_number
> 0)
4074 as_bad (_("bignum invalid"));
4076 as_bad (_("floating point number invalid"));
4078 else if (exp
.X_op
== O_subtract
4079 && !S_IS_FORWARD_REF (symbolP
)
4080 && SEG_NORMAL (S_GET_SEGMENT (exp
.X_add_symbol
))
4081 && (symbol_get_frag (exp
.X_add_symbol
)
4082 == symbol_get_frag (exp
.X_op_symbol
)))
4084 exp
.X_op
= O_constant
;
4085 exp
.X_add_number
= (S_GET_VALUE (exp
.X_add_symbol
)
4086 - S_GET_VALUE (exp
.X_op_symbol
));
4089 if (symbol_section_p (symbolP
))
4091 as_bad ("attempt to set value of section symbol");
4100 exp
.X_add_number
= 0;
4103 S_SET_SEGMENT (symbolP
, absolute_section
);
4104 S_SET_VALUE (symbolP
, (valueT
) exp
.X_add_number
);
4105 set_zero_frag (symbolP
);
4109 #ifndef TC_GLOBAL_REGISTER_SYMBOL_OK
4110 if (S_IS_EXTERNAL (symbolP
))
4112 as_bad ("can't equate global symbol `%s' with register name",
4113 S_GET_NAME (symbolP
));
4117 /* Make sure symbol_equated_p() recognizes the symbol as an equate. */
4118 exp
.X_add_symbol
= make_expr_symbol (&exp
);
4119 exp
.X_add_number
= 0;
4120 exp
.X_op
= O_symbol
;
4121 symbol_set_value_expression (symbolP
, &exp
);
4122 S_SET_SEGMENT (symbolP
, reg_section
);
4123 set_zero_frag (symbolP
);
4127 seg
= S_GET_SEGMENT (exp
.X_add_symbol
);
4128 /* For x=undef+const, create an expression symbol.
4129 For x=x+const, just update x except when x is an undefined symbol
4130 For x=defined+const, evaluate x. */
4131 if (symbolP
== exp
.X_add_symbol
4132 && (seg
!= undefined_section
4133 || !symbol_constant_p (symbolP
)))
4135 *symbol_X_add_number (symbolP
) += exp
.X_add_number
;
4138 else if (!S_IS_FORWARD_REF (symbolP
) && seg
!= undefined_section
)
4140 symbolS
*s
= exp
.X_add_symbol
;
4142 if (S_IS_COMMON (s
))
4143 as_bad (_("`%s' can't be equated to common symbol `%s'"),
4144 S_GET_NAME (symbolP
), S_GET_NAME (s
));
4146 S_SET_SEGMENT (symbolP
, seg
);
4147 S_SET_VALUE (symbolP
, exp
.X_add_number
+ S_GET_VALUE (s
));
4148 symbol_set_frag (symbolP
, symbol_get_frag (s
));
4149 copy_symbol_attributes (symbolP
, s
);
4152 S_SET_SEGMENT (symbolP
, undefined_section
);
4153 symbol_set_value_expression (symbolP
, &exp
);
4154 copy_symbol_attributes (symbolP
, exp
.X_add_symbol
);
4155 set_zero_frag (symbolP
);
4159 /* The value is some complex expression. */
4160 S_SET_SEGMENT (symbolP
, expr_section
);
4161 symbol_set_value_expression (symbolP
, &exp
);
4162 set_zero_frag (symbolP
);
4169 CONStruct more frag of .bytes, or .words etc.
4170 Should need_pass_2 be 1 then emit no frag(s).
4171 This understands EXPRESSIONS.
4175 This has a split personality. We use expression() to read the
4176 value. We can detect if the value won't fit in a byte or word.
4177 But we can't detect if expression() discarded significant digits
4178 in the case of a long. Not worth the crocks required to fix it. */
4180 /* Select a parser for cons expressions. */
4182 /* Some targets need to parse the expression in various fancy ways.
4183 You can define TC_PARSE_CONS_EXPRESSION to do whatever you like
4184 (for example, the HPPA does this). Otherwise, you can define
4185 REPEAT_CONS_EXPRESSIONS to permit repeat counts. If none of these
4186 are defined, which is the normal case, then only simple expressions
4191 parse_mri_cons (expressionS
*exp
, unsigned int nbytes
);
4194 #ifndef TC_PARSE_CONS_EXPRESSION
4195 #ifdef REPEAT_CONS_EXPRESSIONS
4196 #define TC_PARSE_CONS_EXPRESSION(EXP, NBYTES) \
4197 (parse_repeat_cons (EXP, NBYTES), TC_PARSE_CONS_RETURN_NONE)
4199 parse_repeat_cons (expressionS
*exp
, unsigned int nbytes
);
4202 /* If we haven't gotten one yet, just call expression. */
4203 #ifndef TC_PARSE_CONS_EXPRESSION
4204 #define TC_PARSE_CONS_EXPRESSION(EXP, NBYTES) \
4205 (expression (EXP), TC_PARSE_CONS_RETURN_NONE)
4210 do_parse_cons_expression (expressionS
*exp
,
4211 int nbytes ATTRIBUTE_UNUSED
)
4213 (void) TC_PARSE_CONS_EXPRESSION (exp
, nbytes
);
4217 /* Worker to do .byte etc statements.
4218 Clobbers input_line_pointer and checks end-of-line. */
4221 cons_worker (int nbytes
, /* 1=.byte, 2=.word, 4=.long. */
4229 #ifdef md_flush_pending_output
4230 md_flush_pending_output ();
4234 stop
= mri_comment_field (&stopc
);
4236 if (is_it_end_of_statement ())
4238 demand_empty_rest_of_line ();
4240 mri_comment_end (stop
, stopc
);
4245 nbytes
= TC_ADDRESS_BYTES ();
4247 #ifdef md_cons_align
4248 md_cons_align (nbytes
);
4254 TC_PARSE_CONS_RETURN_TYPE ret
= TC_PARSE_CONS_RETURN_NONE
;
4255 #ifdef TC_CONS_FIX_CHECK
4256 fixS
**cur_fix
= &frchain_now
->fix_tail
;
4258 if (*cur_fix
!= NULL
)
4259 cur_fix
= &(*cur_fix
)->fx_next
;
4264 parse_mri_cons (&exp
, (unsigned int) nbytes
);
4269 if (*input_line_pointer
== '"')
4271 as_bad (_("unexpected `\"' in expression"));
4272 ignore_rest_of_line ();
4276 ret
= TC_PARSE_CONS_EXPRESSION (&exp
, (unsigned int) nbytes
);
4281 if (exp
.X_op
== O_symbol
)
4282 exp
.X_op
= O_symbol_rva
;
4284 as_fatal (_("rva without symbol"));
4286 emit_expr_with_reloc (&exp
, (unsigned int) nbytes
, ret
);
4287 #ifdef TC_CONS_FIX_CHECK
4288 TC_CONS_FIX_CHECK (&exp
, nbytes
, *cur_fix
);
4292 while (*input_line_pointer
++ == ',');
4294 /* In MRI mode, after an odd number of bytes, we must align to an
4295 even word boundary, unless the next instruction is a dc.b, ds.b
4297 if (flag_mri
&& nbytes
== 1 && (c
& 1) != 0)
4298 mri_pending_align
= 1;
4300 input_line_pointer
--; /* Put terminator back into stream. */
4302 demand_empty_rest_of_line ();
4305 mri_comment_end (stop
, stopc
);
4307 /* Disallow hand-crafting instructions using .byte. FIXME - what about
4308 .word, .long etc ? */
4309 if (flag_synth_cfi
&& frchain_now
&& frchain_now
->frch_ginsn_data
4311 as_bad (_("SCFI: hand-crafting instructions not supported"));
4317 cons_worker (size
, 0);
4323 cons_worker (size
, 1);
4326 /* .reloc offset, reloc_name, symbol+addend. */
4329 s_reloc (int ignore ATTRIBUTE_UNUSED
)
4336 struct reloc_list
*reloc
;
4337 struct _bfd_rel
{ const char * name
; bfd_reloc_code_real_type code
; };
4338 static const struct _bfd_rel bfd_relocs
[] =
4340 { "NONE", BFD_RELOC_NONE
},
4341 { "8", BFD_RELOC_8
},
4342 { "16", BFD_RELOC_16
},
4343 { "32", BFD_RELOC_32
},
4344 { "64", BFD_RELOC_64
}
4347 reloc
= XNEW (struct reloc_list
);
4350 stop
= mri_comment_field (&stopc
);
4359 as_bad (_("missing or bad offset expression"));
4362 exp
.X_add_symbol
= section_symbol (now_seg
);
4363 /* Mark the section symbol used in relocation so that it will be
4364 included in the symbol table. */
4365 symbol_mark_used_in_reloc (exp
.X_add_symbol
);
4366 exp
.X_op
= O_symbol
;
4369 if (exp
.X_add_number
== 0)
4371 reloc
->u
.a
.offset_sym
= exp
.X_add_symbol
;
4376 reloc
->u
.a
.offset_sym
= make_expr_symbol (&exp
);
4381 if (*input_line_pointer
!= ',')
4383 as_bad (_("missing reloc type"));
4387 ++input_line_pointer
;
4389 c
= get_symbol_name (& r_name
);
4390 if (strncasecmp (r_name
, "BFD_RELOC_", 10) == 0)
4394 for (reloc
->u
.a
.howto
= NULL
, i
= 0; i
< ARRAY_SIZE (bfd_relocs
); i
++)
4395 if (strcasecmp (r_name
+ 10, bfd_relocs
[i
].name
) == 0)
4397 reloc
->u
.a
.howto
= bfd_reloc_type_lookup (stdoutput
,
4398 bfd_relocs
[i
].code
);
4403 reloc
->u
.a
.howto
= bfd_reloc_name_lookup (stdoutput
, r_name
);
4404 *input_line_pointer
= c
;
4405 if (reloc
->u
.a
.howto
== NULL
)
4407 as_bad (_("unrecognized reloc type"));
4411 exp
.X_op
= O_absent
;
4412 SKIP_WHITESPACE_AFTER_NAME ();
4413 if (*input_line_pointer
== ',')
4415 ++input_line_pointer
;
4423 as_bad (_("bad reloc expression"));
4425 ignore_rest_of_line ();
4428 mri_comment_end (stop
, stopc
);
4431 reloc
->u
.a
.sym
= NULL
;
4432 reloc
->u
.a
.addend
= 0;
4435 reloc
->u
.a
.sym
= NULL
;
4436 reloc
->u
.a
.addend
= exp
.X_add_number
;
4439 reloc
->u
.a
.sym
= exp
.X_add_symbol
;
4440 reloc
->u
.a
.addend
= exp
.X_add_number
;
4443 reloc
->u
.a
.sym
= make_expr_symbol (&exp
);
4444 reloc
->u
.a
.addend
= 0;
4448 reloc
->file
= as_where (&reloc
->line
);
4449 reloc
->next
= reloc_list
;
4452 demand_empty_rest_of_line ();
4454 mri_comment_end (stop
, stopc
);
4457 /* Put the contents of expression EXP into the object file using
4458 NBYTES bytes. If need_pass_2 is 1, this does nothing. */
4461 emit_expr (expressionS
*exp
, unsigned int nbytes
)
4463 emit_expr_with_reloc (exp
, nbytes
, TC_PARSE_CONS_RETURN_NONE
);
4467 emit_expr_with_reloc (expressionS
*exp
,
4468 unsigned int nbytes
,
4469 TC_PARSE_CONS_RETURN_TYPE reloc
)
4473 valueT extra_digit
= 0;
4475 /* Don't do anything if we are going to make another pass. */
4480 dot_value
= frag_now_fix ();
4481 dot_frag
= frag_now
;
4485 /* When gcc emits DWARF 1 debugging pseudo-ops, a line number will
4486 appear as a four byte positive constant in the .line section,
4487 followed by a 2 byte 0xffff. Look for that case here. */
4488 if (strcmp (segment_name (now_seg
), ".line") != 0)
4490 else if (dwarf_line
>= 0
4492 && exp
->X_op
== O_constant
4493 && (exp
->X_add_number
== -1 || exp
->X_add_number
== 0xffff))
4494 listing_source_line ((unsigned int) dwarf_line
);
4495 else if (nbytes
== 4
4496 && exp
->X_op
== O_constant
4497 && exp
->X_add_number
>= 0)
4498 dwarf_line
= exp
->X_add_number
;
4502 /* When gcc emits DWARF 1 debugging pseudo-ops, a file name will
4503 appear as a 2 byte TAG_compile_unit (0x11) followed by a 2 byte
4504 AT_sibling (0x12) followed by a four byte address of the sibling
4505 followed by a 2 byte AT_name (0x38) followed by the name of the
4506 file. We look for that case here. */
4507 if (strcmp (segment_name (now_seg
), ".debug") != 0)
4509 else if (dwarf_file
== 0
4511 && exp
->X_op
== O_constant
4512 && exp
->X_add_number
== 0x11)
4514 else if (dwarf_file
== 1
4516 && exp
->X_op
== O_constant
4517 && exp
->X_add_number
== 0x12)
4519 else if (dwarf_file
== 2
4522 else if (dwarf_file
== 3
4524 && exp
->X_op
== O_constant
4525 && exp
->X_add_number
== 0x38)
4530 /* The variable dwarf_file_string tells stringer that the string
4531 may be the name of the source file. */
4532 if (dwarf_file
== 4)
4533 dwarf_file_string
= 1;
4535 dwarf_file_string
= 0;
4539 if (check_eh_frame (exp
, &nbytes
))
4544 /* Handle a negative bignum. */
4546 && exp
->X_add_number
== 0
4547 && symbol_get_value_expression (exp
->X_add_symbol
)->X_op
== O_big
4548 && symbol_get_value_expression (exp
->X_add_symbol
)->X_add_number
> 0)
4551 unsigned long carry
;
4553 exp
= symbol_get_value_expression (exp
->X_add_symbol
);
4555 /* Negate the bignum: one's complement each digit and add 1. */
4557 for (i
= 0; i
< exp
->X_add_number
; i
++)
4561 next
= (((~(generic_bignum
[i
] & LITTLENUM_MASK
))
4564 generic_bignum
[i
] = next
& LITTLENUM_MASK
;
4565 carry
= next
>> LITTLENUM_NUMBER_OF_BITS
;
4568 /* We can ignore any carry out, because it will be handled by
4569 extra_digit if it is needed. */
4571 extra_digit
= (valueT
) -1;
4575 if (op
== O_absent
|| op
== O_illegal
)
4577 as_warn (_("zero assumed for missing expression"));
4578 exp
->X_add_number
= 0;
4581 else if (op
== O_big
&& exp
->X_add_number
<= 0)
4583 as_bad (_("floating point number invalid"));
4584 exp
->X_add_number
= 0;
4587 else if (op
== O_register
)
4589 as_warn (_("register value used as expression"));
4593 /* Allow `.word 0' in the absolute section. */
4594 if (now_seg
== absolute_section
)
4596 if (op
!= O_constant
|| exp
->X_add_number
!= 0)
4597 as_bad (_("attempt to store value in absolute section"));
4598 abs_section_offset
+= nbytes
;
4602 /* Allow `.word 0' in BSS style sections. */
4603 if ((op
!= O_constant
|| exp
->X_add_number
!= 0) && in_bss ())
4604 as_bad (_("attempt to store non-zero value in section `%s'"),
4605 segment_name (now_seg
));
4607 p
= frag_more ((int) nbytes
);
4609 if (reloc
!= TC_PARSE_CONS_RETURN_NONE
)
4611 emit_expr_fix (exp
, nbytes
, frag_now
, p
, reloc
);
4615 #ifndef WORKING_DOT_WORD
4616 /* If we have the difference of two symbols in a word, save it on
4617 the broken_words list. See the code in write.c. */
4618 if (op
== O_subtract
&& nbytes
== 2)
4620 struct broken_word
*x
;
4622 x
= XNEW (struct broken_word
);
4623 x
->next_broken_word
= broken_words
;
4626 x
->subseg
= now_subseg
;
4628 x
->word_goes_here
= p
;
4630 x
->add
= exp
->X_add_symbol
;
4631 x
->sub
= exp
->X_op_symbol
;
4632 x
->addnum
= exp
->X_add_number
;
4640 /* If we have an integer, but the number of bytes is too large to
4641 pass to md_number_to_chars, handle it as a bignum. */
4642 if (op
== O_constant
&& nbytes
> sizeof (valueT
))
4644 extra_digit
= exp
->X_unsigned
? 0 : -1;
4645 convert_to_bignum (exp
, !exp
->X_unsigned
);
4649 if (op
== O_constant
)
4656 /* JF << of >= number of bits in the object is undefined. In
4657 particular SPARC (Sun 4) has problems. */
4658 if (nbytes
>= sizeof (valueT
))
4660 know (nbytes
== sizeof (valueT
));
4665 /* Don't store these bits. */
4666 mask
= ~(valueT
) 0 << (BITS_PER_CHAR
* nbytes
);
4669 unmask
= ~mask
; /* Do store these bits. */
4672 "Do this mod if you want every overflow check to assume SIGNED 2's complement data.";
4673 mask
= ~(unmask
>> 1); /* Includes sign bit now. */
4676 get
= exp
->X_add_number
;
4678 if ((get
& mask
) != 0 && (-get
& mask
) != 0)
4680 /* Leading bits contain both 0s & 1s. */
4681 as_warn (_("value 0x%" PRIx64
" truncated to 0x%" PRIx64
),
4682 (uint64_t) get
, (uint64_t) use
);
4684 /* Put bytes in right order. */
4685 md_number_to_chars (p
, use
, (int) nbytes
);
4687 else if (op
== O_big
)
4690 LITTLENUM_TYPE
*nums
;
4692 size
= exp
->X_add_number
* CHARS_PER_LITTLENUM
;
4695 int i
= nbytes
/ CHARS_PER_LITTLENUM
;
4699 LITTLENUM_TYPE sign
= 0;
4700 if ((generic_bignum
[--i
]
4701 & (1 << (LITTLENUM_NUMBER_OF_BITS
- 1))) != 0)
4702 sign
= ~(LITTLENUM_TYPE
) 0;
4704 while (++i
< exp
->X_add_number
)
4705 if (generic_bignum
[i
] != sign
)
4708 else if (nbytes
== 1)
4710 /* We have nbytes == 1 and CHARS_PER_LITTLENUM == 2 (probably).
4711 Check that bits 8.. of generic_bignum[0] match bit 7
4712 and that they match all of generic_bignum[1..exp->X_add_number]. */
4713 LITTLENUM_TYPE sign
= (generic_bignum
[0] & (1 << 7)) ? -1 : 0;
4714 LITTLENUM_TYPE himask
= LITTLENUM_MASK
& ~ 0xFF;
4716 if ((generic_bignum
[0] & himask
) == (sign
& himask
))
4718 while (++i
< exp
->X_add_number
)
4719 if (generic_bignum
[i
] != sign
)
4724 if (i
< exp
->X_add_number
)
4725 as_warn (ngettext ("bignum truncated to %d byte",
4726 "bignum truncated to %d bytes",
4734 md_number_to_chars (p
, (valueT
) generic_bignum
[0], 1);
4737 know (nbytes
% CHARS_PER_LITTLENUM
== 0);
4739 if (target_big_endian
)
4741 while (nbytes
> size
)
4743 md_number_to_chars (p
, extra_digit
, CHARS_PER_LITTLENUM
);
4744 nbytes
-= CHARS_PER_LITTLENUM
;
4745 p
+= CHARS_PER_LITTLENUM
;
4748 nums
= generic_bignum
+ size
/ CHARS_PER_LITTLENUM
;
4749 while (size
>= CHARS_PER_LITTLENUM
)
4752 md_number_to_chars (p
, (valueT
) *nums
, CHARS_PER_LITTLENUM
);
4753 size
-= CHARS_PER_LITTLENUM
;
4754 p
+= CHARS_PER_LITTLENUM
;
4759 nums
= generic_bignum
;
4760 while (size
>= CHARS_PER_LITTLENUM
)
4762 md_number_to_chars (p
, (valueT
) *nums
, CHARS_PER_LITTLENUM
);
4764 size
-= CHARS_PER_LITTLENUM
;
4765 p
+= CHARS_PER_LITTLENUM
;
4766 nbytes
-= CHARS_PER_LITTLENUM
;
4769 while (nbytes
>= CHARS_PER_LITTLENUM
)
4771 md_number_to_chars (p
, extra_digit
, CHARS_PER_LITTLENUM
);
4772 nbytes
-= CHARS_PER_LITTLENUM
;
4773 p
+= CHARS_PER_LITTLENUM
;
4778 emit_expr_fix (exp
, nbytes
, frag_now
, p
, TC_PARSE_CONS_RETURN_NONE
);
4782 emit_expr_fix (expressionS
*exp
, unsigned int nbytes
, fragS
*frag
, char *p
,
4783 TC_PARSE_CONS_RETURN_TYPE r ATTRIBUTE_UNUSED
)
4786 unsigned int size
= nbytes
;
4788 memset (p
, 0, size
);
4790 /* Generate a fixS to record the symbol value. */
4792 #ifdef TC_CONS_FIX_NEW
4793 TC_CONS_FIX_NEW (frag
, p
- frag
->fr_literal
+ offset
, size
, exp
, r
);
4795 if (r
!= TC_PARSE_CONS_RETURN_NONE
)
4797 reloc_howto_type
*reloc_howto
;
4799 reloc_howto
= bfd_reloc_type_lookup (stdoutput
, r
);
4800 size
= bfd_get_reloc_size (reloc_howto
);
4804 as_bad (ngettext ("%s relocations do not fit in %u byte",
4805 "%s relocations do not fit in %u bytes",
4807 reloc_howto
->name
, nbytes
);
4810 else if (target_big_endian
)
4811 offset
= nbytes
- size
;
4832 as_bad (_("unsupported BFD relocation size %u"), size
);
4835 fix_new_exp (frag
, p
- frag
->fr_literal
+ offset
, size
,
4840 /* Handle an MRI style string expression. */
4844 parse_mri_cons (expressionS
*exp
, unsigned int nbytes
)
4846 if (*input_line_pointer
!= '\''
4847 && (input_line_pointer
[1] != '\''
4848 || (*input_line_pointer
!= 'A'
4849 && *input_line_pointer
!= 'E')))
4850 (void) TC_PARSE_CONS_EXPRESSION (exp
, nbytes
);
4854 unsigned int result
= 0;
4856 /* An MRI style string. Cut into as many bytes as will fit into
4857 a nbyte chunk, left justify if necessary, and separate with
4858 commas so we can try again later. */
4859 if (*input_line_pointer
== 'A')
4860 ++input_line_pointer
;
4861 else if (*input_line_pointer
== 'E')
4863 as_bad (_("EBCDIC constants are not supported"));
4864 ++input_line_pointer
;
4867 input_line_pointer
++;
4868 for (scan
= 0; scan
< nbytes
; scan
++)
4870 if (*input_line_pointer
== '\'')
4872 if (input_line_pointer
[1] == '\'')
4874 input_line_pointer
++;
4879 result
= (result
<< 8) | (*input_line_pointer
++);
4883 while (scan
< nbytes
)
4889 /* Create correct expression. */
4890 exp
->X_op
= O_constant
;
4891 exp
->X_add_number
= result
;
4893 /* Fake it so that we can read the next char too. */
4894 if (input_line_pointer
[0] != '\'' ||
4895 (input_line_pointer
[0] == '\'' && input_line_pointer
[1] == '\''))
4897 input_line_pointer
-= 2;
4898 input_line_pointer
[0] = ',';
4899 input_line_pointer
[1] = '\'';
4902 input_line_pointer
++;
4905 #endif /* TC_M68K */
4907 #ifdef REPEAT_CONS_EXPRESSIONS
4909 /* Parse a repeat expression for cons. This is used by the MIPS
4910 assembler. The format is NUMBER:COUNT; NUMBER appears in the
4911 object file COUNT times.
4913 To use this for a target, define REPEAT_CONS_EXPRESSIONS. */
4916 parse_repeat_cons (expressionS
*exp
, unsigned int nbytes
)
4923 if (*input_line_pointer
!= ':')
4925 /* No repeat count. */
4929 ++input_line_pointer
;
4930 expression (&count
);
4931 if (count
.X_op
!= O_constant
4932 || count
.X_add_number
<= 0)
4934 as_warn (_("unresolvable or nonpositive repeat count; using 1"));
4938 /* The cons function is going to output this expression once. So we
4939 output it count - 1 times. */
4940 for (i
= count
.X_add_number
- 1; i
> 0; i
--)
4941 emit_expr (exp
, nbytes
);
4944 #endif /* REPEAT_CONS_EXPRESSIONS */
4946 /* Parse a floating point number represented as a hex constant. This
4947 permits users to specify the exact bits they want in the floating
4951 hex_float (int float_type
, char *bytes
)
4953 int pad
, length
= float_length (float_type
, &pad
);
4959 /* It would be nice if we could go through expression to parse the
4960 hex constant, but if we get a bignum it's a pain to sort it into
4961 the buffer correctly. */
4963 while (hex_p (*input_line_pointer
) || *input_line_pointer
== '_')
4967 /* The MRI assembler accepts arbitrary underscores strewn about
4968 through the hex constant, so we ignore them as well. */
4969 if (*input_line_pointer
== '_')
4971 ++input_line_pointer
;
4977 as_warn (_("floating point constant too large"));
4980 d
= hex_value (*input_line_pointer
) << 4;
4981 ++input_line_pointer
;
4982 while (*input_line_pointer
== '_')
4983 ++input_line_pointer
;
4984 if (hex_p (*input_line_pointer
))
4986 d
+= hex_value (*input_line_pointer
);
4987 ++input_line_pointer
;
4989 if (target_big_endian
)
4992 bytes
[length
- i
- 1] = d
;
4998 if (target_big_endian
)
4999 memset (bytes
+ i
, 0, length
- i
);
5001 memset (bytes
, 0, length
- i
);
5004 memset (bytes
+ length
, 0, pad
);
5006 return length
+ pad
;
5011 CONStruct some more frag chars of .floats .ffloats etc.
5012 Makes 0 or more new frags.
5013 If need_pass_2 == 1, no frags are emitted.
5014 This understands only floating literals, not expressions. Sorry.
5016 A floating constant is defined by atof_generic(), except it is preceded
5017 by 0d 0f 0g or 0h. After observing the STRANGE way my BSD AS does its
5018 reading, I decided to be incompatible. This always tries to give you
5019 rounded bits to the precision of the pseudo-op. Former AS did premature
5020 truncation, restored noisy bits instead of trailing 0s AND gave you
5021 a choice of 2 flavours of noise according to which of 2 floating-point
5022 scanners you directed AS to use.
5024 In: input_line_pointer->whitespace before, or '0' of flonum. */
5027 float_cons (/* Clobbers input_line-pointer, checks end-of-line. */
5028 int float_type
/* 'f':.ffloat ... 'F':.float ... */)
5031 int length
; /* Number of chars in an object. */
5032 char temp
[MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT
];
5034 if (is_it_end_of_statement ())
5036 demand_empty_rest_of_line ();
5040 if (now_seg
== absolute_section
)
5042 as_bad (_("attempt to store float in absolute section"));
5043 ignore_rest_of_line ();
5049 as_bad (_("attempt to store float in section `%s'"),
5050 segment_name (now_seg
));
5051 ignore_rest_of_line ();
5055 #ifdef md_flush_pending_output
5056 md_flush_pending_output ();
5059 #ifdef md_cons_align
5065 length
= parse_one_float (float_type
, temp
);
5075 #ifdef REPEAT_CONS_EXPRESSIONS
5076 if (*input_line_pointer
== ':')
5078 expressionS count_exp
;
5080 ++input_line_pointer
;
5081 expression (&count_exp
);
5083 if (count_exp
.X_op
!= O_constant
5084 || count_exp
.X_add_number
<= 0)
5085 as_warn (_("unresolvable or nonpositive repeat count; using 1"));
5087 count
= count_exp
.X_add_number
;
5091 while (--count
>= 0)
5093 p
= frag_more (length
);
5094 memcpy (p
, temp
, (unsigned int) length
);
5099 while (*input_line_pointer
++ == ',');
5101 /* Put terminator back into stream. */
5102 --input_line_pointer
;
5103 demand_empty_rest_of_line ();
5108 Note - we are using the DWARF standard's definition of LEB128 encoding
5109 where each 7-bit value is a stored in a byte, *not* an octet. This
5110 means that on targets where a byte contains multiple octets there is
5111 a *huge waste of space*. (This also means that we do not have to
5112 have special versions of these functions for when OCTETS_PER_BYTE_POWER
5115 If the 7-bit values were to be packed into N-bit bytes (where N > 8)
5116 we would then have to consider whether multiple, successive LEB128
5117 values should be packed into the bytes without padding (bad idea) or
5118 whether each LEB128 number is padded out to a whole number of bytes.
5119 Plus you have to decide on the endianness of packing octets into a
5122 /* Return the size of a LEB128 value in bytes. */
5124 static inline unsigned int
5125 sizeof_sleb128 (offsetT value
)
5132 byte
= (value
& 0x7f);
5133 /* Sadly, we cannot rely on typical arithmetic right shift behaviour.
5134 Fortunately, we can structure things so that the extra work reduces
5135 to a noop on systems that do things "properly". */
5136 value
= (value
>> 7) | ~(-(offsetT
)1 >> 7);
5139 while (!(((value
== 0) && ((byte
& 0x40) == 0))
5140 || ((value
== -1) && ((byte
& 0x40) != 0))));
5145 static inline unsigned int
5146 sizeof_uleb128 (valueT value
)
5161 sizeof_leb128 (valueT value
, int sign
)
5164 return sizeof_sleb128 ((offsetT
) value
);
5166 return sizeof_uleb128 (value
);
5169 /* Output a LEB128 value. Returns the number of bytes used. */
5171 static inline unsigned int
5172 output_sleb128 (char *p
, offsetT value
)
5179 unsigned byte
= (value
& 0x7f);
5181 /* Sadly, we cannot rely on typical arithmetic right shift behaviour.
5182 Fortunately, we can structure things so that the extra work reduces
5183 to a noop on systems that do things "properly". */
5184 value
= (value
>> 7) | ~(-(offsetT
)1 >> 7);
5186 more
= !((((value
== 0) && ((byte
& 0x40) == 0))
5187 || ((value
== -1) && ((byte
& 0x40) != 0))));
5198 static inline unsigned int
5199 output_uleb128 (char *p
, valueT value
)
5205 unsigned byte
= (value
& 0x7f);
5209 /* More bytes to follow. */
5220 output_leb128 (char *p
, valueT value
, int sign
)
5223 return output_sleb128 (p
, (offsetT
) value
);
5225 return output_uleb128 (p
, value
);
5228 /* Do the same for bignums. We combine sizeof with output here in that
5229 we don't output for NULL values of P. It isn't really as critical as
5230 for "normal" values that this be streamlined. Returns the number of
5233 static inline unsigned int
5234 output_big_sleb128 (char *p
, LITTLENUM_TYPE
*bignum
, unsigned int size
)
5241 /* Strip leading sign extensions off the bignum. */
5243 && bignum
[size
- 1] == LITTLENUM_MASK
5244 && bignum
[size
- 2] > LITTLENUM_MASK
/ 2)
5249 /* OR in the next part of the littlenum. */
5250 val
|= (*bignum
<< loaded
);
5251 loaded
+= LITTLENUM_NUMBER_OF_BITS
;
5255 /* Add bytes until there are less than 7 bits left in VAL
5256 or until every non-sign bit has been written. */
5263 || val
!= ((byte
& 0x40) == 0 ? 0 : ((valueT
) 1 << loaded
) - 1))
5270 while ((byte
& 0x80) != 0 && loaded
>= 7);
5274 /* Mop up any left-over bits (of which there will be less than 7). */
5275 if ((byte
& 0x80) != 0)
5277 /* Sign-extend VAL. */
5278 if (val
& (1 << (loaded
- 1)))
5279 val
|= ~0U << loaded
;
5288 static inline unsigned int
5289 output_big_uleb128 (char *p
, LITTLENUM_TYPE
*bignum
, unsigned int size
)
5296 /* Strip leading zeros off the bignum. */
5297 /* XXX: Is this needed? */
5298 while (size
> 0 && bignum
[size
- 1] == 0)
5303 if (loaded
< 7 && size
> 0)
5305 val
|= (*bignum
<< loaded
);
5306 loaded
+= 8 * CHARS_PER_LITTLENUM
;
5315 if (size
> 0 || val
)
5322 while (byte
& 0x80);
5328 output_big_leb128 (char *p
, LITTLENUM_TYPE
*bignum
, unsigned int size
, int sign
)
5331 return output_big_sleb128 (p
, bignum
, size
);
5333 return output_big_uleb128 (p
, bignum
, size
);
5336 /* Generate the appropriate fragments for a given expression to emit a
5337 leb128 value. SIGN is 1 for sleb, 0 for uleb. */
5340 emit_leb128_expr (expressionS
*exp
, int sign
)
5342 operatorT op
= exp
->X_op
;
5343 unsigned int nbytes
;
5345 if (op
== O_absent
|| op
== O_illegal
)
5347 as_warn (_("zero assumed for missing expression"));
5348 exp
->X_add_number
= 0;
5351 else if (op
== O_big
&& exp
->X_add_number
<= 0)
5353 as_bad (_("floating point number invalid"));
5354 exp
->X_add_number
= 0;
5357 else if (op
== O_register
)
5359 as_warn (_("register value used as expression"));
5362 else if (op
== O_constant
5364 && (exp
->X_add_number
< 0) == !exp
->X_extrabit
)
5366 /* We're outputting a signed leb128 and the sign of X_add_number
5367 doesn't reflect the sign of the original value. Convert EXP
5368 to a correctly-extended bignum instead. */
5369 convert_to_bignum (exp
, exp
->X_extrabit
);
5373 if (now_seg
== absolute_section
)
5375 if (op
!= O_constant
|| exp
->X_add_number
!= 0)
5376 as_bad (_("attempt to store value in absolute section"));
5377 abs_section_offset
++;
5381 if ((op
!= O_constant
|| exp
->X_add_number
!= 0) && in_bss ())
5382 as_bad (_("attempt to store non-zero value in section `%s'"),
5383 segment_name (now_seg
));
5385 /* Let check_eh_frame know that data is being emitted. nbytes == -1 is
5386 a signal that this is leb128 data. It shouldn't optimize this away. */
5387 nbytes
= (unsigned int) -1;
5388 if (check_eh_frame (exp
, &nbytes
))
5391 /* Let the backend know that subsequent data may be byte aligned. */
5392 #ifdef md_cons_align
5396 if (op
== O_constant
)
5398 /* If we've got a constant, emit the thing directly right now. */
5400 valueT value
= exp
->X_add_number
;
5404 size
= sizeof_leb128 (value
, sign
);
5405 p
= frag_more (size
);
5406 if (output_leb128 (p
, value
, sign
) > size
)
5409 else if (op
== O_big
)
5411 /* O_big is a different sort of constant. */
5412 int nbr_digits
= exp
->X_add_number
;
5416 /* If the leading littenum is 0xffff, prepend a 0 to avoid confusion with
5417 a signed number. Unary operators like - or ~ always extend the
5418 bignum to its largest size. */
5420 && nbr_digits
< SIZE_OF_LARGE_NUMBER
5421 && generic_bignum
[nbr_digits
- 1] == LITTLENUM_MASK
)
5422 generic_bignum
[nbr_digits
++] = 0;
5424 size
= output_big_leb128 (NULL
, generic_bignum
, nbr_digits
, sign
);
5425 p
= frag_more (size
);
5426 if (output_big_leb128 (p
, generic_bignum
, nbr_digits
, sign
) > size
)
5431 /* Otherwise, we have to create a variable sized fragment and
5432 resolve things later. */
5434 frag_var (rs_leb128
, sizeof_uleb128 (~(valueT
) 0), 0, sign
,
5435 make_expr_symbol (exp
), 0, (char *) NULL
);
5439 /* Parse the .sleb128 and .uleb128 pseudos. */
5446 #ifdef md_flush_pending_output
5447 md_flush_pending_output ();
5453 emit_leb128_expr (&exp
, sign
);
5455 while (*input_line_pointer
++ == ',');
5457 input_line_pointer
--;
5458 demand_empty_rest_of_line ();
5461 /* Code for handling base64 encoded strings.
5462 Based upon code in sharutils' lib/base64.c source file, written by
5463 Simon Josefsson. Which was partially adapted from GNU MailUtils
5464 (mailbox/filter_trans.c, as of 2004-11-28) and improved by review
5465 from Paul Eggert, Bruno Haible, and Stepan Kasal. */
5534 static const signed char b64
[0x100] =
5536 B64 (0), B64 (1), B64 (2), B64 (3),
5537 B64 (4), B64 (5), B64 (6), B64 (7),
5538 B64 (8), B64 (9), B64 (10), B64 (11),
5539 B64 (12), B64 (13), B64 (14), B64 (15),
5540 B64 (16), B64 (17), B64 (18), B64 (19),
5541 B64 (20), B64 (21), B64 (22), B64 (23),
5542 B64 (24), B64 (25), B64 (26), B64 (27),
5543 B64 (28), B64 (29), B64 (30), B64 (31),
5544 B64 (32), B64 (33), B64 (34), B64 (35),
5545 B64 (36), B64 (37), B64 (38), B64 (39),
5546 B64 (40), B64 (41), B64 (42), B64 (43),
5547 B64 (44), B64 (45), B64 (46), B64 (47),
5548 B64 (48), B64 (49), B64 (50), B64 (51),
5549 B64 (52), B64 (53), B64 (54), B64 (55),
5550 B64 (56), B64 (57), B64 (58), B64 (59),
5551 B64 (60), B64 (61), B64 (62), B64 (63),
5552 B64 (64), B64 (65), B64 (66), B64 (67),
5553 B64 (68), B64 (69), B64 (70), B64 (71),
5554 B64 (72), B64 (73), B64 (74), B64 (75),
5555 B64 (76), B64 (77), B64 (78), B64 (79),
5556 B64 (80), B64 (81), B64 (82), B64 (83),
5557 B64 (84), B64 (85), B64 (86), B64 (87),
5558 B64 (88), B64 (89), B64 (90), B64 (91),
5559 B64 (92), B64 (93), B64 (94), B64 (95),
5560 B64 (96), B64 (97), B64 (98), B64 (99),
5561 B64 (100), B64 (101), B64 (102), B64 (103),
5562 B64 (104), B64 (105), B64 (106), B64 (107),
5563 B64 (108), B64 (109), B64 (110), B64 (111),
5564 B64 (112), B64 (113), B64 (114), B64 (115),
5565 B64 (116), B64 (117), B64 (118), B64 (119),
5566 B64 (120), B64 (121), B64 (122), B64 (123),
5567 B64 (124), B64 (125), B64 (126), B64 (127),
5568 B64 (128), B64 (129), B64 (130), B64 (131),
5569 B64 (132), B64 (133), B64 (134), B64 (135),
5570 B64 (136), B64 (137), B64 (138), B64 (139),
5571 B64 (140), B64 (141), B64 (142), B64 (143),
5572 B64 (144), B64 (145), B64 (146), B64 (147),
5573 B64 (148), B64 (149), B64 (150), B64 (151),
5574 B64 (152), B64 (153), B64 (154), B64 (155),
5575 B64 (156), B64 (157), B64 (158), B64 (159),
5576 B64 (160), B64 (161), B64 (162), B64 (163),
5577 B64 (164), B64 (165), B64 (166), B64 (167),
5578 B64 (168), B64 (169), B64 (170), B64 (171),
5579 B64 (172), B64 (173), B64 (174), B64 (175),
5580 B64 (176), B64 (177), B64 (178), B64 (179),
5581 B64 (180), B64 (181), B64 (182), B64 (183),
5582 B64 (184), B64 (185), B64 (186), B64 (187),
5583 B64 (188), B64 (189), B64 (190), B64 (191),
5584 B64 (192), B64 (193), B64 (194), B64 (195),
5585 B64 (196), B64 (197), B64 (198), B64 (199),
5586 B64 (200), B64 (201), B64 (202), B64 (203),
5587 B64 (204), B64 (205), B64 (206), B64 (207),
5588 B64 (208), B64 (209), B64 (210), B64 (211),
5589 B64 (212), B64 (213), B64 (214), B64 (215),
5590 B64 (216), B64 (217), B64 (218), B64 (219),
5591 B64 (220), B64 (221), B64 (222), B64 (223),
5592 B64 (224), B64 (225), B64 (226), B64 (227),
5593 B64 (228), B64 (229), B64 (230), B64 (231),
5594 B64 (232), B64 (233), B64 (234), B64 (235),
5595 B64 (236), B64 (237), B64 (238), B64 (239),
5596 B64 (240), B64 (241), B64 (242), B64 (243),
5597 B64 (244), B64 (245), B64 (246), B64 (247),
5598 B64 (248), B64 (249), B64 (250), B64 (251),
5599 B64 (252), B64 (253), B64 (254), B64 (255)
5603 is_base64_char (unsigned int c
)
5605 return (c
< 0x100) && (b64
[c
] != -1);
5609 decode_base64_and_append (unsigned int b
[4], int len
)
5611 gas_assert (len
> 1);
5613 FRAG_APPEND_1_CHAR ((b64
[b
[0]] << 2) | (b64
[b
[1]] >> 4));
5616 return; /* FIXME: Check for unused bits in b[1] ? */
5618 FRAG_APPEND_1_CHAR (((b64
[b
[1]] << 4) & 0xf0) | (b64
[b
[2]] >> 2));
5621 return; /* FIXME: Check for unused bits in b[2] ? */
5623 FRAG_APPEND_1_CHAR (((b64
[b
[2]] << 6) & 0xc0) | b64
[b
[3]]);
5626 /* Accept one or more comma separated, base64 encoded strings. Decode them
5627 and store them at the current point in the current section. The strings
5628 must be enclosed in double quotes. Line breaks, quoted characters and
5629 escaped characters are not allowed. Only the characters "A-Za-z0-9+/" are
5630 accepted inside the string. The string must be a multiple of four
5631 characters in length. If the encoded string does not fit this requirement
5632 it may use one or more '=' characters at the end as padding. */
5635 s_base64 (int dummy ATTRIBUTE_UNUSED
)
5638 unsigned long num_octets
= 0;
5640 /* If we have been switched into the abs_section then we
5641 will not have an obstack onto which we can hang strings. */
5642 if (now_seg
== absolute_section
)
5644 as_bad (_("base64 strings must be placed into a section"));
5645 ignore_rest_of_line ();
5649 if (is_it_end_of_statement ())
5651 as_bad (_("a string must follow the .base64 pseudo-op"));
5655 #ifdef md_flush_pending_output
5656 md_flush_pending_output ();
5659 #ifdef md_cons_align
5665 SKIP_ALL_WHITESPACE ();
5667 c
= * input_line_pointer
++;
5671 as_bad (_("expected double quote enclosed string as argument to .base64 pseudo-op"));
5672 ignore_rest_of_line ();
5676 /* Read a block of four base64 encoded characters. */
5679 bool seen_equals
= false;
5682 for (i
= 0; i
< 4; i
++)
5684 c
= * input_line_pointer
++;
5686 if (c
>= 256 || is_end_of_line
[c
])
5688 as_bad (_("end of line encountered inside .base64 string"));
5689 ignore_rest_of_line ();
5695 /* We allow this. But only if there were enough
5696 characters to form a valid base64 encoding. */
5699 as_warn (_(".base64 string terminated early"));
5700 -- input_line_pointer
;
5704 as_bad (_(".base64 string terminated unexpectedly"));
5705 ignore_rest_of_line ();
5709 if (seen_equals
&& c
!= '=')
5711 as_bad (_("equals character only allowed at end of .base64 string"));
5712 ignore_rest_of_line ();
5720 as_bad (_("the equals character cannot start a block of four base64 encoded bytes"));
5721 ignore_rest_of_line ();
5726 as_bad (_("the equals character cannot be the second character in a block of four base64 encoded bytes"));
5727 ignore_rest_of_line ();
5733 else if (! is_base64_char (c
))
5736 as_bad (_("invalid character '%c' found inside .base64 string"), c
);
5738 as_bad (_("invalid character %#x found inside .base64 string"), c
);
5739 ignore_rest_of_line ();
5746 if (seen_equals
&& i
== 4)
5753 /* We have a block of up to four valid base64 encoded bytes. */
5754 decode_base64_and_append (b
, i
);
5755 num_octets
+= (i
- 1);
5757 /* Check the next character. */
5758 c
= * input_line_pointer
++;
5760 if (is_base64_char (c
))
5764 as_bad (_("no base64 characters expected after '=' padding characters"));
5765 ignore_rest_of_line ();
5769 -- input_line_pointer
;
5774 as_bad (_(".base64 string must have a terminating double quote character"));
5775 ignore_rest_of_line ();
5779 SKIP_ALL_WHITESPACE ();
5781 c
= * input_line_pointer
++;
5785 /* Make sure that we have not skipped the EOL marker. */
5786 -- input_line_pointer
;
5788 while (num_octets
% OCTETS_PER_BYTE
)
5790 /* We have finished emiting the octets for this .base64 pseudo-op, but
5791 we have not filled up enough bytes for the target architecture. So
5792 we emit padding octets here. This is done after all of the arguments
5793 to the pseudo-op have been processed, rather than at the end of each
5794 argument, as it is likely that the user wants the arguments to be
5796 FRAG_APPEND_1_CHAR (0);
5800 demand_empty_rest_of_line ();
5804 stringer_append_char (int c
, int bitsize
)
5807 as_bad (_("attempt to store non-empty string in section `%s'"),
5808 segment_name (now_seg
));
5810 if (!target_big_endian
)
5811 FRAG_APPEND_1_CHAR (c
);
5816 FRAG_APPEND_1_CHAR (0);
5817 FRAG_APPEND_1_CHAR (0);
5818 FRAG_APPEND_1_CHAR (0);
5819 FRAG_APPEND_1_CHAR (0);
5822 FRAG_APPEND_1_CHAR (0);
5823 FRAG_APPEND_1_CHAR (0);
5826 FRAG_APPEND_1_CHAR (0);
5831 /* Called with invalid bitsize argument. */
5835 if (target_big_endian
)
5836 FRAG_APPEND_1_CHAR (c
);
5839 /* Worker to do .ascii etc statements.
5840 Reads 0 or more ',' separated, double-quoted strings.
5841 Caller should have checked need_pass_2 is FALSE because we don't
5843 Checks for end-of-line.
5844 BITS_APPENDZERO says how many bits are in a target char.
5845 The bottom bit is set if a NUL char should be appended to the strings. */
5848 stringer (int bits_appendzero
)
5850 const int bitsize
= bits_appendzero
& ~7;
5851 const int append_zero
= bits_appendzero
& 1;
5853 #if !defined(NO_LISTING) && defined (OBJ_ELF)
5857 #ifdef md_flush_pending_output
5858 md_flush_pending_output ();
5861 #ifdef md_cons_align
5865 /* If we have been switched into the abs_section then we
5866 will not have an obstack onto which we can hang strings. */
5867 if (now_seg
== absolute_section
)
5869 as_bad (_("strings must be placed into a section"));
5870 ignore_rest_of_line ();
5874 /* The following awkward logic is to parse ZERO or more strings,
5875 comma separated. Recall a string expression includes spaces
5876 before the opening '\"' and spaces after the closing '\"'.
5877 We fake a leading ',' if there is (supposed to be)
5878 a 1st, expression. We keep demanding expressions for each ','. */
5879 if (is_it_end_of_statement ())
5881 c
= 0; /* Skip loop. */
5882 ++input_line_pointer
; /* Compensate for end of loop. */
5886 c
= ','; /* Do loop. */
5889 while (c
== ',' || c
== '<' || c
== '"')
5892 switch (*input_line_pointer
)
5895 ++input_line_pointer
; /*->1st char of string. */
5896 #if !defined(NO_LISTING) && defined (OBJ_ELF)
5897 start
= input_line_pointer
;
5900 while (is_a_char (c
= next_char_of_string ()))
5901 stringer_append_char (c
, bitsize
);
5903 /* Treat "a" "b" as "ab". Even if we are appending zeros. */
5904 SKIP_ALL_WHITESPACE ();
5905 if (*input_line_pointer
== '"')
5909 stringer_append_char (0, bitsize
);
5911 #if !defined(NO_LISTING) && defined (OBJ_ELF)
5912 /* In ELF, when gcc is emitting DWARF 1 debugging output, it
5913 will emit .string with a filename in the .debug section
5914 after a sequence of constants. See the comment in
5915 emit_expr for the sequence. emit_expr will set
5916 dwarf_file_string to non-zero if this string might be a
5917 source file name. */
5918 if (strcmp (segment_name (now_seg
), ".debug") != 0)
5919 dwarf_file_string
= 0;
5920 else if (dwarf_file_string
)
5922 c
= input_line_pointer
[-1];
5923 input_line_pointer
[-1] = '\0';
5924 listing_source_file (start
);
5925 input_line_pointer
[-1] = c
;
5931 input_line_pointer
++;
5932 c
= get_single_number ();
5933 stringer_append_char (c
, bitsize
);
5934 if (*input_line_pointer
!= '>')
5936 as_bad (_("expected <nn>"));
5937 ignore_rest_of_line ();
5940 input_line_pointer
++;
5943 input_line_pointer
++;
5947 c
= *input_line_pointer
;
5950 demand_empty_rest_of_line ();
5953 /* FIXME-SOMEDAY: I had trouble here on characters with the
5954 high bits set. We'll probably also have trouble with
5955 multibyte chars, wide chars, etc. Also be careful about
5956 returning values bigger than 1 byte. xoxorich. */
5959 next_char_of_string (void)
5963 c
= *input_line_pointer
++ & CHAR_MASK
;
5967 /* PR 20902: Do not advance past the end of the buffer. */
5968 -- input_line_pointer
;
5977 as_warn (_("unterminated string; newline inserted"));
5978 bump_line_counters ();
5982 if (!TC_STRING_ESCAPES
)
5984 switch (c
= *input_line_pointer
++ & CHAR_MASK
)
6012 break; /* As itself. */
6028 for (i
= 0, number
= 0;
6029 ISDIGIT (c
) && i
< 3;
6030 c
= *input_line_pointer
++, i
++)
6032 number
= number
* 8 + c
- '0';
6035 c
= number
& CHAR_MASK
;
6037 --input_line_pointer
;
6046 c
= *input_line_pointer
++;
6047 while (ISXDIGIT (c
))
6050 number
= number
* 16 + c
- '0';
6051 else if (ISUPPER (c
))
6052 number
= number
* 16 + c
- 'A' + 10;
6054 number
= number
* 16 + c
- 'a' + 10;
6055 c
= *input_line_pointer
++;
6057 c
= number
& CHAR_MASK
;
6058 --input_line_pointer
;
6063 /* To be compatible with BSD 4.2 as: give the luser a linefeed!! */
6064 as_warn (_("unterminated string; newline inserted"));
6066 bump_line_counters ();
6070 /* Do not advance past the end of the buffer. */
6071 -- input_line_pointer
;
6077 #ifdef ONLY_STANDARD_ESCAPES
6078 as_bad (_("bad escaped character in string"));
6080 #endif /* ONLY_STANDARD_ESCAPES */
6093 get_segmented_expression (expressionS
*expP
)
6097 retval
= expression (expP
);
6098 if (expP
->X_op
== O_illegal
6099 || expP
->X_op
== O_absent
6100 || expP
->X_op
== O_big
)
6102 as_bad (_("expected address expression"));
6103 expP
->X_op
= O_constant
;
6104 expP
->X_add_number
= 0;
6105 retval
= absolute_section
;
6111 get_known_segmented_expression (expressionS
*expP
)
6113 segT retval
= get_segmented_expression (expP
);
6115 if (retval
== undefined_section
)
6117 /* There is no easy way to extract the undefined symbol from the
6119 if (expP
->X_add_symbol
!= NULL
6120 && S_GET_SEGMENT (expP
->X_add_symbol
) != expr_section
)
6121 as_warn (_("symbol \"%s\" undefined; zero assumed"),
6122 S_GET_NAME (expP
->X_add_symbol
));
6124 as_warn (_("some symbol undefined; zero assumed"));
6125 retval
= absolute_section
;
6126 expP
->X_op
= O_constant
;
6127 expP
->X_add_number
= 0;
6132 char /* Return terminator. */
6133 get_absolute_expression_and_terminator (long *val_pointer
/* Return value of expression. */)
6135 /* FIXME: val_pointer should probably be offsetT *. */
6136 *val_pointer
= (long) get_absolute_expression ();
6137 return (*input_line_pointer
++);
6140 /* Like demand_copy_string, but return NULL if the string contains any '\0's.
6141 Give a warning if that happens. */
6144 demand_copy_C_string (int *len_pointer
)
6148 if ((s
= demand_copy_string (len_pointer
)) != 0)
6152 for (len
= *len_pointer
; len
> 0; len
--)
6154 if (s
[len
- 1] == 0)
6158 as_bad (_("this string may not contain \'\\0\'"));
6167 /* Demand string, but return a safe (=private) copy of the string.
6168 Return NULL if we can't read a string here. */
6171 demand_copy_string (int *lenP
)
6179 if (*input_line_pointer
== '\"')
6181 input_line_pointer
++; /* Skip opening quote. */
6183 while (is_a_char (c
= next_char_of_string ()))
6185 obstack_1grow (¬es
, c
);
6188 /* JF this next line is so demand_copy_C_string will return a
6189 null terminated string. */
6190 obstack_1grow (¬es
, '\0');
6191 retval
= (char *) obstack_finish (¬es
);
6195 as_bad (_("missing string"));
6197 ignore_rest_of_line ();
6203 /* In: Input_line_pointer->next character.
6205 Do: Skip input_line_pointer over all whitespace.
6207 Out: 1 if input_line_pointer->end-of-line. */
6210 is_it_end_of_statement (void)
6213 return (is_end_of_line
[(unsigned char) *input_line_pointer
]);
6217 equals (char *sym_name
, int reassign
)
6222 input_line_pointer
++;
6223 if (*input_line_pointer
== '=')
6224 input_line_pointer
++;
6225 if (reassign
< 0 && *input_line_pointer
== '=')
6226 input_line_pointer
++;
6228 while (*input_line_pointer
== ' ' || *input_line_pointer
== '\t')
6229 input_line_pointer
++;
6232 stop
= mri_comment_field (&stopc
);
6234 assign_symbol (sym_name
, reassign
>= 0 ? !reassign
: reassign
);
6238 demand_empty_rest_of_line ();
6239 mri_comment_end (stop
, stopc
);
6243 /* Open FILENAME, first trying the unadorned file name, then if that
6244 fails and the file name is not an absolute path, attempt to open
6245 the file in current -I include paths. PATH is a preallocated
6246 buffer which will be set to the file opened, or FILENAME if no file
6250 search_and_open (const char *filename
, char *path
)
6252 FILE *f
= fopen (filename
, FOPEN_RB
);
6253 if (f
== NULL
&& !IS_ABSOLUTE_PATH (filename
))
6255 for (size_t i
= 0; i
< include_dir_count
; i
++)
6257 sprintf (path
, "%s/%s", include_dirs
[i
], filename
);
6258 f
= fopen (path
, FOPEN_RB
);
6263 strcpy (path
, filename
);
6267 /* .incbin -- include a file verbatim at the current location. */
6270 s_incbin (int x ATTRIBUTE_UNUSED
)
6281 #ifdef md_flush_pending_output
6282 md_flush_pending_output ();
6285 #ifdef md_cons_align
6290 filename
= demand_copy_string (& len
);
6291 if (filename
== NULL
)
6296 /* Look for optional skip and count. */
6297 if (* input_line_pointer
== ',')
6299 ++ input_line_pointer
;
6300 skip
= get_absolute_expression ();
6304 if (* input_line_pointer
== ',')
6306 ++ input_line_pointer
;
6308 count
= get_absolute_expression ();
6310 as_warn (_(".incbin count zero, ignoring `%s'"), filename
);
6316 demand_empty_rest_of_line ();
6318 path
= XNEWVEC (char, len
+ include_dir_maxlen
+ 2);
6319 binfile
= search_and_open (filename
, path
);
6321 if (binfile
== NULL
)
6322 as_bad (_("file not found: %s"), filename
);
6326 struct stat filestat
;
6328 if (fstat (fileno (binfile
), &filestat
) != 0
6329 || ! S_ISREG (filestat
.st_mode
)
6330 || S_ISDIR (filestat
.st_mode
))
6332 as_bad (_("unable to include `%s'"), path
);
6336 register_dependency (path
);
6338 /* Compute the length of the file. */
6339 if (fseek (binfile
, 0, SEEK_END
) != 0)
6341 as_bad (_("seek to end of .incbin file failed `%s'"), path
);
6344 file_len
= ftell (binfile
);
6346 /* If a count was not specified use the remainder of the file. */
6348 count
= file_len
- skip
;
6350 if (skip
< 0 || count
< 0 || file_len
< 0 || skip
+ count
> file_len
)
6352 as_bad (_("skip (%ld) or count (%ld) invalid for file size (%ld)"),
6353 skip
, count
, file_len
);
6357 if (fseek (binfile
, skip
, SEEK_SET
) != 0)
6359 as_bad (_("could not skip to %ld in file `%s'"), skip
, path
);
6363 /* Allocate frag space and store file contents in it. */
6364 binfrag
= frag_more (count
);
6366 bytes
= fread (binfrag
, 1, count
, binfile
);
6368 as_warn (_("truncated file `%s', %ld of %ld bytes read"),
6369 path
, bytes
, count
);
6372 if (binfile
!= NULL
)
6377 /* .include -- include a file at this point. */
6380 s_include (int arg ATTRIBUTE_UNUSED
)
6389 filename
= demand_copy_string (&i
);
6390 if (filename
== NULL
)
6392 /* demand_copy_string has already printed an error and
6393 called ignore_rest_of_line. */
6401 while (!is_end_of_line
[(unsigned char) *input_line_pointer
]
6402 && *input_line_pointer
!= ' '
6403 && *input_line_pointer
!= '\t')
6405 obstack_1grow (¬es
, *input_line_pointer
);
6406 ++input_line_pointer
;
6410 obstack_1grow (¬es
, '\0');
6411 filename
= (char *) obstack_finish (¬es
);
6412 while (!is_end_of_line
[(unsigned char) *input_line_pointer
])
6413 ++input_line_pointer
;
6416 demand_empty_rest_of_line ();
6418 path
= notes_alloc (i
+ include_dir_maxlen
+ 2);
6419 try_file
= search_and_open (filename
, path
);
6423 register_dependency (path
);
6424 input_scrub_insert_file (path
);
6428 init_include_dir (void)
6430 include_dirs
= XNEWVEC (const char *, 1);
6431 include_dirs
[0] = "."; /* Current dir. */
6432 include_dir_count
= 1;
6433 include_dir_maxlen
= 1;
6437 add_include_dir (char *path
)
6439 include_dir_count
++;
6440 include_dirs
= XRESIZEVEC (const char *, include_dirs
, include_dir_count
);
6441 include_dirs
[include_dir_count
- 1] = path
; /* New one. */
6443 size_t i
= strlen (path
);
6444 if (i
> include_dir_maxlen
)
6445 include_dir_maxlen
= i
;
6448 /* Output debugging information to denote the source file. */
6451 generate_file_debug (void)
6453 if (debug_type
== DEBUG_STABS
)
6454 stabs_generate_asm_file ();
6457 /* Output line number debugging information for the current source line. */
6460 generate_lineno_debug (void)
6464 case DEBUG_UNSPECIFIED
:
6469 stabs_generate_asm_lineno ();
6472 ecoff_generate_asm_lineno ();
6475 /* ??? We could here indicate to dwarf2dbg.c that something
6476 has changed. However, since there is additional backend
6477 support that is required (calling dwarf2_emit_insn), we
6478 let dwarf2dbg.c call as_where on its own. */
6480 case DEBUG_CODEVIEW
:
6481 codeview_generate_asm_lineno ();
6486 /* Output debugging information to mark a function entry point or end point.
6487 END_P is zero for .func, and non-zero for .endfunc. */
6492 do_s_func (end_p
, NULL
);
6495 /* Subroutine of s_func so targets can choose a different default prefix.
6496 If DEFAULT_PREFIX is NULL, use the target's "leading char". */
6499 do_s_func (int end_p
, const char *default_prefix
)
6503 if (current_name
== NULL
)
6505 as_bad (_("missing .func"));
6506 ignore_rest_of_line ();
6510 if (debug_type
== DEBUG_STABS
)
6511 stabs_generate_asm_endfunc (current_name
, current_label
);
6513 free (current_name
);
6514 free (current_label
);
6515 current_name
= current_label
= NULL
;
6520 char delim1
, delim2
;
6522 if (current_name
!= NULL
)
6524 as_bad (_(".endfunc missing for previous .func"));
6525 ignore_rest_of_line ();
6529 delim1
= get_symbol_name (& name
);
6530 name
= xstrdup (name
);
6531 *input_line_pointer
= delim1
;
6532 SKIP_WHITESPACE_AFTER_NAME ();
6533 if (*input_line_pointer
!= ',')
6537 if (asprintf (&label
, "%s%s", default_prefix
, name
) == -1)
6538 as_fatal ("%s", xstrerror (errno
));
6542 char leading_char
= bfd_get_symbol_leading_char (stdoutput
);
6543 /* Missing entry point, use function's name with the leading
6547 if (asprintf (&label
, "%c%s", leading_char
, name
) == -1)
6548 as_fatal ("%s", xstrerror (errno
));
6551 label
= xstrdup (name
);
6556 ++input_line_pointer
;
6558 delim2
= get_symbol_name (& label
);
6559 label
= xstrdup (label
);
6560 restore_line_pointer (delim2
);
6563 if (debug_type
== DEBUG_STABS
)
6564 stabs_generate_asm_func (name
, label
);
6566 current_name
= name
;
6567 current_label
= label
;
6570 demand_empty_rest_of_line ();
6573 #ifdef HANDLE_BUNDLE
6576 s_bundle_align_mode (int arg ATTRIBUTE_UNUSED
)
6578 unsigned int align
= get_absolute_expression ();
6580 demand_empty_rest_of_line ();
6582 if (align
> (unsigned int) TC_ALIGN_LIMIT
)
6583 as_fatal (_(".bundle_align_mode alignment too large (maximum %u)"),
6584 (unsigned int) TC_ALIGN_LIMIT
);
6586 if (bundle_lock_frag
!= NULL
)
6588 as_bad (_("cannot change .bundle_align_mode inside .bundle_lock"));
6592 bundle_align_p2
= align
;
6596 s_bundle_lock (int arg ATTRIBUTE_UNUSED
)
6598 demand_empty_rest_of_line ();
6600 if (bundle_align_p2
== 0)
6602 as_bad (_(".bundle_lock is meaningless without .bundle_align_mode"));
6606 if (bundle_lock_depth
== 0)
6608 bundle_lock_frchain
= frchain_now
;
6609 bundle_lock_frag
= start_bundle ();
6611 ++bundle_lock_depth
;
6615 s_bundle_unlock (int arg ATTRIBUTE_UNUSED
)
6619 demand_empty_rest_of_line ();
6621 if (bundle_lock_frag
== NULL
)
6623 as_bad (_(".bundle_unlock without preceding .bundle_lock"));
6627 gas_assert (bundle_align_p2
> 0);
6629 gas_assert (bundle_lock_depth
> 0);
6630 if (--bundle_lock_depth
> 0)
6633 size
= pending_bundle_size (bundle_lock_frag
);
6635 if (size
> 1U << bundle_align_p2
)
6636 as_bad (_(".bundle_lock sequence is %u bytes, "
6637 "but bundle size is only %u bytes"),
6638 size
, 1u << bundle_align_p2
);
6640 finish_bundle (bundle_lock_frag
, size
);
6642 bundle_lock_frag
= NULL
;
6643 bundle_lock_frchain
= NULL
;
6646 #endif /* HANDLE_BUNDLE */
6649 s_ignore (int arg ATTRIBUTE_UNUSED
)
6651 ignore_rest_of_line ();
6655 read_print_statistics (FILE *file
)
6657 htab_print_statistics (file
, "pseudo-op table", po_hash
);
6660 /* Inserts the given line into the input stream.
6662 This call avoids macro/conditionals nesting checking, since the contents of
6663 the line are assumed to replace the contents of a line already scanned.
6665 An appropriate use of this function would be substitution of input lines when
6666 called by md_start_line_hook(). The given line is assumed to already be
6667 properly scrubbed. */
6670 input_scrub_insert_line (const char *line
)
6673 size_t len
= strlen (line
);
6674 sb_build (&newline
, len
);
6675 sb_add_buffer (&newline
, line
, len
);
6676 input_scrub_include_sb (&newline
, input_line_pointer
, expanding_none
);
6678 buffer_limit
= input_scrub_next_buffer (&input_line_pointer
);
6681 /* Insert a file into the input stream; the path must resolve to an actual
6682 file; no include path searching or dependency registering is performed. */
6685 input_scrub_insert_file (char *path
)
6687 input_scrub_include_file (path
, input_line_pointer
);
6688 buffer_limit
= input_scrub_next_buffer (&input_line_pointer
);
6691 /* Find the end of a line, considering quotation and escaping of quotes. */
6693 #if !defined(TC_SINGLE_QUOTE_STRINGS) && defined(SINGLE_QUOTE_STRINGS)
6694 # define TC_SINGLE_QUOTE_STRINGS 1
6698 _find_end_of_line (char *s
, int mri_string
, int insn ATTRIBUTE_UNUSED
,
6701 char inquote
= '\0';
6704 while (!is_end_of_line
[(unsigned char) *s
]
6705 || (inquote
&& !ISCNTRL (*s
))
6706 || (inquote
== '\'' && flag_mri
)
6707 #ifdef TC_EOL_IN_INSN
6708 || (insn
&& TC_EOL_IN_INSN (s
))
6710 /* PR 6926: When we are parsing the body of a macro the sequence
6711 \@ is special - it refers to the invocation count. If the @
6712 character happens to be registered as a line-separator character
6713 by the target, then the is_end_of_line[] test above will have
6714 returned true, but we need to ignore the line separating
6715 semantics in this particular case. */
6716 || (in_macro
&& inescape
&& *s
== '@')
6719 if (mri_string
&& *s
== '\'')
6723 else if (*s
== '\\')
6727 #ifdef TC_SINGLE_QUOTE_STRINGS
6728 || (TC_SINGLE_QUOTE_STRINGS
&& *s
== '\'')
6735 as_warn (_("missing closing `%c'"), inquote
);
6736 if (inescape
&& !ignore_input ())
6737 as_warn (_("stray `\\'"));
6742 find_end_of_line (char *s
, int mri_string
)
6744 return _find_end_of_line (s
, mri_string
, 0, 0);
6747 static char *saved_ilp
;
6748 static char *saved_limit
;
6750 /* Use BUF as a temporary input pointer for calling other functions in this
6751 file. BUF must be a C string, so that its end can be found by strlen.
6752 Also sets the buffer_limit variable (local to this file) so that buffer
6753 overruns should not occur. Saves the current input line pointer so that
6754 it can be restored by calling restore_ilp().
6756 Does not support recursion. */
6759 temp_ilp (char *buf
)
6761 gas_assert (saved_ilp
== NULL
);
6762 gas_assert (buf
!= NULL
);
6764 saved_ilp
= input_line_pointer
;
6765 saved_limit
= buffer_limit
;
6766 /* Prevent the assert in restore_ilp from triggering if
6767 the input_line_pointer has not yet been initialised. */
6768 if (saved_ilp
== NULL
)
6769 saved_limit
= saved_ilp
= (char *) "";
6771 input_line_pointer
= buf
;
6772 buffer_limit
= buf
+ strlen (buf
);
6773 input_from_string
= true;
6776 /* Restore a saved input line pointer. */
6781 gas_assert (saved_ilp
!= NULL
);
6783 input_line_pointer
= saved_ilp
;
6784 buffer_limit
= saved_limit
;
6785 input_from_string
= false;