1 /* read.c - read a source file -
2 Copyright (C) 1986, 87, 90, 91, 92, 93, 94, 95, 96, 97, 98, 1999
3 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 #define MASK_CHAR (0xFF) /* If your chars aren't 8 bits, you will
24 change this a bit. But then, GNU isn't
25 spozed to run on your machine anyway.
26 (RMS is so shortsighted sometimes.)
29 #define MASK_CHAR ((int)(unsigned char)-1)
33 /* This is the largest known floating point format (for now). It will
34 grow when we do 4361 style flonums. */
36 #define MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT (16)
38 /* Routines that read assembler source text to build spagetti in memory.
39 Another group of these functions is in the expr.c module. */
52 #ifndef TC_START_LABEL
53 #define TC_START_LABEL(x,y) (x==':')
56 /* The NOP_OPCODE is for the alignment fill value.
57 * fill it a nop instruction so that the disassembler does not choke
61 #define NOP_OPCODE 0x00
64 char *input_line_pointer
; /*->next char of source file to parse. */
66 #if BITS_PER_CHAR != 8
67 /* The following table is indexed by[(char)] and will break if
68 a char does not have exactly 256 states (hopefully 0:255!)! */
73 /* The m88k unfortunately uses @ as a label beginner. */
78 /* The RS/6000 assembler uses {,},[,] as parts of symbol names. */
83 /* The Delta 68k assembler permits % inside label names. */
88 /* The PowerPC Windows NT assemblers permits ? inside label names. */
97 /* The a29k assembler does not permits labels to start with $. */
102 /* The Delta 68k assembler permits ~ at start of label names. */
106 /* used by is_... macros. our ctype[] */
109 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* @ABCDEFGHIJKLMNO */
110 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* PQRSTUVWXYZ[\]^_ */
111 0, 0, 0, LEX_HASH
, LEX_DOLLAR
, LEX_PCT
, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, /* _!"#$%&'()*+,-./ */
112 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, LEX_QM
, /* 0123456789:;<=>? */
113 LEX_AT
, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* @ABCDEFGHIJKLMNO */
114 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, LEX_BR
, 0, LEX_BR
, 0, 3, /* PQRSTUVWXYZ[\]^_ */
115 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* `abcdefghijklmno */
116 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, LEX_BR
, 0, LEX_BR
, LEX_TILDE
, 0, /* pqrstuvwxyz{|}~. */
117 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
118 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
119 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
120 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
121 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
122 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
123 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
124 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3
130 * Out: 1 if this character ends a line.
133 char is_end_of_line
[256] =
136 99, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, 99, Z_
, Z_
, 99, Z_
, Z_
, /* @abcdefghijklmno */
138 99, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, 99, Z_
, Z_
, Z_
, Z_
, Z_
, /* @abcdefghijklmno */
140 Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, /* */
142 Z_
,99, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, /* _!"#$%&'()*+,-./ */
143 Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, /* 0123456789:;<=>? */
145 Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, /* */
146 Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, 99, Z_
, Z_
, Z_
, Z_
, /* 0123456789:;<=>? */
148 Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, /* */
149 Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, /* */
150 Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, /* */
151 Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, /* */
152 Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, /* */
153 Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, /* */
154 Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, /* */
155 Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, /* */
156 Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, Z_
, /* */
160 /* Functions private to this file. */
162 static char *buffer
; /* 1st char of each buffer of lines is here. */
163 static char *buffer_limit
; /*->1 + last char in buffer. */
165 /* TARGET_BYTES_BIG_ENDIAN is required to be defined to either 0 or 1 in the
166 tc-<CPU>.h file. See the "Porting GAS" section of the internals manual. */
167 int target_big_endian
= TARGET_BYTES_BIG_ENDIAN
;
169 static char *old_buffer
; /* JF a hack */
170 static char *old_input
;
171 static char *old_limit
;
173 /* Variables for handling include file directory table. */
175 char **include_dirs
; /* Table of pointers to directories to
176 search for .include's */
177 int include_dir_count
; /* How many are in the table */
178 int include_dir_maxlen
= 1;/* Length of longest in table */
180 #ifndef WORKING_DOT_WORD
181 struct broken_word
*broken_words
;
182 int new_broken_words
;
185 /* The current offset into the absolute section. We don't try to
186 build frags in the absolute section, since no data can be stored
187 there. We just keep track of the current offset. */
188 addressT abs_section_offset
;
190 /* If this line had an MRI style label, it is stored in this variable.
191 This is used by some of the MRI pseudo-ops. */
194 /* This global variable is used to support MRI common sections. We
195 translate such sections into a common symbol. This variable is
196 non-NULL when we are in an MRI common section. */
197 symbolS
*mri_common_symbol
;
199 /* In MRI mode, after a dc.b pseudo-op with an odd number of bytes, we
200 need to align to an even byte boundary unless the next pseudo-op is
201 dc.b, ds.b, or dcb.b. This variable is set to 1 if an alignment
203 static int mri_pending_align
;
207 /* This variable is set to be non-zero if the next string we see might
208 be the name of the source file in DWARF debugging information. See
209 the comment in emit_expr for the format we look for. */
210 static int dwarf_file_string
;
214 static void cons_worker
PARAMS ((int, int));
215 static int scrub_from_string
PARAMS ((char *, int));
216 static void do_align
PARAMS ((int, char *, int, int));
217 static void s_align
PARAMS ((int, int));
218 static void s_lcomm_internal
PARAMS ((int, int));
219 static int hex_float
PARAMS ((int, char *));
220 static inline int sizeof_sleb128
PARAMS ((offsetT
));
221 static inline int sizeof_uleb128
PARAMS ((valueT
));
222 static inline int output_sleb128
PARAMS ((char *, offsetT
));
223 static inline int output_uleb128
PARAMS ((char *, valueT
));
224 static inline int output_big_sleb128
PARAMS ((char *, LITTLENUM_TYPE
*, int));
225 static inline int output_big_uleb128
PARAMS ((char *, LITTLENUM_TYPE
*, int));
226 static int output_big_leb128
PARAMS ((char *, LITTLENUM_TYPE
*, int, int));
227 static void do_org
PARAMS ((segT
, expressionS
*, int));
228 char *demand_copy_string
PARAMS ((int *lenP
));
229 static segT get_segmented_expression
PARAMS ((expressionS
*expP
));
230 static segT get_known_segmented_expression
PARAMS ((expressionS
* expP
));
231 static void pobegin
PARAMS ((void));
232 static int get_line_sb
PARAMS ((sb
*));
233 static void generate_file_debug
PARAMS ((void));
242 obj_read_begin_hook ();
244 /* Something close -- but not too close -- to a multiple of 1024.
245 The debugging malloc I'm using has 24 bytes of overhead. */
246 obstack_begin (¬es
, chunksize
);
247 obstack_begin (&cond_obstack
, chunksize
);
249 /* Use machine dependent syntax */
250 for (p
= line_separator_chars
; *p
; p
++)
251 is_end_of_line
[(unsigned char) *p
] = 1;
252 /* Use more. FIXME-SOMEDAY. */
258 /* set up pseudo-op tables */
260 static struct hash_control
*po_hash
;
262 static const pseudo_typeS potable
[] =
264 {"abort", s_abort
, 0},
265 {"align", s_align_ptwo
, 0},
266 {"ascii", stringer
, 0},
267 {"asciz", stringer
, 1},
268 {"balign", s_align_bytes
, 0},
269 {"balignw", s_align_bytes
, -2},
270 {"balignl", s_align_bytes
, -4},
274 {"common", s_mri_common
, 0},
275 {"common.s", s_mri_common
, 1},
279 {"dc.d", float_cons
, 'd'},
281 {"dc.s", float_cons
, 'f'},
283 {"dc.x", float_cons
, 'x'},
285 {"dcb.b", s_space
, 1},
286 {"dcb.d", s_float_space
, 'd'},
287 {"dcb.l", s_space
, 4},
288 {"dcb.s", s_float_space
, 'f'},
289 {"dcb.w", s_space
, 2},
290 {"dcb.x", s_float_space
, 'x'},
292 {"ds.b", s_space
, 1},
293 {"ds.d", s_space
, 8},
294 {"ds.l", s_space
, 4},
295 {"ds.p", s_space
, 12},
296 {"ds.s", s_space
, 4},
297 {"ds.w", s_space
, 2},
298 {"ds.x", s_space
, 12},
299 {"debug", s_ignore
, 0},
304 {"double", float_cons
, 'd'},
306 {"eject", listing_eject
, 0}, /* Formfeed listing */
308 {"elsec", s_else
, 0},
310 {"endc", s_endif
, 0},
311 {"endfunc", s_func
, 1},
312 {"endif", s_endif
, 0},
317 {"exitm", s_mexit
, 0},
319 {"extern", s_ignore
, 0}, /* We treat all undef as ext */
320 {"appfile", s_app_file
, 1},
321 {"appline", s_app_line
, 0},
323 {"file", s_app_file
, 0},
325 {"float", float_cons
, 'f'},
326 {"format", s_ignore
, 0},
328 {"global", s_globl
, 0},
329 {"globl", s_globl
, 0},
331 {"if", s_if
, (int) O_ne
},
333 {"ifdef", s_ifdef
, 0},
334 {"ifeq", s_if
, (int) O_eq
},
335 {"ifeqs", s_ifeqs
, 0},
336 {"ifge", s_if
, (int) O_ge
},
337 {"ifgt", s_if
, (int) O_gt
},
338 {"ifle", s_if
, (int) O_le
},
339 {"iflt", s_if
, (int) O_lt
},
341 {"ifndef", s_ifdef
, 1},
342 {"ifne", s_if
, (int) O_ne
},
343 {"ifnes", s_ifeqs
, 1},
344 {"ifnotdef", s_ifdef
, 1},
345 {"include", s_include
, 0},
351 {"lcomm", s_lcomm
, 0},
352 {"lflags", listing_flags
, 0}, /* Listing flags */
353 {"linkonce", s_linkonce
, 0},
354 {"list", listing_list
, 1}, /* Turn listing on */
355 {"llen", listing_psize
, 1},
358 {"macro", s_macro
, 0},
359 {"mexit", s_mexit
, 0},
361 {".mri", s_mri
, 0}, /* Special case so .mri works in MRI mode. */
362 {"name", s_ignore
, 0},
363 {"noformat", s_ignore
, 0},
364 {"nolist", listing_list
, 0}, /* Turn listing off */
365 {"nopage", listing_nopage
, 0},
367 {"offset", s_struct
, 0},
369 {"p2align", s_align_ptwo
, 0},
370 {"p2alignw", s_align_ptwo
, -2},
371 {"p2alignl", s_align_ptwo
, -4},
372 {"page", listing_eject
, 0},
373 {"plen", listing_psize
, 0},
374 {"print", s_print
, 0},
375 {"psize", listing_psize
, 0}, /* set paper size */
376 {"purgem", s_purgem
, 0},
381 {"sbttl", listing_title
, 1}, /* Subtitle of listing */
386 {"single", float_cons
, 'f'},
388 {"space", s_space
, 0},
389 {"skip", s_space
, 0},
390 {"sleb128", s_leb128
, 1},
391 {"spc", s_ignore
, 0},
392 {"stabd", s_stab
, 'd'},
393 {"stabn", s_stab
, 'n'},
394 {"stabs", s_stab
, 's'},
395 {"string", stringer
, 1},
396 {"struct", s_struct
, 0},
400 /* This is for gcc to use. It's only just been added (2/94), so gcc
401 won't be able to use it for a while -- probably a year or more.
402 But once this has been released, check with gcc maintainers
403 before deleting it or even changing the spelling. */
404 {"this_GCC_requires_the_GNU_assembler", s_ignore
, 0},
405 /* If we're folding case -- done for some targets, not necessarily
406 all -- the above string in an input file will be converted to
407 this one. Match it either way... */
408 {"this_gcc_requires_the_gnu_assembler", s_ignore
, 0},
410 {"title", listing_title
, 0}, /* Listing title */
411 {"ttl", listing_title
, 0},
413 {"uleb128", s_leb128
, 0},
417 {"xdef", s_globl
, 0},
418 {"xref", s_ignore
, 0},
419 {"xstabs", s_xstab
, 's'},
421 {"zero", s_space
, 0},
422 {NULL
, NULL
, 0} /* end sentinel */
425 static int pop_override_ok
= 0;
426 static const char *pop_table_name
;
430 const pseudo_typeS
*table
;
433 const pseudo_typeS
*pop
;
434 for (pop
= table
; pop
->poc_name
; pop
++)
436 errtxt
= hash_insert (po_hash
, pop
->poc_name
, (char *) pop
);
437 if (errtxt
&& (!pop_override_ok
|| strcmp (errtxt
, "exists")))
438 as_fatal (_("error constructing %s pseudo-op table: %s"), pop_table_name
,
443 #ifndef md_pop_insert
444 #define md_pop_insert() pop_insert(md_pseudo_table)
447 #ifndef obj_pop_insert
448 #define obj_pop_insert() pop_insert(obj_pseudo_table)
454 po_hash
= hash_new ();
456 /* Do the target-specific pseudo ops. */
457 pop_table_name
= "md";
460 /* Now object specific. Skip any that were in the target table. */
461 pop_table_name
= "obj";
465 /* Now portable ones. Skip any that we've seen already. */
466 pop_table_name
= "standard";
467 pop_insert (potable
);
470 #define HANDLE_CONDITIONAL_ASSEMBLY() \
471 if (ignore_input ()) \
473 while (! is_end_of_line[(unsigned char) *input_line_pointer++]) \
474 if (input_line_pointer == buffer_limit) \
480 /* This function is used when scrubbing the characters between #APP
483 static char *scrub_string
;
484 static char *scrub_string_end
;
487 scrub_from_string (buf
, buflen
)
493 copy
= scrub_string_end
- scrub_string
;
496 memcpy (buf
, scrub_string
, copy
);
497 scrub_string
+= copy
;
501 /* read_a_source_file()
503 * We read the file, putting things into a web that
504 * represents what we have been reading.
507 read_a_source_file (name
)
511 register char *s
; /* string of symbol, '\0' appended */
515 buffer
= input_scrub_new_file (name
);
518 listing_newline (NULL
);
519 register_dependency (name
);
521 /* Generate debugging information before we've read anything in to denote
522 this file as the "main" source file and not a subordinate one
523 (e.g. N_SO vs N_SOL in stabs). */
524 generate_file_debug ();
526 while ((buffer_limit
= input_scrub_next_buffer (&input_line_pointer
)) != 0)
527 { /* We have another line to parse. */
528 know (buffer_limit
[-1] == '\n'); /* Must have a sentinel. */
529 contin
: /* JF this goto is my fault I admit it.
530 Someone brave please re-write the whole
531 input section here? Pleeze??? */
532 while (input_line_pointer
< buffer_limit
)
534 /* We have more of this buffer to parse. */
537 * We now have input_line_pointer->1st char of next line.
538 * If input_line_pointer [-1] == '\n' then we just
539 * scanned another line: so bump line counters.
541 if (is_end_of_line
[(unsigned char) input_line_pointer
[-1]])
543 #ifdef md_start_line_hook
544 md_start_line_hook ();
547 if (input_line_pointer
[-1] == '\n')
548 bump_line_counters ();
553 #ifdef LABELS_WITHOUT_COLONS
558 /* Text at the start of a line must be a label, we
559 run down and stick a colon in. */
560 if (is_name_beginner (*input_line_pointer
))
562 char *line_start
= input_line_pointer
;
567 HANDLE_CONDITIONAL_ASSEMBLY ();
569 c
= get_symbol_end ();
571 /* In MRI mode, the EQU and MACRO pseudoops must
572 be handled specially. */
576 char *rest
= input_line_pointer
+ 1;
580 if (*rest
== ' ' || *rest
== '\t')
582 if ((strncasecmp (rest
, "EQU", 3) == 0
583 || strncasecmp (rest
, "SET", 3) == 0)
584 && (rest
[3] == ' ' || rest
[3] == '\t'))
586 input_line_pointer
= rest
+ 3;
588 strncasecmp (rest
, "SET", 3) == 0);
591 if (strncasecmp (rest
, "MACRO", 5) == 0
594 || is_end_of_line
[(unsigned char) rest
[5]]))
598 /* In MRI mode, we need to handle the MACRO
599 pseudo-op specially: we don't want to put the
600 symbol in the symbol table. */
601 if (! mri_line_macro
)
602 line_label
= colon (line_start
);
604 line_label
= symbol_create (line_start
,
609 *input_line_pointer
= c
;
611 input_line_pointer
++;
617 * We are at the begining of a line, or similar place.
618 * We expect a well-formed assembler statement.
619 * A "symbol-name:" is a statement.
621 * Depending on what compiler is used, the order of these tests
622 * may vary to catch most common case 1st.
623 * Each test is independent of all other tests at the (top) level.
624 * PLEASE make a compiler that doesn't use this assembler.
625 * It is crufty to waste a compiler's time encoding things for this
626 * assembler, which then wastes more time decoding it.
627 * (And communicating via (linear) files is silly!
628 * If you must pass stuff, please pass a tree!)
630 if ((c
= *input_line_pointer
++) == '\t'
635 c
= *input_line_pointer
++;
637 know (c
!= ' '); /* No further leading whitespace. */
640 /* If listing is on, and we are expanding a macro, then give
641 the listing code the contents of the expanded line. */
644 if ((listing
& LISTING_MACEXP
) && macro_nest
> 0)
649 /* Find the end of the current expanded macro line. */
650 for (s
= input_line_pointer
-1; *s
; ++s
)
651 if (is_end_of_line
[(unsigned char) *s
])
654 /* Copy it for safe keeping. Also give an indication of
655 how much macro nesting is involved at this point. */
656 len
= s
- (input_line_pointer
-1);
657 copy
= (char *) xmalloc (len
+ macro_nest
+ 2);
658 memset (copy
, '>', macro_nest
);
659 copy
[macro_nest
] = ' ';
660 memcpy (copy
+ macro_nest
+ 1, input_line_pointer
-1, len
);
661 copy
[macro_nest
+1+len
] = '\0';
663 /* Install the line with the listing facility. */
664 listing_newline (copy
);
667 listing_newline (NULL
);
672 * C is the 1st significant character.
673 * Input_line_pointer points after that character.
675 if (is_name_beginner (c
))
677 /* want user-defined label or pseudo/opcode */
678 HANDLE_CONDITIONAL_ASSEMBLY ();
680 s
= --input_line_pointer
;
681 c
= get_symbol_end (); /* name's delimiter */
683 * C is character after symbol.
684 * That character's place in the input line is now '\0'.
685 * S points to the beginning of the symbol.
686 * [In case of pseudo-op, s->'.'.]
687 * Input_line_pointer->'\0' where c was.
689 if (TC_START_LABEL(c
, input_line_pointer
))
693 char *rest
= input_line_pointer
+ 1;
695 /* In MRI mode, \tsym: set 0 is permitted. */
699 if (*rest
== ' ' || *rest
== '\t')
701 if ((strncasecmp (rest
, "EQU", 3) == 0
702 || strncasecmp (rest
, "SET", 3) == 0)
703 && (rest
[3] == ' ' || rest
[3] == '\t'))
705 input_line_pointer
= rest
+ 3;
711 line_label
= colon (s
); /* user-defined label */
712 *input_line_pointer
++ = ':'; /* Put ':' back for error messages' sake. */
713 /* Input_line_pointer->after ':'. */
719 || ((c
== ' ' || c
== '\t')
720 && input_line_pointer
[1] == '='
721 #ifdef TC_EQUAL_IN_INSN
722 && ! TC_EQUAL_IN_INSN (c
, input_line_pointer
)
727 demand_empty_rest_of_line ();
730 { /* expect pseudo-op or machine instruction */
733 #define IGNORE_OPCODE_CASE
734 #ifdef IGNORE_OPCODE_CASE
739 if (isupper ((unsigned char) *s2
))
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
== '.'))
765 * WARNING: c has next char, which may be end-of-line.
766 * We lookup the pseudo-op table with s+1 because we
767 * already know that the pseudo-op begins with a '.'.
771 pop
= (pseudo_typeS
*) hash_find (po_hash
, s
+ 1);
773 /* In MRI mode, we may need to insert an
774 automatic alignment directive. What a hack
776 if (mri_pending_align
778 || ! ((pop
->poc_handler
== cons
779 && pop
->poc_val
== 1)
780 || (pop
->poc_handler
== s_space
781 && pop
->poc_val
== 1)
782 #ifdef tc_conditional_pseudoop
783 || tc_conditional_pseudoop (pop
)
785 || pop
->poc_handler
== s_if
786 || pop
->poc_handler
== s_ifdef
787 || pop
->poc_handler
== s_ifc
788 || pop
->poc_handler
== s_ifeqs
789 || pop
->poc_handler
== s_else
790 || pop
->poc_handler
== s_endif
791 || pop
->poc_handler
== s_globl
792 || pop
->poc_handler
== s_ignore
)))
794 do_align (1, (char *) NULL
, 0, 0);
795 mri_pending_align
= 0;
796 if (line_label
!= NULL
)
798 symbol_set_frag (line_label
, frag_now
);
799 S_SET_VALUE (line_label
, frag_now_fix ());
803 /* Print the error msg now, while we still can */
806 as_bad (_("Unknown pseudo-op: `%s'"), s
);
807 *input_line_pointer
= c
;
812 /* Put it back for error messages etc. */
813 *input_line_pointer
= c
;
814 /* The following skip of whitespace is compulsory.
815 A well shaped space is sometimes all that separates
816 keyword from operands. */
817 if (c
== ' ' || c
== '\t')
818 input_line_pointer
++;
820 * Input_line is restored.
821 * Input_line_pointer->1st non-blank char
822 * after pseudo-operation.
824 (*pop
->poc_handler
) (pop
->poc_val
);
826 /* If that was .end, just get out now. */
827 if (pop
->poc_handler
== s_end
)
833 #ifdef QUOTES_IN_INSN
837 /* WARNING: c has char, which may be end-of-line. */
838 /* Also: input_line_pointer->`\0` where c was. */
839 *input_line_pointer
= c
;
840 while (!is_end_of_line
[(unsigned char) *input_line_pointer
]
842 #ifdef TC_EOL_IN_INSN
843 || TC_EOL_IN_INSN (input_line_pointer
)
847 if (flag_m68k_mri
&& *input_line_pointer
== '\'')
849 #ifdef QUOTES_IN_INSN
852 else if (*input_line_pointer
== '"')
854 else if (*input_line_pointer
== '\\')
857 input_line_pointer
++;
860 c
= *input_line_pointer
;
861 *input_line_pointer
= '\0';
863 generate_lineno_debug ();
870 if (check_macro (s
, &out
, '\0', &err
))
874 *input_line_pointer
++ = c
;
875 input_scrub_include_sb (&out
,
879 input_scrub_next_buffer (&input_line_pointer
);
884 if (mri_pending_align
)
886 do_align (1, (char *) NULL
, 0, 0);
887 mri_pending_align
= 0;
888 if (line_label
!= NULL
)
890 symbol_set_frag (line_label
, frag_now
);
891 S_SET_VALUE (line_label
, frag_now_fix ());
895 md_assemble (s
); /* Assemble 1 instruction. */
897 *input_line_pointer
++ = c
;
899 /* We resume loop AFTER the end-of-line from
904 } /* if (is_name_beginner(c) */
907 /* Empty statement? */
908 if (is_end_of_line
[(unsigned char) c
])
911 if ((LOCAL_LABELS_DOLLAR
|| LOCAL_LABELS_FB
)
912 && isdigit ((unsigned char) c
))
914 /* local label ("4:") */
915 char *backup
= input_line_pointer
;
917 HANDLE_CONDITIONAL_ASSEMBLY ();
921 while (isdigit ((unsigned char) *input_line_pointer
))
923 temp
= (temp
* 10) + *input_line_pointer
- '0';
924 ++input_line_pointer
;
925 } /* read the whole number */
927 if (LOCAL_LABELS_DOLLAR
928 && *input_line_pointer
== '$'
929 && *(input_line_pointer
+ 1) == ':')
931 input_line_pointer
+= 2;
933 if (dollar_label_defined (temp
))
935 as_fatal (_("label \"%d$\" redefined"), temp
);
938 define_dollar_label (temp
);
939 colon (dollar_label_name (temp
, 0));
944 && *input_line_pointer
++ == ':')
946 fb_label_instance_inc (temp
);
947 colon (fb_label_name (temp
, 0));
951 input_line_pointer
= backup
;
952 } /* local label ("4:") */
954 if (c
&& strchr (line_comment_chars
, c
))
955 { /* Its a comment. Better say APP or NO_APP */
959 unsigned int new_length
;
962 bump_line_counters ();
963 s
= input_line_pointer
;
964 if (strncmp (s
, "APP\n", 4))
965 continue; /* We ignore it */
968 ends
= strstr (s
, "#NO_APP\n");
972 unsigned int tmp_len
;
975 /* The end of the #APP wasn't in this buffer. We
976 keep reading in buffers until we find the #NO_APP
977 that goes with this #APP There is one. The specs
979 tmp_len
= buffer_limit
- s
;
980 tmp_buf
= xmalloc (tmp_len
+ 1);
981 memcpy (tmp_buf
, s
, tmp_len
);
984 new_tmp
= input_scrub_next_buffer (&buffer
);
988 buffer_limit
= new_tmp
;
989 input_line_pointer
= buffer
;
990 ends
= strstr (buffer
, "#NO_APP\n");
994 num
= buffer_limit
- buffer
;
996 tmp_buf
= xrealloc (tmp_buf
, tmp_len
+ num
);
997 memcpy (tmp_buf
+ tmp_len
, buffer
, num
);
1002 input_line_pointer
= ends
? ends
+ 8 : NULL
;
1010 input_line_pointer
= ends
+ 8;
1014 scrub_string_end
= ends
;
1016 new_length
= ends
- s
;
1017 new_buf
= (char *) xmalloc (new_length
);
1024 space
= (new_buf
+ new_length
) - new_tmp
;
1025 size
= do_scrub_chars (scrub_from_string
, new_tmp
, space
);
1033 new_buf
= xrealloc (new_buf
, new_length
+ 100);
1034 new_tmp
= new_buf
+ new_length
;
1040 old_buffer
= buffer
;
1041 old_input
= input_line_pointer
;
1042 old_limit
= buffer_limit
;
1044 input_line_pointer
= new_buf
;
1045 buffer_limit
= new_tmp
;
1049 HANDLE_CONDITIONAL_ASSEMBLY ();
1051 #ifdef tc_unrecognized_line
1052 if (tc_unrecognized_line (c
))
1056 /* as_warn("Junk character %d.",c); Now done by ignore_rest */
1057 input_line_pointer
--; /* Report unknown char as ignored. */
1058 ignore_rest_of_line ();
1059 } /* while (input_line_pointer<buffer_limit) */
1061 #ifdef md_after_pass_hook
1062 md_after_pass_hook ();
1068 bump_line_counters ();
1071 buffer
= old_buffer
;
1072 input_line_pointer
= old_input
;
1073 buffer_limit
= old_limit
;
1078 } /* while (more buffers to scan) */
1085 input_scrub_close (); /* Close the input file */
1088 /* For most MRI pseudo-ops, the line actually ends at the first
1089 nonquoted space. This function looks for that point, stuffs a null
1090 in, and sets *STOPCP to the character that used to be there, and
1091 returns the location.
1093 Until I hear otherwise, I am going to assume that this is only true
1094 for the m68k MRI assembler. */
1097 mri_comment_field (stopcp
)
1105 know (flag_m68k_mri
);
1107 for (s
= input_line_pointer
;
1108 ((! is_end_of_line
[(unsigned char) *s
] && *s
!= ' ' && *s
!= '\t')
1113 inquote
= ! inquote
;
1123 for (s
= input_line_pointer
; ! is_end_of_line
[(unsigned char) *s
]; s
++)
1133 /* Skip to the end of an MRI comment field. */
1136 mri_comment_end (stop
, stopc
)
1142 input_line_pointer
= stop
;
1144 while (! is_end_of_line
[(unsigned char) *input_line_pointer
])
1145 ++input_line_pointer
;
1150 int ignore ATTRIBUTE_UNUSED
;
1152 as_fatal (_(".abort detected. Abandoning ship."));
1155 /* Guts of .align directive. N is the power of two to which to align.
1156 FILL may be NULL, or it may point to the bytes of the fill pattern.
1157 LEN is the length of whatever FILL points to, if anything. MAX is
1158 the maximum number of characters to skip when doing the alignment,
1159 or 0 if there is no maximum. */
1162 do_align (n
, fill
, len
, max
)
1171 md_do_align (n
, fill
, len
, max
, just_record_alignment
);
1176 if (subseg_text_p (now_seg
))
1177 default_fill
= NOP_OPCODE
;
1180 fill
= &default_fill
;
1184 /* Only make a frag if we HAVE to. . . */
1185 if (n
!= 0 && !need_pass_2
)
1188 frag_align (n
, *fill
, max
);
1190 frag_align_pattern (n
, fill
, len
, max
);
1194 just_record_alignment
:
1197 record_alignment (now_seg
, n
);
1200 /* Handle the .align pseudo-op. A positive ARG is a default alignment
1201 (in bytes). A negative ARG is the negative of the length of the
1202 fill pattern. BYTES_P is non-zero if the alignment value should be
1203 interpreted as the byte boundary, rather than the power of 2. */
1206 s_align (arg
, bytes_p
)
1210 register unsigned int align
;
1218 stop
= mri_comment_field (&stopc
);
1220 if (is_end_of_line
[(unsigned char) *input_line_pointer
])
1225 align
= arg
; /* Default value from pseudo-op table */
1229 align
= get_absolute_expression ();
1235 /* Convert to a power of 2. */
1240 for (i
= 0; (align
& 1) == 0; align
>>= 1, ++i
)
1243 as_bad (_("Alignment not a power of 2"));
1251 as_bad (_("Alignment too large: %u assumed"), align
);
1254 if (*input_line_pointer
!= ',')
1261 ++input_line_pointer
;
1262 if (*input_line_pointer
== ',')
1266 fill
= get_absolute_expression ();
1271 if (*input_line_pointer
!= ',')
1275 ++input_line_pointer
;
1276 max
= get_absolute_expression ();
1283 as_warn (_("expected fill pattern missing"));
1284 do_align (align
, (char *) NULL
, 0, max
);
1299 do_align (align
, &fill_char
, fill_len
, max
);
1305 if ((size_t) fill_len
> sizeof ab
)
1307 md_number_to_chars (ab
, fill
, fill_len
);
1308 do_align (align
, ab
, fill_len
, max
);
1312 demand_empty_rest_of_line ();
1315 mri_comment_end (stop
, stopc
);
1318 /* Handle the .align pseudo-op on machines where ".align 4" means
1319 align to a 4 byte boundary. */
1328 /* Handle the .align pseudo-op on machines where ".align 4" means align
1329 to a 2**4 boundary. */
1340 int ignore ATTRIBUTE_UNUSED
;
1342 register char *name
;
1346 register symbolS
*symbolP
;
1351 stop
= mri_comment_field (&stopc
);
1353 name
= input_line_pointer
;
1354 c
= get_symbol_end ();
1355 /* just after name is now '\0' */
1356 p
= input_line_pointer
;
1359 if (*input_line_pointer
!= ',')
1361 as_bad (_("Expected comma after symbol-name: rest of line ignored."));
1362 ignore_rest_of_line ();
1364 mri_comment_end (stop
, stopc
);
1367 input_line_pointer
++; /* skip ',' */
1368 if ((temp
= get_absolute_expression ()) < 0)
1370 as_warn (_(".COMMon length (%ld.) <0! Ignored."), (long) temp
);
1371 ignore_rest_of_line ();
1373 mri_comment_end (stop
, stopc
);
1377 symbolP
= symbol_find_or_make (name
);
1379 if (S_IS_DEFINED (symbolP
) && ! S_IS_COMMON (symbolP
))
1381 as_bad (_("Ignoring attempt to re-define symbol `%s'."),
1382 S_GET_NAME (symbolP
));
1383 ignore_rest_of_line ();
1385 mri_comment_end (stop
, stopc
);
1388 if (S_GET_VALUE (symbolP
))
1390 if (S_GET_VALUE (symbolP
) != (valueT
) temp
)
1391 as_bad (_("Length of .comm \"%s\" is already %ld. Not changed to %ld."),
1392 S_GET_NAME (symbolP
),
1393 (long) S_GET_VALUE (symbolP
),
1398 S_SET_VALUE (symbolP
, (valueT
) temp
);
1399 S_SET_EXTERNAL (symbolP
);
1403 extern int flag_one
;
1404 if ( (!temp
) || !flag_one
)
1405 S_GET_OTHER(symbolP
) = const_flag
;
1407 #endif /* not OBJ_VMS */
1408 know (symbolP
->sy_frag
== &zero_address_frag
);
1410 demand_empty_rest_of_line ();
1413 mri_comment_end (stop
, stopc
);
1416 /* The MRI COMMON pseudo-op. We handle this by creating a common
1417 symbol with the appropriate name. We make s_space do the right
1418 thing by increasing the size. */
1421 s_mri_common (small
)
1422 int small ATTRIBUTE_UNUSED
;
1438 stop
= mri_comment_field (&stopc
);
1442 name
= input_line_pointer
;
1443 if (! isdigit ((unsigned char) *name
))
1444 c
= get_symbol_end ();
1449 ++input_line_pointer
;
1451 while (isdigit ((unsigned char) *input_line_pointer
));
1452 c
= *input_line_pointer
;
1453 *input_line_pointer
= '\0';
1455 if (line_label
!= NULL
)
1457 alc
= (char *) xmalloc (strlen (S_GET_NAME (line_label
))
1458 + (input_line_pointer
- name
)
1460 sprintf (alc
, "%s%s", name
, S_GET_NAME (line_label
));
1465 sym
= symbol_find_or_make (name
);
1466 *input_line_pointer
= c
;
1470 if (*input_line_pointer
!= ',')
1474 ++input_line_pointer
;
1475 align
= get_absolute_expression ();
1478 if (S_IS_DEFINED (sym
) && ! S_IS_COMMON (sym
))
1480 as_bad (_("attempt to re-define symbol `%s'"), S_GET_NAME (sym
));
1481 ignore_rest_of_line ();
1482 mri_comment_end (stop
, stopc
);
1486 S_SET_EXTERNAL (sym
);
1487 mri_common_symbol
= sym
;
1491 S_SET_ALIGN (sym
, align
);
1494 if (line_label
!= NULL
)
1497 exp
.X_op
= O_symbol
;
1498 exp
.X_add_symbol
= sym
;
1499 exp
.X_add_number
= 0;
1500 symbol_set_value_expression (line_label
, &exp
);
1501 symbol_set_frag (line_label
, &zero_address_frag
);
1502 S_SET_SEGMENT (line_label
, expr_section
);
1505 /* FIXME: We just ignore the small argument, which distinguishes
1506 COMMON and COMMON.S. I don't know what we can do about it. */
1508 /* Ignore the type and hptype. */
1509 if (*input_line_pointer
== ',')
1510 input_line_pointer
+= 2;
1511 if (*input_line_pointer
== ',')
1512 input_line_pointer
+= 2;
1514 demand_empty_rest_of_line ();
1516 mri_comment_end (stop
, stopc
);
1521 int ignore ATTRIBUTE_UNUSED
;
1526 temp
= get_absolute_expression ();
1527 if (flag_readonly_data_in_text
)
1529 section
= text_section
;
1533 section
= data_section
;
1535 subseg_set (section
, (subsegT
) temp
);
1540 demand_empty_rest_of_line ();
1543 /* Handle the .appfile pseudo-op. This is automatically generated by
1544 do_scrub_chars when a preprocessor # line comment is seen with a
1545 file name. This default definition may be overridden by the object
1546 or CPU specific pseudo-ops. This function is also the default
1547 definition for .file; the APPFILE argument is 1 for .appfile, 0 for
1551 s_app_file (appfile
)
1557 /* Some assemblers tolerate immediately following '"' */
1558 if ((s
= demand_copy_string (&length
)) != 0)
1560 /* If this is a fake .appfile, a fake newline was inserted into
1561 the buffer. Passing -2 to new_logical_line tells it to
1564 = (! new_logical_line (s
, appfile
? -2 : -1) && appfile
);
1566 /* In MRI mode, the preprocessor may have inserted an extraneous
1569 && *input_line_pointer
== '\''
1570 && is_end_of_line
[(unsigned char) input_line_pointer
[1]])
1571 ++input_line_pointer
;
1573 demand_empty_rest_of_line ();
1578 listing_source_file (s
);
1580 register_dependency (s
);
1588 /* Handle the .appline pseudo-op. This is automatically generated by
1589 do_scrub_chars when a preprocessor # line comment is seen. This
1590 default definition may be overridden by the object or CPU specific
1595 int ignore ATTRIBUTE_UNUSED
;
1599 /* The given number is that of the next line. */
1600 l
= get_absolute_expression () - 1;
1602 /* Some of the back ends can't deal with non-positive line numbers.
1603 Besides, it's silly. */
1604 as_warn (_("Line numbers must be positive; line number %d rejected."), l
+1);
1607 new_logical_line ((char *) NULL
, l
);
1610 listing_source_line (l
);
1613 demand_empty_rest_of_line ();
1616 /* Handle the .end pseudo-op. Actually, the real work is done in
1617 read_a_source_file. */
1621 int ignore ATTRIBUTE_UNUSED
;
1625 /* The MRI assembler permits the start symbol to follow .end,
1626 but we don't support that. */
1628 if (! is_end_of_line
[(unsigned char) *input_line_pointer
]
1629 && *input_line_pointer
!= '*'
1630 && *input_line_pointer
!= '!')
1631 as_warn (_("start address not supported"));
1635 /* Handle the .err pseudo-op. */
1639 int ignore ATTRIBUTE_UNUSED
;
1641 as_bad (_(".err encountered"));
1642 demand_empty_rest_of_line ();
1645 /* Handle the MRI fail pseudo-op. */
1649 int ignore ATTRIBUTE_UNUSED
;
1656 stop
= mri_comment_field (&stopc
);
1658 temp
= get_absolute_expression ();
1660 as_warn (_(".fail %ld encountered"), (long) temp
);
1662 as_bad (_(".fail %ld encountered"), (long) temp
);
1664 demand_empty_rest_of_line ();
1667 mri_comment_end (stop
, stopc
);
1672 int ignore ATTRIBUTE_UNUSED
;
1674 expressionS rep_exp
;
1676 register long fill
= 0;
1679 #ifdef md_flush_pending_output
1680 md_flush_pending_output ();
1683 get_known_segmented_expression (&rep_exp
);
1684 if (*input_line_pointer
== ',')
1686 input_line_pointer
++;
1687 size
= get_absolute_expression ();
1688 if (*input_line_pointer
== ',')
1690 input_line_pointer
++;
1691 fill
= get_absolute_expression ();
1695 /* This is to be compatible with BSD 4.2 AS, not for any rational reason. */
1696 #define BSD_FILL_SIZE_CROCK_8 (8)
1697 if (size
> BSD_FILL_SIZE_CROCK_8
)
1699 as_warn (_(".fill size clamped to %d."), BSD_FILL_SIZE_CROCK_8
);
1700 size
= BSD_FILL_SIZE_CROCK_8
;
1704 as_warn (_("Size negative: .fill ignored."));
1707 else if (rep_exp
.X_op
== O_constant
&& rep_exp
.X_add_number
<= 0)
1709 if (rep_exp
.X_add_number
< 0)
1710 as_warn (_("Repeat < 0, .fill ignored"));
1714 if (size
&& !need_pass_2
)
1716 if (rep_exp
.X_op
== O_constant
)
1718 p
= frag_var (rs_fill
, (int) size
, (int) size
,
1719 (relax_substateT
) 0, (symbolS
*) 0,
1720 (offsetT
) rep_exp
.X_add_number
,
1725 /* We don't have a constant repeat count, so we can't use
1726 rs_fill. We can get the same results out of rs_space,
1727 but its argument is in bytes, so we must multiply the
1728 repeat count by size. */
1731 rep_sym
= make_expr_symbol (&rep_exp
);
1734 expressionS size_exp
;
1735 size_exp
.X_op
= O_constant
;
1736 size_exp
.X_add_number
= size
;
1738 rep_exp
.X_op
= O_multiply
;
1739 rep_exp
.X_add_symbol
= rep_sym
;
1740 rep_exp
.X_op_symbol
= make_expr_symbol (&size_exp
);
1741 rep_exp
.X_add_number
= 0;
1742 rep_sym
= make_expr_symbol (&rep_exp
);
1745 p
= frag_var (rs_space
, (int) size
, (int) size
,
1746 (relax_substateT
) 0, rep_sym
, (offsetT
) 0, (char *) 0);
1748 memset (p
, 0, (unsigned int) size
);
1749 /* The magic number BSD_FILL_SIZE_CROCK_4 is from BSD 4.2 VAX
1750 * flavoured AS. The following bizzare behaviour is to be
1751 * compatible with above. I guess they tried to take up to 8
1752 * bytes from a 4-byte expression and they forgot to sign
1753 * extend. Un*x Sux. */
1754 #define BSD_FILL_SIZE_CROCK_4 (4)
1755 md_number_to_chars (p
, (valueT
) fill
,
1756 (size
> BSD_FILL_SIZE_CROCK_4
1757 ? BSD_FILL_SIZE_CROCK_4
1759 /* Note: .fill (),0 emits no frag (since we are asked to .fill 0 bytes)
1760 * but emits no error message because it seems a legal thing to do.
1761 * It is a degenerate case of .fill but could be emitted by a compiler.
1764 demand_empty_rest_of_line ();
1769 int ignore ATTRIBUTE_UNUSED
;
1778 stop
= mri_comment_field (&stopc
);
1782 name
= input_line_pointer
;
1783 c
= get_symbol_end ();
1784 symbolP
= symbol_find_or_make (name
);
1785 S_SET_EXTERNAL (symbolP
);
1787 *input_line_pointer
= c
;
1789 c
= *input_line_pointer
;
1792 input_line_pointer
++;
1794 if (*input_line_pointer
== '\n')
1800 demand_empty_rest_of_line ();
1803 mri_comment_end (stop
, stopc
);
1806 /* Handle the MRI IRP and IRPC pseudo-ops. */
1818 as_where (&file
, &line
);
1821 while (! is_end_of_line
[(unsigned char) *input_line_pointer
])
1822 sb_add_char (&s
, *input_line_pointer
++);
1826 err
= expand_irp (irpc
, 0, &s
, &out
, get_line_sb
, '\0');
1828 as_bad_where (file
, line
, "%s", err
);
1832 input_scrub_include_sb (&out
, input_line_pointer
);
1834 buffer_limit
= input_scrub_next_buffer (&input_line_pointer
);
1837 /* Handle the .linkonce pseudo-op. This tells the assembler to mark
1838 the section to only be linked once. However, this is not supported
1839 by most object file formats. This takes an optional argument,
1840 which is what to do about duplicates. */
1844 int ignore ATTRIBUTE_UNUSED
;
1846 enum linkonce_type type
;
1850 type
= LINKONCE_DISCARD
;
1852 if (! is_end_of_line
[(unsigned char) *input_line_pointer
])
1857 s
= input_line_pointer
;
1858 c
= get_symbol_end ();
1859 if (strcasecmp (s
, "discard") == 0)
1860 type
= LINKONCE_DISCARD
;
1861 else if (strcasecmp (s
, "one_only") == 0)
1862 type
= LINKONCE_ONE_ONLY
;
1863 else if (strcasecmp (s
, "same_size") == 0)
1864 type
= LINKONCE_SAME_SIZE
;
1865 else if (strcasecmp (s
, "same_contents") == 0)
1866 type
= LINKONCE_SAME_CONTENTS
;
1868 as_warn (_("unrecognized .linkonce type `%s'"), s
);
1870 *input_line_pointer
= c
;
1873 #ifdef obj_handle_link_once
1874 obj_handle_link_once (type
);
1875 #else /* ! defined (obj_handle_link_once) */
1876 #ifdef BFD_ASSEMBLER
1880 if ((bfd_applicable_section_flags (stdoutput
) & SEC_LINK_ONCE
) == 0)
1881 as_warn (_(".linkonce is not supported for this object file format"));
1883 flags
= bfd_get_section_flags (stdoutput
, now_seg
);
1884 flags
|= SEC_LINK_ONCE
;
1889 case LINKONCE_DISCARD
:
1890 flags
|= SEC_LINK_DUPLICATES_DISCARD
;
1892 case LINKONCE_ONE_ONLY
:
1893 flags
|= SEC_LINK_DUPLICATES_ONE_ONLY
;
1895 case LINKONCE_SAME_SIZE
:
1896 flags
|= SEC_LINK_DUPLICATES_SAME_SIZE
;
1898 case LINKONCE_SAME_CONTENTS
:
1899 flags
|= SEC_LINK_DUPLICATES_SAME_CONTENTS
;
1902 if (! bfd_set_section_flags (stdoutput
, now_seg
, flags
))
1903 as_bad (_("bfd_set_section_flags: %s"),
1904 bfd_errmsg (bfd_get_error ()));
1906 #else /* ! defined (BFD_ASSEMBLER) */
1907 as_warn (_(".linkonce is not supported for this object file format"));
1908 #endif /* ! defined (BFD_ASSEMBLER) */
1909 #endif /* ! defined (obj_handle_link_once) */
1911 demand_empty_rest_of_line ();
1915 s_lcomm_internal (needs_align
, bytes_p
)
1916 /* 1 if this was a ".bss" directive, which may require a 3rd argument
1917 (alignment); 0 if it was an ".lcomm" (2 args only) */
1919 /* 1 if the alignment value should be interpreted as the byte boundary,
1920 rather than the power of 2. */
1923 register char *name
;
1927 register symbolS
*symbolP
;
1928 segT current_seg
= now_seg
;
1929 subsegT current_subseg
= now_subseg
;
1930 const int max_alignment
= 15;
1932 segT bss_seg
= bss_section
;
1934 name
= input_line_pointer
;
1935 c
= get_symbol_end ();
1936 p
= input_line_pointer
;
1940 /* Accept an optional comma after the name. The comma used to be
1941 required, but Irix 5 cc does not generate it. */
1942 if (*input_line_pointer
== ',')
1944 ++input_line_pointer
;
1948 if (*input_line_pointer
== '\n')
1950 as_bad (_("Missing size expression"));
1954 if ((temp
= get_absolute_expression ()) < 0)
1956 as_warn (_("BSS length (%d.) <0! Ignored."), temp
);
1957 ignore_rest_of_line ();
1961 #if defined (TC_MIPS) || defined (TC_ALPHA)
1962 if (OUTPUT_FLAVOR
== bfd_target_ecoff_flavour
1963 || OUTPUT_FLAVOR
== bfd_target_elf_flavour
)
1965 /* For MIPS and Alpha ECOFF or ELF, small objects are put in .sbss. */
1966 if (temp
<= bfd_get_gp_size (stdoutput
))
1968 bss_seg
= subseg_new (".sbss", 1);
1969 seg_info (bss_seg
)->bss
= 1;
1970 #ifdef BFD_ASSEMBLER
1971 if (! bfd_set_section_flags (stdoutput
, bss_seg
, SEC_ALLOC
))
1972 as_warn (_("error setting flags for \".sbss\": %s"),
1973 bfd_errmsg (bfd_get_error ()));
1980 /* FIXME. This needs to be machine independent. */
1991 /* FIXME: This needs to be done in a more general fashion. */
1995 record_alignment(bss_seg
, align
);
2002 if (*input_line_pointer
!= ',')
2004 as_bad (_("Expected comma after size"));
2005 ignore_rest_of_line ();
2008 input_line_pointer
++;
2010 if (*input_line_pointer
== '\n')
2012 as_bad (_("Missing alignment"));
2015 align
= get_absolute_expression ();
2018 /* Convert to a power of 2. */
2023 for (i
= 0; (align
& 1) == 0; align
>>= 1, ++i
)
2026 as_bad (_("Alignment not a power of 2"));
2030 if (align
> max_alignment
)
2032 align
= max_alignment
;
2033 as_warn (_("Alignment too large: %d. assumed."), align
);
2038 as_warn (_("Alignment negative. 0 assumed."));
2040 record_alignment (bss_seg
, align
);
2041 } /* if needs align */
2044 /* Assume some objects may require alignment on some systems. */
2045 #if defined (TC_ALPHA) && ! defined (VMS)
2048 align
= ffs (temp
) - 1;
2049 if (temp
% (1 << align
))
2056 symbolP
= symbol_find_or_make (name
);
2060 #if defined(OBJ_AOUT) | defined(OBJ_BOUT)
2061 S_GET_OTHER (symbolP
) == 0 &&
2062 S_GET_DESC (symbolP
) == 0 &&
2063 #endif /* OBJ_AOUT or OBJ_BOUT */
2064 (S_GET_SEGMENT (symbolP
) == bss_seg
2065 || (!S_IS_DEFINED (symbolP
) && S_GET_VALUE (symbolP
) == 0)))
2069 subseg_set (bss_seg
, 1);
2072 frag_align (align
, 0, 0);
2073 /* detach from old frag */
2074 if (S_GET_SEGMENT (symbolP
) == bss_seg
)
2075 symbol_get_frag (symbolP
)->fr_symbol
= NULL
;
2077 symbol_set_frag (symbolP
, frag_now
);
2078 pfrag
= frag_var (rs_org
, 1, 1, (relax_substateT
)0, symbolP
,
2079 (offsetT
) temp
, (char *) 0);
2082 S_SET_SEGMENT (symbolP
, bss_seg
);
2085 /* The symbol may already have been created with a preceding
2086 ".globl" directive -- be careful not to step on storage class
2087 in that case. Otherwise, set it to static. */
2088 if (S_GET_STORAGE_CLASS (symbolP
) != C_EXT
)
2090 S_SET_STORAGE_CLASS (symbolP
, C_STAT
);
2092 #endif /* OBJ_COFF */
2095 S_SET_SIZE (symbolP
, temp
);
2099 as_bad (_("Ignoring attempt to re-define symbol `%s'."),
2100 S_GET_NAME (symbolP
));
2102 subseg_set (current_seg
, current_subseg
);
2104 demand_empty_rest_of_line ();
2105 } /* s_lcomm_internal() */
2108 s_lcomm (needs_align
)
2111 s_lcomm_internal (needs_align
, 0);
2114 void s_lcomm_bytes (needs_align
)
2117 s_lcomm_internal (needs_align
, 1);
2122 int ignore ATTRIBUTE_UNUSED
;
2124 register char *name
;
2128 register symbolS
*symbolP
;
2130 /* we permit ANY defined expression: BSD4.2 demands constants */
2131 name
= input_line_pointer
;
2132 c
= get_symbol_end ();
2133 p
= input_line_pointer
;
2136 if (*input_line_pointer
!= ',')
2139 as_bad (_("Expected comma after name \"%s\""), name
);
2141 ignore_rest_of_line ();
2144 input_line_pointer
++;
2146 if (exp
.X_op
!= O_constant
2147 && exp
.X_op
!= O_register
)
2149 as_bad (_("bad expression"));
2150 ignore_rest_of_line ();
2154 symbolP
= symbol_find_or_make (name
);
2156 /* FIXME-SOON I pulled a (&& symbolP->sy_other == 0 &&
2157 symbolP->sy_desc == 0) out of this test because coff doesn't have
2158 those fields, and I can't see when they'd ever be tripped. I
2159 don't think I understand why they were here so I may have
2160 introduced a bug. As recently as 1.37 didn't have this test
2161 anyway. xoxorich. */
2163 if (S_GET_SEGMENT (symbolP
) == undefined_section
2164 && S_GET_VALUE (symbolP
) == 0)
2166 /* The name might be an undefined .global symbol; be sure to
2167 keep the "external" bit. */
2168 S_SET_SEGMENT (symbolP
,
2169 (exp
.X_op
== O_constant
2172 S_SET_VALUE (symbolP
, (valueT
) exp
.X_add_number
);
2176 as_bad (_("Symbol %s already defined"), name
);
2179 demand_empty_rest_of_line ();
2182 /* Read a line into an sb. */
2188 char quote1
, quote2
, inquote
;
2190 if (input_line_pointer
[-1] == '\n')
2191 bump_line_counters ();
2193 if (input_line_pointer
>= buffer_limit
)
2195 buffer_limit
= input_scrub_next_buffer (&input_line_pointer
);
2196 if (buffer_limit
== 0)
2200 /* If app.c sets any other characters to LEX_IS_STRINGQUOTE, this
2201 code needs to be changed. */
2202 if (! flag_m68k_mri
)
2210 #ifdef LEX_IS_STRINGQUOTE
2215 while (! is_end_of_line
[(unsigned char) *input_line_pointer
]
2216 || (inquote
!= '\0' && *input_line_pointer
!= '\n'))
2218 if (inquote
== *input_line_pointer
)
2220 else if (inquote
== '\0')
2222 if (*input_line_pointer
== quote1
)
2224 else if (*input_line_pointer
== quote2
)
2227 sb_add_char (line
, *input_line_pointer
++);
2229 while (input_line_pointer
< buffer_limit
2230 && is_end_of_line
[(unsigned char) *input_line_pointer
])
2232 if (input_line_pointer
[-1] == '\n')
2233 bump_line_counters ();
2234 ++input_line_pointer
;
2239 /* Define a macro. This is an interface to macro.c, which is shared
2240 between gas and gasp. */
2244 int ignore ATTRIBUTE_UNUSED
;
2253 as_where (&file
, &line
);
2256 while (! is_end_of_line
[(unsigned char) *input_line_pointer
])
2257 sb_add_char (&s
, *input_line_pointer
++);
2260 if (line_label
!= NULL
)
2261 sb_add_string (&label
, S_GET_NAME (line_label
));
2263 err
= define_macro (0, &s
, &label
, get_line_sb
, &name
);
2265 as_bad_where (file
, line
, "%s", err
);
2268 if (line_label
!= NULL
)
2270 S_SET_SEGMENT (line_label
, undefined_section
);
2271 S_SET_VALUE (line_label
, 0);
2272 symbol_set_frag (line_label
, &zero_address_frag
);
2276 #ifdef NO_PSEUDO_DOT
2280 && hash_find (po_hash
, name
) != NULL
)
2283 && hash_find (po_hash
, name
+ 1) != NULL
))
2284 as_warn (_("attempt to redefine pseudo-op `%s' ignored"),
2291 /* Handle the .mexit pseudo-op, which immediately exits a macro
2296 int ignore ATTRIBUTE_UNUSED
;
2298 cond_exit_macro (macro_nest
);
2299 buffer_limit
= input_scrub_next_buffer (&input_line_pointer
);
2302 /* Switch in and out of MRI mode. */
2306 int ignore ATTRIBUTE_UNUSED
;
2310 on
= get_absolute_expression ();
2311 old_flag
= flag_mri
;
2327 /* Operator precedence changes in m68k MRI mode, so we need to
2328 update the operator rankings. */
2329 expr_set_precedence ();
2331 #ifdef MRI_MODE_CHANGE
2333 MRI_MODE_CHANGE (on
);
2336 demand_empty_rest_of_line ();
2339 /* Handle changing the location counter. */
2342 do_org (segment
, exp
, fill
)
2347 if (segment
!= now_seg
&& segment
!= absolute_section
)
2348 as_bad (_("invalid segment \"%s\"; segment \"%s\" assumed"),
2349 segment_name (segment
), segment_name (now_seg
));
2351 if (now_seg
== absolute_section
)
2354 as_warn (_("ignoring fill value in absolute section"));
2355 if (exp
->X_op
!= O_constant
)
2357 as_bad (_("only constant offsets supported in absolute section"));
2358 exp
->X_add_number
= 0;
2360 abs_section_offset
= exp
->X_add_number
;
2366 p
= frag_var (rs_org
, 1, 1, (relax_substateT
) 0, exp
->X_add_symbol
,
2367 exp
->X_add_number
, (char *) NULL
);
2374 int ignore ATTRIBUTE_UNUSED
;
2376 register segT segment
;
2378 register long temp_fill
;
2380 #ifdef md_flush_pending_output
2381 md_flush_pending_output ();
2384 /* The m68k MRI assembler has a different meaning for .org. It
2385 means to create an absolute section at a given address. We can't
2386 support that--use a linker script instead. */
2389 as_bad (_("MRI style ORG pseudo-op not supported"));
2390 ignore_rest_of_line ();
2394 /* Don't believe the documentation of BSD 4.2 AS. There is no such
2395 thing as a sub-segment-relative origin. Any absolute origin is
2396 given a warning, then assumed to be segment-relative. Any
2397 segmented origin expression ("foo+42") had better be in the right
2398 segment or the .org is ignored.
2400 BSD 4.2 AS warns if you try to .org backwards. We cannot because
2401 we never know sub-segment sizes when we are reading code. BSD
2402 will crash trying to emit negative numbers of filler bytes in
2403 certain .orgs. We don't crash, but see as-write for that code.
2405 Don't make frag if need_pass_2==1. */
2406 segment
= get_known_segmented_expression (&exp
);
2407 if (*input_line_pointer
== ',')
2409 input_line_pointer
++;
2410 temp_fill
= get_absolute_expression ();
2416 do_org (segment
, &exp
, temp_fill
);
2418 demand_empty_rest_of_line ();
2421 /* Handle parsing for the MRI SECT/SECTION pseudo-op. This should be
2422 called by the obj-format routine which handles section changing
2423 when in MRI mode. It will create a new section, and return it. It
2424 will set *TYPE to the section type: one of 'C' (code), 'D' (data),
2425 'M' (mixed), or 'R' (romable). If BFD_ASSEMBLER is defined, the
2426 flags will be set in the section. */
2430 char *type ATTRIBUTE_UNUSED
;
2440 name
= input_line_pointer
;
2441 if (! isdigit ((unsigned char) *name
))
2442 c
= get_symbol_end ();
2447 ++input_line_pointer
;
2449 while (isdigit ((unsigned char) *input_line_pointer
));
2450 c
= *input_line_pointer
;
2451 *input_line_pointer
= '\0';
2454 name
= xstrdup (name
);
2456 *input_line_pointer
= c
;
2458 seg
= subseg_new (name
, 0);
2460 if (*input_line_pointer
== ',')
2464 ++input_line_pointer
;
2465 align
= get_absolute_expression ();
2466 record_alignment (seg
, align
);
2470 if (*input_line_pointer
== ',')
2472 c
= *++input_line_pointer
;
2473 c
= toupper ((unsigned char) c
);
2474 if (c
== 'C' || c
== 'D' || c
== 'M' || c
== 'R')
2477 as_bad (_("unrecognized section type"));
2478 ++input_line_pointer
;
2480 #ifdef BFD_ASSEMBLER
2484 flags
= SEC_NO_FLAGS
;
2486 flags
= SEC_ALLOC
| SEC_LOAD
| SEC_READONLY
| SEC_CODE
;
2487 else if (*type
== 'D' || *type
== 'M')
2488 flags
= SEC_ALLOC
| SEC_LOAD
| SEC_DATA
;
2489 else if (*type
== 'R')
2490 flags
= SEC_ALLOC
| SEC_LOAD
| SEC_DATA
| SEC_READONLY
| SEC_ROM
;
2491 if (flags
!= SEC_NO_FLAGS
)
2493 if (! bfd_set_section_flags (stdoutput
, seg
, flags
))
2494 as_warn (_("error setting flags for \"%s\": %s"),
2495 bfd_section_name (stdoutput
, seg
),
2496 bfd_errmsg (bfd_get_error ()));
2502 /* Ignore the HP type. */
2503 if (*input_line_pointer
== ',')
2504 input_line_pointer
+= 2;
2506 demand_empty_rest_of_line ();
2508 #else /* ! TC_M68K */
2517 name
= input_line_pointer
;
2518 c
= get_symbol_end ();
2520 name
= xstrdup (name
);
2522 *input_line_pointer
= c
;
2524 seg
= subseg_new (name
, 0);
2526 if (*input_line_pointer
!= ',')
2532 ++input_line_pointer
;
2534 sectype
= input_line_pointer
;
2535 c
= get_symbol_end ();
2536 if (*sectype
== '\0')
2538 else if (strcasecmp (sectype
, "text") == 0)
2540 else if (strcasecmp (sectype
, "data") == 0)
2542 else if (strcasecmp (sectype
, "romdata") == 0)
2545 as_warn (_("unrecognized section type `%s'"), sectype
);
2546 *input_line_pointer
= c
;
2549 if (*input_line_pointer
== ',')
2553 ++input_line_pointer
;
2555 seccmd
= input_line_pointer
;
2556 c
= get_symbol_end ();
2557 if (strcasecmp (seccmd
, "absolute") == 0)
2559 as_bad (_("absolute sections are not supported"));
2560 *input_line_pointer
= c
;
2561 ignore_rest_of_line ();
2564 else if (strcasecmp (seccmd
, "align") == 0)
2568 *input_line_pointer
= c
;
2569 align
= get_absolute_expression ();
2570 record_alignment (seg
, align
);
2574 as_warn (_("unrecognized section command `%s'"), seccmd
);
2575 *input_line_pointer
= c
;
2579 demand_empty_rest_of_line ();
2581 #else /* ! TC_I960 */
2582 /* The MRI assembler seems to use different forms of .sect for
2583 different targets. */
2584 as_bad ("MRI mode not supported for this target");
2585 ignore_rest_of_line ();
2586 #endif /* ! TC_I960 */
2587 #endif /* ! TC_M68K */
2590 /* Handle the .print pseudo-op. */
2594 int ignore ATTRIBUTE_UNUSED
;
2599 s
= demand_copy_C_string (&len
);
2601 demand_empty_rest_of_line ();
2604 /* Handle the .purgem pseudo-op. */
2608 int ignore ATTRIBUTE_UNUSED
;
2610 if (is_it_end_of_statement ())
2612 demand_empty_rest_of_line ();
2622 name
= input_line_pointer
;
2623 c
= get_symbol_end ();
2624 delete_macro (name
);
2625 *input_line_pointer
= c
;
2628 while (*input_line_pointer
++ == ',');
2630 --input_line_pointer
;
2631 demand_empty_rest_of_line ();
2634 /* Handle the .rept pseudo-op. */
2638 int ignore ATTRIBUTE_UNUSED
;
2644 count
= get_absolute_expression ();
2647 if (! buffer_and_nest ("REPT", "ENDR", &one
, get_line_sb
))
2649 as_bad (_("rept without endr"));
2655 sb_add_sb (&many
, &one
);
2659 input_scrub_include_sb (&many
, input_line_pointer
);
2661 buffer_limit
= input_scrub_next_buffer (&input_line_pointer
);
2664 /* Handle the .equ, .equiv and .set directives. If EQUIV is 1, then
2665 this is .equiv, and it is an error if the symbol is already
2672 register char *name
;
2673 register char delim
;
2674 register char *end_name
;
2675 register symbolS
*symbolP
;
2678 * Especial apologies for the random logic:
2679 * this just grew, and could be parsed much more simply!
2682 name
= input_line_pointer
;
2683 delim
= get_symbol_end ();
2684 end_name
= input_line_pointer
;
2688 if (*input_line_pointer
!= ',')
2691 as_bad (_("Expected comma after name \"%s\""), name
);
2693 ignore_rest_of_line ();
2697 input_line_pointer
++;
2700 if (name
[0] == '.' && name
[1] == '\0')
2702 /* Turn '. = mumble' into a .org mumble */
2703 register segT segment
;
2706 segment
= get_known_segmented_expression (&exp
);
2709 do_org (segment
, &exp
, 0);
2715 if ((symbolP
= symbol_find (name
)) == NULL
2716 && (symbolP
= md_undefined_symbol (name
)) == NULL
)
2719 /* When doing symbol listings, play games with dummy fragments living
2720 outside the normal fragment chain to record the file and line info
2722 if (listing
& LISTING_SYMBOLS
)
2724 extern struct list_info_struct
*listing_tail
;
2725 fragS
*dummy_frag
= (fragS
*) xmalloc (sizeof(fragS
));
2726 memset (dummy_frag
, 0, sizeof(fragS
));
2727 dummy_frag
->fr_type
= rs_fill
;
2728 dummy_frag
->line
= listing_tail
;
2729 symbolP
= symbol_new (name
, undefined_section
, 0, dummy_frag
);
2730 dummy_frag
->fr_symbol
= symbolP
;
2734 symbolP
= symbol_new (name
, undefined_section
, 0, &zero_address_frag
);
2737 /* "set" symbols are local unless otherwise specified. */
2738 SF_SET_LOCAL (symbolP
);
2739 #endif /* OBJ_COFF */
2741 } /* make a new symbol */
2743 symbol_table_insert (symbolP
);
2748 && S_IS_DEFINED (symbolP
)
2749 && S_GET_SEGMENT (symbolP
) != reg_section
)
2750 as_bad (_("symbol `%s' already defined"), S_GET_NAME (symbolP
));
2752 pseudo_set (symbolP
);
2753 demand_empty_rest_of_line ();
2767 #ifdef md_flush_pending_output
2768 md_flush_pending_output ();
2772 stop
= mri_comment_field (&stopc
);
2774 /* In m68k MRI mode, we need to align to a word boundary, unless
2776 if (flag_m68k_mri
&& mult
> 1)
2778 if (now_seg
== absolute_section
)
2780 abs_section_offset
+= abs_section_offset
& 1;
2781 if (line_label
!= NULL
)
2782 S_SET_VALUE (line_label
, abs_section_offset
);
2784 else if (mri_common_symbol
!= NULL
)
2788 val
= S_GET_VALUE (mri_common_symbol
);
2791 S_SET_VALUE (mri_common_symbol
, val
+ 1);
2792 if (line_label
!= NULL
)
2794 expressionS
*symexp
;
2796 symexp
= symbol_get_value_expression (line_label
);
2797 know (symexp
->X_op
== O_symbol
);
2798 know (symexp
->X_add_symbol
== mri_common_symbol
);
2799 symexp
->X_add_number
+= 1;
2805 do_align (1, (char *) NULL
, 0, 0);
2806 if (line_label
!= NULL
)
2808 symbol_set_frag (line_label
, frag_now
);
2809 S_SET_VALUE (line_label
, frag_now_fix ());
2819 if (*input_line_pointer
== ',')
2821 ++input_line_pointer
;
2826 val
.X_op
= O_constant
;
2827 val
.X_add_number
= 0;
2830 if (val
.X_op
!= O_constant
2831 || val
.X_add_number
< - 0x80
2832 || val
.X_add_number
> 0xff
2833 || (mult
!= 0 && mult
!= 1 && val
.X_add_number
!= 0))
2835 if (exp
.X_op
!= O_constant
)
2836 as_bad (_("Unsupported variable size or fill value"));
2843 bytes
= mult
* exp
.X_add_number
;
2844 for (i
= 0; i
< exp
.X_add_number
; i
++)
2845 emit_expr (&val
, mult
);
2850 if (exp
.X_op
== O_constant
)
2854 repeat
= exp
.X_add_number
;
2861 as_warn (_(".space repeat count is zero, ignored"));
2862 else if (repeat
< 0)
2863 as_warn (_(".space repeat count is negative, ignored"));
2867 /* If we are in the absolute section, just bump the offset. */
2868 if (now_seg
== absolute_section
)
2870 abs_section_offset
+= repeat
;
2874 /* If we are secretly in an MRI common section, then
2875 creating space just increases the size of the common
2877 if (mri_common_symbol
!= NULL
)
2879 S_SET_VALUE (mri_common_symbol
,
2880 S_GET_VALUE (mri_common_symbol
) + repeat
);
2885 p
= frag_var (rs_fill
, 1, 1, (relax_substateT
) 0, (symbolS
*) 0,
2886 (offsetT
) repeat
, (char *) 0);
2890 if (now_seg
== absolute_section
)
2892 as_bad (_("space allocation too complex in absolute section"));
2893 subseg_set (text_section
, 0);
2895 if (mri_common_symbol
!= NULL
)
2897 as_bad (_("space allocation too complex in common section"));
2898 mri_common_symbol
= NULL
;
2901 p
= frag_var (rs_space
, 1, 1, (relax_substateT
) 0,
2902 make_expr_symbol (&exp
), (offsetT
) 0, (char *) 0);
2906 *p
= val
.X_add_number
;
2911 /* In MRI mode, after an odd number of bytes, we must align to an
2912 even word boundary, unless the next instruction is a dc.b, ds.b
2914 if (flag_mri
&& (bytes
& 1) != 0)
2915 mri_pending_align
= 1;
2917 demand_empty_rest_of_line ();
2920 mri_comment_end (stop
, stopc
);
2923 /* This is like s_space, but the value is a floating point number with
2924 the given precision. This is for the MRI dcb.s pseudo-op and
2928 s_float_space (float_type
)
2933 char temp
[MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT
];
2938 stop
= mri_comment_field (&stopc
);
2940 count
= get_absolute_expression ();
2943 if (*input_line_pointer
!= ',')
2945 as_bad (_("missing value"));
2946 ignore_rest_of_line ();
2948 mri_comment_end (stop
, stopc
);
2952 ++input_line_pointer
;
2956 /* Skip any 0{letter} that may be present. Don't even check if the
2957 * letter is legal. */
2958 if (input_line_pointer
[0] == '0'
2959 && isalpha ((unsigned char) input_line_pointer
[1]))
2960 input_line_pointer
+= 2;
2962 /* Accept :xxxx, where the x's are hex digits, for a floating point
2963 with the exact digits specified. */
2964 if (input_line_pointer
[0] == ':')
2966 flen
= hex_float (float_type
, temp
);
2969 ignore_rest_of_line ();
2971 mri_comment_end (stop
, stopc
);
2979 err
= md_atof (float_type
, temp
, &flen
);
2980 know (flen
<= MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT
);
2984 as_bad (_("Bad floating literal: %s"), err
);
2985 ignore_rest_of_line ();
2987 mri_comment_end (stop
, stopc
);
2992 while (--count
>= 0)
2996 p
= frag_more (flen
);
2997 memcpy (p
, temp
, (unsigned int) flen
);
3000 demand_empty_rest_of_line ();
3003 mri_comment_end (stop
, stopc
);
3006 /* Handle the .struct pseudo-op, as found in MIPS assemblers. */
3010 int ignore ATTRIBUTE_UNUSED
;
3016 stop
= mri_comment_field (&stopc
);
3017 abs_section_offset
= get_absolute_expression ();
3018 subseg_set (absolute_section
, 0);
3019 demand_empty_rest_of_line ();
3021 mri_comment_end (stop
, stopc
);
3026 int ignore ATTRIBUTE_UNUSED
;
3030 temp
= get_absolute_expression ();
3031 subseg_set (text_section
, (subsegT
) temp
);
3032 demand_empty_rest_of_line ();
3034 const_flag
&= ~IN_DEFAULT_SECTION
;
3040 demand_empty_rest_of_line ()
3043 if (is_end_of_line
[(unsigned char) *input_line_pointer
])
3045 input_line_pointer
++;
3049 ignore_rest_of_line ();
3051 /* Return having already swallowed end-of-line. */
3052 } /* Return pointing just after end-of-line. */
3055 ignore_rest_of_line () /* For suspect lines: gives warning. */
3057 if (!is_end_of_line
[(unsigned char) *input_line_pointer
])
3059 if (isprint ((unsigned char) *input_line_pointer
))
3060 as_bad (_("Rest of line ignored. First ignored character is `%c'."),
3061 *input_line_pointer
);
3063 as_bad (_("Rest of line ignored. First ignored character valued 0x%x."),
3064 *input_line_pointer
);
3065 while (input_line_pointer
< buffer_limit
3066 && !is_end_of_line
[(unsigned char) *input_line_pointer
])
3068 input_line_pointer
++;
3071 input_line_pointer
++; /* Return pointing just after end-of-line. */
3072 know (is_end_of_line
[(unsigned char) input_line_pointer
[-1]]);
3076 discard_rest_of_line ()
3078 while (input_line_pointer
< buffer_limit
3079 && !is_end_of_line
[(unsigned char) *input_line_pointer
])
3081 input_line_pointer
++;
3083 input_line_pointer
++; /* Return pointing just after end-of-line. */
3084 know (is_end_of_line
[(unsigned char) input_line_pointer
[-1]]);
3090 * In: Pointer to a symbol.
3091 * Input_line_pointer->expression.
3093 * Out: Input_line_pointer->just after any whitespace after expression.
3094 * Tried to set symbol to value of expression.
3095 * Will change symbols type, value, and frag;
3098 pseudo_set (symbolP
)
3102 #if (defined (OBJ_AOUT) || defined (OBJ_BOUT)) && ! defined (BFD_ASSEMBLER)
3104 #endif /* OBJ_AOUT or OBJ_BOUT */
3106 know (symbolP
); /* NULL pointer is logic error. */
3107 #if (defined (OBJ_AOUT) || defined (OBJ_BOUT)) && ! defined (BFD_ASSEMBLER)
3108 ext
= S_IS_EXTERNAL (symbolP
);
3109 #endif /* OBJ_AOUT or OBJ_BOUT */
3111 (void) expression (&exp
);
3113 if (exp
.X_op
== O_illegal
)
3114 as_bad (_("illegal expression; zero assumed"));
3115 else if (exp
.X_op
== O_absent
)
3116 as_bad (_("missing expression; zero assumed"));
3117 else if (exp
.X_op
== O_big
)
3119 if (exp
.X_add_number
> 0)
3120 as_bad (_("bignum invalid; zero assumed"));
3122 as_bad (_("floating point number invalid; zero assumed"));
3124 else if (exp
.X_op
== O_subtract
3125 && (S_GET_SEGMENT (exp
.X_add_symbol
)
3126 == S_GET_SEGMENT (exp
.X_op_symbol
))
3127 && SEG_NORMAL (S_GET_SEGMENT (exp
.X_add_symbol
))
3128 && (symbol_get_frag (exp
.X_add_symbol
)
3129 == symbol_get_frag (exp
.X_op_symbol
)))
3131 exp
.X_op
= O_constant
;
3132 exp
.X_add_number
= (S_GET_VALUE (exp
.X_add_symbol
)
3133 - S_GET_VALUE (exp
.X_op_symbol
));
3141 exp
.X_add_number
= 0;
3144 S_SET_SEGMENT (symbolP
, absolute_section
);
3145 #if (defined (OBJ_AOUT) || defined (OBJ_BOUT)) && ! defined (BFD_ASSEMBLER)
3147 S_SET_EXTERNAL (symbolP
);
3149 S_CLEAR_EXTERNAL (symbolP
);
3150 #endif /* OBJ_AOUT or OBJ_BOUT */
3151 S_SET_VALUE (symbolP
, (valueT
) exp
.X_add_number
);
3152 if (exp
.X_op
!= O_constant
)
3153 symbol_set_frag (symbolP
, &zero_address_frag
);
3157 S_SET_SEGMENT (symbolP
, reg_section
);
3158 S_SET_VALUE (symbolP
, (valueT
) exp
.X_add_number
);
3159 symbol_set_frag (symbolP
, &zero_address_frag
);
3163 if (S_GET_SEGMENT (exp
.X_add_symbol
) == undefined_section
3164 || exp
.X_add_number
!= 0)
3165 symbol_set_value_expression (symbolP
, &exp
);
3166 else if (symbol_section_p (symbolP
))
3167 as_bad ("invalid attempt to set value of section symbol");
3170 symbolS
*s
= exp
.X_add_symbol
;
3172 S_SET_SEGMENT (symbolP
, S_GET_SEGMENT (s
));
3173 #if (defined (OBJ_AOUT) || defined (OBJ_BOUT)) && ! defined (BFD_ASSEMBLER)
3175 S_SET_EXTERNAL (symbolP
);
3177 S_CLEAR_EXTERNAL (symbolP
);
3178 #endif /* OBJ_AOUT or OBJ_BOUT */
3179 S_SET_VALUE (symbolP
,
3180 exp
.X_add_number
+ S_GET_VALUE (s
));
3181 symbol_set_frag (symbolP
, symbol_get_frag (s
));
3182 copy_symbol_attributes (symbolP
, s
);
3187 /* The value is some complex expression.
3188 FIXME: Should we set the segment to anything? */
3189 symbol_set_value_expression (symbolP
, &exp
);
3197 * CONStruct more frag of .bytes, or .words etc.
3198 * Should need_pass_2 be 1 then emit no frag(s).
3199 * This understands EXPRESSIONS.
3203 * This has a split personality. We use expression() to read the
3204 * value. We can detect if the value won't fit in a byte or word.
3205 * But we can't detect if expression() discarded significant digits
3206 * in the case of a long. Not worth the crocks required to fix it.
3209 /* Select a parser for cons expressions. */
3211 /* Some targets need to parse the expression in various fancy ways.
3212 You can define TC_PARSE_CONS_EXPRESSION to do whatever you like
3213 (for example, the HPPA does this). Otherwise, you can define
3214 BITFIELD_CONS_EXPRESSIONS to permit bitfields to be specified, or
3215 REPEAT_CONS_EXPRESSIONS to permit repeat counts. If none of these
3216 are defined, which is the normal case, then only simple expressions
3220 parse_mri_cons
PARAMS ((expressionS
*exp
, unsigned int nbytes
));
3222 #ifndef TC_PARSE_CONS_EXPRESSION
3223 #ifdef BITFIELD_CONS_EXPRESSIONS
3224 #define TC_PARSE_CONS_EXPRESSION(EXP, NBYTES) parse_bitfield_cons (EXP, NBYTES)
3226 parse_bitfield_cons
PARAMS ((expressionS
*exp
, unsigned int nbytes
));
3228 #ifdef REPEAT_CONS_EXPRESSIONS
3229 #define TC_PARSE_CONS_EXPRESSION(EXP, NBYTES) parse_repeat_cons (EXP, NBYTES)
3231 parse_repeat_cons
PARAMS ((expressionS
*exp
, unsigned int nbytes
));
3234 /* If we haven't gotten one yet, just call expression. */
3235 #ifndef TC_PARSE_CONS_EXPRESSION
3236 #define TC_PARSE_CONS_EXPRESSION(EXP, NBYTES) expression (EXP)
3240 /* worker to do .byte etc statements */
3241 /* clobbers input_line_pointer, checks */
3244 cons_worker (nbytes
, rva
)
3245 register int nbytes
; /* 1=.byte, 2=.word, 4=.long */
3253 #ifdef md_flush_pending_output
3254 md_flush_pending_output ();
3258 stop
= mri_comment_field (&stopc
);
3260 if (is_it_end_of_statement ())
3262 demand_empty_rest_of_line ();
3264 mri_comment_end (stop
, stopc
);
3268 #ifdef md_cons_align
3269 md_cons_align (nbytes
);
3276 parse_mri_cons (&exp
, (unsigned int) nbytes
);
3278 TC_PARSE_CONS_EXPRESSION (&exp
, (unsigned int) nbytes
);
3282 if (exp
.X_op
== O_symbol
)
3283 exp
.X_op
= O_symbol_rva
;
3285 as_fatal (_("rva without symbol"));
3287 emit_expr (&exp
, (unsigned int) nbytes
);
3290 while (*input_line_pointer
++ == ',');
3292 /* In MRI mode, after an odd number of bytes, we must align to an
3293 even word boundary, unless the next instruction is a dc.b, ds.b
3295 if (flag_mri
&& nbytes
== 1 && (c
& 1) != 0)
3296 mri_pending_align
= 1;
3298 input_line_pointer
--; /* Put terminator back into stream. */
3300 demand_empty_rest_of_line ();
3303 mri_comment_end (stop
, stopc
);
3311 cons_worker (size
, 0);
3318 cons_worker (size
, 1);
3321 /* Put the contents of expression EXP into the object file using
3322 NBYTES bytes. If need_pass_2 is 1, this does nothing. */
3325 emit_expr (exp
, nbytes
)
3327 unsigned int nbytes
;
3331 valueT extra_digit
= 0;
3333 /* Don't do anything if we are going to make another pass. */
3339 /* When gcc emits DWARF 1 debugging pseudo-ops, a line number will
3340 appear as a four byte positive constant in the .line section,
3341 followed by a 2 byte 0xffff. Look for that case here. */
3343 static int dwarf_line
= -1;
3345 if (strcmp (segment_name (now_seg
), ".line") != 0)
3347 else if (dwarf_line
>= 0
3349 && exp
->X_op
== O_constant
3350 && (exp
->X_add_number
== -1 || exp
->X_add_number
== 0xffff))
3351 listing_source_line ((unsigned int) dwarf_line
);
3352 else if (nbytes
== 4
3353 && exp
->X_op
== O_constant
3354 && exp
->X_add_number
>= 0)
3355 dwarf_line
= exp
->X_add_number
;
3360 /* When gcc emits DWARF 1 debugging pseudo-ops, a file name will
3361 appear as a 2 byte TAG_compile_unit (0x11) followed by a 2 byte
3362 AT_sibling (0x12) followed by a four byte address of the sibling
3363 followed by a 2 byte AT_name (0x38) followed by the name of the
3364 file. We look for that case here. */
3366 static int dwarf_file
= 0;
3368 if (strcmp (segment_name (now_seg
), ".debug") != 0)
3370 else if (dwarf_file
== 0
3372 && exp
->X_op
== O_constant
3373 && exp
->X_add_number
== 0x11)
3375 else if (dwarf_file
== 1
3377 && exp
->X_op
== O_constant
3378 && exp
->X_add_number
== 0x12)
3380 else if (dwarf_file
== 2
3383 else if (dwarf_file
== 3
3385 && exp
->X_op
== O_constant
3386 && exp
->X_add_number
== 0x38)
3391 /* The variable dwarf_file_string tells stringer that the string
3392 may be the name of the source file. */
3393 if (dwarf_file
== 4)
3394 dwarf_file_string
= 1;
3396 dwarf_file_string
= 0;
3401 if (check_eh_frame (exp
, &nbytes
))
3406 /* Allow `.word 0' in the absolute section. */
3407 if (now_seg
== absolute_section
)
3409 if (op
!= O_constant
|| exp
->X_add_number
!= 0)
3410 as_bad (_("attempt to store value in absolute section"));
3411 abs_section_offset
+= nbytes
;
3415 /* Handle a negative bignum. */
3417 && exp
->X_add_number
== 0
3418 && symbol_get_value_expression (exp
->X_add_symbol
)->X_op
== O_big
3419 && symbol_get_value_expression (exp
->X_add_symbol
)->X_add_number
> 0)
3422 unsigned long carry
;
3424 exp
= symbol_get_value_expression (exp
->X_add_symbol
);
3426 /* Negate the bignum: one's complement each digit and add 1. */
3428 for (i
= 0; i
< exp
->X_add_number
; i
++)
3432 next
= (((~ (generic_bignum
[i
] & LITTLENUM_MASK
))
3435 generic_bignum
[i
] = next
& LITTLENUM_MASK
;
3436 carry
= next
>> LITTLENUM_NUMBER_OF_BITS
;
3439 /* We can ignore any carry out, because it will be handled by
3440 extra_digit if it is needed. */
3442 extra_digit
= (valueT
) -1;
3446 if (op
== O_absent
|| op
== O_illegal
)
3448 as_warn (_("zero assumed for missing expression"));
3449 exp
->X_add_number
= 0;
3452 else if (op
== O_big
&& exp
->X_add_number
<= 0)
3454 as_bad (_("floating point number invalid; zero assumed"));
3455 exp
->X_add_number
= 0;
3458 else if (op
== O_register
)
3460 as_warn (_("register value used as expression"));
3464 p
= frag_more ((int) nbytes
);
3466 #ifndef WORKING_DOT_WORD
3467 /* If we have the difference of two symbols in a word, save it on
3468 the broken_words list. See the code in write.c. */
3469 if (op
== O_subtract
&& nbytes
== 2)
3471 struct broken_word
*x
;
3473 x
= (struct broken_word
*) xmalloc (sizeof (struct broken_word
));
3474 x
->next_broken_word
= broken_words
;
3477 x
->subseg
= now_subseg
;
3479 x
->word_goes_here
= p
;
3481 x
->add
= exp
->X_add_symbol
;
3482 x
->sub
= exp
->X_op_symbol
;
3483 x
->addnum
= exp
->X_add_number
;
3490 /* If we have an integer, but the number of bytes is too large to
3491 pass to md_number_to_chars, handle it as a bignum. */
3492 if (op
== O_constant
&& nbytes
> sizeof (valueT
))
3497 if (! exp
->X_unsigned
&& exp
->X_add_number
< 0)
3498 extra_digit
= (valueT
) -1;
3499 val
= (valueT
) exp
->X_add_number
;
3503 generic_bignum
[gencnt
] = val
& LITTLENUM_MASK
;
3504 val
>>= LITTLENUM_NUMBER_OF_BITS
;
3508 op
= exp
->X_op
= O_big
;
3509 exp
->X_add_number
= gencnt
;
3512 if (op
== O_constant
)
3514 register valueT get
;
3515 register valueT use
;
3516 register valueT mask
;
3518 register valueT unmask
;
3520 /* JF << of >= number of bits in the object is undefined. In
3521 particular SPARC (Sun 4) has problems */
3522 if (nbytes
>= sizeof (valueT
))
3525 if (nbytes
> sizeof (valueT
))
3528 hibit
= (valueT
) 1 << (nbytes
* BITS_PER_CHAR
- 1);
3532 /* Don't store these bits. */
3533 mask
= ~(valueT
) 0 << (BITS_PER_CHAR
* nbytes
);
3534 hibit
= (valueT
) 1 << (nbytes
* BITS_PER_CHAR
- 1);
3537 unmask
= ~mask
; /* Do store these bits. */
3540 "Do this mod if you want every overflow check to assume SIGNED 2's complement data.";
3541 mask
= ~(unmask
>> 1); /* Includes sign bit now. */
3544 get
= exp
->X_add_number
;
3546 if ((get
& mask
) != 0
3547 && ((get
& mask
) != mask
3548 || (get
& hibit
) == 0))
3549 { /* Leading bits contain both 0s & 1s. */
3550 as_warn (_("Value 0x%lx truncated to 0x%lx."),
3551 (unsigned long) get
, (unsigned long) use
);
3553 /* put bytes in right order. */
3554 md_number_to_chars (p
, use
, (int) nbytes
);
3556 else if (op
== O_big
)
3559 LITTLENUM_TYPE
*nums
;
3561 know (nbytes
% CHARS_PER_LITTLENUM
== 0);
3563 size
= exp
->X_add_number
* CHARS_PER_LITTLENUM
;
3566 as_warn (_("Bignum truncated to %d bytes"), nbytes
);
3570 if (target_big_endian
)
3572 while (nbytes
> size
)
3574 md_number_to_chars (p
, extra_digit
, CHARS_PER_LITTLENUM
);
3575 nbytes
-= CHARS_PER_LITTLENUM
;
3576 p
+= CHARS_PER_LITTLENUM
;
3579 nums
= generic_bignum
+ size
/ CHARS_PER_LITTLENUM
;
3583 md_number_to_chars (p
, (valueT
) *nums
, CHARS_PER_LITTLENUM
);
3584 size
-= CHARS_PER_LITTLENUM
;
3585 p
+= CHARS_PER_LITTLENUM
;
3590 nums
= generic_bignum
;
3593 md_number_to_chars (p
, (valueT
) *nums
, CHARS_PER_LITTLENUM
);
3595 size
-= CHARS_PER_LITTLENUM
;
3596 p
+= CHARS_PER_LITTLENUM
;
3597 nbytes
-= CHARS_PER_LITTLENUM
;
3602 md_number_to_chars (p
, extra_digit
, CHARS_PER_LITTLENUM
);
3603 nbytes
-= CHARS_PER_LITTLENUM
;
3604 p
+= CHARS_PER_LITTLENUM
;
3610 memset (p
, 0, nbytes
);
3612 /* Now we need to generate a fixS to record the symbol value.
3613 This is easy for BFD. For other targets it can be more
3614 complex. For very complex cases (currently, the HPPA and
3615 NS32K), you can define TC_CONS_FIX_NEW to do whatever you
3616 want. For simpler cases, you can define TC_CONS_RELOC to be
3617 the name of the reloc code that should be stored in the fixS.
3618 If neither is defined, the code uses NO_RELOC if it is
3619 defined, and otherwise uses 0. */
3621 #ifdef BFD_ASSEMBLER
3622 #ifdef TC_CONS_FIX_NEW
3623 TC_CONS_FIX_NEW (frag_now
, p
- frag_now
->fr_literal
, nbytes
, exp
);
3626 bfd_reloc_code_real_type r
;
3643 as_bad (_("unsupported BFD relocation size %u"), nbytes
);
3647 fix_new_exp (frag_now
, p
- frag_now
->fr_literal
, (int) nbytes
, exp
,
3652 #ifdef TC_CONS_FIX_NEW
3653 TC_CONS_FIX_NEW (frag_now
, p
- frag_now
->fr_literal
, nbytes
, exp
);
3655 /* Figure out which reloc number to use. Use TC_CONS_RELOC if
3656 it is defined, otherwise use NO_RELOC if it is defined,
3658 #ifndef TC_CONS_RELOC
3660 #define TC_CONS_RELOC NO_RELOC
3662 #define TC_CONS_RELOC 0
3665 fix_new_exp (frag_now
, p
- frag_now
->fr_literal
, (int) nbytes
, exp
, 0,
3667 #endif /* TC_CONS_FIX_NEW */
3668 #endif /* BFD_ASSEMBLER */
3672 #ifdef BITFIELD_CONS_EXPRESSIONS
3674 /* i960 assemblers, (eg, asm960), allow bitfields after ".byte" as
3675 w:x,y:z, where w and y are bitwidths and x and y are values. They
3676 then pack them all together. We do a little better in that we allow
3677 them in words, longs, etc. and we'll pack them in target byte order
3680 The rules are: pack least significat bit first, if a field doesn't
3681 entirely fit, put it in the next unit. Overflowing the bitfield is
3682 explicitly *not* even a warning. The bitwidth should be considered
3685 To use this function the tc-XXX.h file should define
3686 BITFIELD_CONS_EXPRESSIONS. */
3689 parse_bitfield_cons (exp
, nbytes
)
3691 unsigned int nbytes
;
3693 unsigned int bits_available
= BITS_PER_CHAR
* nbytes
;
3694 char *hold
= input_line_pointer
;
3696 (void) expression (exp
);
3698 if (*input_line_pointer
== ':')
3704 unsigned long width
;
3706 if (*input_line_pointer
!= ':')
3708 input_line_pointer
= hold
;
3710 } /* next piece is not a bitfield */
3712 /* In the general case, we can't allow
3713 full expressions with symbol
3714 differences and such. The relocation
3715 entries for symbols not defined in this
3716 assembly would require arbitrary field
3717 widths, positions, and masks which most
3718 of our current object formats don't
3721 In the specific case where a symbol
3722 *is* defined in this assembly, we
3723 *could* build fixups and track it, but
3724 this could lead to confusion for the
3725 backends. I'm lazy. I'll take any
3726 SEG_ABSOLUTE. I think that means that
3727 you can use a previous .set or
3728 .equ type symbol. xoxorich. */
3730 if (exp
->X_op
== O_absent
)
3732 as_warn (_("using a bit field width of zero"));
3733 exp
->X_add_number
= 0;
3734 exp
->X_op
= O_constant
;
3735 } /* implied zero width bitfield */
3737 if (exp
->X_op
!= O_constant
)
3739 *input_line_pointer
= '\0';
3740 as_bad (_("field width \"%s\" too complex for a bitfield"), hold
);
3741 *input_line_pointer
= ':';
3742 demand_empty_rest_of_line ();
3746 if ((width
= exp
->X_add_number
) > (BITS_PER_CHAR
* nbytes
))
3748 as_warn (_("field width %lu too big to fit in %d bytes: truncated to %d bits"),
3749 width
, nbytes
, (BITS_PER_CHAR
* nbytes
));
3750 width
= BITS_PER_CHAR
* nbytes
;
3753 if (width
> bits_available
)
3755 /* FIXME-SOMEDAY: backing up and reparsing is wasteful. */
3756 input_line_pointer
= hold
;
3757 exp
->X_add_number
= value
;
3761 hold
= ++input_line_pointer
; /* skip ':' */
3763 (void) expression (exp
);
3764 if (exp
->X_op
!= O_constant
)
3766 char cache
= *input_line_pointer
;
3768 *input_line_pointer
= '\0';
3769 as_bad (_("field value \"%s\" too complex for a bitfield"), hold
);
3770 *input_line_pointer
= cache
;
3771 demand_empty_rest_of_line ();
3775 value
|= ((~(-1 << width
) & exp
->X_add_number
)
3776 << ((BITS_PER_CHAR
* nbytes
) - bits_available
));
3778 if ((bits_available
-= width
) == 0
3779 || is_it_end_of_statement ()
3780 || *input_line_pointer
!= ',')
3783 } /* all the bitfields we're gonna get */
3785 hold
= ++input_line_pointer
;
3786 (void) expression (exp
);
3787 } /* forever loop */
3789 exp
->X_add_number
= value
;
3790 exp
->X_op
= O_constant
;
3791 exp
->X_unsigned
= 1;
3792 } /* if looks like a bitfield */
3793 } /* parse_bitfield_cons() */
3795 #endif /* BITFIELD_CONS_EXPRESSIONS */
3797 /* Handle an MRI style string expression. */
3800 parse_mri_cons (exp
, nbytes
)
3802 unsigned int nbytes
;
3804 if (*input_line_pointer
!= '\''
3805 && (input_line_pointer
[1] != '\''
3806 || (*input_line_pointer
!= 'A'
3807 && *input_line_pointer
!= 'E')))
3808 TC_PARSE_CONS_EXPRESSION (exp
, nbytes
);
3812 unsigned int result
= 0;
3814 /* An MRI style string. Cut into as many bytes as will fit into
3815 a nbyte chunk, left justify if necessary, and separate with
3816 commas so we can try again later. */
3817 if (*input_line_pointer
== 'A')
3818 ++input_line_pointer
;
3819 else if (*input_line_pointer
== 'E')
3821 as_bad (_("EBCDIC constants are not supported"));
3822 ++input_line_pointer
;
3825 input_line_pointer
++;
3826 for (scan
= 0; scan
< nbytes
; scan
++)
3828 if (*input_line_pointer
== '\'')
3830 if (input_line_pointer
[1] == '\'')
3832 input_line_pointer
++;
3837 result
= (result
<< 8) | (*input_line_pointer
++);
3841 while (scan
< nbytes
)
3846 /* Create correct expression */
3847 exp
->X_op
= O_constant
;
3848 exp
->X_add_number
= result
;
3849 /* Fake it so that we can read the next char too */
3850 if (input_line_pointer
[0] != '\'' ||
3851 (input_line_pointer
[0] == '\'' && input_line_pointer
[1] == '\''))
3853 input_line_pointer
-= 2;
3854 input_line_pointer
[0] = ',';
3855 input_line_pointer
[1] = '\'';
3858 input_line_pointer
++;
3862 #ifdef REPEAT_CONS_EXPRESSIONS
3864 /* Parse a repeat expression for cons. This is used by the MIPS
3865 assembler. The format is NUMBER:COUNT; NUMBER appears in the
3866 object file COUNT times.
3868 To use this for a target, define REPEAT_CONS_EXPRESSIONS. */
3871 parse_repeat_cons (exp
, nbytes
)
3873 unsigned int nbytes
;
3880 if (*input_line_pointer
!= ':')
3882 /* No repeat count. */
3886 ++input_line_pointer
;
3887 expression (&count
);
3888 if (count
.X_op
!= O_constant
3889 || count
.X_add_number
<= 0)
3891 as_warn (_("Unresolvable or nonpositive repeat count; using 1"));
3895 /* The cons function is going to output this expression once. So we
3896 output it count - 1 times. */
3897 for (i
= count
.X_add_number
- 1; i
> 0; i
--)
3898 emit_expr (exp
, nbytes
);
3901 #endif /* REPEAT_CONS_EXPRESSIONS */
3903 /* Parse a floating point number represented as a hex constant. This
3904 permits users to specify the exact bits they want in the floating
3908 hex_float (float_type
, bytes
)
3942 as_bad (_("Unknown floating type type '%c'"), float_type
);
3946 /* It would be nice if we could go through expression to parse the
3947 hex constant, but if we get a bignum it's a pain to sort it into
3948 the buffer correctly. */
3950 while (hex_p (*input_line_pointer
) || *input_line_pointer
== '_')
3954 /* The MRI assembler accepts arbitrary underscores strewn about
3955 through the hex constant, so we ignore them as well. */
3956 if (*input_line_pointer
== '_')
3958 ++input_line_pointer
;
3964 as_warn (_("Floating point constant too large"));
3967 d
= hex_value (*input_line_pointer
) << 4;
3968 ++input_line_pointer
;
3969 while (*input_line_pointer
== '_')
3970 ++input_line_pointer
;
3971 if (hex_p (*input_line_pointer
))
3973 d
+= hex_value (*input_line_pointer
);
3974 ++input_line_pointer
;
3976 if (target_big_endian
)
3979 bytes
[length
- i
- 1] = d
;
3985 if (target_big_endian
)
3986 memset (bytes
+ i
, 0, length
- i
);
3988 memset (bytes
, 0, length
- i
);
3997 * CONStruct some more frag chars of .floats .ffloats etc.
3998 * Makes 0 or more new frags.
3999 * If need_pass_2 == 1, no frags are emitted.
4000 * This understands only floating literals, not expressions. Sorry.
4002 * A floating constant is defined by atof_generic(), except it is preceded
4003 * by 0d 0f 0g or 0h. After observing the STRANGE way my BSD AS does its
4004 * reading, I decided to be incompatible. This always tries to give you
4005 * rounded bits to the precision of the pseudo-op. Former AS did premature
4006 * truncatation, restored noisy bits instead of trailing 0s AND gave you
4007 * a choice of 2 flavours of noise according to which of 2 floating-point
4008 * scanners you directed AS to use.
4010 * In: input_line_pointer->whitespace before, or '0' of flonum.
4015 float_cons (float_type
)
4016 /* Clobbers input_line-pointer, checks end-of-line. */
4017 register int float_type
; /* 'f':.ffloat ... 'F':.float ... */
4020 int length
; /* Number of chars in an object. */
4021 register char *err
; /* Error from scanning floating literal. */
4022 char temp
[MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT
];
4024 if (is_it_end_of_statement ())
4026 demand_empty_rest_of_line ();
4030 #ifdef md_flush_pending_output
4031 md_flush_pending_output ();
4036 /* input_line_pointer->1st char of a flonum (we hope!). */
4039 /* Skip any 0{letter} that may be present. Don't even check if the
4040 * letter is legal. Someone may invent a "z" format and this routine
4041 * has no use for such information. Lusers beware: you get
4042 * diagnostics if your input is ill-conditioned.
4044 if (input_line_pointer
[0] == '0'
4045 && isalpha ((unsigned char) input_line_pointer
[1]))
4046 input_line_pointer
+= 2;
4048 /* Accept :xxxx, where the x's are hex digits, for a floating
4049 point with the exact digits specified. */
4050 if (input_line_pointer
[0] == ':')
4052 ++input_line_pointer
;
4053 length
= hex_float (float_type
, temp
);
4056 ignore_rest_of_line ();
4062 err
= md_atof (float_type
, temp
, &length
);
4063 know (length
<= MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT
);
4067 as_bad (_("Bad floating literal: %s"), err
);
4068 ignore_rest_of_line ();
4079 #ifdef REPEAT_CONS_EXPRESSIONS
4080 if (*input_line_pointer
== ':')
4082 expressionS count_exp
;
4084 ++input_line_pointer
;
4085 expression (&count_exp
);
4086 if (count_exp
.X_op
!= O_constant
4087 || count_exp
.X_add_number
<= 0)
4089 as_warn (_("unresolvable or nonpositive repeat count; using 1"));
4092 count
= count_exp
.X_add_number
;
4096 while (--count
>= 0)
4098 p
= frag_more (length
);
4099 memcpy (p
, temp
, (unsigned int) length
);
4104 while (*input_line_pointer
++ == ',');
4106 --input_line_pointer
; /* Put terminator back into stream. */
4107 demand_empty_rest_of_line ();
4108 } /* float_cons() */
4110 /* Return the size of a LEB128 value */
4113 sizeof_sleb128 (value
)
4116 register int size
= 0;
4117 register unsigned byte
;
4121 byte
= (value
& 0x7f);
4122 /* Sadly, we cannot rely on typical arithmetic right shift behaviour.
4123 Fortunately, we can structure things so that the extra work reduces
4124 to a noop on systems that do things "properly". */
4125 value
= (value
>> 7) | ~(-(offsetT
)1 >> 7);
4128 while (!(((value
== 0) && ((byte
& 0x40) == 0))
4129 || ((value
== -1) && ((byte
& 0x40) != 0))));
4135 sizeof_uleb128 (value
)
4138 register int size
= 0;
4139 register unsigned byte
;
4143 byte
= (value
& 0x7f);
4153 sizeof_leb128 (value
, sign
)
4158 return sizeof_sleb128 ((offsetT
) value
);
4160 return sizeof_uleb128 (value
);
4163 /* Output a LEB128 value. */
4166 output_sleb128 (p
, value
)
4170 register char *orig
= p
;
4175 unsigned byte
= (value
& 0x7f);
4177 /* Sadly, we cannot rely on typical arithmetic right shift behaviour.
4178 Fortunately, we can structure things so that the extra work reduces
4179 to a noop on systems that do things "properly". */
4180 value
= (value
>> 7) | ~(-(offsetT
)1 >> 7);
4182 more
= !((((value
== 0) && ((byte
& 0x40) == 0))
4183 || ((value
== -1) && ((byte
& 0x40) != 0))));
4195 output_uleb128 (p
, value
)
4203 unsigned byte
= (value
& 0x7f);
4206 /* More bytes to follow. */
4217 output_leb128 (p
, value
, sign
)
4223 return output_sleb128 (p
, (offsetT
) value
);
4225 return output_uleb128 (p
, value
);
4228 /* Do the same for bignums. We combine sizeof with output here in that
4229 we don't output for NULL values of P. It isn't really as critical as
4230 for "normal" values that this be streamlined. */
4233 output_big_sleb128 (p
, bignum
, size
)
4235 LITTLENUM_TYPE
*bignum
;
4243 /* Strip leading sign extensions off the bignum. */
4244 while (size
> 0 && bignum
[size
-1] == (LITTLENUM_TYPE
)-1)
4249 if (loaded
< 7 && size
> 0)
4251 val
|= (*bignum
<< loaded
);
4252 loaded
+= 8 * CHARS_PER_LITTLENUM
;
4263 if ((val
== 0 && (byte
& 0x40) == 0)
4264 || (~(val
| ~(((valueT
)1 << loaded
) - 1)) == 0
4265 && (byte
& 0x40) != 0))
4273 while (byte
& 0x80);
4279 output_big_uleb128 (p
, bignum
, size
)
4281 LITTLENUM_TYPE
*bignum
;
4289 /* Strip leading zeros off the bignum. */
4290 /* XXX: Is this needed? */
4291 while (size
> 0 && bignum
[size
-1] == 0)
4296 if (loaded
< 7 && size
> 0)
4298 val
|= (*bignum
<< loaded
);
4299 loaded
+= 8 * CHARS_PER_LITTLENUM
;
4308 if (size
> 0 || val
)
4315 while (byte
& 0x80);
4321 output_big_leb128 (p
, bignum
, size
, sign
)
4323 LITTLENUM_TYPE
*bignum
;
4327 return output_big_sleb128 (p
, bignum
, size
);
4329 return output_big_uleb128 (p
, bignum
, size
);
4332 /* Generate the appropriate fragments for a given expression to emit a
4336 emit_leb128_expr(exp
, sign
)
4340 operatorT op
= exp
->X_op
;
4342 if (op
== O_absent
|| op
== O_illegal
)
4344 as_warn (_("zero assumed for missing expression"));
4345 exp
->X_add_number
= 0;
4348 else if (op
== O_big
&& exp
->X_add_number
<= 0)
4350 as_bad (_("floating point number invalid; zero assumed"));
4351 exp
->X_add_number
= 0;
4354 else if (op
== O_register
)
4356 as_warn (_("register value used as expression"));
4360 if (op
== O_constant
)
4362 /* If we've got a constant, emit the thing directly right now. */
4364 valueT value
= exp
->X_add_number
;
4368 size
= sizeof_leb128 (value
, sign
);
4369 p
= frag_more (size
);
4370 output_leb128 (p
, value
, sign
);
4372 else if (op
== O_big
)
4374 /* O_big is a different sort of constant. */
4379 size
= output_big_leb128 (NULL
, generic_bignum
, exp
->X_add_number
, sign
);
4380 p
= frag_more (size
);
4381 output_big_leb128 (p
, generic_bignum
, exp
->X_add_number
, sign
);
4385 /* Otherwise, we have to create a variable sized fragment and
4386 resolve things later. */
4388 frag_var (rs_leb128
, sizeof_uleb128 (~(valueT
)0), 0, sign
,
4389 make_expr_symbol (exp
), 0, (char *) NULL
);
4393 /* Parse the .sleb128 and .uleb128 pseudos. */
4403 emit_leb128_expr (&exp
, sign
);
4404 } while (*input_line_pointer
++ == ',');
4406 input_line_pointer
--;
4407 demand_empty_rest_of_line ();
4413 * We read 0 or more ',' separated, double-quoted strings.
4415 * Caller should have checked need_pass_2 is FALSE because we don't check it.
4420 stringer (append_zero
) /* Worker to do .ascii etc statements. */
4421 /* Checks end-of-line. */
4422 register int append_zero
; /* 0: don't append '\0', else 1 */
4424 register unsigned int c
;
4427 #ifdef md_flush_pending_output
4428 md_flush_pending_output ();
4432 * The following awkward logic is to parse ZERO or more strings,
4433 * comma separated. Recall a string expression includes spaces
4434 * before the opening '\"' and spaces after the closing '\"'.
4435 * We fake a leading ',' if there is (supposed to be)
4436 * a 1st, expression. We keep demanding expressions for each
4439 if (is_it_end_of_statement ())
4441 c
= 0; /* Skip loop. */
4442 ++input_line_pointer
; /* Compensate for end of loop. */
4446 c
= ','; /* Do loop. */
4448 while (c
== ',' || c
== '<' || c
== '"')
4451 switch (*input_line_pointer
)
4454 ++input_line_pointer
; /*->1st char of string. */
4455 start
= input_line_pointer
;
4456 while (is_a_char (c
= next_char_of_string ()))
4458 FRAG_APPEND_1_CHAR (c
);
4462 FRAG_APPEND_1_CHAR (0);
4464 know (input_line_pointer
[-1] == '\"');
4468 /* In ELF, when gcc is emitting DWARF 1 debugging output, it
4469 will emit .string with a filename in the .debug section
4470 after a sequence of constants. See the comment in
4471 emit_expr for the sequence. emit_expr will set
4472 dwarf_file_string to non-zero if this string might be a
4473 source file name. */
4474 if (strcmp (segment_name (now_seg
), ".debug") != 0)
4475 dwarf_file_string
= 0;
4476 else if (dwarf_file_string
)
4478 c
= input_line_pointer
[-1];
4479 input_line_pointer
[-1] = '\0';
4480 listing_source_file (start
);
4481 input_line_pointer
[-1] = c
;
4488 input_line_pointer
++;
4489 c
= get_single_number ();
4490 FRAG_APPEND_1_CHAR (c
);
4491 if (*input_line_pointer
!= '>')
4493 as_bad (_("Expected <nn>"));
4495 input_line_pointer
++;
4498 input_line_pointer
++;
4502 c
= *input_line_pointer
;
4505 demand_empty_rest_of_line ();
4508 /* FIXME-SOMEDAY: I had trouble here on characters with the
4509 high bits set. We'll probably also have trouble with
4510 multibyte chars, wide chars, etc. Also be careful about
4511 returning values bigger than 1 byte. xoxorich. */
4514 next_char_of_string ()
4516 register unsigned int c
;
4518 c
= *input_line_pointer
++ & CHAR_MASK
;
4526 as_warn (_("Unterminated string: Newline inserted."));
4527 bump_line_counters ();
4530 #ifndef NO_STRING_ESCAPES
4532 switch (c
= *input_line_pointer
++)
4560 break; /* As itself. */
4576 for (i
= 0, number
= 0; isdigit (c
) && i
< 3; c
= *input_line_pointer
++, i
++)
4578 number
= number
* 8 + c
- '0';
4582 --input_line_pointer
;
4591 c
= *input_line_pointer
++;
4592 while (isxdigit (c
))
4595 number
= number
* 16 + c
- '0';
4596 else if (isupper (c
))
4597 number
= number
* 16 + c
- 'A' + 10;
4599 number
= number
* 16 + c
- 'a' + 10;
4600 c
= *input_line_pointer
++;
4603 --input_line_pointer
;
4608 /* To be compatible with BSD 4.2 as: give the luser a linefeed!! */
4609 as_warn (_("Unterminated string: Newline inserted."));
4611 bump_line_counters ();
4616 #ifdef ONLY_STANDARD_ESCAPES
4617 as_bad (_("Bad escaped character in string, '?' assumed"));
4619 #endif /* ONLY_STANDARD_ESCAPES */
4622 } /* switch on escaped char */
4624 #endif /* ! defined (NO_STRING_ESCAPES) */
4628 } /* switch on char */
4630 } /* next_char_of_string() */
4633 get_segmented_expression (expP
)
4634 register expressionS
*expP
;
4636 register segT retval
;
4638 retval
= expression (expP
);
4639 if (expP
->X_op
== O_illegal
4640 || expP
->X_op
== O_absent
4641 || expP
->X_op
== O_big
)
4643 as_bad (_("expected address expression; zero assumed"));
4644 expP
->X_op
= O_constant
;
4645 expP
->X_add_number
= 0;
4646 retval
= absolute_section
;
4652 get_known_segmented_expression (expP
)
4653 register expressionS
*expP
;
4655 register segT retval
;
4657 if ((retval
= get_segmented_expression (expP
)) == undefined_section
)
4659 /* There is no easy way to extract the undefined symbol from the
4661 if (expP
->X_add_symbol
!= NULL
4662 && S_GET_SEGMENT (expP
->X_add_symbol
) != expr_section
)
4663 as_warn (_("symbol \"%s\" undefined; zero assumed"),
4664 S_GET_NAME (expP
->X_add_symbol
));
4666 as_warn (_("some symbol undefined; zero assumed"));
4667 retval
= absolute_section
;
4668 expP
->X_op
= O_constant
;
4669 expP
->X_add_number
= 0;
4671 know (retval
== absolute_section
|| SEG_NORMAL (retval
));
4673 } /* get_known_segmented_expression() */
4676 get_absolute_expression ()
4681 if (exp
.X_op
!= O_constant
)
4683 if (exp
.X_op
!= O_absent
)
4684 as_bad (_("bad or irreducible absolute expression; zero assumed"));
4685 exp
.X_add_number
= 0;
4687 return exp
.X_add_number
;
4690 char /* return terminator */
4691 get_absolute_expression_and_terminator (val_pointer
)
4692 long *val_pointer
; /* return value of expression */
4694 /* FIXME: val_pointer should probably be offsetT *. */
4695 *val_pointer
= (long) get_absolute_expression ();
4696 return (*input_line_pointer
++);
4700 * demand_copy_C_string()
4702 * Like demand_copy_string, but return NULL if the string contains any '\0's.
4703 * Give a warning if that happens.
4706 demand_copy_C_string (len_pointer
)
4711 if ((s
= demand_copy_string (len_pointer
)) != 0)
4715 for (len
= *len_pointer
; len
> 0; len
--)
4722 as_bad (_("This string may not contain \'\\0\'"));
4730 * demand_copy_string()
4732 * Demand string, but return a safe (=private) copy of the string.
4733 * Return NULL if we can't read a string here.
4736 demand_copy_string (lenP
)
4739 register unsigned int c
;
4745 if (*input_line_pointer
== '\"')
4747 input_line_pointer
++; /* Skip opening quote. */
4749 while (is_a_char (c
= next_char_of_string ()))
4751 obstack_1grow (¬es
, c
);
4754 /* JF this next line is so demand_copy_C_string will return a
4755 null terminated string. */
4756 obstack_1grow (¬es
, '\0');
4757 retval
= obstack_finish (¬es
);
4761 as_warn (_("Missing string"));
4763 ignore_rest_of_line ();
4767 } /* demand_copy_string() */
4770 * is_it_end_of_statement()
4772 * In: Input_line_pointer->next character.
4774 * Do: Skip input_line_pointer over all whitespace.
4776 * Out: 1 if input_line_pointer->end-of-line.
4779 is_it_end_of_statement ()
4782 return (is_end_of_line
[(unsigned char) *input_line_pointer
]);
4783 } /* is_it_end_of_statement() */
4786 equals (sym_name
, reassign
)
4790 register symbolS
*symbolP
; /* symbol we are working with */
4794 input_line_pointer
++;
4795 if (*input_line_pointer
== '=')
4796 input_line_pointer
++;
4798 while (*input_line_pointer
== ' ' || *input_line_pointer
== '\t')
4799 input_line_pointer
++;
4802 stop
= mri_comment_field (&stopc
);
4804 if (sym_name
[0] == '.' && sym_name
[1] == '\0')
4806 /* Turn '. = mumble' into a .org mumble */
4807 register segT segment
;
4810 segment
= get_known_segmented_expression (&exp
);
4812 do_org (segment
, &exp
, 0);
4816 symbolP
= symbol_find_or_make (sym_name
);
4817 /* Permit register names to be redefined. */
4819 && S_IS_DEFINED (symbolP
)
4820 && S_GET_SEGMENT (symbolP
) != reg_section
)
4821 as_bad (_("symbol `%s' already defined"), S_GET_NAME (symbolP
));
4822 pseudo_set (symbolP
);
4827 ignore_rest_of_line (); /* check garbage after the expression */
4828 mri_comment_end (stop
, stopc
);
4832 /* .include -- include a file at this point. */
4837 int arg ATTRIBUTE_UNUSED
;
4845 if (! flag_m68k_mri
)
4847 filename
= demand_copy_string (&i
);
4848 if (filename
== NULL
)
4850 /* demand_copy_string has already printed an error and
4851 called ignore_rest_of_line. */
4859 while (! is_end_of_line
[(unsigned char) *input_line_pointer
]
4860 && *input_line_pointer
!= ' '
4861 && *input_line_pointer
!= '\t')
4863 obstack_1grow (¬es
, *input_line_pointer
);
4864 ++input_line_pointer
;
4867 obstack_1grow (¬es
, '\0');
4868 filename
= obstack_finish (¬es
);
4869 while (! is_end_of_line
[(unsigned char) *input_line_pointer
])
4870 ++input_line_pointer
;
4872 demand_empty_rest_of_line ();
4873 path
= xmalloc ((unsigned long) i
+ include_dir_maxlen
+ 5 /* slop */ );
4874 for (i
= 0; i
< include_dir_count
; i
++)
4876 strcpy (path
, include_dirs
[i
]);
4878 strcat (path
, filename
);
4879 if (0 != (try = fopen (path
, "r")))
4888 /* malloc Storage leak when file is found on path. FIXME-SOMEDAY. */
4889 register_dependency (path
);
4890 newbuf
= input_scrub_include_file (path
, input_line_pointer
);
4891 buffer_limit
= input_scrub_next_buffer (&input_line_pointer
);
4895 add_include_dir (path
)
4900 if (include_dir_count
== 0)
4902 include_dirs
= (char **) xmalloc (2 * sizeof (*include_dirs
));
4903 include_dirs
[0] = "."; /* Current dir */
4904 include_dir_count
= 2;
4908 include_dir_count
++;
4909 include_dirs
= (char **) realloc (include_dirs
,
4910 include_dir_count
* sizeof (*include_dirs
));
4913 include_dirs
[include_dir_count
- 1] = path
; /* New one */
4916 if (i
> include_dir_maxlen
)
4917 include_dir_maxlen
= i
;
4918 } /* add_include_dir() */
4920 /* Output debugging information to denote the source file. */
4923 generate_file_debug ()
4925 if (debug_type
== DEBUG_STABS
)
4926 stabs_generate_asm_file ();
4929 /* Output line number debugging information for the current source line. */
4932 generate_lineno_debug ()
4934 #ifdef ECOFF_DEBUGGING
4935 /* ECOFF assemblers automatically generate debugging information.
4936 FIXME: This should probably be handled elsewhere. */
4937 if (debug_type
== DEBUG_UNSPECIFIED
)
4939 if (ECOFF_DEBUGGING
&& ecoff_no_current_file ())
4940 debug_type
= DEBUG_ECOFF
;
4942 debug_type
= DEBUG_NONE
;
4948 case DEBUG_UNSPECIFIED
:
4952 stabs_generate_asm_lineno ();
4955 ecoff_generate_asm_lineno ();
4964 /* Output debugging information to mark a function entry point or end point.
4965 END_P is zero for .func, and non-zero for .endfunc. */
4971 do_s_func (end_p
, NULL
);
4974 /* Subroutine of s_func so targets can choose a different default prefix.
4975 If DEFAULT_PREFIX is NULL, use the target's "leading char". */
4978 do_s_func (end_p
, default_prefix
)
4980 const char *default_prefix
;
4982 /* Record the current function so that we can issue an error message for
4983 misplaced .func,.endfunc, and also so that .endfunc needs no
4985 static char *current_name
;
4986 static char *current_label
;
4990 if (current_name
== NULL
)
4992 as_bad (_("missing .func"));
4993 ignore_rest_of_line ();
4997 if (debug_type
== DEBUG_STABS
)
4998 stabs_generate_asm_endfunc (current_name
, current_label
);
5000 current_name
= current_label
= NULL
;
5007 if (current_name
!= NULL
)
5009 as_bad (_(".endfunc missing for previous .func"));
5010 ignore_rest_of_line ();
5014 name
= input_line_pointer
;
5015 delim1
= get_symbol_end ();
5016 name
= xstrdup (name
);
5017 *input_line_pointer
= delim1
;
5019 if (*input_line_pointer
!= ',')
5022 asprintf (&label
, "%s%s", default_prefix
, name
);
5025 char leading_char
= 0;
5026 #ifdef BFD_ASSEMBLER
5027 leading_char
= bfd_get_symbol_leading_char (stdoutput
);
5029 /* Missing entry point, use function's name with the leading
5032 asprintf (&label
, "%c%s", leading_char
, name
);
5039 ++input_line_pointer
;
5041 label
= input_line_pointer
;
5042 delim2
= get_symbol_end ();
5043 label
= xstrdup (label
);
5044 *input_line_pointer
= delim2
;
5047 if (debug_type
== DEBUG_STABS
)
5048 stabs_generate_asm_func (name
, label
);
5050 current_name
= name
;
5051 current_label
= label
;
5054 demand_empty_rest_of_line ();
5059 int arg ATTRIBUTE_UNUSED
;
5061 while (!is_end_of_line
[(unsigned char) *input_line_pointer
])
5063 ++input_line_pointer
;
5065 ++input_line_pointer
;
5070 read_print_statistics (file
)
5073 hash_print_statistics (file
, "pseudo-op table", po_hash
);