1 /* read.c - read a source file -
2 Copyright (C) 1986, 87, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99,
3 2000 Free Software Foundation, Inc.
5 This file is part of GAS, the GNU Assembler.
7 GAS is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
12 GAS is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GAS; see the file COPYING. If not, write to the Free
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
23 /* If your chars aren't 8 bits, you will change this a bit.
24 But then, GNU isn't spozed to run on your machine anyway.
25 (RMS is so shortsighted sometimes.) */
26 #define MASK_CHAR (0xFF)
28 #define MASK_CHAR ((int)(unsigned char) -1)
31 /* This is the largest known floating point format (for now). It will
32 grow when we do 4361 style flonums. */
33 #define MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT (16)
35 /* Routines that read assembler source text to build spagetti in memory.
36 Another group of these functions is in the expr.c module. */
49 #ifndef TC_START_LABEL
50 #define TC_START_LABEL(x,y) (x==':')
53 /* Set by the object-format or the target. */
54 #ifndef TC_IMPLICIT_LCOMM_ALIGNMENT
55 #define TC_IMPLICIT_LCOMM_ALIGNMENT(SIZE, P2VAR) \
60 else if ((SIZE) >= 4) \
62 else if ((SIZE) >= 2) \
70 /* The NOP_OPCODE is for the alignment fill value.
71 Fill it a nop instruction so that the disassembler does not choke
74 #define NOP_OPCODE 0x00
77 char *input_line_pointer
; /*->next char of source file to parse. */
79 #if BITS_PER_CHAR != 8
80 /* The following table is indexed by[(char)] and will break if
81 a char does not have exactly 256 states (hopefully 0:255!)! */
86 /* The m88k unfortunately uses @ as a label beginner. */
91 /* The RS/6000 assembler uses {,},[,] as parts of symbol names. */
96 /* The Delta 68k assembler permits % inside label names. */
101 /* The PowerPC Windows NT assemblers permits ? inside label names. */
106 /* The IA-64 assembler uses # as a suffix designating a symbol. We include
107 it in the symbol and strip it out in tc_canonicalize_symbol_name. */
112 /* The a29k assembler does not permits labels to start with $. */
117 /* The Delta 68k assembler permits ~ at start of label names. */
121 /* Used by is_... macros. our ctype[]. */
124 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* @ABCDEFGHIJKLMNO */
125 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* PQRSTUVWXYZ[\]^_ */
126 0, 0, 0, LEX_HASH
, LEX_DOLLAR
, LEX_PCT
, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, /* _!"#$%&'()*+,-./ */
127 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, LEX_QM
, /* 0123456789:;<=>? */
128 LEX_AT
, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* @ABCDEFGHIJKLMNO */
129 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, LEX_BR
, 0, LEX_BR
, 0, 3, /* PQRSTUVWXYZ[\]^_ */
130 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* `abcdefghijklmno */
131 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, LEX_BR
, 0, LEX_BR
, LEX_TILDE
, 0, /* pqrstuvwxyz{|}~. */
132 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
133 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
134 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
135 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
136 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
137 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
138 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
139 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3
143 Out: 1 if this character ends a line. */
144 char is_end_of_line
[256] =
147 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, /* @abcdefghijklmno */
149 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, /* @abcdefghijklmno */
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, /* 0123456789:;<=>? */
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, /* */
157 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
158 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
159 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
160 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
161 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
162 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
163 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
164 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
165 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /* */
168 /* Functions private to this file. */
170 static char *buffer
; /* 1st char of each buffer of lines is here. */
171 static char *buffer_limit
; /*->1 + last char in buffer. */
173 /* TARGET_BYTES_BIG_ENDIAN is required to be defined to either 0 or 1
174 in the tc-<CPU>.h file. See the "Porting GAS" section of the
176 int target_big_endian
= TARGET_BYTES_BIG_ENDIAN
;
178 static char *old_buffer
; /* JF a hack. */
179 static char *old_input
;
180 static char *old_limit
;
182 /* Variables for handling include file directory table. */
184 /* Table of pointers to directories to search for .include's. */
187 /* How many are in the table. */
188 int include_dir_count
;
190 /* Length of longest in table. */
191 int include_dir_maxlen
= 1;
193 #ifndef WORKING_DOT_WORD
194 struct broken_word
*broken_words
;
195 int new_broken_words
;
198 /* The current offset into the absolute section. We don't try to
199 build frags in the absolute section, since no data can be stored
200 there. We just keep track of the current offset. */
201 addressT abs_section_offset
;
203 /* If this line had an MRI style label, it is stored in this variable.
204 This is used by some of the MRI pseudo-ops. */
207 /* This global variable is used to support MRI common sections. We
208 translate such sections into a common symbol. This variable is
209 non-NULL when we are in an MRI common section. */
210 symbolS
*mri_common_symbol
;
212 /* In MRI mode, after a dc.b pseudo-op with an odd number of bytes, we
213 need to align to an even byte boundary unless the next pseudo-op is
214 dc.b, ds.b, or dcb.b. This variable is set to 1 if an alignment
216 static int mri_pending_align
;
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 static void cons_worker
PARAMS ((int, int));
228 static int scrub_from_string
PARAMS ((char *, int));
229 static void do_align
PARAMS ((int, char *, int, int));
230 static void s_align
PARAMS ((int, int));
231 static void s_lcomm_internal
PARAMS ((int, int));
232 static int hex_float
PARAMS ((int, char *));
233 static inline int sizeof_sleb128
PARAMS ((offsetT
));
234 static inline int sizeof_uleb128
PARAMS ((valueT
));
235 static inline int output_sleb128
PARAMS ((char *, offsetT
));
236 static inline int output_uleb128
PARAMS ((char *, valueT
));
237 static inline int output_big_sleb128
PARAMS ((char *, LITTLENUM_TYPE
*, int));
238 static inline int output_big_uleb128
PARAMS ((char *, LITTLENUM_TYPE
*, int));
239 static int output_big_leb128
PARAMS ((char *, LITTLENUM_TYPE
*, int, int));
240 static void do_org
PARAMS ((segT
, expressionS
*, int));
241 char *demand_copy_string
PARAMS ((int *lenP
));
242 static segT get_segmented_expression
PARAMS ((expressionS
*expP
));
243 static segT get_known_segmented_expression
PARAMS ((expressionS
* expP
));
244 static void pobegin
PARAMS ((void));
245 static int get_line_sb
PARAMS ((sb
*));
246 static void generate_file_debug
PARAMS ((void));
254 obj_read_begin_hook ();
256 /* Something close -- but not too close -- to a multiple of 1024.
257 The debugging malloc I'm using has 24 bytes of overhead. */
258 obstack_begin (¬es
, chunksize
);
259 obstack_begin (&cond_obstack
, chunksize
);
261 /* Use machine dependent syntax. */
262 for (p
= line_separator_chars
; *p
; p
++)
263 is_end_of_line
[(unsigned char) *p
] = 1;
264 /* Use more. FIXME-SOMEDAY. */
270 /* Set up pseudo-op tables. */
272 static struct hash_control
*po_hash
;
274 static const pseudo_typeS potable
[] =
276 {"abort", s_abort
, 0},
277 {"align", s_align_ptwo
, 0},
278 {"ascii", stringer
, 0},
279 {"asciz", stringer
, 1},
280 {"balign", s_align_bytes
, 0},
281 {"balignw", s_align_bytes
, -2},
282 {"balignl", s_align_bytes
, -4},
286 {"common", s_mri_common
, 0},
287 {"common.s", s_mri_common
, 1},
291 {"dc.d", float_cons
, 'd'},
293 {"dc.s", float_cons
, 'f'},
295 {"dc.x", float_cons
, 'x'},
297 {"dcb.b", s_space
, 1},
298 {"dcb.d", s_float_space
, 'd'},
299 {"dcb.l", s_space
, 4},
300 {"dcb.s", s_float_space
, 'f'},
301 {"dcb.w", s_space
, 2},
302 {"dcb.x", s_float_space
, 'x'},
304 {"ds.b", s_space
, 1},
305 {"ds.d", s_space
, 8},
306 {"ds.l", s_space
, 4},
307 {"ds.p", s_space
, 12},
308 {"ds.s", s_space
, 4},
309 {"ds.w", s_space
, 2},
310 {"ds.x", s_space
, 12},
311 {"debug", s_ignore
, 0},
316 {"double", float_cons
, 'd'},
318 {"eject", listing_eject
, 0}, /* Formfeed listing. */
320 {"elsec", s_else
, 0},
321 {"elseif", s_elseif
, (int) O_ne
},
323 {"endc", s_endif
, 0},
324 {"endfunc", s_func
, 1},
325 {"endif", s_endif
, 0},
330 {"exitm", s_mexit
, 0},
332 {"extern", s_ignore
, 0}, /* We treat all undef as ext. */
333 {"appfile", s_app_file
, 1},
334 {"appline", s_app_line
, 0},
336 {"file", s_app_file
, 0},
338 {"float", float_cons
, 'f'},
339 {"format", s_ignore
, 0},
341 {"global", s_globl
, 0},
342 {"globl", s_globl
, 0},
344 {"if", s_if
, (int) O_ne
},
346 {"ifdef", s_ifdef
, 0},
347 {"ifeq", s_if
, (int) O_eq
},
348 {"ifeqs", s_ifeqs
, 0},
349 {"ifge", s_if
, (int) O_ge
},
350 {"ifgt", s_if
, (int) O_gt
},
351 {"ifle", s_if
, (int) O_le
},
352 {"iflt", s_if
, (int) O_lt
},
354 {"ifndef", s_ifdef
, 1},
355 {"ifne", s_if
, (int) O_ne
},
356 {"ifnes", s_ifeqs
, 1},
357 {"ifnotdef", s_ifdef
, 1},
358 {"include", s_include
, 0},
364 {"lcomm", s_lcomm
, 0},
365 {"lflags", listing_flags
, 0}, /* Listing flags. */
366 {"linkonce", s_linkonce
, 0},
367 {"list", listing_list
, 1}, /* Turn listing on. */
368 {"llen", listing_psize
, 1},
371 {"macro", s_macro
, 0},
372 {"mexit", s_mexit
, 0},
374 {".mri", s_mri
, 0}, /* Special case so .mri works in MRI mode. */
375 {"name", s_ignore
, 0},
376 {"noformat", s_ignore
, 0},
377 {"nolist", listing_list
, 0}, /* Turn listing off. */
378 {"nopage", listing_nopage
, 0},
380 {"offset", s_struct
, 0},
382 {"p2align", s_align_ptwo
, 0},
383 {"p2alignw", s_align_ptwo
, -2},
384 {"p2alignl", s_align_ptwo
, -4},
385 {"page", listing_eject
, 0},
386 {"plen", listing_psize
, 0},
387 {"print", s_print
, 0},
388 {"psize", listing_psize
, 0}, /* Set paper size. */
389 {"purgem", s_purgem
, 0},
394 {"sbttl", listing_title
, 1}, /* Subtitle of listing. */
399 {"single", float_cons
, 'f'},
401 {"space", s_space
, 0},
402 {"skip", s_space
, 0},
403 {"sleb128", s_leb128
, 1},
404 {"spc", s_ignore
, 0},
405 {"stabd", s_stab
, 'd'},
406 {"stabn", s_stab
, 'n'},
407 {"stabs", s_stab
, 's'},
408 {"string", stringer
, 1},
409 {"struct", s_struct
, 0},
413 /* This is for gcc to use. It's only just been added (2/94), so gcc
414 won't be able to use it for a while -- probably a year or more.
415 But once this has been released, check with gcc maintainers
416 before deleting it or even changing the spelling. */
417 {"this_GCC_requires_the_GNU_assembler", s_ignore
, 0},
418 /* If we're folding case -- done for some targets, not necessarily
419 all -- the above string in an input file will be converted to
420 this one. Match it either way... */
421 {"this_gcc_requires_the_gnu_assembler", s_ignore
, 0},
423 {"title", listing_title
, 0}, /* Listing title. */
424 {"ttl", listing_title
, 0},
426 {"uleb128", s_leb128
, 0},
430 {"xdef", s_globl
, 0},
431 {"xref", s_ignore
, 0},
432 {"xstabs", s_xstab
, 's'},
434 {"zero", s_space
, 0},
435 {NULL
, NULL
, 0} /* End sentinel. */
438 static int pop_override_ok
= 0;
439 static const char *pop_table_name
;
443 const pseudo_typeS
*table
;
446 const pseudo_typeS
*pop
;
447 for (pop
= table
; pop
->poc_name
; pop
++)
449 errtxt
= hash_insert (po_hash
, pop
->poc_name
, (char *) pop
);
450 if (errtxt
&& (!pop_override_ok
|| strcmp (errtxt
, "exists")))
451 as_fatal (_("error constructing %s pseudo-op table: %s"), pop_table_name
,
456 #ifndef md_pop_insert
457 #define md_pop_insert() pop_insert(md_pseudo_table)
460 #ifndef obj_pop_insert
461 #define obj_pop_insert() pop_insert(obj_pseudo_table)
467 po_hash
= hash_new ();
469 /* Do the target-specific pseudo ops. */
470 pop_table_name
= "md";
473 /* Now object specific. Skip any that were in the target table. */
474 pop_table_name
= "obj";
478 /* Now portable ones. Skip any that we've seen already. */
479 pop_table_name
= "standard";
480 pop_insert (potable
);
483 #define HANDLE_CONDITIONAL_ASSEMBLY() \
484 if (ignore_input ()) \
486 while (!is_end_of_line[(unsigned char) *input_line_pointer++]) \
487 if (input_line_pointer == buffer_limit) \
492 /* This function is used when scrubbing the characters between #APP
495 static char *scrub_string
;
496 static char *scrub_string_end
;
499 scrub_from_string (buf
, buflen
)
505 copy
= scrub_string_end
- scrub_string
;
508 memcpy (buf
, scrub_string
, copy
);
509 scrub_string
+= copy
;
513 /* We read the file, putting things into a web that represents what we
514 have been reading. */
516 read_a_source_file (name
)
520 register char *s
; /* String of symbol, '\0' appended. */
528 buffer
= input_scrub_new_file (name
);
531 listing_newline (NULL
);
532 register_dependency (name
);
534 /* Generate debugging information before we've read anything in to denote
535 this file as the "main" source file and not a subordinate one
536 (e.g. N_SO vs N_SOL in stabs). */
537 generate_file_debug ();
539 while ((buffer_limit
= input_scrub_next_buffer (&input_line_pointer
)) != 0)
540 { /* We have another line to parse. */
541 know (buffer_limit
[-1] == '\n'); /* Must have a sentinel. */
542 contin
: /* JF this goto is my fault I admit it.
543 Someone brave please re-write the whole
544 input section here? Pleeze??? */
545 while (input_line_pointer
< buffer_limit
)
547 /* We have more of this buffer to parse. */
549 /* We now have input_line_pointer->1st char of next line.
550 If input_line_pointer [-1] == '\n' then we just
551 scanned another line: so bump line counters. */
552 if (is_end_of_line
[(unsigned char) input_line_pointer
[-1]])
554 #ifdef md_start_line_hook
555 md_start_line_hook ();
557 if (input_line_pointer
[-1] == '\n')
558 bump_line_counters ();
562 if (LABELS_WITHOUT_COLONS
|| flag_m68k_mri
)
564 /* Text at the start of a line must be a label, we
565 run down and stick a colon in. */
566 if (is_name_beginner (*input_line_pointer
))
568 char *line_start
= input_line_pointer
;
573 HANDLE_CONDITIONAL_ASSEMBLY ();
575 c
= get_symbol_end ();
577 /* In MRI mode, the EQU and MACRO pseudoops must
578 be handled specially. */
582 char *rest
= input_line_pointer
+ 1;
586 if (*rest
== ' ' || *rest
== '\t')
588 if ((strncasecmp (rest
, "EQU", 3) == 0
589 || strncasecmp (rest
, "SET", 3) == 0)
590 && (rest
[3] == ' ' || rest
[3] == '\t'))
592 input_line_pointer
= rest
+ 3;
594 strncasecmp (rest
, "SET", 3) == 0);
597 if (strncasecmp (rest
, "MACRO", 5) == 0
600 || is_end_of_line
[(unsigned char) rest
[5]]))
604 /* In MRI mode, we need to handle the MACRO
605 pseudo-op specially: we don't want to put the
606 symbol in the symbol table. */
608 #ifdef TC_START_LABEL_WITHOUT_COLON
609 && TC_START_LABEL_WITHOUT_COLON(c
,
613 line_label
= colon (line_start
);
615 line_label
= symbol_create (line_start
,
620 *input_line_pointer
= c
;
622 input_line_pointer
++;
627 /* We are at the begining of a line, or similar place.
628 We expect a well-formed assembler statement.
629 A "symbol-name:" is a statement.
631 Depending on what compiler is used, the order of these tests
632 may vary to catch most common case 1st.
633 Each test is independent of all other tests at the (top) level.
634 PLEASE make a compiler that doesn't use this assembler.
635 It is crufty to waste a compiler's time encoding things for this
636 assembler, which then wastes more time decoding it.
637 (And communicating via (linear) files is silly!
638 If you must pass stuff, please pass a tree!) */
639 if ((c
= *input_line_pointer
++) == '\t'
643 c
= *input_line_pointer
++;
645 know (c
!= ' '); /* No further leading whitespace. */
648 /* If listing is on, and we are expanding a macro, then give
649 the listing code the contents of the expanded line. */
652 if ((listing
& LISTING_MACEXP
) && macro_nest
> 0)
657 /* Find the end of the current expanded macro line. */
658 for (s
= input_line_pointer
- 1; *s
; ++s
)
659 if (is_end_of_line
[(unsigned char) *s
])
662 /* Copy it for safe keeping. Also give an indication of
663 how much macro nesting is involved at this point. */
664 len
= s
- (input_line_pointer
-1);
665 copy
= (char *) xmalloc (len
+ macro_nest
+ 2);
666 memset (copy
, '>', macro_nest
);
667 copy
[macro_nest
] = ' ';
668 memcpy (copy
+ macro_nest
+ 1, input_line_pointer
- 1, len
);
669 copy
[macro_nest
+ 1 + len
] = '\0';
671 /* Install the line with the listing facility. */
672 listing_newline (copy
);
675 listing_newline (NULL
);
678 /* C is the 1st significant character.
679 Input_line_pointer points after that character. */
680 if (is_name_beginner (c
))
682 /* Want user-defined label or pseudo/opcode. */
683 HANDLE_CONDITIONAL_ASSEMBLY ();
685 s
= --input_line_pointer
;
686 c
= get_symbol_end (); /* name's delimiter. */
688 /* C is character after symbol.
689 That character's place in the input line is now '\0'.
690 S points to the beginning of the symbol.
691 [In case of pseudo-op, s->'.'.]
692 Input_line_pointer->'\0' where c was. */
693 if (TC_START_LABEL (c
, input_line_pointer
))
697 char *rest
= input_line_pointer
+ 1;
699 /* In MRI mode, \tsym: set 0 is permitted. */
703 if (*rest
== ' ' || *rest
== '\t')
706 if ((strncasecmp (rest
, "EQU", 3) == 0
707 || strncasecmp (rest
, "SET", 3) == 0)
708 && (rest
[3] == ' ' || rest
[3] == '\t'))
710 input_line_pointer
= rest
+ 3;
716 line_label
= colon (s
); /* User-defined label. */
717 /* Put ':' back for error messages' sake. */
718 *input_line_pointer
++ = ':';
719 /* Input_line_pointer->after ':'. */
723 || ((c
== ' ' || c
== '\t')
724 && input_line_pointer
[1] == '='
725 #ifdef TC_EQUAL_IN_INSN
726 && !TC_EQUAL_IN_INSN (c
, input_line_pointer
)
731 demand_empty_rest_of_line ();
735 /* Expect pseudo-op or machine instruction. */
738 #define IGNORE_OPCODE_CASE
739 #ifdef IGNORE_OPCODE_CASE
744 if (isupper ((unsigned char) *s2
))
750 if (NO_PSEUDO_DOT
|| flag_m68k_mri
)
752 /* The MRI assembler and the m88k use pseudo-ops
754 pop
= (pseudo_typeS
*) hash_find (po_hash
, s
);
755 if (pop
!= NULL
&& pop
->poc_handler
== NULL
)
760 || (!flag_m68k_mri
&& *s
== '.'))
764 WARNING: c has next char, which may be end-of-line.
765 We lookup the pseudo-op table with s+1 because we
766 already know that the pseudo-op begins with a '.'. */
769 pop
= (pseudo_typeS
*) hash_find (po_hash
, s
+ 1);
771 /* In MRI mode, we may need to insert an
772 automatic alignment directive. What a hack
774 if (mri_pending_align
776 || !((pop
->poc_handler
== cons
777 && pop
->poc_val
== 1)
778 || (pop
->poc_handler
== s_space
779 && pop
->poc_val
== 1)
780 #ifdef tc_conditional_pseudoop
781 || tc_conditional_pseudoop (pop
)
783 || pop
->poc_handler
== s_if
784 || pop
->poc_handler
== s_ifdef
785 || pop
->poc_handler
== s_ifc
786 || pop
->poc_handler
== s_ifeqs
787 || pop
->poc_handler
== s_else
788 || pop
->poc_handler
== s_endif
789 || pop
->poc_handler
== s_globl
790 || pop
->poc_handler
== s_ignore
)))
792 do_align (1, (char *) NULL
, 0, 0);
793 mri_pending_align
= 0;
795 if (line_label
!= NULL
)
797 symbol_set_frag (line_label
, frag_now
);
798 S_SET_VALUE (line_label
, frag_now_fix ());
802 /* Print the error msg now, while we still can. */
805 as_bad (_("Unknown pseudo-op: `%s'"), s
);
806 *input_line_pointer
= c
;
811 /* Put it back for error messages etc. */
812 *input_line_pointer
= c
;
813 /* The following skip of whitespace is compulsory.
814 A well shaped space is sometimes all that separates
815 keyword from operands. */
816 if (c
== ' ' || c
== '\t')
817 input_line_pointer
++;
819 /* Input_line is restored.
820 Input_line_pointer->1st non-blank char
821 after pseudo-operation. */
822 (*pop
->poc_handler
) (pop
->poc_val
);
824 /* If that was .end, just get out now. */
825 if (pop
->poc_handler
== s_end
)
831 #ifdef QUOTES_IN_INSN
835 /* WARNING: c has char, which may be end-of-line. */
836 /* Also: input_line_pointer->`\0` where c was. */
837 *input_line_pointer
= c
;
838 while (!is_end_of_line
[(unsigned char) *input_line_pointer
]
840 #ifdef TC_EOL_IN_INSN
841 || TC_EOL_IN_INSN (input_line_pointer
)
845 if (flag_m68k_mri
&& *input_line_pointer
== '\'')
847 #ifdef QUOTES_IN_INSN
850 else if (*input_line_pointer
== '"')
852 else if (*input_line_pointer
== '\\')
855 input_line_pointer
++;
858 c
= *input_line_pointer
;
859 *input_line_pointer
= '\0';
861 generate_lineno_debug ();
869 if (check_macro (s
, &out
, '\0', &err
, ¯o
))
873 *input_line_pointer
++ = c
;
874 input_scrub_include_sb (&out
,
875 input_line_pointer
, 1);
878 input_scrub_next_buffer (&input_line_pointer
);
880 md_macro_info (macro
);
886 if (mri_pending_align
)
888 do_align (1, (char *) NULL
, 0, 0);
889 mri_pending_align
= 0;
890 if (line_label
!= NULL
)
892 symbol_set_frag (line_label
, frag_now
);
893 S_SET_VALUE (line_label
, frag_now_fix ());
897 md_assemble (s
); /* Assemble 1 instruction. */
899 *input_line_pointer
++ = c
;
901 /* We resume loop AFTER the end-of-line from
908 /* Empty statement? */
909 if (is_end_of_line
[(unsigned char) c
])
912 if ((LOCAL_LABELS_DOLLAR
|| LOCAL_LABELS_FB
)
913 && isdigit ((unsigned char) c
))
915 /* local label ("4:") */
916 char *backup
= input_line_pointer
;
918 HANDLE_CONDITIONAL_ASSEMBLY ();
922 /* Read the whole number. */
923 while (isdigit ((unsigned char) *input_line_pointer
))
925 temp
= (temp
* 10) + *input_line_pointer
- '0';
926 ++input_line_pointer
;
929 if (LOCAL_LABELS_DOLLAR
930 && *input_line_pointer
== '$'
931 && *(input_line_pointer
+ 1) == ':')
933 input_line_pointer
+= 2;
935 if (dollar_label_defined (temp
))
937 as_fatal (_("label \"%d$\" redefined"), temp
);
940 define_dollar_label (temp
);
941 colon (dollar_label_name (temp
, 0));
946 && *input_line_pointer
++ == ':')
948 fb_label_instance_inc (temp
);
949 colon (fb_label_name (temp
, 0));
953 input_line_pointer
= backup
;
954 } /* local label ("4:") */
956 if (c
&& strchr (line_comment_chars
, c
))
957 { /* Its a comment. Better say APP or NO_APP. */
961 unsigned int new_length
;
964 bump_line_counters ();
965 s
= input_line_pointer
;
966 if (strncmp (s
, "APP\n", 4))
967 continue; /* We ignore it */
970 ends
= strstr (s
, "#NO_APP\n");
974 unsigned int tmp_len
;
977 /* The end of the #APP wasn't in this buffer. We
978 keep reading in buffers until we find the #NO_APP
979 that goes with this #APP There is one. The specs
981 tmp_len
= buffer_limit
- s
;
982 tmp_buf
= xmalloc (tmp_len
+ 1);
983 memcpy (tmp_buf
, s
, tmp_len
);
986 new_tmp
= input_scrub_next_buffer (&buffer
);
990 buffer_limit
= new_tmp
;
991 input_line_pointer
= buffer
;
992 ends
= strstr (buffer
, "#NO_APP\n");
996 num
= buffer_limit
- buffer
;
998 tmp_buf
= xrealloc (tmp_buf
, tmp_len
+ num
);
999 memcpy (tmp_buf
+ tmp_len
, buffer
, num
);
1004 input_line_pointer
= ends
? ends
+ 8 : NULL
;
1012 input_line_pointer
= ends
+ 8;
1016 scrub_string_end
= ends
;
1018 new_length
= ends
- s
;
1019 new_buf
= (char *) xmalloc (new_length
);
1026 space
= (new_buf
+ new_length
) - new_tmp
;
1027 size
= do_scrub_chars (scrub_from_string
, new_tmp
, space
);
1035 new_buf
= xrealloc (new_buf
, new_length
+ 100);
1036 new_tmp
= new_buf
+ new_length
;
1042 old_buffer
= buffer
;
1043 old_input
= input_line_pointer
;
1044 old_limit
= buffer_limit
;
1046 input_line_pointer
= new_buf
;
1047 buffer_limit
= new_tmp
;
1052 HANDLE_CONDITIONAL_ASSEMBLY ();
1054 #ifdef tc_unrecognized_line
1055 if (tc_unrecognized_line (c
))
1058 /* as_warn (_("Junk character %d."),c); Now done by ignore_rest. */
1059 input_line_pointer
--; /* Report unknown char as ignored. */
1060 ignore_rest_of_line ();
1063 #ifdef md_after_pass_hook
1064 md_after_pass_hook ();
1070 bump_line_counters ();
1073 buffer
= old_buffer
;
1074 input_line_pointer
= old_input
;
1075 buffer_limit
= old_limit
;
1087 /* Close the input file. */
1088 input_scrub_close ();
1089 #ifdef WARN_COMMENTS
1091 if (warn_comment
&& found_comment
)
1092 as_warn_where (found_comment_file
, found_comment
,
1093 "first comment found here");
1098 /* For most MRI pseudo-ops, the line actually ends at the first
1099 nonquoted space. This function looks for that point, stuffs a null
1100 in, and sets *STOPCP to the character that used to be there, and
1101 returns the location.
1103 Until I hear otherwise, I am going to assume that this is only true
1104 for the m68k MRI assembler. */
1107 mri_comment_field (stopcp
)
1114 know (flag_m68k_mri
);
1116 for (s
= input_line_pointer
;
1117 ((!is_end_of_line
[(unsigned char) *s
] && *s
!= ' ' && *s
!= '\t')
1125 for (s
= input_line_pointer
;
1126 !is_end_of_line
[(unsigned char) *s
];
1136 /* Skip to the end of an MRI comment field. */
1139 mri_comment_end (stop
, stopc
)
1145 input_line_pointer
= stop
;
1147 while (!is_end_of_line
[(unsigned char) *input_line_pointer
])
1148 ++input_line_pointer
;
1153 int ignore ATTRIBUTE_UNUSED
;
1155 as_fatal (_(".abort detected. Abandoning ship."));
1158 /* Guts of .align directive. N is the power of two to which to align.
1159 FILL may be NULL, or it may point to the bytes of the fill pattern.
1160 LEN is the length of whatever FILL points to, if anything. MAX is
1161 the maximum number of characters to skip when doing the alignment,
1162 or 0 if there is no maximum. */
1165 do_align (n
, fill
, len
, max
)
1174 md_do_align (n
, fill
, len
, max
, just_record_alignment
);
1179 if (subseg_text_p (now_seg
))
1180 default_fill
= NOP_OPCODE
;
1183 fill
= &default_fill
;
1187 /* Only make a frag if we HAVE to... */
1188 if (n
!= 0 && !need_pass_2
)
1191 frag_align (n
, *fill
, max
);
1193 frag_align_pattern (n
, fill
, len
, max
);
1197 just_record_alignment
:
1200 record_alignment (now_seg
, n
- OCTETS_PER_BYTE_POWER
);
1203 /* Handle the .align pseudo-op. A positive ARG is a default alignment
1204 (in bytes). A negative ARG is the negative of the length of the
1205 fill pattern. BYTES_P is non-zero if the alignment value should be
1206 interpreted as the byte boundary, rather than the power of 2. */
1209 s_align (arg
, bytes_p
)
1213 register unsigned int align
;
1221 stop
= mri_comment_field (&stopc
);
1223 if (is_end_of_line
[(unsigned char) *input_line_pointer
])
1228 align
= arg
; /* Default value from pseudo-op table. */
1232 align
= get_absolute_expression ();
1238 /* Convert to a power of 2. */
1243 for (i
= 0; (align
& 1) == 0; align
>>= 1, ++i
)
1246 as_bad (_("Alignment not a power of 2"));
1255 as_bad (_("Alignment too large: %u assumed"), align
);
1258 if (*input_line_pointer
!= ',')
1265 ++input_line_pointer
;
1266 if (*input_line_pointer
== ',')
1270 fill
= get_absolute_expression ();
1275 if (*input_line_pointer
!= ',')
1279 ++input_line_pointer
;
1280 max
= get_absolute_expression ();
1287 as_warn (_("expected fill pattern missing"));
1288 do_align (align
, (char *) NULL
, 0, max
);
1303 do_align (align
, &fill_char
, fill_len
, max
);
1309 if ((size_t) fill_len
> sizeof ab
)
1311 md_number_to_chars (ab
, fill
, fill_len
);
1312 do_align (align
, ab
, fill_len
, max
);
1316 demand_empty_rest_of_line ();
1319 mri_comment_end (stop
, stopc
);
1322 /* Handle the .align pseudo-op on machines where ".align 4" means
1323 align to a 4 byte boundary. */
1332 /* Handle the .align pseudo-op on machines where ".align 4" means align
1333 to a 2**4 boundary. */
1344 int ignore ATTRIBUTE_UNUSED
;
1346 register char *name
;
1350 register symbolS
*symbolP
;
1355 stop
= mri_comment_field (&stopc
);
1357 name
= input_line_pointer
;
1358 c
= get_symbol_end ();
1359 /* Just after name is now '\0'. */
1360 p
= input_line_pointer
;
1364 if (*input_line_pointer
!= ',')
1366 as_bad (_("Expected comma after symbol-name: rest of line ignored."));
1367 ignore_rest_of_line ();
1369 mri_comment_end (stop
, stopc
);
1373 input_line_pointer
++; /* skip ',' */
1375 if ((temp
= get_absolute_expression ()) < 0)
1377 as_warn (_(".COMMon length (%ld.) <0! Ignored."), (long) temp
);
1378 ignore_rest_of_line ();
1380 mri_comment_end (stop
, stopc
);
1385 symbolP
= symbol_find_or_make (name
);
1388 if (S_IS_DEFINED (symbolP
) && !S_IS_COMMON (symbolP
))
1390 as_bad (_("Ignoring attempt to re-define symbol `%s'."),
1391 S_GET_NAME (symbolP
));
1392 ignore_rest_of_line ();
1394 mri_comment_end (stop
, stopc
);
1398 if (S_GET_VALUE (symbolP
))
1400 if (S_GET_VALUE (symbolP
) != (valueT
) temp
)
1401 as_bad (_("Length of .comm \"%s\" is already %ld. Not changed to %ld."),
1402 S_GET_NAME (symbolP
),
1403 (long) S_GET_VALUE (symbolP
),
1408 S_SET_VALUE (symbolP
, (valueT
) temp
);
1409 S_SET_EXTERNAL (symbolP
);
1413 extern int flag_one
;
1414 if (!temp
|| !flag_one
)
1415 S_GET_OTHER(symbolP
) = const_flag
;
1417 #endif /* not OBJ_VMS */
1418 know (symbolP
->sy_frag
== &zero_address_frag
);
1420 demand_empty_rest_of_line ();
1423 mri_comment_end (stop
, stopc
);
1426 /* The MRI COMMON pseudo-op. We handle this by creating a common
1427 symbol with the appropriate name. We make s_space do the right
1428 thing by increasing the size. */
1431 s_mri_common (small
)
1432 int small ATTRIBUTE_UNUSED
;
1448 stop
= mri_comment_field (&stopc
);
1452 name
= input_line_pointer
;
1453 if (!isdigit ((unsigned char) *name
))
1454 c
= get_symbol_end ();
1459 ++input_line_pointer
;
1461 while (isdigit ((unsigned char) *input_line_pointer
));
1463 c
= *input_line_pointer
;
1464 *input_line_pointer
= '\0';
1466 if (line_label
!= NULL
)
1468 alc
= (char *) xmalloc (strlen (S_GET_NAME (line_label
))
1469 + (input_line_pointer
- name
)
1471 sprintf (alc
, "%s%s", name
, S_GET_NAME (line_label
));
1476 sym
= symbol_find_or_make (name
);
1477 *input_line_pointer
= c
;
1481 if (*input_line_pointer
!= ',')
1485 ++input_line_pointer
;
1486 align
= get_absolute_expression ();
1489 if (S_IS_DEFINED (sym
) && !S_IS_COMMON (sym
))
1491 as_bad (_("attempt to re-define symbol `%s'"), S_GET_NAME (sym
));
1492 ignore_rest_of_line ();
1493 mri_comment_end (stop
, stopc
);
1497 S_SET_EXTERNAL (sym
);
1498 mri_common_symbol
= sym
;
1502 S_SET_ALIGN (sym
, align
);
1505 if (line_label
!= NULL
)
1508 exp
.X_op
= O_symbol
;
1509 exp
.X_add_symbol
= sym
;
1510 exp
.X_add_number
= 0;
1511 symbol_set_value_expression (line_label
, &exp
);
1512 symbol_set_frag (line_label
, &zero_address_frag
);
1513 S_SET_SEGMENT (line_label
, expr_section
);
1516 /* FIXME: We just ignore the small argument, which distinguishes
1517 COMMON and COMMON.S. I don't know what we can do about it. */
1519 /* Ignore the type and hptype. */
1520 if (*input_line_pointer
== ',')
1521 input_line_pointer
+= 2;
1522 if (*input_line_pointer
== ',')
1523 input_line_pointer
+= 2;
1525 demand_empty_rest_of_line ();
1527 mri_comment_end (stop
, stopc
);
1532 int ignore ATTRIBUTE_UNUSED
;
1537 temp
= get_absolute_expression ();
1538 if (flag_readonly_data_in_text
)
1540 section
= text_section
;
1544 section
= data_section
;
1546 subseg_set (section
, (subsegT
) temp
);
1551 demand_empty_rest_of_line ();
1554 /* Handle the .appfile pseudo-op. This is automatically generated by
1555 do_scrub_chars when a preprocessor # line comment is seen with a
1556 file name. This default definition may be overridden by the object
1557 or CPU specific pseudo-ops. This function is also the default
1558 definition for .file; the APPFILE argument is 1 for .appfile, 0 for
1562 s_app_file (appfile
)
1568 /* Some assemblers tolerate immediately following '"'. */
1569 if ((s
= demand_copy_string (&length
)) != 0)
1571 /* If this is a fake .appfile, a fake newline was inserted into
1572 the buffer. Passing -2 to new_logical_line tells it to
1575 = (!new_logical_line (s
, appfile
? -2 : -1) && appfile
);
1577 /* In MRI mode, the preprocessor may have inserted an extraneous
1580 && *input_line_pointer
== '\''
1581 && is_end_of_line
[(unsigned char) input_line_pointer
[1]])
1582 ++input_line_pointer
;
1584 demand_empty_rest_of_line ();
1589 listing_source_file (s
);
1591 register_dependency (s
);
1599 /* Handle the .appline pseudo-op. This is automatically generated by
1600 do_scrub_chars when a preprocessor # line comment is seen. This
1601 default definition may be overridden by the object or CPU specific
1606 int ignore ATTRIBUTE_UNUSED
;
1610 /* The given number is that of the next line. */
1611 l
= get_absolute_expression () - 1;
1613 /* Some of the back ends can't deal with non-positive line numbers.
1614 Besides, it's silly. */
1615 as_warn (_("Line numbers must be positive; line number %d rejected."),
1619 new_logical_line ((char *) NULL
, l
);
1622 listing_source_line (l
);
1625 demand_empty_rest_of_line ();
1628 /* Handle the .end pseudo-op. Actually, the real work is done in
1629 read_a_source_file. */
1633 int ignore ATTRIBUTE_UNUSED
;
1637 /* The MRI assembler permits the start symbol to follow .end,
1638 but we don't support that. */
1640 if (!is_end_of_line
[(unsigned char) *input_line_pointer
]
1641 && *input_line_pointer
!= '*'
1642 && *input_line_pointer
!= '!')
1643 as_warn (_("start address not supported"));
1647 /* Handle the .err pseudo-op. */
1651 int ignore ATTRIBUTE_UNUSED
;
1653 as_bad (_(".err encountered"));
1654 demand_empty_rest_of_line ();
1657 /* Handle the MRI fail pseudo-op. */
1661 int ignore ATTRIBUTE_UNUSED
;
1668 stop
= mri_comment_field (&stopc
);
1670 temp
= get_absolute_expression ();
1672 as_warn (_(".fail %ld encountered"), (long) temp
);
1674 as_bad (_(".fail %ld encountered"), (long) temp
);
1676 demand_empty_rest_of_line ();
1679 mri_comment_end (stop
, stopc
);
1684 int ignore ATTRIBUTE_UNUSED
;
1686 expressionS rep_exp
;
1688 register long fill
= 0;
1691 #ifdef md_flush_pending_output
1692 md_flush_pending_output ();
1695 get_known_segmented_expression (&rep_exp
);
1696 if (*input_line_pointer
== ',')
1698 input_line_pointer
++;
1699 size
= get_absolute_expression ();
1700 if (*input_line_pointer
== ',')
1702 input_line_pointer
++;
1703 fill
= get_absolute_expression ();
1707 /* This is to be compatible with BSD 4.2 AS, not for any rational reason. */
1708 #define BSD_FILL_SIZE_CROCK_8 (8)
1709 if (size
> BSD_FILL_SIZE_CROCK_8
)
1711 as_warn (_(".fill size clamped to %d."), BSD_FILL_SIZE_CROCK_8
);
1712 size
= BSD_FILL_SIZE_CROCK_8
;
1716 as_warn (_("Size negative: .fill ignored."));
1719 else if (rep_exp
.X_op
== O_constant
&& rep_exp
.X_add_number
<= 0)
1721 if (rep_exp
.X_add_number
< 0)
1722 as_warn (_("Repeat < 0, .fill ignored"));
1726 if (size
&& !need_pass_2
)
1728 if (rep_exp
.X_op
== O_constant
)
1730 p
= frag_var (rs_fill
, (int) size
, (int) size
,
1731 (relax_substateT
) 0, (symbolS
*) 0,
1732 (offsetT
) rep_exp
.X_add_number
,
1737 /* We don't have a constant repeat count, so we can't use
1738 rs_fill. We can get the same results out of rs_space,
1739 but its argument is in bytes, so we must multiply the
1740 repeat count by size. */
1743 rep_sym
= make_expr_symbol (&rep_exp
);
1746 expressionS size_exp
;
1747 size_exp
.X_op
= O_constant
;
1748 size_exp
.X_add_number
= size
;
1750 rep_exp
.X_op
= O_multiply
;
1751 rep_exp
.X_add_symbol
= rep_sym
;
1752 rep_exp
.X_op_symbol
= make_expr_symbol (&size_exp
);
1753 rep_exp
.X_add_number
= 0;
1754 rep_sym
= make_expr_symbol (&rep_exp
);
1757 p
= frag_var (rs_space
, (int) size
, (int) size
,
1758 (relax_substateT
) 0, rep_sym
, (offsetT
) 0, (char *) 0);
1761 memset (p
, 0, (unsigned int) size
);
1763 /* The magic number BSD_FILL_SIZE_CROCK_4 is from BSD 4.2 VAX
1764 flavoured AS. The following bizzare behaviour is to be
1765 compatible with above. I guess they tried to take up to 8
1766 bytes from a 4-byte expression and they forgot to sign
1767 extend. Un*x Sux. */
1768 #define BSD_FILL_SIZE_CROCK_4 (4)
1769 md_number_to_chars (p
, (valueT
) fill
,
1770 (size
> BSD_FILL_SIZE_CROCK_4
1771 ? BSD_FILL_SIZE_CROCK_4
1773 /* Note: .fill (),0 emits no frag (since we are asked to .fill 0 bytes)
1774 but emits no error message because it seems a legal thing to do.
1775 It is a degenerate case of .fill but could be emitted by a
1778 demand_empty_rest_of_line ();
1783 int ignore ATTRIBUTE_UNUSED
;
1792 stop
= mri_comment_field (&stopc
);
1796 name
= input_line_pointer
;
1797 c
= get_symbol_end ();
1798 symbolP
= symbol_find_or_make (name
);
1799 S_SET_EXTERNAL (symbolP
);
1801 *input_line_pointer
= c
;
1803 c
= *input_line_pointer
;
1806 input_line_pointer
++;
1808 if (*input_line_pointer
== '\n')
1814 demand_empty_rest_of_line ();
1817 mri_comment_end (stop
, stopc
);
1820 /* Handle the MRI IRP and IRPC pseudo-ops. */
1832 as_where (&file
, &line
);
1835 while (!is_end_of_line
[(unsigned char) *input_line_pointer
])
1836 sb_add_char (&s
, *input_line_pointer
++);
1840 err
= expand_irp (irpc
, 0, &s
, &out
, get_line_sb
, '\0');
1842 as_bad_where (file
, line
, "%s", err
);
1846 input_scrub_include_sb (&out
, input_line_pointer
, 1);
1848 buffer_limit
= input_scrub_next_buffer (&input_line_pointer
);
1851 /* Handle the .linkonce pseudo-op. This tells the assembler to mark
1852 the section to only be linked once. However, this is not supported
1853 by most object file formats. This takes an optional argument,
1854 which is what to do about duplicates. */
1858 int ignore ATTRIBUTE_UNUSED
;
1860 enum linkonce_type type
;
1864 type
= LINKONCE_DISCARD
;
1866 if (!is_end_of_line
[(unsigned char) *input_line_pointer
])
1871 s
= input_line_pointer
;
1872 c
= get_symbol_end ();
1873 if (strcasecmp (s
, "discard") == 0)
1874 type
= LINKONCE_DISCARD
;
1875 else if (strcasecmp (s
, "one_only") == 0)
1876 type
= LINKONCE_ONE_ONLY
;
1877 else if (strcasecmp (s
, "same_size") == 0)
1878 type
= LINKONCE_SAME_SIZE
;
1879 else if (strcasecmp (s
, "same_contents") == 0)
1880 type
= LINKONCE_SAME_CONTENTS
;
1882 as_warn (_("unrecognized .linkonce type `%s'"), s
);
1884 *input_line_pointer
= c
;
1887 #ifdef obj_handle_link_once
1888 obj_handle_link_once (type
);
1889 #else /* ! defined (obj_handle_link_once) */
1890 #ifdef BFD_ASSEMBLER
1894 if ((bfd_applicable_section_flags (stdoutput
) & SEC_LINK_ONCE
) == 0)
1895 as_warn (_(".linkonce is not supported for this object file format"));
1897 flags
= bfd_get_section_flags (stdoutput
, now_seg
);
1898 flags
|= SEC_LINK_ONCE
;
1903 case LINKONCE_DISCARD
:
1904 flags
|= SEC_LINK_DUPLICATES_DISCARD
;
1906 case LINKONCE_ONE_ONLY
:
1907 flags
|= SEC_LINK_DUPLICATES_ONE_ONLY
;
1909 case LINKONCE_SAME_SIZE
:
1910 flags
|= SEC_LINK_DUPLICATES_SAME_SIZE
;
1912 case LINKONCE_SAME_CONTENTS
:
1913 flags
|= SEC_LINK_DUPLICATES_SAME_CONTENTS
;
1916 if (!bfd_set_section_flags (stdoutput
, now_seg
, flags
))
1917 as_bad (_("bfd_set_section_flags: %s"),
1918 bfd_errmsg (bfd_get_error ()));
1920 #else /* ! defined (BFD_ASSEMBLER) */
1921 as_warn (_(".linkonce is not supported for this object file format"));
1922 #endif /* ! defined (BFD_ASSEMBLER) */
1923 #endif /* ! defined (obj_handle_link_once) */
1925 demand_empty_rest_of_line ();
1929 s_lcomm_internal (needs_align
, bytes_p
)
1930 /* 1 if this was a ".bss" directive, which may require a 3rd argument
1931 (alignment); 0 if it was an ".lcomm" (2 args only). */
1933 /* 1 if the alignment value should be interpreted as the byte boundary,
1934 rather than the power of 2. */
1937 register char *name
;
1941 register symbolS
*symbolP
;
1942 segT current_seg
= now_seg
;
1943 subsegT current_subseg
= now_subseg
;
1944 const int max_alignment
= 15;
1946 segT bss_seg
= bss_section
;
1948 name
= input_line_pointer
;
1949 c
= get_symbol_end ();
1950 p
= input_line_pointer
;
1954 /* Accept an optional comma after the name. The comma used to be
1955 required, but Irix 5 cc does not generate it. */
1956 if (*input_line_pointer
== ',')
1958 ++input_line_pointer
;
1962 if (*input_line_pointer
== '\n')
1964 as_bad (_("Missing size expression"));
1968 if ((temp
= get_absolute_expression ()) < 0)
1970 as_warn (_("BSS length (%d.) <0! Ignored."), temp
);
1971 ignore_rest_of_line ();
1975 #if defined (TC_MIPS) || defined (TC_ALPHA)
1976 if (OUTPUT_FLAVOR
== bfd_target_ecoff_flavour
1977 || OUTPUT_FLAVOR
== bfd_target_elf_flavour
)
1979 /* For MIPS and Alpha ECOFF or ELF, small objects are put in .sbss. */
1980 if (temp
<= bfd_get_gp_size (stdoutput
))
1982 bss_seg
= subseg_new (".sbss", 1);
1983 seg_info (bss_seg
)->bss
= 1;
1984 #ifdef BFD_ASSEMBLER
1985 if (!bfd_set_section_flags (stdoutput
, bss_seg
, SEC_ALLOC
))
1986 as_warn (_("error setting flags for \".sbss\": %s"),
1987 bfd_errmsg (bfd_get_error ()));
1995 TC_IMPLICIT_LCOMM_ALIGNMENT (temp
, align
);
1997 /* Still zero unless TC_IMPLICIT_LCOMM_ALIGNMENT set it. */
1999 record_alignment (bss_seg
, align
);
2007 if (*input_line_pointer
!= ',')
2009 as_bad (_("Expected comma after size"));
2010 ignore_rest_of_line ();
2014 input_line_pointer
++;
2017 if (*input_line_pointer
== '\n')
2019 as_bad (_("Missing alignment"));
2023 align
= get_absolute_expression ();
2027 /* Convert to a power of 2. */
2032 for (i
= 0; (align
& 1) == 0; align
>>= 1, ++i
)
2035 as_bad (_("Alignment not a power of 2"));
2040 if (align
> max_alignment
)
2042 align
= max_alignment
;
2043 as_warn (_("Alignment too large: %d. assumed."), align
);
2048 as_warn (_("Alignment negative. 0 assumed."));
2051 record_alignment (bss_seg
, align
);
2055 /* Assume some objects may require alignment on some systems. */
2056 #if defined (TC_ALPHA) && ! defined (VMS)
2059 align
= ffs (temp
) - 1;
2060 if (temp
% (1 << align
))
2067 symbolP
= symbol_find_or_make (name
);
2071 #if (defined (OBJ_AOUT) || defined (OBJ_MAYBE_AOUT) \
2072 || defined (OBJ_BOUT) || defined (OBJ_MAYBE_BOUT))
2073 #ifdef BFD_ASSEMBLER
2074 (OUTPUT_FLAVOR
!= bfd_target_aout_flavour
2075 || (S_GET_OTHER (symbolP
) == 0 && S_GET_DESC (symbolP
) == 0)) &&
2077 (S_GET_OTHER (symbolP
) == 0 && S_GET_DESC (symbolP
) == 0) &&
2080 (S_GET_SEGMENT (symbolP
) == bss_seg
2081 || (!S_IS_DEFINED (symbolP
) && S_GET_VALUE (symbolP
) == 0)))
2085 subseg_set (bss_seg
, 1);
2088 frag_align (align
, 0, 0);
2090 /* Detach from old frag. */
2091 if (S_GET_SEGMENT (symbolP
) == bss_seg
)
2092 symbol_get_frag (symbolP
)->fr_symbol
= NULL
;
2094 symbol_set_frag (symbolP
, frag_now
);
2095 pfrag
= frag_var (rs_org
, 1, 1, (relax_substateT
) 0, symbolP
,
2096 (offsetT
) temp
, (char *) 0);
2099 S_SET_SEGMENT (symbolP
, bss_seg
);
2102 /* The symbol may already have been created with a preceding
2103 ".globl" directive -- be careful not to step on storage class
2104 in that case. Otherwise, set it to static. */
2105 if (S_GET_STORAGE_CLASS (symbolP
) != C_EXT
)
2107 S_SET_STORAGE_CLASS (symbolP
, C_STAT
);
2109 #endif /* OBJ_COFF */
2112 S_SET_SIZE (symbolP
, temp
);
2116 as_bad (_("Ignoring attempt to re-define symbol `%s'."),
2117 S_GET_NAME (symbolP
));
2119 subseg_set (current_seg
, current_subseg
);
2121 demand_empty_rest_of_line ();
2125 s_lcomm (needs_align
)
2128 s_lcomm_internal (needs_align
, 0);
2132 s_lcomm_bytes (needs_align
)
2135 s_lcomm_internal (needs_align
, 1);
2140 int ignore ATTRIBUTE_UNUSED
;
2142 register char *name
;
2146 register symbolS
*symbolP
;
2148 /* We permit ANY defined expression: BSD4.2 demands constants. */
2149 name
= input_line_pointer
;
2150 c
= get_symbol_end ();
2151 p
= input_line_pointer
;
2155 if (*input_line_pointer
!= ',')
2158 as_bad (_("Expected comma after name \"%s\""), name
);
2160 ignore_rest_of_line ();
2164 input_line_pointer
++;
2167 if (exp
.X_op
!= O_constant
2168 && exp
.X_op
!= O_register
)
2170 as_bad (_("bad expression"));
2171 ignore_rest_of_line ();
2176 symbolP
= symbol_find_or_make (name
);
2178 /* FIXME-SOON I pulled a (&& symbolP->sy_other == 0 &&
2179 symbolP->sy_desc == 0) out of this test because coff doesn't have
2180 those fields, and I can't see when they'd ever be tripped. I
2181 don't think I understand why they were here so I may have
2182 introduced a bug. As recently as 1.37 didn't have this test
2183 anyway. xoxorich. */
2185 if (S_GET_SEGMENT (symbolP
) == undefined_section
2186 && S_GET_VALUE (symbolP
) == 0)
2188 /* The name might be an undefined .global symbol; be sure to
2189 keep the "external" bit. */
2190 S_SET_SEGMENT (symbolP
,
2191 (exp
.X_op
== O_constant
2194 S_SET_VALUE (symbolP
, (valueT
) exp
.X_add_number
);
2198 as_bad (_("Symbol %s already defined"), name
);
2202 demand_empty_rest_of_line ();
2205 /* Read a line into an sb. */
2211 char quote1
, quote2
, inquote
;
2213 if (input_line_pointer
[-1] == '\n')
2214 bump_line_counters ();
2216 if (input_line_pointer
>= buffer_limit
)
2218 buffer_limit
= input_scrub_next_buffer (&input_line_pointer
);
2219 if (buffer_limit
== 0)
2223 /* If app.c sets any other characters to LEX_IS_STRINGQUOTE, this
2224 code needs to be changed. */
2233 #ifdef LEX_IS_STRINGQUOTE
2239 while (!is_end_of_line
[(unsigned char) *input_line_pointer
]
2240 || (inquote
!= '\0' && *input_line_pointer
!= '\n'))
2242 if (inquote
== *input_line_pointer
)
2244 else if (inquote
== '\0')
2246 if (*input_line_pointer
== quote1
)
2248 else if (*input_line_pointer
== quote2
)
2252 sb_add_char (line
, *input_line_pointer
++);
2255 while (input_line_pointer
< buffer_limit
2256 && is_end_of_line
[(unsigned char) *input_line_pointer
])
2258 if (input_line_pointer
[-1] == '\n')
2259 bump_line_counters ();
2260 ++input_line_pointer
;
2266 /* Define a macro. This is an interface to macro.c, which is shared
2267 between gas and gasp. */
2271 int ignore ATTRIBUTE_UNUSED
;
2280 as_where (&file
, &line
);
2283 while (!is_end_of_line
[(unsigned char) *input_line_pointer
])
2284 sb_add_char (&s
, *input_line_pointer
++);
2287 if (line_label
!= NULL
)
2288 sb_add_string (&label
, S_GET_NAME (line_label
));
2290 err
= define_macro (0, &s
, &label
, get_line_sb
, &name
);
2292 as_bad_where (file
, line
, "%s", err
);
2295 if (line_label
!= NULL
)
2297 S_SET_SEGMENT (line_label
, undefined_section
);
2298 S_SET_VALUE (line_label
, 0);
2299 symbol_set_frag (line_label
, &zero_address_frag
);
2302 if (((NO_PSEUDO_DOT
|| flag_m68k_mri
)
2303 && hash_find (po_hash
, name
) != NULL
)
2306 && hash_find (po_hash
, name
+ 1) != NULL
))
2307 as_warn (_("attempt to redefine pseudo-op `%s' ignored"),
2314 /* Handle the .mexit pseudo-op, which immediately exits a macro
2319 int ignore ATTRIBUTE_UNUSED
;
2321 cond_exit_macro (macro_nest
);
2322 buffer_limit
= input_scrub_next_buffer (&input_line_pointer
);
2325 /* Switch in and out of MRI mode. */
2329 int ignore ATTRIBUTE_UNUSED
;
2333 on
= get_absolute_expression ();
2334 old_flag
= flag_mri
;
2352 /* Operator precedence changes in m68k MRI mode, so we need to
2353 update the operator rankings. */
2354 expr_set_precedence ();
2356 #ifdef MRI_MODE_CHANGE
2358 MRI_MODE_CHANGE (on
);
2361 demand_empty_rest_of_line ();
2364 /* Handle changing the location counter. */
2367 do_org (segment
, exp
, fill
)
2372 if (segment
!= now_seg
&& segment
!= absolute_section
)
2373 as_bad (_("invalid segment \"%s\"; segment \"%s\" assumed"),
2374 segment_name (segment
), segment_name (now_seg
));
2376 if (now_seg
== absolute_section
)
2379 as_warn (_("ignoring fill value in absolute section"));
2380 if (exp
->X_op
!= O_constant
)
2382 as_bad (_("only constant offsets supported in absolute section"));
2383 exp
->X_add_number
= 0;
2385 abs_section_offset
= exp
->X_add_number
;
2391 p
= frag_var (rs_org
, 1, 1, (relax_substateT
) 0, exp
->X_add_symbol
,
2392 exp
->X_add_number
* OCTETS_PER_BYTE
, (char *) NULL
);
2399 int ignore ATTRIBUTE_UNUSED
;
2401 register segT segment
;
2403 register long temp_fill
;
2405 #ifdef md_flush_pending_output
2406 md_flush_pending_output ();
2409 /* The m68k MRI assembler has a different meaning for .org. It
2410 means to create an absolute section at a given address. We can't
2411 support that--use a linker script instead. */
2414 as_bad (_("MRI style ORG pseudo-op not supported"));
2415 ignore_rest_of_line ();
2419 /* Don't believe the documentation of BSD 4.2 AS. There is no such
2420 thing as a sub-segment-relative origin. Any absolute origin is
2421 given a warning, then assumed to be segment-relative. Any
2422 segmented origin expression ("foo+42") had better be in the right
2423 segment or the .org is ignored.
2425 BSD 4.2 AS warns if you try to .org backwards. We cannot because
2426 we never know sub-segment sizes when we are reading code. BSD
2427 will crash trying to emit negative numbers of filler bytes in
2428 certain .orgs. We don't crash, but see as-write for that code.
2430 Don't make frag if need_pass_2==1. */
2431 segment
= get_known_segmented_expression (&exp
);
2432 if (*input_line_pointer
== ',')
2434 input_line_pointer
++;
2435 temp_fill
= get_absolute_expression ();
2441 do_org (segment
, &exp
, temp_fill
);
2443 demand_empty_rest_of_line ();
2446 /* Handle parsing for the MRI SECT/SECTION pseudo-op. This should be
2447 called by the obj-format routine which handles section changing
2448 when in MRI mode. It will create a new section, and return it. It
2449 will set *TYPE to the section type: one of 'C' (code), 'D' (data),
2450 'M' (mixed), or 'R' (romable). If BFD_ASSEMBLER is defined, the
2451 flags will be set in the section. */
2455 char *type ATTRIBUTE_UNUSED
;
2465 name
= input_line_pointer
;
2466 if (!isdigit ((unsigned char) *name
))
2467 c
= get_symbol_end ();
2472 ++input_line_pointer
;
2474 while (isdigit ((unsigned char) *input_line_pointer
));
2476 c
= *input_line_pointer
;
2477 *input_line_pointer
= '\0';
2480 name
= xstrdup (name
);
2482 *input_line_pointer
= c
;
2484 seg
= subseg_new (name
, 0);
2486 if (*input_line_pointer
== ',')
2490 ++input_line_pointer
;
2491 align
= get_absolute_expression ();
2492 record_alignment (seg
, align
);
2496 if (*input_line_pointer
== ',')
2498 c
= *++input_line_pointer
;
2499 c
= toupper ((unsigned char) c
);
2500 if (c
== 'C' || c
== 'D' || c
== 'M' || c
== 'R')
2503 as_bad (_("unrecognized section type"));
2504 ++input_line_pointer
;
2506 #ifdef BFD_ASSEMBLER
2510 flags
= SEC_NO_FLAGS
;
2512 flags
= SEC_ALLOC
| SEC_LOAD
| SEC_READONLY
| SEC_CODE
;
2513 else if (*type
== 'D' || *type
== 'M')
2514 flags
= SEC_ALLOC
| SEC_LOAD
| SEC_DATA
;
2515 else if (*type
== 'R')
2516 flags
= SEC_ALLOC
| SEC_LOAD
| SEC_DATA
| SEC_READONLY
| SEC_ROM
;
2517 if (flags
!= SEC_NO_FLAGS
)
2519 if (!bfd_set_section_flags (stdoutput
, seg
, flags
))
2520 as_warn (_("error setting flags for \"%s\": %s"),
2521 bfd_section_name (stdoutput
, seg
),
2522 bfd_errmsg (bfd_get_error ()));
2528 /* Ignore the HP type. */
2529 if (*input_line_pointer
== ',')
2530 input_line_pointer
+= 2;
2532 demand_empty_rest_of_line ();
2534 #else /* ! TC_M68K */
2543 name
= input_line_pointer
;
2544 c
= get_symbol_end ();
2546 name
= xstrdup (name
);
2548 *input_line_pointer
= c
;
2550 seg
= subseg_new (name
, 0);
2552 if (*input_line_pointer
!= ',')
2558 ++input_line_pointer
;
2560 sectype
= input_line_pointer
;
2561 c
= get_symbol_end ();
2562 if (*sectype
== '\0')
2564 else if (strcasecmp (sectype
, "text") == 0)
2566 else if (strcasecmp (sectype
, "data") == 0)
2568 else if (strcasecmp (sectype
, "romdata") == 0)
2571 as_warn (_("unrecognized section type `%s'"), sectype
);
2572 *input_line_pointer
= c
;
2575 if (*input_line_pointer
== ',')
2579 ++input_line_pointer
;
2581 seccmd
= input_line_pointer
;
2582 c
= get_symbol_end ();
2583 if (strcasecmp (seccmd
, "absolute") == 0)
2585 as_bad (_("absolute sections are not supported"));
2586 *input_line_pointer
= c
;
2587 ignore_rest_of_line ();
2590 else if (strcasecmp (seccmd
, "align") == 0)
2594 *input_line_pointer
= c
;
2595 align
= get_absolute_expression ();
2596 record_alignment (seg
, align
);
2600 as_warn (_("unrecognized section command `%s'"), seccmd
);
2601 *input_line_pointer
= c
;
2605 demand_empty_rest_of_line ();
2607 #else /* ! TC_I960 */
2608 /* The MRI assembler seems to use different forms of .sect for
2609 different targets. */
2610 as_bad ("MRI mode not supported for this target");
2611 ignore_rest_of_line ();
2612 #endif /* ! TC_I960 */
2613 #endif /* ! TC_M68K */
2616 /* Handle the .print pseudo-op. */
2620 int ignore ATTRIBUTE_UNUSED
;
2625 s
= demand_copy_C_string (&len
);
2627 demand_empty_rest_of_line ();
2630 /* Handle the .purgem pseudo-op. */
2634 int ignore ATTRIBUTE_UNUSED
;
2636 if (is_it_end_of_statement ())
2638 demand_empty_rest_of_line ();
2648 name
= input_line_pointer
;
2649 c
= get_symbol_end ();
2650 delete_macro (name
);
2651 *input_line_pointer
= c
;
2654 while (*input_line_pointer
++ == ',');
2656 --input_line_pointer
;
2657 demand_empty_rest_of_line ();
2660 /* Handle the .rept pseudo-op. */
2664 int ignore ATTRIBUTE_UNUSED
;
2668 count
= get_absolute_expression ();
2670 do_repeat (count
, "REPT", "ENDR");
2673 /* This function provides a generic repeat block implementation. It allows
2674 different directives to be used as the start/end keys. */
2677 do_repeat (count
, start
, end
)
2686 if (!buffer_and_nest (start
, end
, &one
, get_line_sb
))
2688 as_bad (_("%s without %s"), start
, end
);
2694 sb_add_sb (&many
, &one
);
2698 input_scrub_include_sb (&many
, input_line_pointer
, 1);
2700 buffer_limit
= input_scrub_next_buffer (&input_line_pointer
);
2703 /* Skip to end of current repeat loop; EXTRA indicates how many additional
2704 input buffers to skip. Assumes that conditionals preceding the loop end
2705 are properly nested.
2707 This function makes it easier to implement a premature "break" out of the
2708 loop. The EXTRA arg accounts for other buffers we might have inserted,
2709 such as line substitutions. */
2715 cond_exit_macro (macro_nest
);
2716 while (extra
-- >= 0)
2717 buffer_limit
= input_scrub_next_buffer (&input_line_pointer
);
2720 /* Handle the .equ, .equiv and .set directives. If EQUIV is 1, then
2721 this is .equiv, and it is an error if the symbol is already
2728 register char *name
;
2729 register char delim
;
2730 register char *end_name
;
2731 register symbolS
*symbolP
;
2733 /* Especial apologies for the random logic:
2734 this just grew, and could be parsed much more simply!
2736 name
= input_line_pointer
;
2737 delim
= get_symbol_end ();
2738 end_name
= input_line_pointer
;
2742 if (*input_line_pointer
!= ',')
2745 as_bad (_("Expected comma after name \"%s\""), name
);
2747 ignore_rest_of_line ();
2751 input_line_pointer
++;
2754 if (name
[0] == '.' && name
[1] == '\0')
2756 /* Turn '. = mumble' into a .org mumble. */
2757 register segT segment
;
2760 segment
= get_known_segmented_expression (&exp
);
2763 do_org (segment
, &exp
, 0);
2769 if ((symbolP
= symbol_find (name
)) == NULL
2770 && (symbolP
= md_undefined_symbol (name
)) == NULL
)
2773 /* When doing symbol listings, play games with dummy fragments living
2774 outside the normal fragment chain to record the file and line info
2776 if (listing
& LISTING_SYMBOLS
)
2778 extern struct list_info_struct
*listing_tail
;
2779 fragS
*dummy_frag
= (fragS
*) xmalloc (sizeof (fragS
));
2780 memset (dummy_frag
, 0, sizeof (fragS
));
2781 dummy_frag
->fr_type
= rs_fill
;
2782 dummy_frag
->line
= listing_tail
;
2783 symbolP
= symbol_new (name
, undefined_section
, 0, dummy_frag
);
2784 dummy_frag
->fr_symbol
= symbolP
;
2788 symbolP
= symbol_new (name
, undefined_section
, 0, &zero_address_frag
);
2791 /* "set" symbols are local unless otherwise specified. */
2792 SF_SET_LOCAL (symbolP
);
2793 #endif /* OBJ_COFF */
2796 symbol_table_insert (symbolP
);
2801 && S_IS_DEFINED (symbolP
)
2802 && S_GET_SEGMENT (symbolP
) != reg_section
)
2803 as_bad (_("symbol `%s' already defined"), S_GET_NAME (symbolP
));
2805 pseudo_set (symbolP
);
2806 demand_empty_rest_of_line ();
2820 #ifdef md_flush_pending_output
2821 md_flush_pending_output ();
2825 stop
= mri_comment_field (&stopc
);
2827 /* In m68k MRI mode, we need to align to a word boundary, unless
2829 if (flag_m68k_mri
&& mult
> 1)
2831 if (now_seg
== absolute_section
)
2833 abs_section_offset
+= abs_section_offset
& 1;
2834 if (line_label
!= NULL
)
2835 S_SET_VALUE (line_label
, abs_section_offset
);
2837 else if (mri_common_symbol
!= NULL
)
2841 val
= S_GET_VALUE (mri_common_symbol
);
2844 S_SET_VALUE (mri_common_symbol
, val
+ 1);
2845 if (line_label
!= NULL
)
2847 expressionS
*symexp
;
2849 symexp
= symbol_get_value_expression (line_label
);
2850 know (symexp
->X_op
== O_symbol
);
2851 know (symexp
->X_add_symbol
== mri_common_symbol
);
2852 symexp
->X_add_number
+= 1;
2858 do_align (1, (char *) NULL
, 0, 0);
2859 if (line_label
!= NULL
)
2861 symbol_set_frag (line_label
, frag_now
);
2862 S_SET_VALUE (line_label
, frag_now_fix ());
2872 if (*input_line_pointer
== ',')
2874 ++input_line_pointer
;
2879 val
.X_op
= O_constant
;
2880 val
.X_add_number
= 0;
2883 if (val
.X_op
!= O_constant
2884 || val
.X_add_number
< - 0x80
2885 || val
.X_add_number
> 0xff
2886 || (mult
!= 0 && mult
!= 1 && val
.X_add_number
!= 0))
2888 if (exp
.X_op
!= O_constant
)
2889 as_bad (_("Unsupported variable size or fill value"));
2896 bytes
= mult
* exp
.X_add_number
;
2897 for (i
= 0; i
< exp
.X_add_number
; i
++)
2898 emit_expr (&val
, mult
);
2903 if (exp
.X_op
== O_constant
)
2907 repeat
= exp
.X_add_number
;
2914 as_warn (_(".space repeat count is zero, ignored"));
2915 else if (repeat
< 0)
2916 as_warn (_(".space repeat count is negative, ignored"));
2920 /* If we are in the absolute section, just bump the offset. */
2921 if (now_seg
== absolute_section
)
2923 abs_section_offset
+= repeat
;
2927 /* If we are secretly in an MRI common section, then
2928 creating space just increases the size of the common
2930 if (mri_common_symbol
!= NULL
)
2932 S_SET_VALUE (mri_common_symbol
,
2933 S_GET_VALUE (mri_common_symbol
) + repeat
);
2938 p
= frag_var (rs_fill
, 1, 1, (relax_substateT
) 0, (symbolS
*) 0,
2939 (offsetT
) repeat
, (char *) 0);
2943 if (now_seg
== absolute_section
)
2945 as_bad (_("space allocation too complex in absolute section"));
2946 subseg_set (text_section
, 0);
2949 if (mri_common_symbol
!= NULL
)
2951 as_bad (_("space allocation too complex in common section"));
2952 mri_common_symbol
= NULL
;
2956 p
= frag_var (rs_space
, 1, 1, (relax_substateT
) 0,
2957 make_expr_symbol (&exp
), (offsetT
) 0, (char *) 0);
2961 *p
= val
.X_add_number
;
2966 /* In MRI mode, after an odd number of bytes, we must align to an
2967 even word boundary, unless the next instruction is a dc.b, ds.b
2969 if (flag_mri
&& (bytes
& 1) != 0)
2970 mri_pending_align
= 1;
2972 demand_empty_rest_of_line ();
2975 mri_comment_end (stop
, stopc
);
2978 /* This is like s_space, but the value is a floating point number with
2979 the given precision. This is for the MRI dcb.s pseudo-op and
2983 s_float_space (float_type
)
2988 char temp
[MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT
];
2993 stop
= mri_comment_field (&stopc
);
2995 count
= get_absolute_expression ();
2998 if (*input_line_pointer
!= ',')
3000 as_bad (_("missing value"));
3001 ignore_rest_of_line ();
3003 mri_comment_end (stop
, stopc
);
3007 ++input_line_pointer
;
3011 /* Skip any 0{letter} that may be present. Don't even check if the
3012 * letter is legal. */
3013 if (input_line_pointer
[0] == '0'
3014 && isalpha ((unsigned char) input_line_pointer
[1]))
3015 input_line_pointer
+= 2;
3017 /* Accept :xxxx, where the x's are hex digits, for a floating point
3018 with the exact digits specified. */
3019 if (input_line_pointer
[0] == ':')
3021 flen
= hex_float (float_type
, temp
);
3024 ignore_rest_of_line ();
3026 mri_comment_end (stop
, stopc
);
3034 err
= md_atof (float_type
, temp
, &flen
);
3035 know (flen
<= MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT
);
3039 as_bad (_("Bad floating literal: %s"), err
);
3040 ignore_rest_of_line ();
3042 mri_comment_end (stop
, stopc
);
3047 while (--count
>= 0)
3051 p
= frag_more (flen
);
3052 memcpy (p
, temp
, (unsigned int) flen
);
3055 demand_empty_rest_of_line ();
3058 mri_comment_end (stop
, stopc
);
3061 /* Handle the .struct pseudo-op, as found in MIPS assemblers. */
3065 int ignore ATTRIBUTE_UNUSED
;
3071 stop
= mri_comment_field (&stopc
);
3072 abs_section_offset
= get_absolute_expression ();
3073 subseg_set (absolute_section
, 0);
3074 demand_empty_rest_of_line ();
3076 mri_comment_end (stop
, stopc
);
3081 int ignore ATTRIBUTE_UNUSED
;
3085 temp
= get_absolute_expression ();
3086 subseg_set (text_section
, (subsegT
) temp
);
3087 demand_empty_rest_of_line ();
3089 const_flag
&= ~IN_DEFAULT_SECTION
;
3094 demand_empty_rest_of_line ()
3097 if (is_end_of_line
[(unsigned char) *input_line_pointer
])
3098 input_line_pointer
++;
3100 ignore_rest_of_line ();
3102 /* Return having already swallowed end-of-line. */
3106 ignore_rest_of_line ()
3108 /* For suspect lines: gives warning. */
3109 if (!is_end_of_line
[(unsigned char) *input_line_pointer
])
3111 if (isprint ((unsigned char) *input_line_pointer
))
3112 as_bad (_("Rest of line ignored. First ignored character is `%c'."),
3113 *input_line_pointer
);
3115 as_bad (_("Rest of line ignored. First ignored character valued 0x%x."),
3116 *input_line_pointer
);
3118 while (input_line_pointer
< buffer_limit
3119 && !is_end_of_line
[(unsigned char) *input_line_pointer
])
3120 input_line_pointer
++;
3123 input_line_pointer
++;
3125 /* Return pointing just after end-of-line. */
3126 know (is_end_of_line
[(unsigned char) input_line_pointer
[-1]]);
3130 discard_rest_of_line ()
3132 while (input_line_pointer
< buffer_limit
3133 && !is_end_of_line
[(unsigned char) *input_line_pointer
])
3134 input_line_pointer
++;
3136 input_line_pointer
++;
3138 /* Return pointing just after end-of-line. */
3139 know (is_end_of_line
[(unsigned char) input_line_pointer
[-1]]);
3142 /* In: Pointer to a symbol.
3143 Input_line_pointer->expression.
3145 Out: Input_line_pointer->just after any whitespace after expression.
3146 Tried to set symbol to value of expression.
3147 Will change symbols type, value, and frag; */
3150 pseudo_set (symbolP
)
3154 #if (defined (OBJ_AOUT) || defined (OBJ_BOUT)) && ! defined (BFD_ASSEMBLER)
3156 #endif /* OBJ_AOUT or OBJ_BOUT */
3158 know (symbolP
); /* NULL pointer is logic error. */
3159 #if (defined (OBJ_AOUT) || defined (OBJ_BOUT)) && ! defined (BFD_ASSEMBLER)
3160 ext
= S_IS_EXTERNAL (symbolP
);
3161 #endif /* OBJ_AOUT or OBJ_BOUT */
3163 (void) expression (&exp
);
3165 if (exp
.X_op
== O_illegal
)
3166 as_bad (_("illegal expression; zero assumed"));
3167 else if (exp
.X_op
== O_absent
)
3168 as_bad (_("missing expression; zero assumed"));
3169 else if (exp
.X_op
== O_big
)
3171 if (exp
.X_add_number
> 0)
3172 as_bad (_("bignum invalid; zero assumed"));
3174 as_bad (_("floating point number invalid; zero assumed"));
3176 else if (exp
.X_op
== O_subtract
3177 && (S_GET_SEGMENT (exp
.X_add_symbol
)
3178 == S_GET_SEGMENT (exp
.X_op_symbol
))
3179 && SEG_NORMAL (S_GET_SEGMENT (exp
.X_add_symbol
))
3180 && (symbol_get_frag (exp
.X_add_symbol
)
3181 == symbol_get_frag (exp
.X_op_symbol
)))
3183 exp
.X_op
= O_constant
;
3184 exp
.X_add_number
= (S_GET_VALUE (exp
.X_add_symbol
)
3185 - S_GET_VALUE (exp
.X_op_symbol
));
3193 exp
.X_add_number
= 0;
3196 S_SET_SEGMENT (symbolP
, absolute_section
);
3197 #if (defined (OBJ_AOUT) || defined (OBJ_BOUT)) && ! defined (BFD_ASSEMBLER)
3199 S_SET_EXTERNAL (symbolP
);
3201 S_CLEAR_EXTERNAL (symbolP
);
3202 #endif /* OBJ_AOUT or OBJ_BOUT */
3203 S_SET_VALUE (symbolP
, (valueT
) exp
.X_add_number
);
3204 if (exp
.X_op
!= O_constant
)
3205 symbol_set_frag (symbolP
, &zero_address_frag
);
3209 S_SET_SEGMENT (symbolP
, reg_section
);
3210 S_SET_VALUE (symbolP
, (valueT
) exp
.X_add_number
);
3211 symbol_set_frag (symbolP
, &zero_address_frag
);
3215 if (S_GET_SEGMENT (exp
.X_add_symbol
) == undefined_section
3216 || exp
.X_add_number
!= 0)
3217 symbol_set_value_expression (symbolP
, &exp
);
3218 else if (symbol_section_p (symbolP
))
3219 as_bad ("invalid attempt to set value of section symbol");
3222 symbolS
*s
= exp
.X_add_symbol
;
3224 S_SET_SEGMENT (symbolP
, S_GET_SEGMENT (s
));
3225 #if (defined (OBJ_AOUT) || defined (OBJ_BOUT)) && ! defined (BFD_ASSEMBLER)
3227 S_SET_EXTERNAL (symbolP
);
3229 S_CLEAR_EXTERNAL (symbolP
);
3230 #endif /* OBJ_AOUT or OBJ_BOUT */
3231 S_SET_VALUE (symbolP
,
3232 exp
.X_add_number
+ S_GET_VALUE (s
));
3233 symbol_set_frag (symbolP
, symbol_get_frag (s
));
3234 copy_symbol_attributes (symbolP
, s
);
3239 /* The value is some complex expression.
3240 FIXME: Should we set the segment to anything? */
3241 symbol_set_value_expression (symbolP
, &exp
);
3248 CONStruct more frag of .bytes, or .words etc.
3249 Should need_pass_2 be 1 then emit no frag(s).
3250 This understands EXPRESSIONS.
3254 This has a split personality. We use expression() to read the
3255 value. We can detect if the value won't fit in a byte or word.
3256 But we can't detect if expression() discarded significant digits
3257 in the case of a long. Not worth the crocks required to fix it. */
3259 /* Select a parser for cons expressions. */
3261 /* Some targets need to parse the expression in various fancy ways.
3262 You can define TC_PARSE_CONS_EXPRESSION to do whatever you like
3263 (for example, the HPPA does this). Otherwise, you can define
3264 BITFIELD_CONS_EXPRESSIONS to permit bitfields to be specified, or
3265 REPEAT_CONS_EXPRESSIONS to permit repeat counts. If none of these
3266 are defined, which is the normal case, then only simple expressions
3271 parse_mri_cons
PARAMS ((expressionS
*exp
, unsigned int nbytes
));
3274 #ifndef TC_PARSE_CONS_EXPRESSION
3275 #ifdef BITFIELD_CONS_EXPRESSIONS
3276 #define TC_PARSE_CONS_EXPRESSION(EXP, NBYTES) parse_bitfield_cons (EXP, NBYTES)
3278 parse_bitfield_cons
PARAMS ((expressionS
*exp
, unsigned int nbytes
));
3280 #ifdef REPEAT_CONS_EXPRESSIONS
3281 #define TC_PARSE_CONS_EXPRESSION(EXP, NBYTES) parse_repeat_cons (EXP, NBYTES)
3283 parse_repeat_cons
PARAMS ((expressionS
*exp
, unsigned int nbytes
));
3286 /* If we haven't gotten one yet, just call expression. */
3287 #ifndef TC_PARSE_CONS_EXPRESSION
3288 #define TC_PARSE_CONS_EXPRESSION(EXP, NBYTES) expression (EXP)
3292 /* Worker to do .byte etc statements.
3293 Clobbers input_line_pointer and checks end-of-line. */
3296 cons_worker (nbytes
, rva
)
3297 register int nbytes
; /* 1=.byte, 2=.word, 4=.long. */
3305 #ifdef md_flush_pending_output
3306 md_flush_pending_output ();
3310 stop
= mri_comment_field (&stopc
);
3312 if (is_it_end_of_statement ())
3314 demand_empty_rest_of_line ();
3316 mri_comment_end (stop
, stopc
);
3320 #ifdef md_cons_align
3321 md_cons_align (nbytes
);
3329 parse_mri_cons (&exp
, (unsigned int) nbytes
);
3332 TC_PARSE_CONS_EXPRESSION (&exp
, (unsigned int) nbytes
);
3336 if (exp
.X_op
== O_symbol
)
3337 exp
.X_op
= O_symbol_rva
;
3339 as_fatal (_("rva without symbol"));
3341 emit_expr (&exp
, (unsigned int) nbytes
);
3344 while (*input_line_pointer
++ == ',');
3346 /* In MRI mode, after an odd number of bytes, we must align to an
3347 even word boundary, unless the next instruction is a dc.b, ds.b
3349 if (flag_mri
&& nbytes
== 1 && (c
& 1) != 0)
3350 mri_pending_align
= 1;
3352 input_line_pointer
--; /* Put terminator back into stream. */
3354 demand_empty_rest_of_line ();
3357 mri_comment_end (stop
, stopc
);
3364 cons_worker (size
, 0);
3371 cons_worker (size
, 1);
3374 /* Put the contents of expression EXP into the object file using
3375 NBYTES bytes. If need_pass_2 is 1, this does nothing. */
3378 emit_expr (exp
, nbytes
)
3380 unsigned int nbytes
;
3384 valueT extra_digit
= 0;
3386 /* Don't do anything if we are going to make another pass. */
3392 /* When gcc emits DWARF 1 debugging pseudo-ops, a line number will
3393 appear as a four byte positive constant in the .line section,
3394 followed by a 2 byte 0xffff. Look for that case here. */
3396 static int dwarf_line
= -1;
3398 if (strcmp (segment_name (now_seg
), ".line") != 0)
3400 else if (dwarf_line
>= 0
3402 && exp
->X_op
== O_constant
3403 && (exp
->X_add_number
== -1 || exp
->X_add_number
== 0xffff))
3404 listing_source_line ((unsigned int) dwarf_line
);
3405 else if (nbytes
== 4
3406 && exp
->X_op
== O_constant
3407 && exp
->X_add_number
>= 0)
3408 dwarf_line
= exp
->X_add_number
;
3413 /* When gcc emits DWARF 1 debugging pseudo-ops, a file name will
3414 appear as a 2 byte TAG_compile_unit (0x11) followed by a 2 byte
3415 AT_sibling (0x12) followed by a four byte address of the sibling
3416 followed by a 2 byte AT_name (0x38) followed by the name of the
3417 file. We look for that case here. */
3419 static int dwarf_file
= 0;
3421 if (strcmp (segment_name (now_seg
), ".debug") != 0)
3423 else if (dwarf_file
== 0
3425 && exp
->X_op
== O_constant
3426 && exp
->X_add_number
== 0x11)
3428 else if (dwarf_file
== 1
3430 && exp
->X_op
== O_constant
3431 && exp
->X_add_number
== 0x12)
3433 else if (dwarf_file
== 2
3436 else if (dwarf_file
== 3
3438 && exp
->X_op
== O_constant
3439 && exp
->X_add_number
== 0x38)
3444 /* The variable dwarf_file_string tells stringer that the string
3445 may be the name of the source file. */
3446 if (dwarf_file
== 4)
3447 dwarf_file_string
= 1;
3449 dwarf_file_string
= 0;
3454 if (check_eh_frame (exp
, &nbytes
))
3459 /* Allow `.word 0' in the absolute section. */
3460 if (now_seg
== absolute_section
)
3462 if (op
!= O_constant
|| exp
->X_add_number
!= 0)
3463 as_bad (_("attempt to store value in absolute section"));
3464 abs_section_offset
+= nbytes
;
3468 /* Handle a negative bignum. */
3470 && exp
->X_add_number
== 0
3471 && symbol_get_value_expression (exp
->X_add_symbol
)->X_op
== O_big
3472 && symbol_get_value_expression (exp
->X_add_symbol
)->X_add_number
> 0)
3475 unsigned long carry
;
3477 exp
= symbol_get_value_expression (exp
->X_add_symbol
);
3479 /* Negate the bignum: one's complement each digit and add 1. */
3481 for (i
= 0; i
< exp
->X_add_number
; i
++)
3485 next
= (((~(generic_bignum
[i
] & LITTLENUM_MASK
))
3488 generic_bignum
[i
] = next
& LITTLENUM_MASK
;
3489 carry
= next
>> LITTLENUM_NUMBER_OF_BITS
;
3492 /* We can ignore any carry out, because it will be handled by
3493 extra_digit if it is needed. */
3495 extra_digit
= (valueT
) -1;
3499 if (op
== O_absent
|| op
== O_illegal
)
3501 as_warn (_("zero assumed for missing expression"));
3502 exp
->X_add_number
= 0;
3505 else if (op
== O_big
&& exp
->X_add_number
<= 0)
3507 as_bad (_("floating point number invalid; zero assumed"));
3508 exp
->X_add_number
= 0;
3511 else if (op
== O_register
)
3513 as_warn (_("register value used as expression"));
3517 p
= frag_more ((int) nbytes
);
3519 #ifndef WORKING_DOT_WORD
3520 /* If we have the difference of two symbols in a word, save it on
3521 the broken_words list. See the code in write.c. */
3522 if (op
== O_subtract
&& nbytes
== 2)
3524 struct broken_word
*x
;
3526 x
= (struct broken_word
*) xmalloc (sizeof (struct broken_word
));
3527 x
->next_broken_word
= broken_words
;
3530 x
->subseg
= now_subseg
;
3532 x
->word_goes_here
= p
;
3534 x
->add
= exp
->X_add_symbol
;
3535 x
->sub
= exp
->X_op_symbol
;
3536 x
->addnum
= exp
->X_add_number
;
3543 /* If we have an integer, but the number of bytes is too large to
3544 pass to md_number_to_chars, handle it as a bignum. */
3545 if (op
== O_constant
&& nbytes
> sizeof (valueT
))
3550 if (!exp
->X_unsigned
&& exp
->X_add_number
< 0)
3551 extra_digit
= (valueT
) -1;
3552 val
= (valueT
) exp
->X_add_number
;
3556 generic_bignum
[gencnt
] = val
& LITTLENUM_MASK
;
3557 val
>>= LITTLENUM_NUMBER_OF_BITS
;
3561 op
= exp
->X_op
= O_big
;
3562 exp
->X_add_number
= gencnt
;
3565 if (op
== O_constant
)
3567 register valueT get
;
3568 register valueT use
;
3569 register valueT mask
;
3571 register valueT unmask
;
3573 /* JF << of >= number of bits in the object is undefined. In
3574 particular SPARC (Sun 4) has problems. */
3575 if (nbytes
>= sizeof (valueT
))
3578 if (nbytes
> sizeof (valueT
))
3581 hibit
= (valueT
) 1 << (nbytes
* BITS_PER_CHAR
- 1);
3585 /* Don't store these bits. */
3586 mask
= ~(valueT
) 0 << (BITS_PER_CHAR
* nbytes
);
3587 hibit
= (valueT
) 1 << (nbytes
* BITS_PER_CHAR
- 1);
3590 unmask
= ~mask
; /* Do store these bits. */
3593 "Do this mod if you want every overflow check to assume SIGNED 2's complement data.";
3594 mask
= ~(unmask
>> 1); /* Includes sign bit now. */
3597 get
= exp
->X_add_number
;
3599 if ((get
& mask
) != 0
3600 && ((get
& mask
) != mask
3601 || (get
& hibit
) == 0))
3602 { /* Leading bits contain both 0s & 1s. */
3603 as_warn (_("Value 0x%lx truncated to 0x%lx."),
3604 (unsigned long) get
, (unsigned long) use
);
3606 /* Put bytes in right order. */
3607 md_number_to_chars (p
, use
, (int) nbytes
);
3609 else if (op
== O_big
)
3612 LITTLENUM_TYPE
*nums
;
3614 know (nbytes
% CHARS_PER_LITTLENUM
== 0);
3616 size
= exp
->X_add_number
* CHARS_PER_LITTLENUM
;
3619 as_warn (_("Bignum truncated to %d bytes"), nbytes
);
3623 if (target_big_endian
)
3625 while (nbytes
> size
)
3627 md_number_to_chars (p
, extra_digit
, CHARS_PER_LITTLENUM
);
3628 nbytes
-= CHARS_PER_LITTLENUM
;
3629 p
+= CHARS_PER_LITTLENUM
;
3632 nums
= generic_bignum
+ size
/ CHARS_PER_LITTLENUM
;
3636 md_number_to_chars (p
, (valueT
) *nums
, CHARS_PER_LITTLENUM
);
3637 size
-= CHARS_PER_LITTLENUM
;
3638 p
+= CHARS_PER_LITTLENUM
;
3643 nums
= generic_bignum
;
3646 md_number_to_chars (p
, (valueT
) *nums
, CHARS_PER_LITTLENUM
);
3648 size
-= CHARS_PER_LITTLENUM
;
3649 p
+= CHARS_PER_LITTLENUM
;
3650 nbytes
-= CHARS_PER_LITTLENUM
;
3655 md_number_to_chars (p
, extra_digit
, CHARS_PER_LITTLENUM
);
3656 nbytes
-= CHARS_PER_LITTLENUM
;
3657 p
+= CHARS_PER_LITTLENUM
;
3663 memset (p
, 0, nbytes
);
3665 /* Now we need to generate a fixS to record the symbol value.
3666 This is easy for BFD. For other targets it can be more
3667 complex. For very complex cases (currently, the HPPA and
3668 NS32K), you can define TC_CONS_FIX_NEW to do whatever you
3669 want. For simpler cases, you can define TC_CONS_RELOC to be
3670 the name of the reloc code that should be stored in the fixS.
3671 If neither is defined, the code uses NO_RELOC if it is
3672 defined, and otherwise uses 0. */
3674 #ifdef BFD_ASSEMBLER
3675 #ifdef TC_CONS_FIX_NEW
3676 TC_CONS_FIX_NEW (frag_now
, p
- frag_now
->fr_literal
, nbytes
, exp
);
3679 bfd_reloc_code_real_type r
;
3696 as_bad (_("unsupported BFD relocation size %u"), nbytes
);
3700 fix_new_exp (frag_now
, p
- frag_now
->fr_literal
, (int) nbytes
, exp
,
3705 #ifdef TC_CONS_FIX_NEW
3706 TC_CONS_FIX_NEW (frag_now
, p
- frag_now
->fr_literal
, nbytes
, exp
);
3708 /* Figure out which reloc number to use. Use TC_CONS_RELOC if
3709 it is defined, otherwise use NO_RELOC if it is defined,
3711 #ifndef TC_CONS_RELOC
3713 #define TC_CONS_RELOC NO_RELOC
3715 #define TC_CONS_RELOC 0
3718 fix_new_exp (frag_now
, p
- frag_now
->fr_literal
, (int) nbytes
, exp
, 0,
3720 #endif /* TC_CONS_FIX_NEW */
3721 #endif /* BFD_ASSEMBLER */
3725 #ifdef BITFIELD_CONS_EXPRESSIONS
3727 /* i960 assemblers, (eg, asm960), allow bitfields after ".byte" as
3728 w:x,y:z, where w and y are bitwidths and x and y are values. They
3729 then pack them all together. We do a little better in that we allow
3730 them in words, longs, etc. and we'll pack them in target byte order
3733 The rules are: pack least significat bit first, if a field doesn't
3734 entirely fit, put it in the next unit. Overflowing the bitfield is
3735 explicitly *not* even a warning. The bitwidth should be considered
3738 To use this function the tc-XXX.h file should define
3739 BITFIELD_CONS_EXPRESSIONS. */
3742 parse_bitfield_cons (exp
, nbytes
)
3744 unsigned int nbytes
;
3746 unsigned int bits_available
= BITS_PER_CHAR
* nbytes
;
3747 char *hold
= input_line_pointer
;
3749 (void) expression (exp
);
3751 if (*input_line_pointer
== ':')
3758 unsigned long width
;
3760 if (*input_line_pointer
!= ':')
3762 input_line_pointer
= hold
;
3764 } /* Next piece is not a bitfield. */
3766 /* In the general case, we can't allow
3767 full expressions with symbol
3768 differences and such. The relocation
3769 entries for symbols not defined in this
3770 assembly would require arbitrary field
3771 widths, positions, and masks which most
3772 of our current object formats don't
3775 In the specific case where a symbol
3776 *is* defined in this assembly, we
3777 *could* build fixups and track it, but
3778 this could lead to confusion for the
3779 backends. I'm lazy. I'll take any
3780 SEG_ABSOLUTE. I think that means that
3781 you can use a previous .set or
3782 .equ type symbol. xoxorich. */
3784 if (exp
->X_op
== O_absent
)
3786 as_warn (_("using a bit field width of zero"));
3787 exp
->X_add_number
= 0;
3788 exp
->X_op
= O_constant
;
3789 } /* Implied zero width bitfield. */
3791 if (exp
->X_op
!= O_constant
)
3793 *input_line_pointer
= '\0';
3794 as_bad (_("field width \"%s\" too complex for a bitfield"), hold
);
3795 *input_line_pointer
= ':';
3796 demand_empty_rest_of_line ();
3798 } /* Too complex. */
3800 if ((width
= exp
->X_add_number
) > (BITS_PER_CHAR
* nbytes
))
3802 as_warn (_("field width %lu too big to fit in %d bytes: truncated to %d bits"),
3803 width
, nbytes
, (BITS_PER_CHAR
* nbytes
));
3804 width
= BITS_PER_CHAR
* nbytes
;
3807 if (width
> bits_available
)
3809 /* FIXME-SOMEDAY: backing up and reparsing is wasteful. */
3810 input_line_pointer
= hold
;
3811 exp
->X_add_number
= value
;
3815 hold
= ++input_line_pointer
; /* skip ':' */
3817 (void) expression (exp
);
3818 if (exp
->X_op
!= O_constant
)
3820 char cache
= *input_line_pointer
;
3822 *input_line_pointer
= '\0';
3823 as_bad (_("field value \"%s\" too complex for a bitfield"), hold
);
3824 *input_line_pointer
= cache
;
3825 demand_empty_rest_of_line ();
3827 } /* Too complex. */
3829 value
|= ((~(-1 << width
) & exp
->X_add_number
)
3830 << ((BITS_PER_CHAR
* nbytes
) - bits_available
));
3832 if ((bits_available
-= width
) == 0
3833 || is_it_end_of_statement ()
3834 || *input_line_pointer
!= ',')
3837 } /* All the bitfields we're gonna get. */
3839 hold
= ++input_line_pointer
;
3840 (void) expression (exp
);
3843 exp
->X_add_number
= value
;
3844 exp
->X_op
= O_constant
;
3845 exp
->X_unsigned
= 1;
3849 #endif /* BITFIELD_CONS_EXPRESSIONS */
3851 /* Handle an MRI style string expression. */
3855 parse_mri_cons (exp
, nbytes
)
3857 unsigned int nbytes
;
3859 if (*input_line_pointer
!= '\''
3860 && (input_line_pointer
[1] != '\''
3861 || (*input_line_pointer
!= 'A'
3862 && *input_line_pointer
!= 'E')))
3863 TC_PARSE_CONS_EXPRESSION (exp
, nbytes
);
3867 unsigned int result
= 0;
3869 /* An MRI style string. Cut into as many bytes as will fit into
3870 a nbyte chunk, left justify if necessary, and separate with
3871 commas so we can try again later. */
3872 if (*input_line_pointer
== 'A')
3873 ++input_line_pointer
;
3874 else if (*input_line_pointer
== 'E')
3876 as_bad (_("EBCDIC constants are not supported"));
3877 ++input_line_pointer
;
3880 input_line_pointer
++;
3881 for (scan
= 0; scan
< nbytes
; scan
++)
3883 if (*input_line_pointer
== '\'')
3885 if (input_line_pointer
[1] == '\'')
3887 input_line_pointer
++;
3892 result
= (result
<< 8) | (*input_line_pointer
++);
3896 while (scan
< nbytes
)
3902 /* Create correct expression. */
3903 exp
->X_op
= O_constant
;
3904 exp
->X_add_number
= result
;
3906 /* Fake it so that we can read the next char too. */
3907 if (input_line_pointer
[0] != '\'' ||
3908 (input_line_pointer
[0] == '\'' && input_line_pointer
[1] == '\''))
3910 input_line_pointer
-= 2;
3911 input_line_pointer
[0] = ',';
3912 input_line_pointer
[1] = '\'';
3915 input_line_pointer
++;
3918 #endif /* TC_M68K */
3920 #ifdef REPEAT_CONS_EXPRESSIONS
3922 /* Parse a repeat expression for cons. This is used by the MIPS
3923 assembler. The format is NUMBER:COUNT; NUMBER appears in the
3924 object file COUNT times.
3926 To use this for a target, define REPEAT_CONS_EXPRESSIONS. */
3929 parse_repeat_cons (exp
, nbytes
)
3931 unsigned int nbytes
;
3938 if (*input_line_pointer
!= ':')
3940 /* No repeat count. */
3944 ++input_line_pointer
;
3945 expression (&count
);
3946 if (count
.X_op
!= O_constant
3947 || count
.X_add_number
<= 0)
3949 as_warn (_("Unresolvable or nonpositive repeat count; using 1"));
3953 /* The cons function is going to output this expression once. So we
3954 output it count - 1 times. */
3955 for (i
= count
.X_add_number
- 1; i
> 0; i
--)
3956 emit_expr (exp
, nbytes
);
3959 #endif /* REPEAT_CONS_EXPRESSIONS */
3961 /* Parse a floating point number represented as a hex constant. This
3962 permits users to specify the exact bits they want in the floating
3966 hex_float (float_type
, bytes
)
4000 as_bad (_("Unknown floating type type '%c'"), float_type
);
4004 /* It would be nice if we could go through expression to parse the
4005 hex constant, but if we get a bignum it's a pain to sort it into
4006 the buffer correctly. */
4008 while (hex_p (*input_line_pointer
) || *input_line_pointer
== '_')
4012 /* The MRI assembler accepts arbitrary underscores strewn about
4013 through the hex constant, so we ignore them as well. */
4014 if (*input_line_pointer
== '_')
4016 ++input_line_pointer
;
4022 as_warn (_("Floating point constant too large"));
4025 d
= hex_value (*input_line_pointer
) << 4;
4026 ++input_line_pointer
;
4027 while (*input_line_pointer
== '_')
4028 ++input_line_pointer
;
4029 if (hex_p (*input_line_pointer
))
4031 d
+= hex_value (*input_line_pointer
);
4032 ++input_line_pointer
;
4034 if (target_big_endian
)
4037 bytes
[length
- i
- 1] = d
;
4043 if (target_big_endian
)
4044 memset (bytes
+ i
, 0, length
- i
);
4046 memset (bytes
, 0, length
- i
);
4054 CONStruct some more frag chars of .floats .ffloats etc.
4055 Makes 0 or more new frags.
4056 If need_pass_2 == 1, no frags are emitted.
4057 This understands only floating literals, not expressions. Sorry.
4059 A floating constant is defined by atof_generic(), except it is preceded
4060 by 0d 0f 0g or 0h. After observing the STRANGE way my BSD AS does its
4061 reading, I decided to be incompatible. This always tries to give you
4062 rounded bits to the precision of the pseudo-op. Former AS did premature
4063 truncatation, restored noisy bits instead of trailing 0s AND gave you
4064 a choice of 2 flavours of noise according to which of 2 floating-point
4065 scanners you directed AS to use.
4067 In: input_line_pointer->whitespace before, or '0' of flonum. */
4070 float_cons (float_type
)
4071 /* Clobbers input_line-pointer, checks end-of-line. */
4072 register int float_type
; /* 'f':.ffloat ... 'F':.float ... */
4075 int length
; /* Number of chars in an object. */
4076 register char *err
; /* Error from scanning floating literal. */
4077 char temp
[MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT
];
4079 if (is_it_end_of_statement ())
4081 demand_empty_rest_of_line ();
4085 #ifdef md_flush_pending_output
4086 md_flush_pending_output ();
4091 /* input_line_pointer->1st char of a flonum (we hope!). */
4094 /* Skip any 0{letter} that may be present. Don't even check if the
4095 letter is legal. Someone may invent a "z" format and this routine
4096 has no use for such information. Lusers beware: you get
4097 diagnostics if your input is ill-conditioned. */
4098 if (input_line_pointer
[0] == '0'
4099 && isalpha ((unsigned char) input_line_pointer
[1]))
4100 input_line_pointer
+= 2;
4102 /* Accept :xxxx, where the x's are hex digits, for a floating
4103 point with the exact digits specified. */
4104 if (input_line_pointer
[0] == ':')
4106 ++input_line_pointer
;
4107 length
= hex_float (float_type
, temp
);
4110 ignore_rest_of_line ();
4116 err
= md_atof (float_type
, temp
, &length
);
4117 know (length
<= MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT
);
4121 as_bad (_("Bad floating literal: %s"), err
);
4122 ignore_rest_of_line ();
4133 #ifdef REPEAT_CONS_EXPRESSIONS
4134 if (*input_line_pointer
== ':')
4136 expressionS count_exp
;
4138 ++input_line_pointer
;
4139 expression (&count_exp
);
4141 if (count_exp
.X_op
!= O_constant
4142 || count_exp
.X_add_number
<= 0)
4143 as_warn (_("unresolvable or nonpositive repeat count; using 1"));
4145 count
= count_exp
.X_add_number
;
4149 while (--count
>= 0)
4151 p
= frag_more (length
);
4152 memcpy (p
, temp
, (unsigned int) length
);
4157 while (*input_line_pointer
++ == ',');
4159 /* Put terminator back into stream. */
4160 --input_line_pointer
;
4161 demand_empty_rest_of_line ();
4164 /* Return the size of a LEB128 value. */
4167 sizeof_sleb128 (value
)
4170 register int size
= 0;
4171 register unsigned byte
;
4175 byte
= (value
& 0x7f);
4176 /* Sadly, we cannot rely on typical arithmetic right shift behaviour.
4177 Fortunately, we can structure things so that the extra work reduces
4178 to a noop on systems that do things "properly". */
4179 value
= (value
>> 7) | ~(-(offsetT
)1 >> 7);
4182 while (!(((value
== 0) && ((byte
& 0x40) == 0))
4183 || ((value
== -1) && ((byte
& 0x40) != 0))));
4189 sizeof_uleb128 (value
)
4192 register int size
= 0;
4193 register unsigned byte
;
4197 byte
= (value
& 0x7f);
4207 sizeof_leb128 (value
, sign
)
4212 return sizeof_sleb128 ((offsetT
) value
);
4214 return sizeof_uleb128 (value
);
4217 /* Output a LEB128 value. */
4220 output_sleb128 (p
, value
)
4224 register char *orig
= p
;
4229 unsigned byte
= (value
& 0x7f);
4231 /* Sadly, we cannot rely on typical arithmetic right shift behaviour.
4232 Fortunately, we can structure things so that the extra work reduces
4233 to a noop on systems that do things "properly". */
4234 value
= (value
>> 7) | ~(-(offsetT
)1 >> 7);
4236 more
= !((((value
== 0) && ((byte
& 0x40) == 0))
4237 || ((value
== -1) && ((byte
& 0x40) != 0))));
4249 output_uleb128 (p
, value
)
4257 unsigned byte
= (value
& 0x7f);
4260 /* More bytes to follow. */
4271 output_leb128 (p
, value
, sign
)
4277 return output_sleb128 (p
, (offsetT
) value
);
4279 return output_uleb128 (p
, value
);
4282 /* Do the same for bignums. We combine sizeof with output here in that
4283 we don't output for NULL values of P. It isn't really as critical as
4284 for "normal" values that this be streamlined. */
4287 output_big_sleb128 (p
, bignum
, size
)
4289 LITTLENUM_TYPE
*bignum
;
4297 /* Strip leading sign extensions off the bignum. */
4298 while (size
> 0 && bignum
[size
- 1] == (LITTLENUM_TYPE
) -1)
4303 if (loaded
< 7 && size
> 0)
4305 val
|= (*bignum
<< loaded
);
4306 loaded
+= 8 * CHARS_PER_LITTLENUM
;
4317 if ((val
== 0 && (byte
& 0x40) == 0)
4318 || (~(val
| ~(((valueT
) 1 << loaded
) - 1)) == 0
4319 && (byte
& 0x40) != 0))
4327 while (byte
& 0x80);
4333 output_big_uleb128 (p
, bignum
, size
)
4335 LITTLENUM_TYPE
*bignum
;
4343 /* Strip leading zeros off the bignum. */
4344 /* XXX: Is this needed? */
4345 while (size
> 0 && bignum
[size
- 1] == 0)
4350 if (loaded
< 7 && size
> 0)
4352 val
|= (*bignum
<< loaded
);
4353 loaded
+= 8 * CHARS_PER_LITTLENUM
;
4362 if (size
> 0 || val
)
4369 while (byte
& 0x80);
4375 output_big_leb128 (p
, bignum
, size
, sign
)
4377 LITTLENUM_TYPE
*bignum
;
4381 return output_big_sleb128 (p
, bignum
, size
);
4383 return output_big_uleb128 (p
, bignum
, size
);
4386 /* Generate the appropriate fragments for a given expression to emit a
4390 emit_leb128_expr (exp
, sign
)
4394 operatorT op
= exp
->X_op
;
4396 if (op
== O_absent
|| op
== O_illegal
)
4398 as_warn (_("zero assumed for missing expression"));
4399 exp
->X_add_number
= 0;
4402 else if (op
== O_big
&& exp
->X_add_number
<= 0)
4404 as_bad (_("floating point number invalid; zero assumed"));
4405 exp
->X_add_number
= 0;
4408 else if (op
== O_register
)
4410 as_warn (_("register value used as expression"));
4414 if (op
== O_constant
)
4416 /* If we've got a constant, emit the thing directly right now. */
4418 valueT value
= exp
->X_add_number
;
4422 size
= sizeof_leb128 (value
, sign
);
4423 p
= frag_more (size
);
4424 output_leb128 (p
, value
, sign
);
4426 else if (op
== O_big
)
4428 /* O_big is a different sort of constant. */
4433 size
= output_big_leb128 (NULL
, generic_bignum
, exp
->X_add_number
, sign
);
4434 p
= frag_more (size
);
4435 output_big_leb128 (p
, generic_bignum
, exp
->X_add_number
, sign
);
4439 /* Otherwise, we have to create a variable sized fragment and
4440 resolve things later. */
4442 frag_var (rs_leb128
, sizeof_uleb128 (~(valueT
) 0), 0, sign
,
4443 make_expr_symbol (exp
), 0, (char *) NULL
);
4447 /* Parse the .sleb128 and .uleb128 pseudos. */
4458 emit_leb128_expr (&exp
, sign
);
4460 while (*input_line_pointer
++ == ',');
4462 input_line_pointer
--;
4463 demand_empty_rest_of_line ();
4466 /* We read 0 or more ',' separated, double-quoted strings.
4467 Caller should have checked need_pass_2 is FALSE because we don't
4471 stringer (append_zero
) /* Worker to do .ascii etc statements. */
4472 /* Checks end-of-line. */
4473 register int append_zero
; /* 0: don't append '\0', else 1. */
4475 register unsigned int c
;
4478 #ifdef md_flush_pending_output
4479 md_flush_pending_output ();
4482 /* The following awkward logic is to parse ZERO or more strings,
4483 comma separated. Recall a string expression includes spaces
4484 before the opening '\"' and spaces after the closing '\"'.
4485 We fake a leading ',' if there is (supposed to be)
4486 a 1st, expression. We keep demanding expressions for each ','. */
4487 if (is_it_end_of_statement ())
4489 c
= 0; /* Skip loop. */
4490 ++input_line_pointer
; /* Compensate for end of loop. */
4494 c
= ','; /* Do loop. */
4496 while (c
== ',' || c
== '<' || c
== '"')
4499 switch (*input_line_pointer
)
4502 ++input_line_pointer
; /*->1st char of string. */
4503 start
= input_line_pointer
;
4504 while (is_a_char (c
= next_char_of_string ()))
4506 FRAG_APPEND_1_CHAR (c
);
4510 FRAG_APPEND_1_CHAR (0);
4512 know (input_line_pointer
[-1] == '\"');
4516 /* In ELF, when gcc is emitting DWARF 1 debugging output, it
4517 will emit .string with a filename in the .debug section
4518 after a sequence of constants. See the comment in
4519 emit_expr for the sequence. emit_expr will set
4520 dwarf_file_string to non-zero if this string might be a
4521 source file name. */
4522 if (strcmp (segment_name (now_seg
), ".debug") != 0)
4523 dwarf_file_string
= 0;
4524 else if (dwarf_file_string
)
4526 c
= input_line_pointer
[-1];
4527 input_line_pointer
[-1] = '\0';
4528 listing_source_file (start
);
4529 input_line_pointer
[-1] = c
;
4536 input_line_pointer
++;
4537 c
= get_single_number ();
4538 FRAG_APPEND_1_CHAR (c
);
4539 if (*input_line_pointer
!= '>')
4541 as_bad (_("Expected <nn>"));
4543 input_line_pointer
++;
4546 input_line_pointer
++;
4550 c
= *input_line_pointer
;
4553 demand_empty_rest_of_line ();
4556 /* FIXME-SOMEDAY: I had trouble here on characters with the
4557 high bits set. We'll probably also have trouble with
4558 multibyte chars, wide chars, etc. Also be careful about
4559 returning values bigger than 1 byte. xoxorich. */
4562 next_char_of_string ()
4564 register unsigned int c
;
4566 c
= *input_line_pointer
++ & CHAR_MASK
;
4574 as_warn (_("Unterminated string: Newline inserted."));
4575 bump_line_counters ();
4578 #ifndef NO_STRING_ESCAPES
4580 switch (c
= *input_line_pointer
++)
4608 break; /* As itself. */
4624 for (i
= 0, number
= 0;
4625 isdigit (c
) && i
< 3;
4626 c
= *input_line_pointer
++, i
++)
4628 number
= number
* 8 + c
- '0';
4633 --input_line_pointer
;
4642 c
= *input_line_pointer
++;
4643 while (isxdigit (c
))
4646 number
= number
* 16 + c
- '0';
4647 else if (isupper (c
))
4648 number
= number
* 16 + c
- 'A' + 10;
4650 number
= number
* 16 + c
- 'a' + 10;
4651 c
= *input_line_pointer
++;
4654 --input_line_pointer
;
4659 /* To be compatible with BSD 4.2 as: give the luser a linefeed!! */
4660 as_warn (_("Unterminated string: Newline inserted."));
4662 bump_line_counters ();
4667 #ifdef ONLY_STANDARD_ESCAPES
4668 as_bad (_("Bad escaped character in string, '?' assumed"));
4670 #endif /* ONLY_STANDARD_ESCAPES */
4675 #endif /* ! defined (NO_STRING_ESCAPES) */
4684 get_segmented_expression (expP
)
4685 register expressionS
*expP
;
4687 register segT retval
;
4689 retval
= expression (expP
);
4690 if (expP
->X_op
== O_illegal
4691 || expP
->X_op
== O_absent
4692 || expP
->X_op
== O_big
)
4694 as_bad (_("expected address expression; zero assumed"));
4695 expP
->X_op
= O_constant
;
4696 expP
->X_add_number
= 0;
4697 retval
= absolute_section
;
4703 get_known_segmented_expression (expP
)
4704 register expressionS
*expP
;
4706 register segT retval
;
4708 if ((retval
= get_segmented_expression (expP
)) == undefined_section
)
4710 /* There is no easy way to extract the undefined symbol from the
4712 if (expP
->X_add_symbol
!= NULL
4713 && S_GET_SEGMENT (expP
->X_add_symbol
) != expr_section
)
4714 as_warn (_("symbol \"%s\" undefined; zero assumed"),
4715 S_GET_NAME (expP
->X_add_symbol
));
4717 as_warn (_("some symbol undefined; zero assumed"));
4718 retval
= absolute_section
;
4719 expP
->X_op
= O_constant
;
4720 expP
->X_add_number
= 0;
4722 know (retval
== absolute_section
|| SEG_NORMAL (retval
));
4727 get_absolute_expression ()
4732 if (exp
.X_op
!= O_constant
)
4734 if (exp
.X_op
!= O_absent
)
4735 as_bad (_("bad or irreducible absolute expression; zero assumed"));
4736 exp
.X_add_number
= 0;
4738 return exp
.X_add_number
;
4741 char /* Return terminator. */
4742 get_absolute_expression_and_terminator (val_pointer
)
4743 long *val_pointer
; /* Return value of expression. */
4745 /* FIXME: val_pointer should probably be offsetT *. */
4746 *val_pointer
= (long) get_absolute_expression ();
4747 return (*input_line_pointer
++);
4750 /* Like demand_copy_string, but return NULL if the string contains any '\0's.
4751 Give a warning if that happens. */
4754 demand_copy_C_string (len_pointer
)
4759 if ((s
= demand_copy_string (len_pointer
)) != 0)
4763 for (len
= *len_pointer
; len
> 0; len
--)
4770 as_bad (_("This string may not contain \'\\0\'"));
4778 /* Demand string, but return a safe (=private) copy of the string.
4779 Return NULL if we can't read a string here. */
4782 demand_copy_string (lenP
)
4785 register unsigned int c
;
4791 if (*input_line_pointer
== '\"')
4793 input_line_pointer
++; /* Skip opening quote. */
4795 while (is_a_char (c
= next_char_of_string ()))
4797 obstack_1grow (¬es
, c
);
4800 /* JF this next line is so demand_copy_C_string will return a
4801 null terminated string. */
4802 obstack_1grow (¬es
, '\0');
4803 retval
= obstack_finish (¬es
);
4807 as_warn (_("Missing string"));
4809 ignore_rest_of_line ();
4815 /* In: Input_line_pointer->next character.
4817 Do: Skip input_line_pointer over all whitespace.
4819 Out: 1 if input_line_pointer->end-of-line. */
4822 is_it_end_of_statement ()
4825 return (is_end_of_line
[(unsigned char) *input_line_pointer
]);
4829 equals (sym_name
, reassign
)
4833 register symbolS
*symbolP
; /* Symbol we are working with. */
4837 input_line_pointer
++;
4838 if (*input_line_pointer
== '=')
4839 input_line_pointer
++;
4841 while (*input_line_pointer
== ' ' || *input_line_pointer
== '\t')
4842 input_line_pointer
++;
4845 stop
= mri_comment_field (&stopc
);
4847 if (sym_name
[0] == '.' && sym_name
[1] == '\0')
4849 /* Turn '. = mumble' into a .org mumble. */
4850 register segT segment
;
4853 segment
= get_known_segmented_expression (&exp
);
4855 do_org (segment
, &exp
, 0);
4859 symbolP
= symbol_find_or_make (sym_name
);
4860 /* Permit register names to be redefined. */
4862 && S_IS_DEFINED (symbolP
)
4863 && S_GET_SEGMENT (symbolP
) != reg_section
)
4864 as_bad (_("symbol `%s' already defined"), S_GET_NAME (symbolP
));
4865 pseudo_set (symbolP
);
4870 /* Check garbage after the expression. */
4871 ignore_rest_of_line ();
4872 mri_comment_end (stop
, stopc
);
4876 /* .include -- include a file at this point. */
4880 int arg ATTRIBUTE_UNUSED
;
4889 filename
= demand_copy_string (&i
);
4890 if (filename
== NULL
)
4892 /* demand_copy_string has already printed an error and
4893 called ignore_rest_of_line. */
4901 while (!is_end_of_line
[(unsigned char) *input_line_pointer
]
4902 && *input_line_pointer
!= ' '
4903 && *input_line_pointer
!= '\t')
4905 obstack_1grow (¬es
, *input_line_pointer
);
4906 ++input_line_pointer
;
4910 obstack_1grow (¬es
, '\0');
4911 filename
= obstack_finish (¬es
);
4912 while (!is_end_of_line
[(unsigned char) *input_line_pointer
])
4913 ++input_line_pointer
;
4916 demand_empty_rest_of_line ();
4917 path
= xmalloc ((unsigned long) i
+ include_dir_maxlen
+ 5 /* slop */ );
4919 for (i
= 0; i
< include_dir_count
; i
++)
4921 strcpy (path
, include_dirs
[i
]);
4923 strcat (path
, filename
);
4924 if (0 != (try = fopen (path
, "r")))
4934 /* malloc Storage leak when file is found on path. FIXME-SOMEDAY. */
4935 register_dependency (path
);
4936 input_scrub_insert_file (path
);
4940 add_include_dir (path
)
4945 if (include_dir_count
== 0)
4947 include_dirs
= (char **) xmalloc (2 * sizeof (*include_dirs
));
4948 include_dirs
[0] = "."; /* Current dir. */
4949 include_dir_count
= 2;
4953 include_dir_count
++;
4955 (char **) realloc (include_dirs
,
4956 include_dir_count
* sizeof (*include_dirs
));
4959 include_dirs
[include_dir_count
- 1] = path
; /* New one. */
4962 if (i
> include_dir_maxlen
)
4963 include_dir_maxlen
= i
;
4966 /* Output debugging information to denote the source file. */
4969 generate_file_debug ()
4971 if (debug_type
== DEBUG_STABS
)
4972 stabs_generate_asm_file ();
4975 /* Output line number debugging information for the current source line. */
4978 generate_lineno_debug ()
4980 #ifdef ECOFF_DEBUGGING
4981 /* ECOFF assemblers automatically generate debugging information.
4982 FIXME: This should probably be handled elsewhere. */
4983 if (debug_type
== DEBUG_UNSPECIFIED
)
4985 if (ECOFF_DEBUGGING
&& ecoff_no_current_file ())
4986 debug_type
= DEBUG_ECOFF
;
4988 debug_type
= DEBUG_NONE
;
4994 case DEBUG_UNSPECIFIED
:
4998 stabs_generate_asm_lineno ();
5001 ecoff_generate_asm_lineno ();
5010 /* Output debugging information to mark a function entry point or end point.
5011 END_P is zero for .func, and non-zero for .endfunc. */
5017 do_s_func (end_p
, NULL
);
5020 /* Subroutine of s_func so targets can choose a different default prefix.
5021 If DEFAULT_PREFIX is NULL, use the target's "leading char". */
5024 do_s_func (end_p
, default_prefix
)
5026 const char *default_prefix
;
5028 /* Record the current function so that we can issue an error message for
5029 misplaced .func,.endfunc, and also so that .endfunc needs no
5031 static char *current_name
;
5032 static char *current_label
;
5036 if (current_name
== NULL
)
5038 as_bad (_("missing .func"));
5039 ignore_rest_of_line ();
5043 if (debug_type
== DEBUG_STABS
)
5044 stabs_generate_asm_endfunc (current_name
, current_label
);
5046 current_name
= current_label
= NULL
;
5051 char delim1
, delim2
;
5053 if (current_name
!= NULL
)
5055 as_bad (_(".endfunc missing for previous .func"));
5056 ignore_rest_of_line ();
5060 name
= input_line_pointer
;
5061 delim1
= get_symbol_end ();
5062 name
= xstrdup (name
);
5063 *input_line_pointer
= delim1
;
5065 if (*input_line_pointer
!= ',')
5068 asprintf (&label
, "%s%s", default_prefix
, name
);
5071 char leading_char
= 0;
5072 #ifdef BFD_ASSEMBLER
5073 leading_char
= bfd_get_symbol_leading_char (stdoutput
);
5075 /* Missing entry point, use function's name with the leading
5078 asprintf (&label
, "%c%s", leading_char
, name
);
5085 ++input_line_pointer
;
5087 label
= input_line_pointer
;
5088 delim2
= get_symbol_end ();
5089 label
= xstrdup (label
);
5090 *input_line_pointer
= delim2
;
5093 if (debug_type
== DEBUG_STABS
)
5094 stabs_generate_asm_func (name
, label
);
5096 current_name
= name
;
5097 current_label
= label
;
5100 demand_empty_rest_of_line ();
5105 int arg ATTRIBUTE_UNUSED
;
5107 while (!is_end_of_line
[(unsigned char) *input_line_pointer
])
5109 ++input_line_pointer
;
5111 ++input_line_pointer
;
5115 read_print_statistics (file
)
5118 hash_print_statistics (file
, "pseudo-op table", po_hash
);
5121 /* Inserts the given line into the input stream.
5123 This call avoids macro/conditionals nesting checking, since the contents of
5124 the line are assumed to replace the contents of a line already scanned.
5126 An appropriate use of this function would be substition of input lines when
5127 called by md_start_line_hook(). The given line is assumed to already be
5128 properly scrubbed. */
5131 input_scrub_insert_line (line
)
5136 sb_add_string (&newline
, line
);
5137 input_scrub_include_sb (&newline
, input_line_pointer
, 0);
5139 buffer_limit
= input_scrub_next_buffer (&input_line_pointer
);
5142 /* Insert a file into the input stream; the path must resolve to an actual
5143 file; no include path searching or dependency registering is performed. */
5146 input_scrub_insert_file (path
)
5149 input_scrub_include_file (path
, input_line_pointer
);
5150 buffer_limit
= input_scrub_next_buffer (&input_line_pointer
);