1 /* read.c - read a source file -
2 Copyright (C) 1986, 87, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99,
3 2000 Free Software Foundation, Inc.
5 This file is part of GAS, the GNU Assembler.
7 GAS is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
12 GAS is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GAS; see the file COPYING. If not, write to the Free
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
23 /* If your chars aren't 8 bits, you will change this a bit.
24 But then, GNU isn't spozed to run on your machine anyway.
25 (RMS is so shortsighted sometimes.) */
26 #define MASK_CHAR (0xFF)
28 #define MASK_CHAR ((int)(unsigned char) -1)
31 /* This is the largest known floating point format (for now). It will
32 grow when we do 4361 style flonums. */
33 #define MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT (16)
35 /* Routines that read assembler source text to build spagetti in memory.
36 Another group of these functions is in the expr.c module. */
49 #ifndef TC_START_LABEL
50 #define TC_START_LABEL(x,y) (x==':')
53 /* Set by the object-format or the target. */
54 #ifndef TC_IMPLICIT_LCOMM_ALIGNMENT
55 #define TC_IMPLICIT_LCOMM_ALIGNMENT(SIZE, P2VAR) \
60 else if ((SIZE) >= 4) \
62 else if ((SIZE) >= 2) \
70 /* The NOP_OPCODE is for the alignment fill value.
71 Fill it a nop instruction so that the disassembler does not choke
74 #define NOP_OPCODE 0x00
77 char *input_line_pointer
; /*->next char of source file to parse. */
79 #if BITS_PER_CHAR != 8
80 /* The following table is indexed by[(char)] and will break if
81 a char does not have exactly 256 states (hopefully 0:255!)! */
86 /* The m88k unfortunately uses @ as a label beginner. */
91 /* The RS/6000 assembler uses {,},[,] as parts of symbol names. */
96 /* The Delta 68k assembler permits % inside label names. */
101 /* The PowerPC Windows NT assemblers permits ? inside label names. */
106 /* The IA-64 assembler uses # as a suffix designating a symbol. We include
107 it in the symbol and strip it out in tc_canonicalize_symbol_name. */
112 /* The a29k assembler does not permits labels to start with $. */
117 /* The Delta 68k assembler permits ~ at start of label names. */
121 /* Used by is_... macros. our ctype[]. */
124 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* @ABCDEFGHIJKLMNO */
125 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* PQRSTUVWXYZ[\]^_ */
126 0, 0, 0, LEX_HASH
, LEX_DOLLAR
, LEX_PCT
, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, /* _!"#$%&'()*+,-./ */
127 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, LEX_QM
, /* 0123456789:;<=>? */
128 LEX_AT
, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* @ABCDEFGHIJKLMNO */
129 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, LEX_BR
, 0, LEX_BR
, 0, 3, /* PQRSTUVWXYZ[\]^_ */
130 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* `abcdefghijklmno */
131 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, LEX_BR
, 0, LEX_BR
, LEX_TILDE
, 0, /* pqrstuvwxyz{|}~. */
132 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
133 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
134 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
135 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
136 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
137 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
138 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
139 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3
143 Out: 1 if this character ends a line. */
144 char is_end_of_line
[256] =
147 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, /* @abcdefghijklmno */
149 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, /* @abcdefghijklmno */
151 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
152 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* _!"#$%&'()*+,-./ */
153 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0123456789:;<=>? */
154 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
155 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
156 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
157 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
158 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
159 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
160 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
161 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
162 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
163 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
164 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
165 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /* */
168 /* Functions private to this file. */
170 static char *buffer
; /* 1st char of each buffer of lines is here. */
171 static char *buffer_limit
; /*->1 + last char in buffer. */
173 /* TARGET_BYTES_BIG_ENDIAN is required to be defined to either 0 or 1
174 in the tc-<CPU>.h file. See the "Porting GAS" section of the
176 int target_big_endian
= TARGET_BYTES_BIG_ENDIAN
;
178 static char *old_buffer
; /* JF a hack. */
179 static char *old_input
;
180 static char *old_limit
;
182 /* Variables for handling include file directory table. */
184 /* Table of pointers to directories to search for .include's. */
187 /* How many are in the table. */
188 int include_dir_count
;
190 /* Length of longest in table. */
191 int include_dir_maxlen
= 1;
193 #ifndef WORKING_DOT_WORD
194 struct broken_word
*broken_words
;
195 int new_broken_words
;
198 /* The current offset into the absolute section. We don't try to
199 build frags in the absolute section, since no data can be stored
200 there. We just keep track of the current offset. */
201 addressT abs_section_offset
;
203 /* If this line had an MRI style label, it is stored in this variable.
204 This is used by some of the MRI pseudo-ops. */
207 /* This global variable is used to support MRI common sections. We
208 translate such sections into a common symbol. This variable is
209 non-NULL when we are in an MRI common section. */
210 symbolS
*mri_common_symbol
;
212 /* In MRI mode, after a dc.b pseudo-op with an odd number of bytes, we
213 need to align to an even byte boundary unless the next pseudo-op is
214 dc.b, ds.b, or dcb.b. This variable is set to 1 if an alignment
216 static int mri_pending_align
;
220 /* This variable is set to be non-zero if the next string we see might
221 be the name of the source file in DWARF debugging information. See
222 the comment in emit_expr for the format we look for. */
223 static int dwarf_file_string
;
227 static void cons_worker
PARAMS ((int, int));
228 static int scrub_from_string
PARAMS ((char *, int));
229 static void do_align
PARAMS ((int, char *, int, int));
230 static void s_align
PARAMS ((int, int));
231 static void s_lcomm_internal
PARAMS ((int, int));
232 static int hex_float
PARAMS ((int, char *));
233 static inline int sizeof_sleb128
PARAMS ((offsetT
));
234 static inline int sizeof_uleb128
PARAMS ((valueT
));
235 static inline int output_sleb128
PARAMS ((char *, offsetT
));
236 static inline int output_uleb128
PARAMS ((char *, valueT
));
237 static inline int output_big_sleb128
PARAMS ((char *, LITTLENUM_TYPE
*, int));
238 static inline int output_big_uleb128
PARAMS ((char *, LITTLENUM_TYPE
*, int));
239 static int output_big_leb128
PARAMS ((char *, LITTLENUM_TYPE
*, int, int));
240 static void do_org
PARAMS ((segT
, expressionS
*, int));
241 char *demand_copy_string
PARAMS ((int *lenP
));
242 static segT get_segmented_expression
PARAMS ((expressionS
*expP
));
243 static segT get_known_segmented_expression
PARAMS ((expressionS
* expP
));
244 static void pobegin
PARAMS ((void));
245 static int get_line_sb
PARAMS ((sb
*));
246 static void generate_file_debug
PARAMS ((void));
254 obj_read_begin_hook ();
256 /* Something close -- but not too close -- to a multiple of 1024.
257 The debugging malloc I'm using has 24 bytes of overhead. */
258 obstack_begin (¬es
, chunksize
);
259 obstack_begin (&cond_obstack
, chunksize
);
261 /* Use machine dependent syntax. */
262 for (p
= line_separator_chars
; *p
; p
++)
263 is_end_of_line
[(unsigned char) *p
] = 1;
264 /* Use more. FIXME-SOMEDAY. */
270 /* Set up pseudo-op tables. */
272 static struct hash_control
*po_hash
;
274 static const pseudo_typeS potable
[] =
276 {"abort", s_abort
, 0},
277 {"align", s_align_ptwo
, 0},
278 {"ascii", stringer
, 0},
279 {"asciz", stringer
, 1},
280 {"balign", s_align_bytes
, 0},
281 {"balignw", s_align_bytes
, -2},
282 {"balignl", s_align_bytes
, -4},
286 {"common", s_mri_common
, 0},
287 {"common.s", s_mri_common
, 1},
291 {"dc.d", float_cons
, 'd'},
293 {"dc.s", float_cons
, 'f'},
295 {"dc.x", float_cons
, 'x'},
297 {"dcb.b", s_space
, 1},
298 {"dcb.d", s_float_space
, 'd'},
299 {"dcb.l", s_space
, 4},
300 {"dcb.s", s_float_space
, 'f'},
301 {"dcb.w", s_space
, 2},
302 {"dcb.x", s_float_space
, 'x'},
304 {"ds.b", s_space
, 1},
305 {"ds.d", s_space
, 8},
306 {"ds.l", s_space
, 4},
307 {"ds.p", s_space
, 12},
308 {"ds.s", s_space
, 4},
309 {"ds.w", s_space
, 2},
310 {"ds.x", s_space
, 12},
311 {"debug", s_ignore
, 0},
316 {"double", float_cons
, 'd'},
318 {"eject", listing_eject
, 0}, /* Formfeed listing. */
320 {"elsec", s_else
, 0},
321 {"elseif", s_elseif
, (int) O_ne
},
323 {"endc", s_endif
, 0},
324 {"endfunc", s_func
, 1},
325 {"endif", s_endif
, 0},
330 {"exitm", s_mexit
, 0},
332 {"extern", s_ignore
, 0}, /* We treat all undef as ext. */
333 {"appfile", s_app_file
, 1},
334 {"appline", s_app_line
, 0},
336 {"file", s_app_file
, 0},
338 {"float", float_cons
, 'f'},
339 {"format", s_ignore
, 0},
341 {"global", s_globl
, 0},
342 {"globl", s_globl
, 0},
344 {"if", s_if
, (int) O_ne
},
346 {"ifdef", s_ifdef
, 0},
347 {"ifeq", s_if
, (int) O_eq
},
348 {"ifeqs", s_ifeqs
, 0},
349 {"ifge", s_if
, (int) O_ge
},
350 {"ifgt", s_if
, (int) O_gt
},
351 {"ifle", s_if
, (int) O_le
},
352 {"iflt", s_if
, (int) O_lt
},
354 {"ifndef", s_ifdef
, 1},
355 {"ifne", s_if
, (int) O_ne
},
356 {"ifnes", s_ifeqs
, 1},
357 {"ifnotdef", s_ifdef
, 1},
358 {"include", s_include
, 0},
364 {"lcomm", s_lcomm
, 0},
365 {"lflags", listing_flags
, 0}, /* Listing flags. */
366 {"linkonce", s_linkonce
, 0},
367 {"list", listing_list
, 1}, /* Turn listing on. */
368 {"llen", listing_psize
, 1},
371 {"macro", s_macro
, 0},
372 {"mexit", s_mexit
, 0},
374 {".mri", s_mri
, 0}, /* Special case so .mri works in MRI mode. */
375 {"name", s_ignore
, 0},
376 {"noformat", s_ignore
, 0},
377 {"nolist", listing_list
, 0}, /* Turn listing off. */
378 {"nopage", listing_nopage
, 0},
380 {"offset", s_struct
, 0},
382 {"p2align", s_align_ptwo
, 0},
383 {"p2alignw", s_align_ptwo
, -2},
384 {"p2alignl", s_align_ptwo
, -4},
385 {"page", listing_eject
, 0},
386 {"plen", listing_psize
, 0},
387 {"print", s_print
, 0},
388 {"psize", listing_psize
, 0}, /* Set paper size. */
389 {"purgem", s_purgem
, 0},
394 {"sbttl", listing_title
, 1}, /* Subtitle of listing. */
399 {"single", float_cons
, 'f'},
401 {"space", s_space
, 0},
402 {"skip", s_space
, 0},
403 {"sleb128", s_leb128
, 1},
404 {"spc", s_ignore
, 0},
405 {"stabd", s_stab
, 'd'},
406 {"stabn", s_stab
, 'n'},
407 {"stabs", s_stab
, 's'},
408 {"string", stringer
, 1},
409 {"struct", s_struct
, 0},
413 /* This is for gcc to use. It's only just been added (2/94), so gcc
414 won't be able to use it for a while -- probably a year or more.
415 But once this has been released, check with gcc maintainers
416 before deleting it or even changing the spelling. */
417 {"this_GCC_requires_the_GNU_assembler", s_ignore
, 0},
418 /* If we're folding case -- done for some targets, not necessarily
419 all -- the above string in an input file will be converted to
420 this one. Match it either way... */
421 {"this_gcc_requires_the_gnu_assembler", s_ignore
, 0},
423 {"title", listing_title
, 0}, /* Listing title. */
424 {"ttl", listing_title
, 0},
426 {"uleb128", s_leb128
, 0},
430 {"xdef", s_globl
, 0},
431 {"xref", s_ignore
, 0},
432 {"xstabs", s_xstab
, 's'},
434 {"zero", s_space
, 0},
435 {NULL
, NULL
, 0} /* End sentinel. */
438 static int pop_override_ok
= 0;
439 static const char *pop_table_name
;
443 const pseudo_typeS
*table
;
446 const pseudo_typeS
*pop
;
447 for (pop
= table
; pop
->poc_name
; pop
++)
449 errtxt
= hash_insert (po_hash
, pop
->poc_name
, (char *) pop
);
450 if (errtxt
&& (!pop_override_ok
|| strcmp (errtxt
, "exists")))
451 as_fatal (_("error constructing %s pseudo-op table: %s"), pop_table_name
,
456 #ifndef md_pop_insert
457 #define md_pop_insert() pop_insert(md_pseudo_table)
460 #ifndef obj_pop_insert
461 #define obj_pop_insert() pop_insert(obj_pseudo_table)
467 po_hash
= hash_new ();
469 /* Do the target-specific pseudo ops. */
470 pop_table_name
= "md";
473 /* Now object specific. Skip any that were in the target table. */
474 pop_table_name
= "obj";
478 /* Now portable ones. Skip any that we've seen already. */
479 pop_table_name
= "standard";
480 pop_insert (potable
);
483 #define HANDLE_CONDITIONAL_ASSEMBLY() \
484 if (ignore_input ()) \
486 while (!is_end_of_line[(unsigned char) *input_line_pointer++]) \
487 if (input_line_pointer == buffer_limit) \
492 /* This function is used when scrubbing the characters between #APP
495 static char *scrub_string
;
496 static char *scrub_string_end
;
499 scrub_from_string (buf
, buflen
)
505 copy
= scrub_string_end
- scrub_string
;
508 memcpy (buf
, scrub_string
, copy
);
509 scrub_string
+= copy
;
513 /* We read the file, putting things into a web that represents what we
514 have been reading. */
516 read_a_source_file (name
)
520 register char *s
; /* String of symbol, '\0' appended. */
524 buffer
= input_scrub_new_file (name
);
527 listing_newline (NULL
);
528 register_dependency (name
);
530 /* Generate debugging information before we've read anything in to denote
531 this file as the "main" source file and not a subordinate one
532 (e.g. N_SO vs N_SOL in stabs). */
533 generate_file_debug ();
535 while ((buffer_limit
= input_scrub_next_buffer (&input_line_pointer
)) != 0)
536 { /* We have another line to parse. */
537 know (buffer_limit
[-1] == '\n'); /* Must have a sentinel. */
538 contin
: /* JF this goto is my fault I admit it.
539 Someone brave please re-write the whole
540 input section here? Pleeze??? */
541 while (input_line_pointer
< buffer_limit
)
543 /* We have more of this buffer to parse. */
545 /* We now have input_line_pointer->1st char of next line.
546 If input_line_pointer [-1] == '\n' then we just
547 scanned another line: so bump line counters. */
548 if (is_end_of_line
[(unsigned char) input_line_pointer
[-1]])
550 #ifdef md_start_line_hook
551 md_start_line_hook ();
553 if (input_line_pointer
[-1] == '\n')
554 bump_line_counters ();
558 if (LABELS_WITHOUT_COLONS
|| flag_m68k_mri
)
560 /* Text at the start of a line must be a label, we
561 run down and stick a colon in. */
562 if (is_name_beginner (*input_line_pointer
))
564 char *line_start
= input_line_pointer
;
569 HANDLE_CONDITIONAL_ASSEMBLY ();
571 c
= get_symbol_end ();
573 /* In MRI mode, the EQU and MACRO pseudoops must
574 be handled specially. */
578 char *rest
= input_line_pointer
+ 1;
582 if (*rest
== ' ' || *rest
== '\t')
584 if ((strncasecmp (rest
, "EQU", 3) == 0
585 || strncasecmp (rest
, "SET", 3) == 0)
586 && (rest
[3] == ' ' || rest
[3] == '\t'))
588 input_line_pointer
= rest
+ 3;
590 strncasecmp (rest
, "SET", 3) == 0);
593 if (strncasecmp (rest
, "MACRO", 5) == 0
596 || is_end_of_line
[(unsigned char) rest
[5]]))
600 /* In MRI mode, we need to handle the MACRO
601 pseudo-op specially: we don't want to put the
602 symbol in the symbol table. */
604 #ifdef TC_START_LABEL_WITHOUT_COLON
605 && TC_START_LABEL_WITHOUT_COLON(c
,
609 line_label
= colon (line_start
);
611 line_label
= symbol_create (line_start
,
616 *input_line_pointer
= c
;
618 input_line_pointer
++;
623 /* We are at the begining of a line, or similar place.
624 We expect a well-formed assembler statement.
625 A "symbol-name:" is a statement.
627 Depending on what compiler is used, the order of these tests
628 may vary to catch most common case 1st.
629 Each test is independent of all other tests at the (top) level.
630 PLEASE make a compiler that doesn't use this assembler.
631 It is crufty to waste a compiler's time encoding things for this
632 assembler, which then wastes more time decoding it.
633 (And communicating via (linear) files is silly!
634 If you must pass stuff, please pass a tree!) */
635 if ((c
= *input_line_pointer
++) == '\t'
639 c
= *input_line_pointer
++;
641 know (c
!= ' '); /* No further leading whitespace. */
644 /* If listing is on, and we are expanding a macro, then give
645 the listing code the contents of the expanded line. */
648 if ((listing
& LISTING_MACEXP
) && macro_nest
> 0)
653 /* Find the end of the current expanded macro line. */
654 for (s
= input_line_pointer
- 1; *s
; ++s
)
655 if (is_end_of_line
[(unsigned char) *s
])
658 /* Copy it for safe keeping. Also give an indication of
659 how much macro nesting is involved at this point. */
660 len
= s
- (input_line_pointer
-1);
661 copy
= (char *) xmalloc (len
+ macro_nest
+ 2);
662 memset (copy
, '>', macro_nest
);
663 copy
[macro_nest
] = ' ';
664 memcpy (copy
+ macro_nest
+ 1, input_line_pointer
- 1, len
);
665 copy
[macro_nest
+ 1 + len
] = '\0';
667 /* Install the line with the listing facility. */
668 listing_newline (copy
);
671 listing_newline (NULL
);
674 /* C is the 1st significant character.
675 Input_line_pointer points after that character. */
676 if (is_name_beginner (c
))
678 /* Want user-defined label or pseudo/opcode. */
679 HANDLE_CONDITIONAL_ASSEMBLY ();
681 s
= --input_line_pointer
;
682 c
= get_symbol_end (); /* name's delimiter. */
684 /* C is character after symbol.
685 That character's place in the input line is now '\0'.
686 S points to the beginning of the symbol.
687 [In case of pseudo-op, s->'.'.]
688 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')
702 if ((strncasecmp (rest
, "EQU", 3) == 0
703 || strncasecmp (rest
, "SET", 3) == 0)
704 && (rest
[3] == ' ' || rest
[3] == '\t'))
706 input_line_pointer
= rest
+ 3;
712 line_label
= colon (s
); /* User-defined label. */
713 /* Put ':' back for error messages' sake. */
714 *input_line_pointer
++ = ':';
715 /* 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 ();
731 /* Expect pseudo-op or machine instruction. */
734 #define IGNORE_OPCODE_CASE
735 #ifdef IGNORE_OPCODE_CASE
740 if (isupper ((unsigned char) *s2
))
746 if (NO_PSEUDO_DOT
|| flag_m68k_mri
)
748 /* The MRI assembler and the m88k use pseudo-ops
750 pop
= (pseudo_typeS
*) hash_find (po_hash
, s
);
751 if (pop
!= NULL
&& pop
->poc_handler
== NULL
)
756 || (!flag_m68k_mri
&& *s
== '.'))
760 WARNING: c has next char, which may be end-of-line.
761 We lookup the pseudo-op table with s+1 because we
762 already know that the pseudo-op begins with a '.'. */
765 pop
= (pseudo_typeS
*) hash_find (po_hash
, s
+ 1);
767 /* In MRI mode, we may need to insert an
768 automatic alignment directive. What a hack
770 if (mri_pending_align
772 || !((pop
->poc_handler
== cons
773 && pop
->poc_val
== 1)
774 || (pop
->poc_handler
== s_space
775 && pop
->poc_val
== 1)
776 #ifdef tc_conditional_pseudoop
777 || tc_conditional_pseudoop (pop
)
779 || pop
->poc_handler
== s_if
780 || pop
->poc_handler
== s_ifdef
781 || pop
->poc_handler
== s_ifc
782 || pop
->poc_handler
== s_ifeqs
783 || pop
->poc_handler
== s_else
784 || pop
->poc_handler
== s_endif
785 || pop
->poc_handler
== s_globl
786 || pop
->poc_handler
== s_ignore
)))
788 do_align (1, (char *) NULL
, 0, 0);
789 mri_pending_align
= 0;
791 if (line_label
!= NULL
)
793 symbol_set_frag (line_label
, frag_now
);
794 S_SET_VALUE (line_label
, frag_now_fix ());
798 /* Print the error msg now, while we still can. */
801 as_bad (_("Unknown pseudo-op: `%s'"), s
);
802 *input_line_pointer
= c
;
807 /* Put it back for error messages etc. */
808 *input_line_pointer
= c
;
809 /* The following skip of whitespace is compulsory.
810 A well shaped space is sometimes all that separates
811 keyword from operands. */
812 if (c
== ' ' || c
== '\t')
813 input_line_pointer
++;
815 /* Input_line is restored.
816 Input_line_pointer->1st non-blank char
817 after pseudo-operation. */
818 (*pop
->poc_handler
) (pop
->poc_val
);
820 /* If that was .end, just get out now. */
821 if (pop
->poc_handler
== s_end
)
827 #ifdef QUOTES_IN_INSN
831 /* WARNING: c has char, which may be end-of-line. */
832 /* Also: input_line_pointer->`\0` where c was. */
833 *input_line_pointer
= c
;
834 while (!is_end_of_line
[(unsigned char) *input_line_pointer
]
836 #ifdef TC_EOL_IN_INSN
837 || TC_EOL_IN_INSN (input_line_pointer
)
841 if (flag_m68k_mri
&& *input_line_pointer
== '\'')
843 #ifdef QUOTES_IN_INSN
846 else if (*input_line_pointer
== '"')
848 else if (*input_line_pointer
== '\\')
851 input_line_pointer
++;
854 c
= *input_line_pointer
;
855 *input_line_pointer
= '\0';
857 generate_lineno_debug ();
865 if (check_macro (s
, &out
, '\0', &err
, ¯o
))
869 *input_line_pointer
++ = c
;
870 input_scrub_include_sb (&out
,
871 input_line_pointer
, 1);
874 input_scrub_next_buffer (&input_line_pointer
);
876 md_macro_info (macro
);
882 if (mri_pending_align
)
884 do_align (1, (char *) NULL
, 0, 0);
885 mri_pending_align
= 0;
886 if (line_label
!= NULL
)
888 symbol_set_frag (line_label
, frag_now
);
889 S_SET_VALUE (line_label
, frag_now_fix ());
893 md_assemble (s
); /* Assemble 1 instruction. */
895 *input_line_pointer
++ = c
;
897 /* We resume loop AFTER the end-of-line from
904 /* Empty statement? */
905 if (is_end_of_line
[(unsigned char) c
])
908 if ((LOCAL_LABELS_DOLLAR
|| LOCAL_LABELS_FB
)
909 && isdigit ((unsigned char) c
))
911 /* local label ("4:") */
912 char *backup
= input_line_pointer
;
914 HANDLE_CONDITIONAL_ASSEMBLY ();
918 /* Read the whole number. */
919 while (isdigit ((unsigned char) *input_line_pointer
))
921 temp
= (temp
* 10) + *input_line_pointer
- '0';
922 ++input_line_pointer
;
925 if (LOCAL_LABELS_DOLLAR
926 && *input_line_pointer
== '$'
927 && *(input_line_pointer
+ 1) == ':')
929 input_line_pointer
+= 2;
931 if (dollar_label_defined (temp
))
933 as_fatal (_("label \"%d$\" redefined"), temp
);
936 define_dollar_label (temp
);
937 colon (dollar_label_name (temp
, 0));
942 && *input_line_pointer
++ == ':')
944 fb_label_instance_inc (temp
);
945 colon (fb_label_name (temp
, 0));
949 input_line_pointer
= backup
;
950 } /* local label ("4:") */
952 if (c
&& strchr (line_comment_chars
, c
))
953 { /* Its a comment. Better say APP or NO_APP. */
957 unsigned int new_length
;
960 bump_line_counters ();
961 s
= input_line_pointer
;
962 if (strncmp (s
, "APP\n", 4))
963 continue; /* We ignore it */
966 ends
= strstr (s
, "#NO_APP\n");
970 unsigned int tmp_len
;
973 /* The end of the #APP wasn't in this buffer. We
974 keep reading in buffers until we find the #NO_APP
975 that goes with this #APP There is one. The specs
977 tmp_len
= buffer_limit
- s
;
978 tmp_buf
= xmalloc (tmp_len
+ 1);
979 memcpy (tmp_buf
, s
, tmp_len
);
982 new_tmp
= input_scrub_next_buffer (&buffer
);
986 buffer_limit
= new_tmp
;
987 input_line_pointer
= buffer
;
988 ends
= strstr (buffer
, "#NO_APP\n");
992 num
= buffer_limit
- buffer
;
994 tmp_buf
= xrealloc (tmp_buf
, tmp_len
+ num
);
995 memcpy (tmp_buf
+ tmp_len
, buffer
, num
);
1000 input_line_pointer
= ends
? ends
+ 8 : NULL
;
1008 input_line_pointer
= ends
+ 8;
1012 scrub_string_end
= ends
;
1014 new_length
= ends
- s
;
1015 new_buf
= (char *) xmalloc (new_length
);
1022 space
= (new_buf
+ new_length
) - new_tmp
;
1023 size
= do_scrub_chars (scrub_from_string
, new_tmp
, space
);
1031 new_buf
= xrealloc (new_buf
, new_length
+ 100);
1032 new_tmp
= new_buf
+ new_length
;
1038 old_buffer
= buffer
;
1039 old_input
= input_line_pointer
;
1040 old_limit
= buffer_limit
;
1042 input_line_pointer
= new_buf
;
1043 buffer_limit
= new_tmp
;
1048 HANDLE_CONDITIONAL_ASSEMBLY ();
1050 #ifdef tc_unrecognized_line
1051 if (tc_unrecognized_line (c
))
1054 /* as_warn (_("Junk character %d."),c); Now done by ignore_rest. */
1055 input_line_pointer
--; /* Report unknown char as ignored. */
1056 ignore_rest_of_line ();
1059 #ifdef md_after_pass_hook
1060 md_after_pass_hook ();
1066 bump_line_counters ();
1069 buffer
= old_buffer
;
1070 input_line_pointer
= old_input
;
1071 buffer_limit
= old_limit
;
1083 /* Close the input file. */
1084 input_scrub_close ();
1087 /* For most MRI pseudo-ops, the line actually ends at the first
1088 nonquoted space. This function looks for that point, stuffs a null
1089 in, and sets *STOPCP to the character that used to be there, and
1090 returns the location.
1092 Until I hear otherwise, I am going to assume that this is only true
1093 for the m68k MRI assembler. */
1096 mri_comment_field (stopcp
)
1103 know (flag_m68k_mri
);
1105 for (s
= input_line_pointer
;
1106 ((!is_end_of_line
[(unsigned char) *s
] && *s
!= ' ' && *s
!= '\t')
1114 for (s
= input_line_pointer
;
1115 !is_end_of_line
[(unsigned char) *s
];
1125 /* Skip to the end of an MRI comment field. */
1128 mri_comment_end (stop
, stopc
)
1134 input_line_pointer
= stop
;
1136 while (!is_end_of_line
[(unsigned char) *input_line_pointer
])
1137 ++input_line_pointer
;
1142 int ignore ATTRIBUTE_UNUSED
;
1144 as_fatal (_(".abort detected. Abandoning ship."));
1147 /* Guts of .align directive. N is the power of two to which to align.
1148 FILL may be NULL, or it may point to the bytes of the fill pattern.
1149 LEN is the length of whatever FILL points to, if anything. MAX is
1150 the maximum number of characters to skip when doing the alignment,
1151 or 0 if there is no maximum. */
1154 do_align (n
, fill
, len
, max
)
1163 md_do_align (n
, fill
, len
, max
, just_record_alignment
);
1168 if (subseg_text_p (now_seg
))
1169 default_fill
= NOP_OPCODE
;
1172 fill
= &default_fill
;
1176 /* Only make a frag if we HAVE to... */
1177 if (n
!= 0 && !need_pass_2
)
1180 frag_align (n
, *fill
, max
);
1182 frag_align_pattern (n
, fill
, len
, max
);
1186 just_record_alignment
:
1189 record_alignment (now_seg
, n
- OCTETS_PER_BYTE_POWER
);
1192 /* Handle the .align pseudo-op. A positive ARG is a default alignment
1193 (in bytes). A negative ARG is the negative of the length of the
1194 fill pattern. BYTES_P is non-zero if the alignment value should be
1195 interpreted as the byte boundary, rather than the power of 2. */
1198 s_align (arg
, bytes_p
)
1202 register unsigned int align
;
1210 stop
= mri_comment_field (&stopc
);
1212 if (is_end_of_line
[(unsigned char) *input_line_pointer
])
1217 align
= arg
; /* Default value from pseudo-op table. */
1221 align
= get_absolute_expression ();
1227 /* Convert to a power of 2. */
1232 for (i
= 0; (align
& 1) == 0; align
>>= 1, ++i
)
1235 as_bad (_("Alignment not a power of 2"));
1244 as_bad (_("Alignment too large: %u assumed"), align
);
1247 if (*input_line_pointer
!= ',')
1254 ++input_line_pointer
;
1255 if (*input_line_pointer
== ',')
1259 fill
= get_absolute_expression ();
1264 if (*input_line_pointer
!= ',')
1268 ++input_line_pointer
;
1269 max
= get_absolute_expression ();
1276 as_warn (_("expected fill pattern missing"));
1277 do_align (align
, (char *) NULL
, 0, max
);
1292 do_align (align
, &fill_char
, fill_len
, max
);
1298 if ((size_t) fill_len
> sizeof ab
)
1300 md_number_to_chars (ab
, fill
, fill_len
);
1301 do_align (align
, ab
, fill_len
, max
);
1305 demand_empty_rest_of_line ();
1308 mri_comment_end (stop
, stopc
);
1311 /* Handle the .align pseudo-op on machines where ".align 4" means
1312 align to a 4 byte boundary. */
1321 /* Handle the .align pseudo-op on machines where ".align 4" means align
1322 to a 2**4 boundary. */
1333 int ignore ATTRIBUTE_UNUSED
;
1335 register char *name
;
1339 register symbolS
*symbolP
;
1344 stop
= mri_comment_field (&stopc
);
1346 name
= input_line_pointer
;
1347 c
= get_symbol_end ();
1348 /* Just after name is now '\0'. */
1349 p
= input_line_pointer
;
1353 if (*input_line_pointer
!= ',')
1355 as_bad (_("Expected comma after symbol-name: rest of line ignored."));
1356 ignore_rest_of_line ();
1358 mri_comment_end (stop
, stopc
);
1362 input_line_pointer
++; /* skip ',' */
1364 if ((temp
= get_absolute_expression ()) < 0)
1366 as_warn (_(".COMMon length (%ld.) <0! Ignored."), (long) temp
);
1367 ignore_rest_of_line ();
1369 mri_comment_end (stop
, stopc
);
1374 symbolP
= symbol_find_or_make (name
);
1377 if (S_IS_DEFINED (symbolP
) && !S_IS_COMMON (symbolP
))
1379 as_bad (_("Ignoring attempt to re-define symbol `%s'."),
1380 S_GET_NAME (symbolP
));
1381 ignore_rest_of_line ();
1383 mri_comment_end (stop
, stopc
);
1387 if (S_GET_VALUE (symbolP
))
1389 if (S_GET_VALUE (symbolP
) != (valueT
) temp
)
1390 as_bad (_("Length of .comm \"%s\" is already %ld. Not changed to %ld."),
1391 S_GET_NAME (symbolP
),
1392 (long) S_GET_VALUE (symbolP
),
1397 S_SET_VALUE (symbolP
, (valueT
) temp
);
1398 S_SET_EXTERNAL (symbolP
);
1402 extern int flag_one
;
1403 if (!temp
|| !flag_one
)
1404 S_GET_OTHER(symbolP
) = const_flag
;
1406 #endif /* not OBJ_VMS */
1407 know (symbolP
->sy_frag
== &zero_address_frag
);
1409 demand_empty_rest_of_line ();
1412 mri_comment_end (stop
, stopc
);
1415 /* The MRI COMMON pseudo-op. We handle this by creating a common
1416 symbol with the appropriate name. We make s_space do the right
1417 thing by increasing the size. */
1420 s_mri_common (small
)
1421 int small ATTRIBUTE_UNUSED
;
1437 stop
= mri_comment_field (&stopc
);
1441 name
= input_line_pointer
;
1442 if (!isdigit ((unsigned char) *name
))
1443 c
= get_symbol_end ();
1448 ++input_line_pointer
;
1450 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."),
1608 new_logical_line ((char *) NULL
, l
);
1611 listing_source_line (l
);
1614 demand_empty_rest_of_line ();
1617 /* Handle the .end pseudo-op. Actually, the real work is done in
1618 read_a_source_file. */
1622 int ignore ATTRIBUTE_UNUSED
;
1626 /* The MRI assembler permits the start symbol to follow .end,
1627 but we don't support that. */
1629 if (!is_end_of_line
[(unsigned char) *input_line_pointer
]
1630 && *input_line_pointer
!= '*'
1631 && *input_line_pointer
!= '!')
1632 as_warn (_("start address not supported"));
1636 /* Handle the .err pseudo-op. */
1640 int ignore ATTRIBUTE_UNUSED
;
1642 as_bad (_(".err encountered"));
1643 demand_empty_rest_of_line ();
1646 /* Handle the MRI fail pseudo-op. */
1650 int ignore ATTRIBUTE_UNUSED
;
1657 stop
= mri_comment_field (&stopc
);
1659 temp
= get_absolute_expression ();
1661 as_warn (_(".fail %ld encountered"), (long) temp
);
1663 as_bad (_(".fail %ld encountered"), (long) temp
);
1665 demand_empty_rest_of_line ();
1668 mri_comment_end (stop
, stopc
);
1673 int ignore ATTRIBUTE_UNUSED
;
1675 expressionS rep_exp
;
1677 register long fill
= 0;
1680 #ifdef md_flush_pending_output
1681 md_flush_pending_output ();
1684 get_known_segmented_expression (&rep_exp
);
1685 if (*input_line_pointer
== ',')
1687 input_line_pointer
++;
1688 size
= get_absolute_expression ();
1689 if (*input_line_pointer
== ',')
1691 input_line_pointer
++;
1692 fill
= get_absolute_expression ();
1696 /* This is to be compatible with BSD 4.2 AS, not for any rational reason. */
1697 #define BSD_FILL_SIZE_CROCK_8 (8)
1698 if (size
> BSD_FILL_SIZE_CROCK_8
)
1700 as_warn (_(".fill size clamped to %d."), BSD_FILL_SIZE_CROCK_8
);
1701 size
= BSD_FILL_SIZE_CROCK_8
;
1705 as_warn (_("Size negative: .fill ignored."));
1708 else if (rep_exp
.X_op
== O_constant
&& rep_exp
.X_add_number
<= 0)
1710 if (rep_exp
.X_add_number
< 0)
1711 as_warn (_("Repeat < 0, .fill ignored"));
1715 if (size
&& !need_pass_2
)
1717 if (rep_exp
.X_op
== O_constant
)
1719 p
= frag_var (rs_fill
, (int) size
, (int) size
,
1720 (relax_substateT
) 0, (symbolS
*) 0,
1721 (offsetT
) rep_exp
.X_add_number
,
1726 /* We don't have a constant repeat count, so we can't use
1727 rs_fill. We can get the same results out of rs_space,
1728 but its argument is in bytes, so we must multiply the
1729 repeat count by size. */
1732 rep_sym
= make_expr_symbol (&rep_exp
);
1735 expressionS size_exp
;
1736 size_exp
.X_op
= O_constant
;
1737 size_exp
.X_add_number
= size
;
1739 rep_exp
.X_op
= O_multiply
;
1740 rep_exp
.X_add_symbol
= rep_sym
;
1741 rep_exp
.X_op_symbol
= make_expr_symbol (&size_exp
);
1742 rep_exp
.X_add_number
= 0;
1743 rep_sym
= make_expr_symbol (&rep_exp
);
1746 p
= frag_var (rs_space
, (int) size
, (int) size
,
1747 (relax_substateT
) 0, rep_sym
, (offsetT
) 0, (char *) 0);
1750 memset (p
, 0, (unsigned int) size
);
1752 /* The magic number BSD_FILL_SIZE_CROCK_4 is from BSD 4.2 VAX
1753 flavoured AS. The following bizzare behaviour is to be
1754 compatible with above. I guess they tried to take up to 8
1755 bytes from a 4-byte expression and they forgot to sign
1756 extend. Un*x Sux. */
1757 #define BSD_FILL_SIZE_CROCK_4 (4)
1758 md_number_to_chars (p
, (valueT
) fill
,
1759 (size
> BSD_FILL_SIZE_CROCK_4
1760 ? BSD_FILL_SIZE_CROCK_4
1762 /* Note: .fill (),0 emits no frag (since we are asked to .fill 0 bytes)
1763 but emits no error message because it seems a legal thing to do.
1764 It is a degenerate case of .fill but could be emitted by a
1767 demand_empty_rest_of_line ();
1772 int ignore ATTRIBUTE_UNUSED
;
1781 stop
= mri_comment_field (&stopc
);
1785 name
= input_line_pointer
;
1786 c
= get_symbol_end ();
1787 symbolP
= symbol_find_or_make (name
);
1788 S_SET_EXTERNAL (symbolP
);
1790 *input_line_pointer
= c
;
1792 c
= *input_line_pointer
;
1795 input_line_pointer
++;
1797 if (*input_line_pointer
== '\n')
1803 demand_empty_rest_of_line ();
1806 mri_comment_end (stop
, stopc
);
1809 /* Handle the MRI IRP and IRPC pseudo-ops. */
1821 as_where (&file
, &line
);
1824 while (!is_end_of_line
[(unsigned char) *input_line_pointer
])
1825 sb_add_char (&s
, *input_line_pointer
++);
1829 err
= expand_irp (irpc
, 0, &s
, &out
, get_line_sb
, '\0');
1831 as_bad_where (file
, line
, "%s", err
);
1835 input_scrub_include_sb (&out
, input_line_pointer
, 1);
1837 buffer_limit
= input_scrub_next_buffer (&input_line_pointer
);
1840 /* Handle the .linkonce pseudo-op. This tells the assembler to mark
1841 the section to only be linked once. However, this is not supported
1842 by most object file formats. This takes an optional argument,
1843 which is what to do about duplicates. */
1847 int ignore ATTRIBUTE_UNUSED
;
1849 enum linkonce_type type
;
1853 type
= LINKONCE_DISCARD
;
1855 if (!is_end_of_line
[(unsigned char) *input_line_pointer
])
1860 s
= input_line_pointer
;
1861 c
= get_symbol_end ();
1862 if (strcasecmp (s
, "discard") == 0)
1863 type
= LINKONCE_DISCARD
;
1864 else if (strcasecmp (s
, "one_only") == 0)
1865 type
= LINKONCE_ONE_ONLY
;
1866 else if (strcasecmp (s
, "same_size") == 0)
1867 type
= LINKONCE_SAME_SIZE
;
1868 else if (strcasecmp (s
, "same_contents") == 0)
1869 type
= LINKONCE_SAME_CONTENTS
;
1871 as_warn (_("unrecognized .linkonce type `%s'"), s
);
1873 *input_line_pointer
= c
;
1876 #ifdef obj_handle_link_once
1877 obj_handle_link_once (type
);
1878 #else /* ! defined (obj_handle_link_once) */
1879 #ifdef BFD_ASSEMBLER
1883 if ((bfd_applicable_section_flags (stdoutput
) & SEC_LINK_ONCE
) == 0)
1884 as_warn (_(".linkonce is not supported for this object file format"));
1886 flags
= bfd_get_section_flags (stdoutput
, now_seg
);
1887 flags
|= SEC_LINK_ONCE
;
1892 case LINKONCE_DISCARD
:
1893 flags
|= SEC_LINK_DUPLICATES_DISCARD
;
1895 case LINKONCE_ONE_ONLY
:
1896 flags
|= SEC_LINK_DUPLICATES_ONE_ONLY
;
1898 case LINKONCE_SAME_SIZE
:
1899 flags
|= SEC_LINK_DUPLICATES_SAME_SIZE
;
1901 case LINKONCE_SAME_CONTENTS
:
1902 flags
|= SEC_LINK_DUPLICATES_SAME_CONTENTS
;
1905 if (!bfd_set_section_flags (stdoutput
, now_seg
, flags
))
1906 as_bad (_("bfd_set_section_flags: %s"),
1907 bfd_errmsg (bfd_get_error ()));
1909 #else /* ! defined (BFD_ASSEMBLER) */
1910 as_warn (_(".linkonce is not supported for this object file format"));
1911 #endif /* ! defined (BFD_ASSEMBLER) */
1912 #endif /* ! defined (obj_handle_link_once) */
1914 demand_empty_rest_of_line ();
1918 s_lcomm_internal (needs_align
, bytes_p
)
1919 /* 1 if this was a ".bss" directive, which may require a 3rd argument
1920 (alignment); 0 if it was an ".lcomm" (2 args only). */
1922 /* 1 if the alignment value should be interpreted as the byte boundary,
1923 rather than the power of 2. */
1926 register char *name
;
1930 register symbolS
*symbolP
;
1931 segT current_seg
= now_seg
;
1932 subsegT current_subseg
= now_subseg
;
1933 const int max_alignment
= 15;
1935 segT bss_seg
= bss_section
;
1937 name
= input_line_pointer
;
1938 c
= get_symbol_end ();
1939 p
= input_line_pointer
;
1943 /* Accept an optional comma after the name. The comma used to be
1944 required, but Irix 5 cc does not generate it. */
1945 if (*input_line_pointer
== ',')
1947 ++input_line_pointer
;
1951 if (*input_line_pointer
== '\n')
1953 as_bad (_("Missing size expression"));
1957 if ((temp
= get_absolute_expression ()) < 0)
1959 as_warn (_("BSS length (%d.) <0! Ignored."), temp
);
1960 ignore_rest_of_line ();
1964 #if defined (TC_MIPS) || defined (TC_ALPHA)
1965 if (OUTPUT_FLAVOR
== bfd_target_ecoff_flavour
1966 || OUTPUT_FLAVOR
== bfd_target_elf_flavour
)
1968 /* For MIPS and Alpha ECOFF or ELF, small objects are put in .sbss. */
1969 if (temp
<= bfd_get_gp_size (stdoutput
))
1971 bss_seg
= subseg_new (".sbss", 1);
1972 seg_info (bss_seg
)->bss
= 1;
1973 #ifdef BFD_ASSEMBLER
1974 if (!bfd_set_section_flags (stdoutput
, bss_seg
, SEC_ALLOC
))
1975 as_warn (_("error setting flags for \".sbss\": %s"),
1976 bfd_errmsg (bfd_get_error ()));
1984 TC_IMPLICIT_LCOMM_ALIGNMENT (temp
, align
);
1986 /* Still zero unless TC_IMPLICIT_LCOMM_ALIGNMENT set it. */
1988 record_alignment (bss_seg
, align
);
1996 if (*input_line_pointer
!= ',')
1998 as_bad (_("Expected comma after size"));
1999 ignore_rest_of_line ();
2003 input_line_pointer
++;
2006 if (*input_line_pointer
== '\n')
2008 as_bad (_("Missing alignment"));
2012 align
= get_absolute_expression ();
2016 /* Convert to a power of 2. */
2021 for (i
= 0; (align
& 1) == 0; align
>>= 1, ++i
)
2024 as_bad (_("Alignment not a power of 2"));
2029 if (align
> max_alignment
)
2031 align
= max_alignment
;
2032 as_warn (_("Alignment too large: %d. assumed."), align
);
2037 as_warn (_("Alignment negative. 0 assumed."));
2040 record_alignment (bss_seg
, 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_MAYBE_AOUT) \
2061 || defined (OBJ_BOUT) || defined (OBJ_MAYBE_BOUT))
2062 #ifdef BFD_ASSEMBLER
2063 (OUTPUT_FLAVOR
!= bfd_target_aout_flavour
2064 || (S_GET_OTHER (symbolP
) == 0 && S_GET_DESC (symbolP
) == 0)) &&
2066 (S_GET_OTHER (symbolP
) == 0 && S_GET_DESC (symbolP
) == 0) &&
2069 (S_GET_SEGMENT (symbolP
) == bss_seg
2070 || (!S_IS_DEFINED (symbolP
) && S_GET_VALUE (symbolP
) == 0)))
2074 subseg_set (bss_seg
, 1);
2077 frag_align (align
, 0, 0);
2079 /* Detach from old frag. */
2080 if (S_GET_SEGMENT (symbolP
) == bss_seg
)
2081 symbol_get_frag (symbolP
)->fr_symbol
= NULL
;
2083 symbol_set_frag (symbolP
, frag_now
);
2084 pfrag
= frag_var (rs_org
, 1, 1, (relax_substateT
) 0, symbolP
,
2085 (offsetT
) temp
, (char *) 0);
2088 S_SET_SEGMENT (symbolP
, bss_seg
);
2091 /* The symbol may already have been created with a preceding
2092 ".globl" directive -- be careful not to step on storage class
2093 in that case. Otherwise, set it to static. */
2094 if (S_GET_STORAGE_CLASS (symbolP
) != C_EXT
)
2096 S_SET_STORAGE_CLASS (symbolP
, C_STAT
);
2098 #endif /* OBJ_COFF */
2101 S_SET_SIZE (symbolP
, temp
);
2105 as_bad (_("Ignoring attempt to re-define symbol `%s'."),
2106 S_GET_NAME (symbolP
));
2108 subseg_set (current_seg
, current_subseg
);
2110 demand_empty_rest_of_line ();
2114 s_lcomm (needs_align
)
2117 s_lcomm_internal (needs_align
, 0);
2121 s_lcomm_bytes (needs_align
)
2124 s_lcomm_internal (needs_align
, 1);
2129 int ignore ATTRIBUTE_UNUSED
;
2131 register char *name
;
2135 register symbolS
*symbolP
;
2137 /* We permit ANY defined expression: BSD4.2 demands constants. */
2138 name
= input_line_pointer
;
2139 c
= get_symbol_end ();
2140 p
= input_line_pointer
;
2144 if (*input_line_pointer
!= ',')
2147 as_bad (_("Expected comma after name \"%s\""), name
);
2149 ignore_rest_of_line ();
2153 input_line_pointer
++;
2156 if (exp
.X_op
!= O_constant
2157 && exp
.X_op
!= O_register
)
2159 as_bad (_("bad expression"));
2160 ignore_rest_of_line ();
2165 symbolP
= symbol_find_or_make (name
);
2167 /* FIXME-SOON I pulled a (&& symbolP->sy_other == 0 &&
2168 symbolP->sy_desc == 0) out of this test because coff doesn't have
2169 those fields, and I can't see when they'd ever be tripped. I
2170 don't think I understand why they were here so I may have
2171 introduced a bug. As recently as 1.37 didn't have this test
2172 anyway. xoxorich. */
2174 if (S_GET_SEGMENT (symbolP
) == undefined_section
2175 && S_GET_VALUE (symbolP
) == 0)
2177 /* The name might be an undefined .global symbol; be sure to
2178 keep the "external" bit. */
2179 S_SET_SEGMENT (symbolP
,
2180 (exp
.X_op
== O_constant
2183 S_SET_VALUE (symbolP
, (valueT
) exp
.X_add_number
);
2187 as_bad (_("Symbol %s already defined"), name
);
2191 demand_empty_rest_of_line ();
2194 /* Read a line into an sb. */
2200 char quote1
, quote2
, inquote
;
2202 if (input_line_pointer
[-1] == '\n')
2203 bump_line_counters ();
2205 if (input_line_pointer
>= buffer_limit
)
2207 buffer_limit
= input_scrub_next_buffer (&input_line_pointer
);
2208 if (buffer_limit
== 0)
2212 /* If app.c sets any other characters to LEX_IS_STRINGQUOTE, this
2213 code needs to be changed. */
2222 #ifdef LEX_IS_STRINGQUOTE
2228 while (!is_end_of_line
[(unsigned char) *input_line_pointer
]
2229 || (inquote
!= '\0' && *input_line_pointer
!= '\n'))
2231 if (inquote
== *input_line_pointer
)
2233 else if (inquote
== '\0')
2235 if (*input_line_pointer
== quote1
)
2237 else if (*input_line_pointer
== quote2
)
2241 sb_add_char (line
, *input_line_pointer
++);
2244 while (input_line_pointer
< buffer_limit
2245 && is_end_of_line
[(unsigned char) *input_line_pointer
])
2247 if (input_line_pointer
[-1] == '\n')
2248 bump_line_counters ();
2249 ++input_line_pointer
;
2255 /* Define a macro. This is an interface to macro.c, which is shared
2256 between gas and gasp. */
2260 int ignore ATTRIBUTE_UNUSED
;
2269 as_where (&file
, &line
);
2272 while (!is_end_of_line
[(unsigned char) *input_line_pointer
])
2273 sb_add_char (&s
, *input_line_pointer
++);
2276 if (line_label
!= NULL
)
2277 sb_add_string (&label
, S_GET_NAME (line_label
));
2279 err
= define_macro (0, &s
, &label
, get_line_sb
, &name
);
2281 as_bad_where (file
, line
, "%s", err
);
2284 if (line_label
!= NULL
)
2286 S_SET_SEGMENT (line_label
, undefined_section
);
2287 S_SET_VALUE (line_label
, 0);
2288 symbol_set_frag (line_label
, &zero_address_frag
);
2291 if (((NO_PSEUDO_DOT
|| flag_m68k_mri
)
2292 && hash_find (po_hash
, name
) != NULL
)
2295 && hash_find (po_hash
, name
+ 1) != NULL
))
2296 as_warn (_("attempt to redefine pseudo-op `%s' ignored"),
2303 /* Handle the .mexit pseudo-op, which immediately exits a macro
2308 int ignore ATTRIBUTE_UNUSED
;
2310 cond_exit_macro (macro_nest
);
2311 buffer_limit
= input_scrub_next_buffer (&input_line_pointer
);
2314 /* Switch in and out of MRI mode. */
2318 int ignore ATTRIBUTE_UNUSED
;
2322 on
= get_absolute_expression ();
2323 old_flag
= flag_mri
;
2341 /* Operator precedence changes in m68k MRI mode, so we need to
2342 update the operator rankings. */
2343 expr_set_precedence ();
2345 #ifdef MRI_MODE_CHANGE
2347 MRI_MODE_CHANGE (on
);
2350 demand_empty_rest_of_line ();
2353 /* Handle changing the location counter. */
2356 do_org (segment
, exp
, fill
)
2361 if (segment
!= now_seg
&& segment
!= absolute_section
)
2362 as_bad (_("invalid segment \"%s\"; segment \"%s\" assumed"),
2363 segment_name (segment
), segment_name (now_seg
));
2365 if (now_seg
== absolute_section
)
2368 as_warn (_("ignoring fill value in absolute section"));
2369 if (exp
->X_op
!= O_constant
)
2371 as_bad (_("only constant offsets supported in absolute section"));
2372 exp
->X_add_number
= 0;
2374 abs_section_offset
= exp
->X_add_number
;
2380 p
= frag_var (rs_org
, 1, 1, (relax_substateT
) 0, exp
->X_add_symbol
,
2381 exp
->X_add_number
* OCTETS_PER_BYTE
, (char *) NULL
);
2388 int ignore ATTRIBUTE_UNUSED
;
2390 register segT segment
;
2392 register long temp_fill
;
2394 #ifdef md_flush_pending_output
2395 md_flush_pending_output ();
2398 /* The m68k MRI assembler has a different meaning for .org. It
2399 means to create an absolute section at a given address. We can't
2400 support that--use a linker script instead. */
2403 as_bad (_("MRI style ORG pseudo-op not supported"));
2404 ignore_rest_of_line ();
2408 /* Don't believe the documentation of BSD 4.2 AS. There is no such
2409 thing as a sub-segment-relative origin. Any absolute origin is
2410 given a warning, then assumed to be segment-relative. Any
2411 segmented origin expression ("foo+42") had better be in the right
2412 segment or the .org is ignored.
2414 BSD 4.2 AS warns if you try to .org backwards. We cannot because
2415 we never know sub-segment sizes when we are reading code. BSD
2416 will crash trying to emit negative numbers of filler bytes in
2417 certain .orgs. We don't crash, but see as-write for that code.
2419 Don't make frag if need_pass_2==1. */
2420 segment
= get_known_segmented_expression (&exp
);
2421 if (*input_line_pointer
== ',')
2423 input_line_pointer
++;
2424 temp_fill
= get_absolute_expression ();
2430 do_org (segment
, &exp
, temp_fill
);
2432 demand_empty_rest_of_line ();
2435 /* Handle parsing for the MRI SECT/SECTION pseudo-op. This should be
2436 called by the obj-format routine which handles section changing
2437 when in MRI mode. It will create a new section, and return it. It
2438 will set *TYPE to the section type: one of 'C' (code), 'D' (data),
2439 'M' (mixed), or 'R' (romable). If BFD_ASSEMBLER is defined, the
2440 flags will be set in the section. */
2444 char *type ATTRIBUTE_UNUSED
;
2454 name
= input_line_pointer
;
2455 if (!isdigit ((unsigned char) *name
))
2456 c
= get_symbol_end ();
2461 ++input_line_pointer
;
2463 while (isdigit ((unsigned char) *input_line_pointer
));
2465 c
= *input_line_pointer
;
2466 *input_line_pointer
= '\0';
2469 name
= xstrdup (name
);
2471 *input_line_pointer
= c
;
2473 seg
= subseg_new (name
, 0);
2475 if (*input_line_pointer
== ',')
2479 ++input_line_pointer
;
2480 align
= get_absolute_expression ();
2481 record_alignment (seg
, align
);
2485 if (*input_line_pointer
== ',')
2487 c
= *++input_line_pointer
;
2488 c
= toupper ((unsigned char) c
);
2489 if (c
== 'C' || c
== 'D' || c
== 'M' || c
== 'R')
2492 as_bad (_("unrecognized section type"));
2493 ++input_line_pointer
;
2495 #ifdef BFD_ASSEMBLER
2499 flags
= SEC_NO_FLAGS
;
2501 flags
= SEC_ALLOC
| SEC_LOAD
| SEC_READONLY
| SEC_CODE
;
2502 else if (*type
== 'D' || *type
== 'M')
2503 flags
= SEC_ALLOC
| SEC_LOAD
| SEC_DATA
;
2504 else if (*type
== 'R')
2505 flags
= SEC_ALLOC
| SEC_LOAD
| SEC_DATA
| SEC_READONLY
| SEC_ROM
;
2506 if (flags
!= SEC_NO_FLAGS
)
2508 if (!bfd_set_section_flags (stdoutput
, seg
, flags
))
2509 as_warn (_("error setting flags for \"%s\": %s"),
2510 bfd_section_name (stdoutput
, seg
),
2511 bfd_errmsg (bfd_get_error ()));
2517 /* Ignore the HP type. */
2518 if (*input_line_pointer
== ',')
2519 input_line_pointer
+= 2;
2521 demand_empty_rest_of_line ();
2523 #else /* ! TC_M68K */
2532 name
= input_line_pointer
;
2533 c
= get_symbol_end ();
2535 name
= xstrdup (name
);
2537 *input_line_pointer
= c
;
2539 seg
= subseg_new (name
, 0);
2541 if (*input_line_pointer
!= ',')
2547 ++input_line_pointer
;
2549 sectype
= input_line_pointer
;
2550 c
= get_symbol_end ();
2551 if (*sectype
== '\0')
2553 else if (strcasecmp (sectype
, "text") == 0)
2555 else if (strcasecmp (sectype
, "data") == 0)
2557 else if (strcasecmp (sectype
, "romdata") == 0)
2560 as_warn (_("unrecognized section type `%s'"), sectype
);
2561 *input_line_pointer
= c
;
2564 if (*input_line_pointer
== ',')
2568 ++input_line_pointer
;
2570 seccmd
= input_line_pointer
;
2571 c
= get_symbol_end ();
2572 if (strcasecmp (seccmd
, "absolute") == 0)
2574 as_bad (_("absolute sections are not supported"));
2575 *input_line_pointer
= c
;
2576 ignore_rest_of_line ();
2579 else if (strcasecmp (seccmd
, "align") == 0)
2583 *input_line_pointer
= c
;
2584 align
= get_absolute_expression ();
2585 record_alignment (seg
, align
);
2589 as_warn (_("unrecognized section command `%s'"), seccmd
);
2590 *input_line_pointer
= c
;
2594 demand_empty_rest_of_line ();
2596 #else /* ! TC_I960 */
2597 /* The MRI assembler seems to use different forms of .sect for
2598 different targets. */
2599 as_bad ("MRI mode not supported for this target");
2600 ignore_rest_of_line ();
2601 #endif /* ! TC_I960 */
2602 #endif /* ! TC_M68K */
2605 /* Handle the .print pseudo-op. */
2609 int ignore ATTRIBUTE_UNUSED
;
2614 s
= demand_copy_C_string (&len
);
2616 demand_empty_rest_of_line ();
2619 /* Handle the .purgem pseudo-op. */
2623 int ignore ATTRIBUTE_UNUSED
;
2625 if (is_it_end_of_statement ())
2627 demand_empty_rest_of_line ();
2637 name
= input_line_pointer
;
2638 c
= get_symbol_end ();
2639 delete_macro (name
);
2640 *input_line_pointer
= c
;
2643 while (*input_line_pointer
++ == ',');
2645 --input_line_pointer
;
2646 demand_empty_rest_of_line ();
2649 /* Handle the .rept pseudo-op. */
2653 int ignore ATTRIBUTE_UNUSED
;
2657 count
= get_absolute_expression ();
2659 do_repeat (count
, "REPT", "ENDR");
2662 /* This function provides a generic repeat block implementation. It allows
2663 different directives to be used as the start/end keys. */
2666 do_repeat (count
, start
, end
)
2675 if (!buffer_and_nest (start
, end
, &one
, get_line_sb
))
2677 as_bad (_("%s without %s"), start
, end
);
2683 sb_add_sb (&many
, &one
);
2687 input_scrub_include_sb (&many
, input_line_pointer
, 1);
2689 buffer_limit
= input_scrub_next_buffer (&input_line_pointer
);
2692 /* Skip to end of current repeat loop; EXTRA indicates how many additional
2693 input buffers to skip. Assumes that conditionals preceding the loop end
2694 are properly nested.
2696 This function makes it easier to implement a premature "break" out of the
2697 loop. The EXTRA arg accounts for other buffers we might have inserted,
2698 such as line substitutions. */
2704 cond_exit_macro (macro_nest
);
2705 while (extra
-- >= 0)
2706 buffer_limit
= input_scrub_next_buffer (&input_line_pointer
);
2709 /* Handle the .equ, .equiv and .set directives. If EQUIV is 1, then
2710 this is .equiv, and it is an error if the symbol is already
2717 register char *name
;
2718 register char delim
;
2719 register char *end_name
;
2720 register symbolS
*symbolP
;
2722 /* Especial apologies for the random logic:
2723 this just grew, and could be parsed much more simply!
2725 name
= input_line_pointer
;
2726 delim
= get_symbol_end ();
2727 end_name
= input_line_pointer
;
2731 if (*input_line_pointer
!= ',')
2734 as_bad (_("Expected comma after name \"%s\""), name
);
2736 ignore_rest_of_line ();
2740 input_line_pointer
++;
2743 if (name
[0] == '.' && name
[1] == '\0')
2745 /* Turn '. = mumble' into a .org mumble. */
2746 register segT segment
;
2749 segment
= get_known_segmented_expression (&exp
);
2752 do_org (segment
, &exp
, 0);
2758 if ((symbolP
= symbol_find (name
)) == NULL
2759 && (symbolP
= md_undefined_symbol (name
)) == NULL
)
2762 /* When doing symbol listings, play games with dummy fragments living
2763 outside the normal fragment chain to record the file and line info
2765 if (listing
& LISTING_SYMBOLS
)
2767 extern struct list_info_struct
*listing_tail
;
2768 fragS
*dummy_frag
= (fragS
*) xmalloc (sizeof (fragS
));
2769 memset (dummy_frag
, 0, sizeof (fragS
));
2770 dummy_frag
->fr_type
= rs_fill
;
2771 dummy_frag
->line
= listing_tail
;
2772 symbolP
= symbol_new (name
, undefined_section
, 0, dummy_frag
);
2773 dummy_frag
->fr_symbol
= symbolP
;
2777 symbolP
= symbol_new (name
, undefined_section
, 0, &zero_address_frag
);
2780 /* "set" symbols are local unless otherwise specified. */
2781 SF_SET_LOCAL (symbolP
);
2782 #endif /* OBJ_COFF */
2785 symbol_table_insert (symbolP
);
2790 && S_IS_DEFINED (symbolP
)
2791 && S_GET_SEGMENT (symbolP
) != reg_section
)
2792 as_bad (_("symbol `%s' already defined"), S_GET_NAME (symbolP
));
2794 pseudo_set (symbolP
);
2795 demand_empty_rest_of_line ();
2809 #ifdef md_flush_pending_output
2810 md_flush_pending_output ();
2814 stop
= mri_comment_field (&stopc
);
2816 /* In m68k MRI mode, we need to align to a word boundary, unless
2818 if (flag_m68k_mri
&& mult
> 1)
2820 if (now_seg
== absolute_section
)
2822 abs_section_offset
+= abs_section_offset
& 1;
2823 if (line_label
!= NULL
)
2824 S_SET_VALUE (line_label
, abs_section_offset
);
2826 else if (mri_common_symbol
!= NULL
)
2830 val
= S_GET_VALUE (mri_common_symbol
);
2833 S_SET_VALUE (mri_common_symbol
, val
+ 1);
2834 if (line_label
!= NULL
)
2836 expressionS
*symexp
;
2838 symexp
= symbol_get_value_expression (line_label
);
2839 know (symexp
->X_op
== O_symbol
);
2840 know (symexp
->X_add_symbol
== mri_common_symbol
);
2841 symexp
->X_add_number
+= 1;
2847 do_align (1, (char *) NULL
, 0, 0);
2848 if (line_label
!= NULL
)
2850 symbol_set_frag (line_label
, frag_now
);
2851 S_SET_VALUE (line_label
, frag_now_fix ());
2861 if (*input_line_pointer
== ',')
2863 ++input_line_pointer
;
2868 val
.X_op
= O_constant
;
2869 val
.X_add_number
= 0;
2872 if (val
.X_op
!= O_constant
2873 || val
.X_add_number
< - 0x80
2874 || val
.X_add_number
> 0xff
2875 || (mult
!= 0 && mult
!= 1 && val
.X_add_number
!= 0))
2877 if (exp
.X_op
!= O_constant
)
2878 as_bad (_("Unsupported variable size or fill value"));
2885 bytes
= mult
* exp
.X_add_number
;
2886 for (i
= 0; i
< exp
.X_add_number
; i
++)
2887 emit_expr (&val
, mult
);
2892 if (exp
.X_op
== O_constant
)
2896 repeat
= exp
.X_add_number
;
2903 as_warn (_(".space repeat count is zero, ignored"));
2904 else if (repeat
< 0)
2905 as_warn (_(".space repeat count is negative, ignored"));
2909 /* If we are in the absolute section, just bump the offset. */
2910 if (now_seg
== absolute_section
)
2912 abs_section_offset
+= repeat
;
2916 /* If we are secretly in an MRI common section, then
2917 creating space just increases the size of the common
2919 if (mri_common_symbol
!= NULL
)
2921 S_SET_VALUE (mri_common_symbol
,
2922 S_GET_VALUE (mri_common_symbol
) + repeat
);
2927 p
= frag_var (rs_fill
, 1, 1, (relax_substateT
) 0, (symbolS
*) 0,
2928 (offsetT
) repeat
, (char *) 0);
2932 if (now_seg
== absolute_section
)
2934 as_bad (_("space allocation too complex in absolute section"));
2935 subseg_set (text_section
, 0);
2938 if (mri_common_symbol
!= NULL
)
2940 as_bad (_("space allocation too complex in common section"));
2941 mri_common_symbol
= NULL
;
2945 p
= frag_var (rs_space
, 1, 1, (relax_substateT
) 0,
2946 make_expr_symbol (&exp
), (offsetT
) 0, (char *) 0);
2950 *p
= val
.X_add_number
;
2955 /* In MRI mode, after an odd number of bytes, we must align to an
2956 even word boundary, unless the next instruction is a dc.b, ds.b
2958 if (flag_mri
&& (bytes
& 1) != 0)
2959 mri_pending_align
= 1;
2961 demand_empty_rest_of_line ();
2964 mri_comment_end (stop
, stopc
);
2967 /* This is like s_space, but the value is a floating point number with
2968 the given precision. This is for the MRI dcb.s pseudo-op and
2972 s_float_space (float_type
)
2977 char temp
[MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT
];
2982 stop
= mri_comment_field (&stopc
);
2984 count
= get_absolute_expression ();
2987 if (*input_line_pointer
!= ',')
2989 as_bad (_("missing value"));
2990 ignore_rest_of_line ();
2992 mri_comment_end (stop
, stopc
);
2996 ++input_line_pointer
;
3000 /* Skip any 0{letter} that may be present. Don't even check if the
3001 * letter is legal. */
3002 if (input_line_pointer
[0] == '0'
3003 && isalpha ((unsigned char) input_line_pointer
[1]))
3004 input_line_pointer
+= 2;
3006 /* Accept :xxxx, where the x's are hex digits, for a floating point
3007 with the exact digits specified. */
3008 if (input_line_pointer
[0] == ':')
3010 flen
= hex_float (float_type
, temp
);
3013 ignore_rest_of_line ();
3015 mri_comment_end (stop
, stopc
);
3023 err
= md_atof (float_type
, temp
, &flen
);
3024 know (flen
<= MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT
);
3028 as_bad (_("Bad floating literal: %s"), err
);
3029 ignore_rest_of_line ();
3031 mri_comment_end (stop
, stopc
);
3036 while (--count
>= 0)
3040 p
= frag_more (flen
);
3041 memcpy (p
, temp
, (unsigned int) flen
);
3044 demand_empty_rest_of_line ();
3047 mri_comment_end (stop
, stopc
);
3050 /* Handle the .struct pseudo-op, as found in MIPS assemblers. */
3054 int ignore ATTRIBUTE_UNUSED
;
3060 stop
= mri_comment_field (&stopc
);
3061 abs_section_offset
= get_absolute_expression ();
3062 subseg_set (absolute_section
, 0);
3063 demand_empty_rest_of_line ();
3065 mri_comment_end (stop
, stopc
);
3070 int ignore ATTRIBUTE_UNUSED
;
3074 temp
= get_absolute_expression ();
3075 subseg_set (text_section
, (subsegT
) temp
);
3076 demand_empty_rest_of_line ();
3078 const_flag
&= ~IN_DEFAULT_SECTION
;
3083 demand_empty_rest_of_line ()
3086 if (is_end_of_line
[(unsigned char) *input_line_pointer
])
3087 input_line_pointer
++;
3089 ignore_rest_of_line ();
3091 /* Return having already swallowed end-of-line. */
3095 ignore_rest_of_line ()
3097 /* For suspect lines: gives warning. */
3098 if (!is_end_of_line
[(unsigned char) *input_line_pointer
])
3100 if (isprint ((unsigned char) *input_line_pointer
))
3101 as_bad (_("Rest of line ignored. First ignored character is `%c'."),
3102 *input_line_pointer
);
3104 as_bad (_("Rest of line ignored. First ignored character valued 0x%x."),
3105 *input_line_pointer
);
3107 while (input_line_pointer
< buffer_limit
3108 && !is_end_of_line
[(unsigned char) *input_line_pointer
])
3109 input_line_pointer
++;
3112 input_line_pointer
++;
3114 /* Return pointing just after end-of-line. */
3115 know (is_end_of_line
[(unsigned char) input_line_pointer
[-1]]);
3119 discard_rest_of_line ()
3121 while (input_line_pointer
< buffer_limit
3122 && !is_end_of_line
[(unsigned char) *input_line_pointer
])
3123 input_line_pointer
++;
3125 input_line_pointer
++;
3127 /* Return pointing just after end-of-line. */
3128 know (is_end_of_line
[(unsigned char) input_line_pointer
[-1]]);
3131 /* In: Pointer to a symbol.
3132 Input_line_pointer->expression.
3134 Out: Input_line_pointer->just after any whitespace after expression.
3135 Tried to set symbol to value of expression.
3136 Will change symbols type, value, and frag; */
3139 pseudo_set (symbolP
)
3143 #if (defined (OBJ_AOUT) || defined (OBJ_BOUT)) && ! defined (BFD_ASSEMBLER)
3145 #endif /* OBJ_AOUT or OBJ_BOUT */
3147 know (symbolP
); /* NULL pointer is logic error. */
3148 #if (defined (OBJ_AOUT) || defined (OBJ_BOUT)) && ! defined (BFD_ASSEMBLER)
3149 ext
= S_IS_EXTERNAL (symbolP
);
3150 #endif /* OBJ_AOUT or OBJ_BOUT */
3152 (void) expression (&exp
);
3154 if (exp
.X_op
== O_illegal
)
3155 as_bad (_("illegal expression; zero assumed"));
3156 else if (exp
.X_op
== O_absent
)
3157 as_bad (_("missing expression; zero assumed"));
3158 else if (exp
.X_op
== O_big
)
3160 if (exp
.X_add_number
> 0)
3161 as_bad (_("bignum invalid; zero assumed"));
3163 as_bad (_("floating point number invalid; zero assumed"));
3165 else if (exp
.X_op
== O_subtract
3166 && (S_GET_SEGMENT (exp
.X_add_symbol
)
3167 == S_GET_SEGMENT (exp
.X_op_symbol
))
3168 && SEG_NORMAL (S_GET_SEGMENT (exp
.X_add_symbol
))
3169 && (symbol_get_frag (exp
.X_add_symbol
)
3170 == symbol_get_frag (exp
.X_op_symbol
)))
3172 exp
.X_op
= O_constant
;
3173 exp
.X_add_number
= (S_GET_VALUE (exp
.X_add_symbol
)
3174 - S_GET_VALUE (exp
.X_op_symbol
));
3182 exp
.X_add_number
= 0;
3185 S_SET_SEGMENT (symbolP
, absolute_section
);
3186 #if (defined (OBJ_AOUT) || defined (OBJ_BOUT)) && ! defined (BFD_ASSEMBLER)
3188 S_SET_EXTERNAL (symbolP
);
3190 S_CLEAR_EXTERNAL (symbolP
);
3191 #endif /* OBJ_AOUT or OBJ_BOUT */
3192 S_SET_VALUE (symbolP
, (valueT
) exp
.X_add_number
);
3193 if (exp
.X_op
!= O_constant
)
3194 symbol_set_frag (symbolP
, &zero_address_frag
);
3198 S_SET_SEGMENT (symbolP
, reg_section
);
3199 S_SET_VALUE (symbolP
, (valueT
) exp
.X_add_number
);
3200 symbol_set_frag (symbolP
, &zero_address_frag
);
3204 if (S_GET_SEGMENT (exp
.X_add_symbol
) == undefined_section
3205 || exp
.X_add_number
!= 0)
3206 symbol_set_value_expression (symbolP
, &exp
);
3207 else if (symbol_section_p (symbolP
))
3208 as_bad ("invalid attempt to set value of section symbol");
3211 symbolS
*s
= exp
.X_add_symbol
;
3213 S_SET_SEGMENT (symbolP
, S_GET_SEGMENT (s
));
3214 #if (defined (OBJ_AOUT) || defined (OBJ_BOUT)) && ! defined (BFD_ASSEMBLER)
3216 S_SET_EXTERNAL (symbolP
);
3218 S_CLEAR_EXTERNAL (symbolP
);
3219 #endif /* OBJ_AOUT or OBJ_BOUT */
3220 S_SET_VALUE (symbolP
,
3221 exp
.X_add_number
+ S_GET_VALUE (s
));
3222 symbol_set_frag (symbolP
, symbol_get_frag (s
));
3223 copy_symbol_attributes (symbolP
, s
);
3228 /* The value is some complex expression.
3229 FIXME: Should we set the segment to anything? */
3230 symbol_set_value_expression (symbolP
, &exp
);
3237 CONStruct more frag of .bytes, or .words etc.
3238 Should need_pass_2 be 1 then emit no frag(s).
3239 This understands EXPRESSIONS.
3243 This has a split personality. We use expression() to read the
3244 value. We can detect if the value won't fit in a byte or word.
3245 But we can't detect if expression() discarded significant digits
3246 in the case of a long. Not worth the crocks required to fix it. */
3248 /* Select a parser for cons expressions. */
3250 /* Some targets need to parse the expression in various fancy ways.
3251 You can define TC_PARSE_CONS_EXPRESSION to do whatever you like
3252 (for example, the HPPA does this). Otherwise, you can define
3253 BITFIELD_CONS_EXPRESSIONS to permit bitfields to be specified, or
3254 REPEAT_CONS_EXPRESSIONS to permit repeat counts. If none of these
3255 are defined, which is the normal case, then only simple expressions
3260 parse_mri_cons
PARAMS ((expressionS
*exp
, unsigned int nbytes
));
3263 #ifndef TC_PARSE_CONS_EXPRESSION
3264 #ifdef BITFIELD_CONS_EXPRESSIONS
3265 #define TC_PARSE_CONS_EXPRESSION(EXP, NBYTES) parse_bitfield_cons (EXP, NBYTES)
3267 parse_bitfield_cons
PARAMS ((expressionS
*exp
, unsigned int nbytes
));
3269 #ifdef REPEAT_CONS_EXPRESSIONS
3270 #define TC_PARSE_CONS_EXPRESSION(EXP, NBYTES) parse_repeat_cons (EXP, NBYTES)
3272 parse_repeat_cons
PARAMS ((expressionS
*exp
, unsigned int nbytes
));
3275 /* If we haven't gotten one yet, just call expression. */
3276 #ifndef TC_PARSE_CONS_EXPRESSION
3277 #define TC_PARSE_CONS_EXPRESSION(EXP, NBYTES) expression (EXP)
3281 /* Worker to do .byte etc statements.
3282 Clobbers input_line_pointer and checks end-of-line. */
3285 cons_worker (nbytes
, rva
)
3286 register int nbytes
; /* 1=.byte, 2=.word, 4=.long. */
3294 #ifdef md_flush_pending_output
3295 md_flush_pending_output ();
3299 stop
= mri_comment_field (&stopc
);
3301 if (is_it_end_of_statement ())
3303 demand_empty_rest_of_line ();
3305 mri_comment_end (stop
, stopc
);
3309 #ifdef md_cons_align
3310 md_cons_align (nbytes
);
3318 parse_mri_cons (&exp
, (unsigned int) nbytes
);
3321 TC_PARSE_CONS_EXPRESSION (&exp
, (unsigned int) nbytes
);
3325 if (exp
.X_op
== O_symbol
)
3326 exp
.X_op
= O_symbol_rva
;
3328 as_fatal (_("rva without symbol"));
3330 emit_expr (&exp
, (unsigned int) nbytes
);
3333 while (*input_line_pointer
++ == ',');
3335 /* In MRI mode, after an odd number of bytes, we must align to an
3336 even word boundary, unless the next instruction is a dc.b, ds.b
3338 if (flag_mri
&& nbytes
== 1 && (c
& 1) != 0)
3339 mri_pending_align
= 1;
3341 input_line_pointer
--; /* Put terminator back into stream. */
3343 demand_empty_rest_of_line ();
3346 mri_comment_end (stop
, stopc
);
3353 cons_worker (size
, 0);
3360 cons_worker (size
, 1);
3363 /* Put the contents of expression EXP into the object file using
3364 NBYTES bytes. If need_pass_2 is 1, this does nothing. */
3367 emit_expr (exp
, nbytes
)
3369 unsigned int nbytes
;
3373 valueT extra_digit
= 0;
3375 /* Don't do anything if we are going to make another pass. */
3381 /* When gcc emits DWARF 1 debugging pseudo-ops, a line number will
3382 appear as a four byte positive constant in the .line section,
3383 followed by a 2 byte 0xffff. Look for that case here. */
3385 static int dwarf_line
= -1;
3387 if (strcmp (segment_name (now_seg
), ".line") != 0)
3389 else if (dwarf_line
>= 0
3391 && exp
->X_op
== O_constant
3392 && (exp
->X_add_number
== -1 || exp
->X_add_number
== 0xffff))
3393 listing_source_line ((unsigned int) dwarf_line
);
3394 else if (nbytes
== 4
3395 && exp
->X_op
== O_constant
3396 && exp
->X_add_number
>= 0)
3397 dwarf_line
= exp
->X_add_number
;
3402 /* When gcc emits DWARF 1 debugging pseudo-ops, a file name will
3403 appear as a 2 byte TAG_compile_unit (0x11) followed by a 2 byte
3404 AT_sibling (0x12) followed by a four byte address of the sibling
3405 followed by a 2 byte AT_name (0x38) followed by the name of the
3406 file. We look for that case here. */
3408 static int dwarf_file
= 0;
3410 if (strcmp (segment_name (now_seg
), ".debug") != 0)
3412 else if (dwarf_file
== 0
3414 && exp
->X_op
== O_constant
3415 && exp
->X_add_number
== 0x11)
3417 else if (dwarf_file
== 1
3419 && exp
->X_op
== O_constant
3420 && exp
->X_add_number
== 0x12)
3422 else if (dwarf_file
== 2
3425 else if (dwarf_file
== 3
3427 && exp
->X_op
== O_constant
3428 && exp
->X_add_number
== 0x38)
3433 /* The variable dwarf_file_string tells stringer that the string
3434 may be the name of the source file. */
3435 if (dwarf_file
== 4)
3436 dwarf_file_string
= 1;
3438 dwarf_file_string
= 0;
3443 if (check_eh_frame (exp
, &nbytes
))
3448 /* Allow `.word 0' in the absolute section. */
3449 if (now_seg
== absolute_section
)
3451 if (op
!= O_constant
|| exp
->X_add_number
!= 0)
3452 as_bad (_("attempt to store value in absolute section"));
3453 abs_section_offset
+= nbytes
;
3457 /* Handle a negative bignum. */
3459 && exp
->X_add_number
== 0
3460 && symbol_get_value_expression (exp
->X_add_symbol
)->X_op
== O_big
3461 && symbol_get_value_expression (exp
->X_add_symbol
)->X_add_number
> 0)
3464 unsigned long carry
;
3466 exp
= symbol_get_value_expression (exp
->X_add_symbol
);
3468 /* Negate the bignum: one's complement each digit and add 1. */
3470 for (i
= 0; i
< exp
->X_add_number
; i
++)
3474 next
= (((~(generic_bignum
[i
] & LITTLENUM_MASK
))
3477 generic_bignum
[i
] = next
& LITTLENUM_MASK
;
3478 carry
= next
>> LITTLENUM_NUMBER_OF_BITS
;
3481 /* We can ignore any carry out, because it will be handled by
3482 extra_digit if it is needed. */
3484 extra_digit
= (valueT
) -1;
3488 if (op
== O_absent
|| op
== O_illegal
)
3490 as_warn (_("zero assumed for missing expression"));
3491 exp
->X_add_number
= 0;
3494 else if (op
== O_big
&& exp
->X_add_number
<= 0)
3496 as_bad (_("floating point number invalid; zero assumed"));
3497 exp
->X_add_number
= 0;
3500 else if (op
== O_register
)
3502 as_warn (_("register value used as expression"));
3506 p
= frag_more ((int) nbytes
);
3508 #ifndef WORKING_DOT_WORD
3509 /* If we have the difference of two symbols in a word, save it on
3510 the broken_words list. See the code in write.c. */
3511 if (op
== O_subtract
&& nbytes
== 2)
3513 struct broken_word
*x
;
3515 x
= (struct broken_word
*) xmalloc (sizeof (struct broken_word
));
3516 x
->next_broken_word
= broken_words
;
3519 x
->subseg
= now_subseg
;
3521 x
->word_goes_here
= p
;
3523 x
->add
= exp
->X_add_symbol
;
3524 x
->sub
= exp
->X_op_symbol
;
3525 x
->addnum
= exp
->X_add_number
;
3532 /* If we have an integer, but the number of bytes is too large to
3533 pass to md_number_to_chars, handle it as a bignum. */
3534 if (op
== O_constant
&& nbytes
> sizeof (valueT
))
3539 if (!exp
->X_unsigned
&& exp
->X_add_number
< 0)
3540 extra_digit
= (valueT
) -1;
3541 val
= (valueT
) exp
->X_add_number
;
3545 generic_bignum
[gencnt
] = val
& LITTLENUM_MASK
;
3546 val
>>= LITTLENUM_NUMBER_OF_BITS
;
3550 op
= exp
->X_op
= O_big
;
3551 exp
->X_add_number
= gencnt
;
3554 if (op
== O_constant
)
3556 register valueT get
;
3557 register valueT use
;
3558 register valueT mask
;
3560 register valueT unmask
;
3562 /* JF << of >= number of bits in the object is undefined. In
3563 particular SPARC (Sun 4) has problems. */
3564 if (nbytes
>= sizeof (valueT
))
3567 if (nbytes
> sizeof (valueT
))
3570 hibit
= (valueT
) 1 << (nbytes
* BITS_PER_CHAR
- 1);
3574 /* Don't store these bits. */
3575 mask
= ~(valueT
) 0 << (BITS_PER_CHAR
* nbytes
);
3576 hibit
= (valueT
) 1 << (nbytes
* BITS_PER_CHAR
- 1);
3579 unmask
= ~mask
; /* Do store these bits. */
3582 "Do this mod if you want every overflow check to assume SIGNED 2's complement data.";
3583 mask
= ~(unmask
>> 1); /* Includes sign bit now. */
3586 get
= exp
->X_add_number
;
3588 if ((get
& mask
) != 0
3589 && ((get
& mask
) != mask
3590 || (get
& hibit
) == 0))
3591 { /* Leading bits contain both 0s & 1s. */
3592 as_warn (_("Value 0x%lx truncated to 0x%lx."),
3593 (unsigned long) get
, (unsigned long) use
);
3595 /* Put bytes in right order. */
3596 md_number_to_chars (p
, use
, (int) nbytes
);
3598 else if (op
== O_big
)
3601 LITTLENUM_TYPE
*nums
;
3603 know (nbytes
% CHARS_PER_LITTLENUM
== 0);
3605 size
= exp
->X_add_number
* CHARS_PER_LITTLENUM
;
3608 as_warn (_("Bignum truncated to %d bytes"), nbytes
);
3612 if (target_big_endian
)
3614 while (nbytes
> size
)
3616 md_number_to_chars (p
, extra_digit
, CHARS_PER_LITTLENUM
);
3617 nbytes
-= CHARS_PER_LITTLENUM
;
3618 p
+= CHARS_PER_LITTLENUM
;
3621 nums
= generic_bignum
+ size
/ CHARS_PER_LITTLENUM
;
3625 md_number_to_chars (p
, (valueT
) *nums
, CHARS_PER_LITTLENUM
);
3626 size
-= CHARS_PER_LITTLENUM
;
3627 p
+= CHARS_PER_LITTLENUM
;
3632 nums
= generic_bignum
;
3635 md_number_to_chars (p
, (valueT
) *nums
, CHARS_PER_LITTLENUM
);
3637 size
-= CHARS_PER_LITTLENUM
;
3638 p
+= CHARS_PER_LITTLENUM
;
3639 nbytes
-= CHARS_PER_LITTLENUM
;
3644 md_number_to_chars (p
, extra_digit
, CHARS_PER_LITTLENUM
);
3645 nbytes
-= CHARS_PER_LITTLENUM
;
3646 p
+= CHARS_PER_LITTLENUM
;
3652 memset (p
, 0, nbytes
);
3654 /* Now we need to generate a fixS to record the symbol value.
3655 This is easy for BFD. For other targets it can be more
3656 complex. For very complex cases (currently, the HPPA and
3657 NS32K), you can define TC_CONS_FIX_NEW to do whatever you
3658 want. For simpler cases, you can define TC_CONS_RELOC to be
3659 the name of the reloc code that should be stored in the fixS.
3660 If neither is defined, the code uses NO_RELOC if it is
3661 defined, and otherwise uses 0. */
3663 #ifdef BFD_ASSEMBLER
3664 #ifdef TC_CONS_FIX_NEW
3665 TC_CONS_FIX_NEW (frag_now
, p
- frag_now
->fr_literal
, nbytes
, exp
);
3668 bfd_reloc_code_real_type r
;
3685 as_bad (_("unsupported BFD relocation size %u"), nbytes
);
3689 fix_new_exp (frag_now
, p
- frag_now
->fr_literal
, (int) nbytes
, exp
,
3694 #ifdef TC_CONS_FIX_NEW
3695 TC_CONS_FIX_NEW (frag_now
, p
- frag_now
->fr_literal
, nbytes
, exp
);
3697 /* Figure out which reloc number to use. Use TC_CONS_RELOC if
3698 it is defined, otherwise use NO_RELOC if it is defined,
3700 #ifndef TC_CONS_RELOC
3702 #define TC_CONS_RELOC NO_RELOC
3704 #define TC_CONS_RELOC 0
3707 fix_new_exp (frag_now
, p
- frag_now
->fr_literal
, (int) nbytes
, exp
, 0,
3709 #endif /* TC_CONS_FIX_NEW */
3710 #endif /* BFD_ASSEMBLER */
3714 #ifdef BITFIELD_CONS_EXPRESSIONS
3716 /* i960 assemblers, (eg, asm960), allow bitfields after ".byte" as
3717 w:x,y:z, where w and y are bitwidths and x and y are values. They
3718 then pack them all together. We do a little better in that we allow
3719 them in words, longs, etc. and we'll pack them in target byte order
3722 The rules are: pack least significat bit first, if a field doesn't
3723 entirely fit, put it in the next unit. Overflowing the bitfield is
3724 explicitly *not* even a warning. The bitwidth should be considered
3727 To use this function the tc-XXX.h file should define
3728 BITFIELD_CONS_EXPRESSIONS. */
3731 parse_bitfield_cons (exp
, nbytes
)
3733 unsigned int nbytes
;
3735 unsigned int bits_available
= BITS_PER_CHAR
* nbytes
;
3736 char *hold
= input_line_pointer
;
3738 (void) expression (exp
);
3740 if (*input_line_pointer
== ':')
3747 unsigned long width
;
3749 if (*input_line_pointer
!= ':')
3751 input_line_pointer
= hold
;
3753 } /* Next piece is not a bitfield. */
3755 /* In the general case, we can't allow
3756 full expressions with symbol
3757 differences and such. The relocation
3758 entries for symbols not defined in this
3759 assembly would require arbitrary field
3760 widths, positions, and masks which most
3761 of our current object formats don't
3764 In the specific case where a symbol
3765 *is* defined in this assembly, we
3766 *could* build fixups and track it, but
3767 this could lead to confusion for the
3768 backends. I'm lazy. I'll take any
3769 SEG_ABSOLUTE. I think that means that
3770 you can use a previous .set or
3771 .equ type symbol. xoxorich. */
3773 if (exp
->X_op
== O_absent
)
3775 as_warn (_("using a bit field width of zero"));
3776 exp
->X_add_number
= 0;
3777 exp
->X_op
= O_constant
;
3778 } /* Implied zero width bitfield. */
3780 if (exp
->X_op
!= O_constant
)
3782 *input_line_pointer
= '\0';
3783 as_bad (_("field width \"%s\" too complex for a bitfield"), hold
);
3784 *input_line_pointer
= ':';
3785 demand_empty_rest_of_line ();
3787 } /* Too complex. */
3789 if ((width
= exp
->X_add_number
) > (BITS_PER_CHAR
* nbytes
))
3791 as_warn (_("field width %lu too big to fit in %d bytes: truncated to %d bits"),
3792 width
, nbytes
, (BITS_PER_CHAR
* nbytes
));
3793 width
= BITS_PER_CHAR
* nbytes
;
3796 if (width
> bits_available
)
3798 /* FIXME-SOMEDAY: backing up and reparsing is wasteful. */
3799 input_line_pointer
= hold
;
3800 exp
->X_add_number
= value
;
3804 hold
= ++input_line_pointer
; /* skip ':' */
3806 (void) expression (exp
);
3807 if (exp
->X_op
!= O_constant
)
3809 char cache
= *input_line_pointer
;
3811 *input_line_pointer
= '\0';
3812 as_bad (_("field value \"%s\" too complex for a bitfield"), hold
);
3813 *input_line_pointer
= cache
;
3814 demand_empty_rest_of_line ();
3816 } /* Too complex. */
3818 value
|= ((~(-1 << width
) & exp
->X_add_number
)
3819 << ((BITS_PER_CHAR
* nbytes
) - bits_available
));
3821 if ((bits_available
-= width
) == 0
3822 || is_it_end_of_statement ()
3823 || *input_line_pointer
!= ',')
3826 } /* All the bitfields we're gonna get. */
3828 hold
= ++input_line_pointer
;
3829 (void) expression (exp
);
3832 exp
->X_add_number
= value
;
3833 exp
->X_op
= O_constant
;
3834 exp
->X_unsigned
= 1;
3838 #endif /* BITFIELD_CONS_EXPRESSIONS */
3840 /* Handle an MRI style string expression. */
3844 parse_mri_cons (exp
, nbytes
)
3846 unsigned int nbytes
;
3848 if (*input_line_pointer
!= '\''
3849 && (input_line_pointer
[1] != '\''
3850 || (*input_line_pointer
!= 'A'
3851 && *input_line_pointer
!= 'E')))
3852 TC_PARSE_CONS_EXPRESSION (exp
, nbytes
);
3856 unsigned int result
= 0;
3858 /* An MRI style string. Cut into as many bytes as will fit into
3859 a nbyte chunk, left justify if necessary, and separate with
3860 commas so we can try again later. */
3861 if (*input_line_pointer
== 'A')
3862 ++input_line_pointer
;
3863 else if (*input_line_pointer
== 'E')
3865 as_bad (_("EBCDIC constants are not supported"));
3866 ++input_line_pointer
;
3869 input_line_pointer
++;
3870 for (scan
= 0; scan
< nbytes
; scan
++)
3872 if (*input_line_pointer
== '\'')
3874 if (input_line_pointer
[1] == '\'')
3876 input_line_pointer
++;
3881 result
= (result
<< 8) | (*input_line_pointer
++);
3885 while (scan
< nbytes
)
3891 /* Create correct expression. */
3892 exp
->X_op
= O_constant
;
3893 exp
->X_add_number
= result
;
3895 /* Fake it so that we can read the next char too. */
3896 if (input_line_pointer
[0] != '\'' ||
3897 (input_line_pointer
[0] == '\'' && input_line_pointer
[1] == '\''))
3899 input_line_pointer
-= 2;
3900 input_line_pointer
[0] = ',';
3901 input_line_pointer
[1] = '\'';
3904 input_line_pointer
++;
3907 #endif /* TC_M68K */
3909 #ifdef REPEAT_CONS_EXPRESSIONS
3911 /* Parse a repeat expression for cons. This is used by the MIPS
3912 assembler. The format is NUMBER:COUNT; NUMBER appears in the
3913 object file COUNT times.
3915 To use this for a target, define REPEAT_CONS_EXPRESSIONS. */
3918 parse_repeat_cons (exp
, nbytes
)
3920 unsigned int nbytes
;
3927 if (*input_line_pointer
!= ':')
3929 /* No repeat count. */
3933 ++input_line_pointer
;
3934 expression (&count
);
3935 if (count
.X_op
!= O_constant
3936 || count
.X_add_number
<= 0)
3938 as_warn (_("Unresolvable or nonpositive repeat count; using 1"));
3942 /* The cons function is going to output this expression once. So we
3943 output it count - 1 times. */
3944 for (i
= count
.X_add_number
- 1; i
> 0; i
--)
3945 emit_expr (exp
, nbytes
);
3948 #endif /* REPEAT_CONS_EXPRESSIONS */
3950 /* Parse a floating point number represented as a hex constant. This
3951 permits users to specify the exact bits they want in the floating
3955 hex_float (float_type
, bytes
)
3989 as_bad (_("Unknown floating type type '%c'"), float_type
);
3993 /* It would be nice if we could go through expression to parse the
3994 hex constant, but if we get a bignum it's a pain to sort it into
3995 the buffer correctly. */
3997 while (hex_p (*input_line_pointer
) || *input_line_pointer
== '_')
4001 /* The MRI assembler accepts arbitrary underscores strewn about
4002 through the hex constant, so we ignore them as well. */
4003 if (*input_line_pointer
== '_')
4005 ++input_line_pointer
;
4011 as_warn (_("Floating point constant too large"));
4014 d
= hex_value (*input_line_pointer
) << 4;
4015 ++input_line_pointer
;
4016 while (*input_line_pointer
== '_')
4017 ++input_line_pointer
;
4018 if (hex_p (*input_line_pointer
))
4020 d
+= hex_value (*input_line_pointer
);
4021 ++input_line_pointer
;
4023 if (target_big_endian
)
4026 bytes
[length
- i
- 1] = d
;
4032 if (target_big_endian
)
4033 memset (bytes
+ i
, 0, length
- i
);
4035 memset (bytes
, 0, length
- i
);
4043 CONStruct some more frag chars of .floats .ffloats etc.
4044 Makes 0 or more new frags.
4045 If need_pass_2 == 1, no frags are emitted.
4046 This understands only floating literals, not expressions. Sorry.
4048 A floating constant is defined by atof_generic(), except it is preceded
4049 by 0d 0f 0g or 0h. After observing the STRANGE way my BSD AS does its
4050 reading, I decided to be incompatible. This always tries to give you
4051 rounded bits to the precision of the pseudo-op. Former AS did premature
4052 truncatation, restored noisy bits instead of trailing 0s AND gave you
4053 a choice of 2 flavours of noise according to which of 2 floating-point
4054 scanners you directed AS to use.
4056 In: input_line_pointer->whitespace before, or '0' of flonum. */
4059 float_cons (float_type
)
4060 /* Clobbers input_line-pointer, checks end-of-line. */
4061 register int float_type
; /* 'f':.ffloat ... 'F':.float ... */
4064 int length
; /* Number of chars in an object. */
4065 register char *err
; /* Error from scanning floating literal. */
4066 char temp
[MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT
];
4068 if (is_it_end_of_statement ())
4070 demand_empty_rest_of_line ();
4074 #ifdef md_flush_pending_output
4075 md_flush_pending_output ();
4080 /* input_line_pointer->1st char of a flonum (we hope!). */
4083 /* Skip any 0{letter} that may be present. Don't even check if the
4084 letter is legal. Someone may invent a "z" format and this routine
4085 has no use for such information. Lusers beware: you get
4086 diagnostics if your input is ill-conditioned. */
4087 if (input_line_pointer
[0] == '0'
4088 && isalpha ((unsigned char) input_line_pointer
[1]))
4089 input_line_pointer
+= 2;
4091 /* Accept :xxxx, where the x's are hex digits, for a floating
4092 point with the exact digits specified. */
4093 if (input_line_pointer
[0] == ':')
4095 ++input_line_pointer
;
4096 length
= hex_float (float_type
, temp
);
4099 ignore_rest_of_line ();
4105 err
= md_atof (float_type
, temp
, &length
);
4106 know (length
<= MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT
);
4110 as_bad (_("Bad floating literal: %s"), err
);
4111 ignore_rest_of_line ();
4122 #ifdef REPEAT_CONS_EXPRESSIONS
4123 if (*input_line_pointer
== ':')
4125 expressionS count_exp
;
4127 ++input_line_pointer
;
4128 expression (&count_exp
);
4130 if (count_exp
.X_op
!= O_constant
4131 || count_exp
.X_add_number
<= 0)
4132 as_warn (_("unresolvable or nonpositive repeat count; using 1"));
4134 count
= count_exp
.X_add_number
;
4138 while (--count
>= 0)
4140 p
= frag_more (length
);
4141 memcpy (p
, temp
, (unsigned int) length
);
4146 while (*input_line_pointer
++ == ',');
4148 /* Put terminator back into stream. */
4149 --input_line_pointer
;
4150 demand_empty_rest_of_line ();
4153 /* Return the size of a LEB128 value. */
4156 sizeof_sleb128 (value
)
4159 register int size
= 0;
4160 register unsigned byte
;
4164 byte
= (value
& 0x7f);
4165 /* Sadly, we cannot rely on typical arithmetic right shift behaviour.
4166 Fortunately, we can structure things so that the extra work reduces
4167 to a noop on systems that do things "properly". */
4168 value
= (value
>> 7) | ~(-(offsetT
)1 >> 7);
4171 while (!(((value
== 0) && ((byte
& 0x40) == 0))
4172 || ((value
== -1) && ((byte
& 0x40) != 0))));
4178 sizeof_uleb128 (value
)
4181 register int size
= 0;
4182 register unsigned byte
;
4186 byte
= (value
& 0x7f);
4196 sizeof_leb128 (value
, sign
)
4201 return sizeof_sleb128 ((offsetT
) value
);
4203 return sizeof_uleb128 (value
);
4206 /* Output a LEB128 value. */
4209 output_sleb128 (p
, value
)
4213 register char *orig
= p
;
4218 unsigned byte
= (value
& 0x7f);
4220 /* Sadly, we cannot rely on typical arithmetic right shift behaviour.
4221 Fortunately, we can structure things so that the extra work reduces
4222 to a noop on systems that do things "properly". */
4223 value
= (value
>> 7) | ~(-(offsetT
)1 >> 7);
4225 more
= !((((value
== 0) && ((byte
& 0x40) == 0))
4226 || ((value
== -1) && ((byte
& 0x40) != 0))));
4238 output_uleb128 (p
, value
)
4246 unsigned byte
= (value
& 0x7f);
4249 /* More bytes to follow. */
4260 output_leb128 (p
, value
, sign
)
4266 return output_sleb128 (p
, (offsetT
) value
);
4268 return output_uleb128 (p
, value
);
4271 /* Do the same for bignums. We combine sizeof with output here in that
4272 we don't output for NULL values of P. It isn't really as critical as
4273 for "normal" values that this be streamlined. */
4276 output_big_sleb128 (p
, bignum
, size
)
4278 LITTLENUM_TYPE
*bignum
;
4286 /* Strip leading sign extensions off the bignum. */
4287 while (size
> 0 && bignum
[size
- 1] == (LITTLENUM_TYPE
) -1)
4292 if (loaded
< 7 && size
> 0)
4294 val
|= (*bignum
<< loaded
);
4295 loaded
+= 8 * CHARS_PER_LITTLENUM
;
4306 if ((val
== 0 && (byte
& 0x40) == 0)
4307 || (~(val
| ~(((valueT
) 1 << loaded
) - 1)) == 0
4308 && (byte
& 0x40) != 0))
4316 while (byte
& 0x80);
4322 output_big_uleb128 (p
, bignum
, size
)
4324 LITTLENUM_TYPE
*bignum
;
4332 /* Strip leading zeros off the bignum. */
4333 /* XXX: Is this needed? */
4334 while (size
> 0 && bignum
[size
- 1] == 0)
4339 if (loaded
< 7 && size
> 0)
4341 val
|= (*bignum
<< loaded
);
4342 loaded
+= 8 * CHARS_PER_LITTLENUM
;
4351 if (size
> 0 || val
)
4358 while (byte
& 0x80);
4364 output_big_leb128 (p
, bignum
, size
, sign
)
4366 LITTLENUM_TYPE
*bignum
;
4370 return output_big_sleb128 (p
, bignum
, size
);
4372 return output_big_uleb128 (p
, bignum
, size
);
4375 /* Generate the appropriate fragments for a given expression to emit a
4379 emit_leb128_expr (exp
, sign
)
4383 operatorT op
= exp
->X_op
;
4385 if (op
== O_absent
|| op
== O_illegal
)
4387 as_warn (_("zero assumed for missing expression"));
4388 exp
->X_add_number
= 0;
4391 else if (op
== O_big
&& exp
->X_add_number
<= 0)
4393 as_bad (_("floating point number invalid; zero assumed"));
4394 exp
->X_add_number
= 0;
4397 else if (op
== O_register
)
4399 as_warn (_("register value used as expression"));
4403 if (op
== O_constant
)
4405 /* If we've got a constant, emit the thing directly right now. */
4407 valueT value
= exp
->X_add_number
;
4411 size
= sizeof_leb128 (value
, sign
);
4412 p
= frag_more (size
);
4413 output_leb128 (p
, value
, sign
);
4415 else if (op
== O_big
)
4417 /* O_big is a different sort of constant. */
4422 size
= output_big_leb128 (NULL
, generic_bignum
, exp
->X_add_number
, sign
);
4423 p
= frag_more (size
);
4424 output_big_leb128 (p
, generic_bignum
, exp
->X_add_number
, sign
);
4428 /* Otherwise, we have to create a variable sized fragment and
4429 resolve things later. */
4431 frag_var (rs_leb128
, sizeof_uleb128 (~(valueT
) 0), 0, sign
,
4432 make_expr_symbol (exp
), 0, (char *) NULL
);
4436 /* Parse the .sleb128 and .uleb128 pseudos. */
4447 emit_leb128_expr (&exp
, sign
);
4449 while (*input_line_pointer
++ == ',');
4451 input_line_pointer
--;
4452 demand_empty_rest_of_line ();
4455 /* We read 0 or more ',' separated, double-quoted strings.
4456 Caller should have checked need_pass_2 is FALSE because we don't
4460 stringer (append_zero
) /* Worker to do .ascii etc statements. */
4461 /* Checks end-of-line. */
4462 register int append_zero
; /* 0: don't append '\0', else 1. */
4464 register unsigned int c
;
4467 #ifdef md_flush_pending_output
4468 md_flush_pending_output ();
4471 /* The following awkward logic is to parse ZERO or more strings,
4472 comma separated. Recall a string expression includes spaces
4473 before the opening '\"' and spaces after the closing '\"'.
4474 We fake a leading ',' if there is (supposed to be)
4475 a 1st, expression. We keep demanding expressions for each ','. */
4476 if (is_it_end_of_statement ())
4478 c
= 0; /* Skip loop. */
4479 ++input_line_pointer
; /* Compensate for end of loop. */
4483 c
= ','; /* Do loop. */
4485 while (c
== ',' || c
== '<' || c
== '"')
4488 switch (*input_line_pointer
)
4491 ++input_line_pointer
; /*->1st char of string. */
4492 start
= input_line_pointer
;
4493 while (is_a_char (c
= next_char_of_string ()))
4495 FRAG_APPEND_1_CHAR (c
);
4499 FRAG_APPEND_1_CHAR (0);
4501 know (input_line_pointer
[-1] == '\"');
4505 /* In ELF, when gcc is emitting DWARF 1 debugging output, it
4506 will emit .string with a filename in the .debug section
4507 after a sequence of constants. See the comment in
4508 emit_expr for the sequence. emit_expr will set
4509 dwarf_file_string to non-zero if this string might be a
4510 source file name. */
4511 if (strcmp (segment_name (now_seg
), ".debug") != 0)
4512 dwarf_file_string
= 0;
4513 else if (dwarf_file_string
)
4515 c
= input_line_pointer
[-1];
4516 input_line_pointer
[-1] = '\0';
4517 listing_source_file (start
);
4518 input_line_pointer
[-1] = c
;
4525 input_line_pointer
++;
4526 c
= get_single_number ();
4527 FRAG_APPEND_1_CHAR (c
);
4528 if (*input_line_pointer
!= '>')
4530 as_bad (_("Expected <nn>"));
4532 input_line_pointer
++;
4535 input_line_pointer
++;
4539 c
= *input_line_pointer
;
4542 demand_empty_rest_of_line ();
4545 /* FIXME-SOMEDAY: I had trouble here on characters with the
4546 high bits set. We'll probably also have trouble with
4547 multibyte chars, wide chars, etc. Also be careful about
4548 returning values bigger than 1 byte. xoxorich. */
4551 next_char_of_string ()
4553 register unsigned int c
;
4555 c
= *input_line_pointer
++ & CHAR_MASK
;
4563 as_warn (_("Unterminated string: Newline inserted."));
4564 bump_line_counters ();
4567 #ifndef NO_STRING_ESCAPES
4569 switch (c
= *input_line_pointer
++)
4597 break; /* As itself. */
4613 for (i
= 0, number
= 0;
4614 isdigit (c
) && i
< 3;
4615 c
= *input_line_pointer
++, i
++)
4617 number
= number
* 8 + c
- '0';
4622 --input_line_pointer
;
4631 c
= *input_line_pointer
++;
4632 while (isxdigit (c
))
4635 number
= number
* 16 + c
- '0';
4636 else if (isupper (c
))
4637 number
= number
* 16 + c
- 'A' + 10;
4639 number
= number
* 16 + c
- 'a' + 10;
4640 c
= *input_line_pointer
++;
4643 --input_line_pointer
;
4648 /* To be compatible with BSD 4.2 as: give the luser a linefeed!! */
4649 as_warn (_("Unterminated string: Newline inserted."));
4651 bump_line_counters ();
4656 #ifdef ONLY_STANDARD_ESCAPES
4657 as_bad (_("Bad escaped character in string, '?' assumed"));
4659 #endif /* ONLY_STANDARD_ESCAPES */
4664 #endif /* ! defined (NO_STRING_ESCAPES) */
4673 get_segmented_expression (expP
)
4674 register expressionS
*expP
;
4676 register segT retval
;
4678 retval
= expression (expP
);
4679 if (expP
->X_op
== O_illegal
4680 || expP
->X_op
== O_absent
4681 || expP
->X_op
== O_big
)
4683 as_bad (_("expected address expression; zero assumed"));
4684 expP
->X_op
= O_constant
;
4685 expP
->X_add_number
= 0;
4686 retval
= absolute_section
;
4692 get_known_segmented_expression (expP
)
4693 register expressionS
*expP
;
4695 register segT retval
;
4697 if ((retval
= get_segmented_expression (expP
)) == undefined_section
)
4699 /* There is no easy way to extract the undefined symbol from the
4701 if (expP
->X_add_symbol
!= NULL
4702 && S_GET_SEGMENT (expP
->X_add_symbol
) != expr_section
)
4703 as_warn (_("symbol \"%s\" undefined; zero assumed"),
4704 S_GET_NAME (expP
->X_add_symbol
));
4706 as_warn (_("some symbol undefined; zero assumed"));
4707 retval
= absolute_section
;
4708 expP
->X_op
= O_constant
;
4709 expP
->X_add_number
= 0;
4711 know (retval
== absolute_section
|| SEG_NORMAL (retval
));
4716 get_absolute_expression ()
4721 if (exp
.X_op
!= O_constant
)
4723 if (exp
.X_op
!= O_absent
)
4724 as_bad (_("bad or irreducible absolute expression; zero assumed"));
4725 exp
.X_add_number
= 0;
4727 return exp
.X_add_number
;
4730 char /* Return terminator. */
4731 get_absolute_expression_and_terminator (val_pointer
)
4732 long *val_pointer
; /* Return value of expression. */
4734 /* FIXME: val_pointer should probably be offsetT *. */
4735 *val_pointer
= (long) get_absolute_expression ();
4736 return (*input_line_pointer
++);
4739 /* Like demand_copy_string, but return NULL if the string contains any '\0's.
4740 Give a warning if that happens. */
4743 demand_copy_C_string (len_pointer
)
4748 if ((s
= demand_copy_string (len_pointer
)) != 0)
4752 for (len
= *len_pointer
; len
> 0; len
--)
4759 as_bad (_("This string may not contain \'\\0\'"));
4767 /* Demand string, but return a safe (=private) copy of the string.
4768 Return NULL if we can't read a string here. */
4771 demand_copy_string (lenP
)
4774 register unsigned int c
;
4780 if (*input_line_pointer
== '\"')
4782 input_line_pointer
++; /* Skip opening quote. */
4784 while (is_a_char (c
= next_char_of_string ()))
4786 obstack_1grow (¬es
, c
);
4789 /* JF this next line is so demand_copy_C_string will return a
4790 null terminated string. */
4791 obstack_1grow (¬es
, '\0');
4792 retval
= obstack_finish (¬es
);
4796 as_warn (_("Missing string"));
4798 ignore_rest_of_line ();
4804 /* In: Input_line_pointer->next character.
4806 Do: Skip input_line_pointer over all whitespace.
4808 Out: 1 if input_line_pointer->end-of-line. */
4811 is_it_end_of_statement ()
4814 return (is_end_of_line
[(unsigned char) *input_line_pointer
]);
4818 equals (sym_name
, reassign
)
4822 register symbolS
*symbolP
; /* Symbol we are working with. */
4826 input_line_pointer
++;
4827 if (*input_line_pointer
== '=')
4828 input_line_pointer
++;
4830 while (*input_line_pointer
== ' ' || *input_line_pointer
== '\t')
4831 input_line_pointer
++;
4834 stop
= mri_comment_field (&stopc
);
4836 if (sym_name
[0] == '.' && sym_name
[1] == '\0')
4838 /* Turn '. = mumble' into a .org mumble. */
4839 register segT segment
;
4842 segment
= get_known_segmented_expression (&exp
);
4844 do_org (segment
, &exp
, 0);
4848 symbolP
= symbol_find_or_make (sym_name
);
4849 /* Permit register names to be redefined. */
4851 && S_IS_DEFINED (symbolP
)
4852 && S_GET_SEGMENT (symbolP
) != reg_section
)
4853 as_bad (_("symbol `%s' already defined"), S_GET_NAME (symbolP
));
4854 pseudo_set (symbolP
);
4859 /* Check garbage after the expression. */
4860 ignore_rest_of_line ();
4861 mri_comment_end (stop
, stopc
);
4865 /* .include -- include a file at this point. */
4869 int arg ATTRIBUTE_UNUSED
;
4878 filename
= demand_copy_string (&i
);
4879 if (filename
== NULL
)
4881 /* demand_copy_string has already printed an error and
4882 called ignore_rest_of_line. */
4890 while (!is_end_of_line
[(unsigned char) *input_line_pointer
]
4891 && *input_line_pointer
!= ' '
4892 && *input_line_pointer
!= '\t')
4894 obstack_1grow (¬es
, *input_line_pointer
);
4895 ++input_line_pointer
;
4899 obstack_1grow (¬es
, '\0');
4900 filename
= obstack_finish (¬es
);
4901 while (!is_end_of_line
[(unsigned char) *input_line_pointer
])
4902 ++input_line_pointer
;
4905 demand_empty_rest_of_line ();
4906 path
= xmalloc ((unsigned long) i
+ include_dir_maxlen
+ 5 /* slop */ );
4908 for (i
= 0; i
< include_dir_count
; i
++)
4910 strcpy (path
, include_dirs
[i
]);
4912 strcat (path
, filename
);
4913 if (0 != (try = fopen (path
, "r")))
4923 /* malloc Storage leak when file is found on path. FIXME-SOMEDAY. */
4924 register_dependency (path
);
4925 input_scrub_insert_file (path
);
4929 add_include_dir (path
)
4934 if (include_dir_count
== 0)
4936 include_dirs
= (char **) xmalloc (2 * sizeof (*include_dirs
));
4937 include_dirs
[0] = "."; /* Current dir. */
4938 include_dir_count
= 2;
4942 include_dir_count
++;
4944 (char **) realloc (include_dirs
,
4945 include_dir_count
* sizeof (*include_dirs
));
4948 include_dirs
[include_dir_count
- 1] = path
; /* New one. */
4951 if (i
> include_dir_maxlen
)
4952 include_dir_maxlen
= i
;
4955 /* Output debugging information to denote the source file. */
4958 generate_file_debug ()
4960 if (debug_type
== DEBUG_STABS
)
4961 stabs_generate_asm_file ();
4964 /* Output line number debugging information for the current source line. */
4967 generate_lineno_debug ()
4969 #ifdef ECOFF_DEBUGGING
4970 /* ECOFF assemblers automatically generate debugging information.
4971 FIXME: This should probably be handled elsewhere. */
4972 if (debug_type
== DEBUG_UNSPECIFIED
)
4974 if (ECOFF_DEBUGGING
&& ecoff_no_current_file ())
4975 debug_type
= DEBUG_ECOFF
;
4977 debug_type
= DEBUG_NONE
;
4983 case DEBUG_UNSPECIFIED
:
4987 stabs_generate_asm_lineno ();
4990 ecoff_generate_asm_lineno ();
4999 /* Output debugging information to mark a function entry point or end point.
5000 END_P is zero for .func, and non-zero for .endfunc. */
5006 do_s_func (end_p
, NULL
);
5009 /* Subroutine of s_func so targets can choose a different default prefix.
5010 If DEFAULT_PREFIX is NULL, use the target's "leading char". */
5013 do_s_func (end_p
, default_prefix
)
5015 const char *default_prefix
;
5017 /* Record the current function so that we can issue an error message for
5018 misplaced .func,.endfunc, and also so that .endfunc needs no
5020 static char *current_name
;
5021 static char *current_label
;
5025 if (current_name
== NULL
)
5027 as_bad (_("missing .func"));
5028 ignore_rest_of_line ();
5032 if (debug_type
== DEBUG_STABS
)
5033 stabs_generate_asm_endfunc (current_name
, current_label
);
5035 current_name
= current_label
= NULL
;
5040 char delim1
, delim2
;
5042 if (current_name
!= NULL
)
5044 as_bad (_(".endfunc missing for previous .func"));
5045 ignore_rest_of_line ();
5049 name
= input_line_pointer
;
5050 delim1
= get_symbol_end ();
5051 name
= xstrdup (name
);
5052 *input_line_pointer
= delim1
;
5054 if (*input_line_pointer
!= ',')
5057 asprintf (&label
, "%s%s", default_prefix
, name
);
5060 char leading_char
= 0;
5061 #ifdef BFD_ASSEMBLER
5062 leading_char
= bfd_get_symbol_leading_char (stdoutput
);
5064 /* Missing entry point, use function's name with the leading
5067 asprintf (&label
, "%c%s", leading_char
, name
);
5074 ++input_line_pointer
;
5076 label
= input_line_pointer
;
5077 delim2
= get_symbol_end ();
5078 label
= xstrdup (label
);
5079 *input_line_pointer
= delim2
;
5082 if (debug_type
== DEBUG_STABS
)
5083 stabs_generate_asm_func (name
, label
);
5085 current_name
= name
;
5086 current_label
= label
;
5089 demand_empty_rest_of_line ();
5094 int arg ATTRIBUTE_UNUSED
;
5096 while (!is_end_of_line
[(unsigned char) *input_line_pointer
])
5098 ++input_line_pointer
;
5100 ++input_line_pointer
;
5104 read_print_statistics (file
)
5107 hash_print_statistics (file
, "pseudo-op table", po_hash
);
5110 /* Inserts the given line into the input stream.
5112 This call avoids macro/conditionals nesting checking, since the contents of
5113 the line are assumed to replace the contents of a line already scanned.
5115 An appropriate use of this function would be substition of input lines when
5116 called by md_start_line_hook(). The given line is assumed to already be
5117 properly scrubbed. */
5120 input_scrub_insert_line (line
)
5125 sb_add_string (&newline
, line
);
5126 input_scrub_include_sb (&newline
, input_line_pointer
, 0);
5128 buffer_limit
= input_scrub_next_buffer (&input_line_pointer
);
5131 /* Insert a file into the input stream; the path must resolve to an actual
5132 file; no include path searching or dependency registering is performed. */
5135 input_scrub_insert_file (path
)
5138 input_scrub_include_file (path
, input_line_pointer
);
5139 buffer_limit
= input_scrub_next_buffer (&input_line_pointer
);