Clean up hash code, parameterize some actions, tweak some parameters. Hash
[deliverable/binutils-gdb.git] / gas / read.c
CommitLineData
fecd2382 1/* read.c - read a source file -
ddb393cf
ILT
2 Copyright (C) 1986, 1987, 1990, 1991, 1993, 1994
3 Free Software Foundation, Inc.
3340f7e5 4
f8701a3f
SC
5This file is part of GAS, the GNU Assembler.
6
7GAS is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 2, or (at your option)
10any later version.
11
12GAS is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with GAS; see the file COPYING. If not, write to
a2a5a4fa 19the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
fecd2382 20
016e0d42 21#if 0
fecd2382
RP
22#define MASK_CHAR (0xFF) /* If your chars aren't 8 bits, you will
23 change this a bit. But then, GNU isn't
24 spozed to run on your machine anyway.
25 (RMS is so shortsighted sometimes.)
26 */
016e0d42
ILT
27#else
28#define MASK_CHAR ((int)(unsigned char)-1)
29#endif
fecd2382 30
9a7d824a 31
9471a360
KR
32/* This is the largest known floating point format (for now). It will
33 grow when we do 4361 style flonums. */
fecd2382 34
9471a360 35#define MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT (16)
fecd2382 36
016e0d42
ILT
37/* Routines that read assembler source text to build spagetti in memory.
38 Another group of these functions is in the expr.c module. */
fecd2382 39
9471a360 40/* for isdigit() */
6efd877d
KR
41#include <ctype.h>
42
fecd2382 43#include "as.h"
9471a360 44#include "subsegs.h"
7e047ac2
ILT
45#include "sb.h"
46#include "macro.h"
1356d77d 47#include "libiberty.h"
fecd2382 48#include "obstack.h"
9a7d824a
ILT
49#include "listing.h"
50
9a7d824a
ILT
51#ifndef TC_START_LABEL
52#define TC_START_LABEL(x,y) (x==':')
53#endif
fecd2382 54
016e0d42
ILT
55/* The NOP_OPCODE is for the alignment fill value.
56 * fill it a nop instruction so that the disassembler does not choke
57 * on it
58 */
59#ifndef NOP_OPCODE
60#define NOP_OPCODE 0x00
61#endif
62
63char *input_line_pointer; /*->next char of source file to parse. */
fecd2382 64
326d16ca 65int generate_asm_lineno = 0; /* flag to generate line stab for .s file */
daad3bbf 66
fecd2382 67#if BITS_PER_CHAR != 8
6efd877d
KR
68/* The following table is indexed by[(char)] and will break if
69 a char does not have exactly 256 states (hopefully 0:255!)! */
70die horribly;
fecd2382 71#endif
f8701a3f 72
c978e704
ILT
73#ifndef LEX_AT
74/* The m88k unfortunately uses @ as a label beginner. */
75#define LEX_AT 0
76#endif
77
ddb393cf
ILT
78#ifndef LEX_BR
79/* The RS/6000 assembler uses {,},[,] as parts of symbol names. */
80#define LEX_BR 0
81#endif
82
6ef37255
KR
83#ifndef LEX_PCT
84/* The Delta 68k assembler permits % inside label names. */
85#define LEX_PCT 0
86#endif
87
18c9057f
ILT
88#ifndef LEX_QM
89/* The PowerPC Windows NT assemblers permits ? inside label names. */
90#define LEX_QM 0
91#endif
92
6594d6b9
KR
93#ifndef LEX_DOLLAR
94/* The a29k assembler does not permits labels to start with $. */
95#define LEX_DOLLAR 3
96#endif
97
016e0d42 98/* used by is_... macros. our ctype[] */
1356d77d 99char lex_type[256] =
016e0d42
ILT
100{
101 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* @ABCDEFGHIJKLMNO */
102 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* PQRSTUVWXYZ[\]^_ */
6594d6b9 103 0, 0, 0, 0, LEX_DOLLAR, LEX_PCT, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, /* _!"#$%&'()*+,-./ */
18c9057f 104 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, LEX_QM, /* 0123456789:;<=>? */
c978e704 105 LEX_AT, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* @ABCDEFGHIJKLMNO */
ddb393cf 106 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, LEX_BR, 0, LEX_BR, 0, 3, /* PQRSTUVWXYZ[\]^_ */
016e0d42 107 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* `abcdefghijklmno */
ddb393cf 108 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, LEX_BR, 0, LEX_BR, 0, 0, /* pqrstuvwxyz{|}~. */
016e0d42
ILT
109 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
110 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
111 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
112 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
113 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
114 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
115 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
116};
117
118
119/*
fecd2382
RP
120 * In: a character.
121 * Out: 1 if this character ends a line.
122 */
123#define _ (0)
016e0d42
ILT
124char is_end_of_line[256] =
125{
fecd2382 126#ifdef CR_EOL
016e0d42 127 _, _, _, _, _, _, _, _, _, _, 99, _, _, 99, _, _, /* @abcdefghijklmno */
fecd2382 128#else
016e0d42 129 _, _, _, _, _, _, _, _, _, _, 99, _, _, _, _, _, /* @abcdefghijklmno */
fecd2382 130#endif
016e0d42 131 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, /* */
40324362
KR
132#ifdef TC_HPPA
133 _,99, _, _, _, _, _, _, _, _, _, _, _, _, _, _, /* _!"#$%&'()*+,-./ */
134 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, /* 0123456789:;<=>? */
135#else
016e0d42
ILT
136 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, /* */
137 _, _, _, _, _, _, _, _, _, _, _, 99, _, _, _, _, /* 0123456789:;<=>? */
40324362 138#endif
016e0d42
ILT
139 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, /* */
140 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, /* */
141 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, /* */
142 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, /* */
143 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, /* */
144 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, /* */
145 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, /* */
146 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, /* */
147 _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, /* */
148};
fecd2382
RP
149#undef _
150
016e0d42
ILT
151/* Functions private to this file. */
152
153static char *buffer; /* 1st char of each buffer of lines is here. */
154static char *buffer_limit; /*->1 + last char in buffer. */
fecd2382 155
2209b19c
KR
156#ifdef TARGET_BYTES_BIG_ENDIAN
157/* Hack to deal with tc-*.h defining TARGET_BYTES_BIG_ENDIAN to empty
158 instead of to 0 or 1. */
159#if 5 - TARGET_BYTES_BIG_ENDIAN - 5 == 10
160#undef TARGET_BYTES_BIG_ENDIAN
161#define TARGET_BYTES_BIG_ENDIAN 1
162#endif
163int target_big_endian = TARGET_BYTES_BIG_ENDIAN;
164#else
165int target_big_endian /* = 0 */;
166#endif
9c6d3f66 167
9471a360 168static char *old_buffer; /* JF a hack */
016e0d42
ILT
169static char *old_input;
170static char *old_limit;
fecd2382 171
016e0d42 172/* Variables for handling include file directory list. */
fecd2382 173
016e0d42
ILT
174char **include_dirs; /* List of pointers to directories to
175 search for .include's */
176int include_dir_count; /* How many are in the list */
177int include_dir_maxlen = 1;/* Length of longest in list */
fecd2382
RP
178
179#ifndef WORKING_DOT_WORD
016e0d42 180struct broken_word *broken_words;
9471a360 181int new_broken_words;
fecd2382
RP
182#endif
183
e28c40d7
ILT
184/* The current offset into the absolute section. We don't try to
185 build frags in the absolute section, since no data can be stored
186 there. We just keep track of the current offset. */
187addressT abs_section_offset;
188
1356d77d
ILT
189/* If this line had an MRI style label, it is stored in this variable.
190 This is used by some of the MRI pseudo-ops. */
7e047ac2 191symbolS *line_label;
1356d77d
ILT
192
193/* This global variable is used to support MRI common sections. We
194 translate such sections into a common symbol. This variable is
195 non-NULL when we are in an MRI common section. */
196symbolS *mri_common_symbol;
197
286cb27a
ILT
198/* In MRI mode, after a dc.b pseudo-op with an odd number of bytes, we
199 need to align to an even byte boundary unless the next pseudo-op is
200 dc.b, ds.b, or dcb.b. This variable is set to 1 if an alignment
201 may be needed. */
202static int mri_pending_align;
203
86038ada 204static int scrub_from_string PARAMS ((char **));
286cb27a 205static void do_align PARAMS ((int, char *));
e28c40d7
ILT
206static int hex_float PARAMS ((int, char *));
207static void do_org PARAMS ((segT, expressionS *, int));
6ef37255 208char *demand_copy_string PARAMS ((int *lenP));
016e0d42 209int is_it_end_of_statement PARAMS ((void));
5ac34ac3 210static segT get_segmented_expression PARAMS ((expressionS *expP));
016e0d42 211static segT get_known_segmented_expression PARAMS ((expressionS * expP));
016e0d42 212static void pobegin PARAMS ((void));
7e047ac2 213static int get_line_sb PARAMS ((sb *));
fecd2382 214\f
6efd877d 215
016e0d42
ILT
216void
217read_begin ()
fecd2382 218{
016e0d42 219 const char *p;
f8701a3f 220
6efd877d
KR
221 pobegin ();
222 obj_read_begin_hook ();
f8701a3f 223
4380166d
KR
224 /* Something close -- but not too close -- to a multiple of 1024.
225 The debugging malloc I'm using has 24 bytes of overhead. */
6594d6b9
KR
226 obstack_begin (&notes, chunksize);
227 obstack_begin (&cond_obstack, chunksize);
f8701a3f 228
f8701a3f
SC
229 /* Use machine dependent syntax */
230 for (p = line_separator_chars; *p; p++)
58d4951d 231 is_end_of_line[(unsigned char) *p] = 1;
f8701a3f 232 /* Use more. FIXME-SOMEDAY. */
1356d77d
ILT
233
234 if (flag_mri)
235 lex_type['?'] = 3;
fecd2382
RP
236}
237\f
238/* set up pseudo-op tables */
239
1356d77d 240static struct hash_control *po_hash;
fecd2382 241
016e0d42 242static const pseudo_typeS potable[] =
fecd2382 243{
6efd877d
KR
244 {"abort", s_abort, 0},
245 {"align", s_align_ptwo, 0},
246 {"ascii", stringer, 0},
247 {"asciz", stringer, 1},
931a8fab 248 {"balign", s_align_bytes, 0},
f8701a3f 249/* block */
6efd877d
KR
250 {"byte", cons, 1},
251 {"comm", s_comm, 0},
1356d77d
ILT
252 {"common", s_mri_common, 0},
253 {"common.s", s_mri_common, 1},
6efd877d 254 {"data", s_data, 0},
1356d77d
ILT
255 {"dc", cons, 2},
256 {"dc.b", cons, 1},
257 {"dc.d", float_cons, 'd'},
258 {"dc.l", cons, 4},
259 {"dc.s", float_cons, 'f'},
260 {"dc.w", cons, 2},
261 {"dc.x", float_cons, 'x'},
e28c40d7
ILT
262 {"dcb", s_space, 2},
263 {"dcb.b", s_space, 1},
264 {"dcb.d", s_float_space, 'd'},
265 {"dcb.l", s_space, 4},
266 {"dcb.s", s_float_space, 'f'},
267 {"dcb.w", s_space, 2},
268 {"dcb.x", s_float_space, 'x'},
1356d77d
ILT
269 {"ds", s_space, 2},
270 {"ds.b", s_space, 1},
e28c40d7 271 {"ds.d", s_space, 8},
1356d77d 272 {"ds.l", s_space, 4},
e28c40d7
ILT
273 {"ds.p", s_space, 12},
274 {"ds.s", s_space, 4},
1356d77d 275 {"ds.w", s_space, 2},
e28c40d7 276 {"ds.x", s_space, 12},
42ac8fa8 277 {"debug", s_ignore, 0},
604633ae 278#ifdef S_SET_DESC
4064305e 279 {"desc", s_desc, 0},
604633ae 280#endif
f8701a3f 281/* dim */
6efd877d 282 {"double", float_cons, 'd'},
f8701a3f 283/* dsect */
6efd877d
KR
284 {"eject", listing_eject, 0}, /* Formfeed listing */
285 {"else", s_else, 0},
e28c40d7 286 {"elsec", s_else, 0},
6efd877d 287 {"end", s_end, 0},
e28c40d7 288 {"endc", s_endif, 0},
6efd877d 289 {"endif", s_endif, 0},
f8701a3f 290/* endef */
6efd877d 291 {"equ", s_set, 0},
42ac8fa8 292 {"err", s_err, 0},
7e047ac2 293 {"exitm", s_mexit, 0},
f8701a3f 294/* extend */
6efd877d 295 {"extern", s_ignore, 0}, /* We treat all undef as ext */
9a7d824a
ILT
296 {"appfile", s_app_file, 1},
297 {"appline", s_app_line, 0},
e28c40d7 298 {"fail", s_fail, 0},
6efd877d
KR
299 {"file", s_app_file, 0},
300 {"fill", s_fill, 0},
301 {"float", float_cons, 'f'},
e28c40d7 302 {"format", s_ignore, 0},
6efd877d
KR
303 {"global", s_globl, 0},
304 {"globl", s_globl, 0},
305 {"hword", cons, 2},
e28c40d7 306 {"if", s_if, (int) O_ne},
7e047ac2 307 {"ifc", s_ifc, 0},
6efd877d 308 {"ifdef", s_ifdef, 0},
e28c40d7 309 {"ifeq", s_if, (int) O_eq},
6efd877d 310 {"ifeqs", s_ifeqs, 0},
e28c40d7
ILT
311 {"ifge", s_if, (int) O_ge},
312 {"ifgt", s_if, (int) O_gt},
313 {"ifle", s_if, (int) O_le},
314 {"iflt", s_if, (int) O_lt},
7e047ac2 315 {"ifnc", s_ifc, 1},
6efd877d 316 {"ifndef", s_ifdef, 1},
e28c40d7 317 {"ifne", s_if, (int) O_ne},
6efd877d
KR
318 {"ifnes", s_ifeqs, 1},
319 {"ifnotdef", s_ifdef, 1},
320 {"include", s_include, 0},
321 {"int", cons, 4},
7e047ac2 322 {"irp", s_irp, 0},
42ac8fa8 323 {"irep", s_irp, 0},
7e047ac2 324 {"irpc", s_irp, 1},
42ac8fa8 325 {"irepc", s_irp, 1},
6efd877d
KR
326 {"lcomm", s_lcomm, 0},
327 {"lflags", listing_flags, 0}, /* Listing flags */
328 {"list", listing_list, 1}, /* Turn listing on */
e28c40d7 329 {"llen", listing_psize, 1},
6efd877d
KR
330 {"long", cons, 4},
331 {"lsym", s_lsym, 0},
7e047ac2
ILT
332 {"macro", s_macro, 0},
333 {"mexit", s_mexit, 0},
e28c40d7 334 {"noformat", s_ignore, 0},
6efd877d 335 {"nolist", listing_list, 0}, /* Turn listing off */
69e077f3 336 {"nopage", listing_nopage, 0},
80aab579 337 {"octa", cons, 16},
e28c40d7 338 {"offset", s_struct, 0},
6efd877d 339 {"org", s_org, 0},
931a8fab 340 {"p2align", s_align_ptwo, 0},
69e077f3
ILT
341 {"page", listing_eject, 0},
342 {"plen", listing_psize, 0},
42ac8fa8 343 {"print", s_print, 0},
6efd877d 344 {"psize", listing_psize, 0}, /* set paper size */
42ac8fa8 345 {"purgem", s_purgem, 0},
80aab579 346 {"quad", cons, 8},
42ac8fa8 347 {"rep", s_rept, 0},
7e047ac2 348 {"rept", s_rept, 0},
86038ada 349 {"rva", s_rva, 4},
6efd877d 350 {"sbttl", listing_title, 1}, /* Subtitle of listing */
f8701a3f
SC
351/* scl */
352/* sect */
6efd877d
KR
353 {"set", s_set, 0},
354 {"short", cons, 2},
355 {"single", float_cons, 'f'},
f8701a3f 356/* size */
6efd877d 357 {"space", s_space, 0},
e14994d9 358 {"spc", s_ignore, 0},
4064305e
SS
359 {"stabd", s_stab, 'd'},
360 {"stabn", s_stab, 'n'},
361 {"stabs", s_stab, 's'},
ba71c54d 362 {"string", stringer, 1},
e28c40d7 363 {"struct", s_struct, 0},
f8701a3f 364/* tag */
6efd877d 365 {"text", s_text, 0},
6ef37255
KR
366
367 /* This is for gcc to use. It's only just been added (2/94), so gcc
368 won't be able to use it for a while -- probably a year or more.
369 But once this has been released, check with gcc maintainers
370 before deleting it or even changing the spelling. */
371 {"this_GCC_requires_the_GNU_assembler", s_ignore, 0},
372 /* If we're folding case -- done for some targets, not necessarily
373 all -- the above string in an input file will be converted to
374 this one. Match it either way... */
375 {"this_gcc_requires_the_gnu_assembler", s_ignore, 0},
376
6efd877d 377 {"title", listing_title, 0}, /* Listing title */
e14994d9 378 {"ttl", listing_title, 0},
f8701a3f
SC
379/* type */
380/* use */
381/* val */
e14994d9 382 {"xcom", s_comm, 0},
1356d77d 383 {"xdef", s_globl, 0},
e14994d9 384 {"xref", s_ignore, 0},
4064305e 385 {"xstabs", s_xstab, 's'},
6efd877d 386 {"word", cons, 2},
c02fd8dc 387 {"zero", s_space, 0},
6efd877d 388 {NULL} /* end sentinel */
fecd2382
RP
389};
390
2209b19c
KR
391static int pop_override_ok = 0;
392static const char *pop_table_name;
393
394void
395pop_insert (table)
396 const pseudo_typeS *table;
6efd877d 397{
2209b19c 398 const char *errtxt;
6efd877d 399 const pseudo_typeS *pop;
2209b19c
KR
400 for (pop = table; pop->poc_name; pop++)
401 {
402 errtxt = hash_insert (po_hash, pop->poc_name, (char *) pop);
403 if (errtxt && (!pop_override_ok || strcmp (errtxt, "exists")))
6594d6b9
KR
404 as_fatal ("error constructing %s pseudo-op table: %s", pop_table_name,
405 errtxt);
2209b19c
KR
406 }
407}
6efd877d 408
2209b19c
KR
409#ifndef md_pop_insert
410#define md_pop_insert() pop_insert(md_pseudo_table)
411#endif
412
413#ifndef obj_pop_insert
414#define obj_pop_insert() pop_insert(obj_pseudo_table)
415#endif
416
417static void
418pobegin ()
419{
6efd877d
KR
420 po_hash = hash_new ();
421
422 /* Do the target-specific pseudo ops. */
2209b19c
KR
423 pop_table_name = "md";
424 md_pop_insert ();
6efd877d
KR
425
426 /* Now object specific. Skip any that were in the target table. */
2209b19c
KR
427 pop_table_name = "obj";
428 pop_override_ok = 1;
429 obj_pop_insert ();
6efd877d
KR
430
431 /* Now portable ones. Skip any that we've seen already. */
2209b19c
KR
432 pop_table_name = "standard";
433 pop_insert (potable);
434}
fecd2382 435\f
58d4951d
ILT
436#define HANDLE_CONDITIONAL_ASSEMBLY() \
437 if (ignore_input ()) \
438 { \
439 while (! is_end_of_line[(unsigned char) *input_line_pointer++]) \
440 if (input_line_pointer == buffer_limit) \
441 break; \
442 continue; \
f8701a3f 443 }
a39116f1 444
fecd2382 445
86038ada
ILT
446/* This function is used when scrubbing the characters between #APP
447 and #NO_APP. */
448
449static char *scrub_string;
450static char *scrub_string_end;
451
452static int
453scrub_from_string (from)
454 char **from;
455{
456 int size;
457
458 *from = scrub_string;
459 size = scrub_string_end - scrub_string;
460 scrub_string = scrub_string_end;
461 return size;
462}
463
fecd2382
RP
464/* read_a_source_file()
465 *
466 * We read the file, putting things into a web that
467 * represents what we have been reading.
468 */
6efd877d
KR
469void
470read_a_source_file (name)
471 char *name;
fecd2382 472{
f8701a3f 473 register char c;
6efd877d 474 register char *s; /* string of symbol, '\0' appended */
f8701a3f 475 register int temp;
6efd877d 476 pseudo_typeS *pop;
f8701a3f 477
6efd877d 478 buffer = input_scrub_new_file (name);
f8701a3f 479
6efd877d
KR
480 listing_file (name);
481 listing_newline ("");
f8701a3f 482
6efd877d
KR
483 while ((buffer_limit = input_scrub_next_buffer (&input_line_pointer)) != 0)
484 { /* We have another line to parse. */
485 know (buffer_limit[-1] == '\n'); /* Must have a sentinel. */
9471a360
KR
486 contin: /* JF this goto is my fault I admit it.
487 Someone brave please re-write the whole
488 input section here? Pleeze??? */
6efd877d 489 while (input_line_pointer < buffer_limit)
9471a360
KR
490 {
491 /* We have more of this buffer to parse. */
f8701a3f
SC
492
493 /*
494 * We now have input_line_pointer->1st char of next line.
495 * If input_line_pointer [-1] == '\n' then we just
496 * scanned another line: so bump line counters.
497 */
d2550c72 498 if (is_end_of_line[(unsigned char) input_line_pointer[-1]])
6efd877d 499 {
a2a5a4fa
KR
500#ifdef md_start_line_hook
501 md_start_line_hook ();
502#endif
503
385ce433
JL
504 if (input_line_pointer[-1] == '\n')
505 bump_line_counters ();
f8701a3f 506
7e047ac2
ILT
507 line_label = NULL;
508
1356d77d
ILT
509 if (flag_mri
510#ifdef LABELS_WITHOUT_COLONS
511 || 1
512#endif
513 )
6efd877d 514 {
1356d77d
ILT
515 /* Text at the start of a line must be a label, we
516 run down and stick a colon in. */
517 if (is_name_beginner (*input_line_pointer))
518 {
519 char *line_start = input_line_pointer;
7e047ac2
ILT
520 char c;
521
522 HANDLE_CONDITIONAL_ASSEMBLY ();
1356d77d 523
7e047ac2
ILT
524 c = get_symbol_end ();
525
526 /* In MRI mode, the EQU pseudoop must be
527 handled specially. */
528 if (flag_mri)
1356d77d 529 {
7e047ac2
ILT
530 char *rest = input_line_pointer + 1;
531
532 if (*rest == ':')
533 ++rest;
534 if (*rest == ' ' || *rest == '\t')
535 ++rest;
536 if ((strncasecmp (rest, "EQU", 3) == 0
537 || strncasecmp (rest, "SET", 3) == 0)
538 && (rest[3] == ' ' || rest[3] == '\t'))
1356d77d 539 {
7e047ac2
ILT
540 input_line_pointer = rest + 3;
541 equals (line_start);
542 continue;
1356d77d
ILT
543 }
544 }
6efd877d 545
7e047ac2
ILT
546 line_label = colon (line_start);
547
1356d77d
ILT
548 *input_line_pointer = c;
549 if (c == ':')
550 input_line_pointer++;
551 }
6efd877d 552 }
9471a360 553 }
f8701a3f 554
f8701a3f
SC
555 /*
556 * We are at the begining of a line, or similar place.
557 * We expect a well-formed assembler statement.
558 * A "symbol-name:" is a statement.
559 *
560 * Depending on what compiler is used, the order of these tests
561 * may vary to catch most common case 1st.
562 * Each test is independent of all other tests at the (top) level.
563 * PLEASE make a compiler that doesn't use this assembler.
564 * It is crufty to waste a compiler's time encoding things for this
565 * assembler, which then wastes more time decoding it.
566 * (And communicating via (linear) files is silly!
567 * If you must pass stuff, please pass a tree!)
568 */
9471a360
KR
569 if ((c = *input_line_pointer++) == '\t'
570 || c == ' '
571 || c == '\f'
572 || c == 0)
6efd877d
KR
573 {
574 c = *input_line_pointer++;
575 }
576 know (c != ' '); /* No further leading whitespace. */
577 LISTING_NEWLINE ();
f8701a3f
SC
578 /*
579 * C is the 1st significant character.
580 * Input_line_pointer points after that character.
581 */
6efd877d 582 if (is_name_beginner (c))
6ef37255
KR
583 {
584 /* want user-defined label or pseudo/opcode */
6efd877d
KR
585 HANDLE_CONDITIONAL_ASSEMBLY ();
586
f8701a3f 587 s = --input_line_pointer;
6efd877d 588 c = get_symbol_end (); /* name's delimiter */
f8701a3f
SC
589 /*
590 * C is character after symbol.
591 * That character's place in the input line is now '\0'.
592 * S points to the beginning of the symbol.
593 * [In case of pseudo-op, s->'.'.]
594 * Input_line_pointer->'\0' where c was.
595 */
9a7d824a 596 if (TC_START_LABEL(c, input_line_pointer))
6efd877d 597 {
7e047ac2
ILT
598 if (flag_mri)
599 {
600 char *rest = input_line_pointer + 1;
601
602 /* In MRI mode, \tsym: set 0 is permitted. */
603
604 if (*rest == ':')
605 ++rest;
606 if (*rest == ' ' || *rest == '\t')
607 ++rest;
608 if ((strncasecmp (rest, "EQU", 3) == 0
609 || strncasecmp (rest, "SET", 3) == 0)
610 && (rest[3] == ' ' || rest[3] == '\t'))
611 {
612 input_line_pointer = rest + 3;
613 equals (s);
614 continue;
615 }
616 }
617
618 line_label = colon (s); /* user-defined label */
6efd877d 619 *input_line_pointer++ = ':'; /* Put ':' back for error messages' sake. */
f8701a3f 620 /* Input_line_pointer->after ':'. */
6efd877d
KR
621 SKIP_WHITESPACE ();
622
f8701a3f 623
6efd877d 624 }
4064305e
SS
625 else if (c == '='
626 || (input_line_pointer[1] == '='
627#ifdef TC_EQUAL_IN_INSN
628 && ! TC_EQUAL_IN_INSN (c, input_line_pointer)
629#endif
630 ))
9c6d3f66 631 {
6efd877d
KR
632 equals (s);
633 demand_empty_rest_of_line ();
634 }
635 else
636 { /* expect pseudo-op or machine instruction */
8ff6f40e
ILT
637 pop = NULL;
638
d4c8cbd8
JL
639#define IGNORE_OPCODE_CASE
640#ifdef IGNORE_OPCODE_CASE
641 {
642 char *s2 = s;
643 while (*s2)
644 {
645 if (isupper (*s2))
646 *s2 = tolower (*s2);
647 s2++;
648 }
649 }
650#endif
651
42ac8fa8
ILT
652#ifndef MRI_MODE_NEEDS_PSEUDO_DOT
653#define MRI_MODE_NEEDS_PSEUDO_DOT 0
654#endif
655
656 if ((flag_mri && ! MRI_MODE_NEEDS_PSEUDO_DOT)
8ff6f40e 657#ifdef NO_PSEUDO_DOT
1356d77d 658 || 1
8ff6f40e 659#endif
1356d77d
ILT
660 )
661 {
662 /* The MRI assembler and the m88k use pseudo-ops
663 without a period. */
664 pop = (pseudo_typeS *) hash_find (po_hash, s);
665 if (pop != NULL && pop->poc_handler == NULL)
666 pop = NULL;
667 }
8ff6f40e 668
7e047ac2 669 if (pop != NULL
42ac8fa8
ILT
670 || ((! flag_mri || MRI_MODE_NEEDS_PSEUDO_DOT)
671 && *s == '.'))
6efd877d
KR
672 {
673 /*
9471a360
KR
674 * PSEUDO - OP.
675 *
676 * WARNING: c has next char, which may be end-of-line.
677 * We lookup the pseudo-op table with s+1 because we
678 * already know that the pseudo-op begins with a '.'.
679 */
6efd877d 680
8ff6f40e
ILT
681 if (pop == NULL)
682 pop = (pseudo_typeS *) hash_find (po_hash, s + 1);
6efd877d 683
286cb27a
ILT
684 /* In MRI mode, we may need to insert an
685 automatic alignment directive. What a hack
686 this is. */
687 if (mri_pending_align
688 && (pop == NULL
689 || ! ((pop->poc_handler == cons
690 && pop->poc_val == 1)
691 || (pop->poc_handler == s_space
692 && pop->poc_val == 1))))
693 {
694 do_align (1, (char *) NULL);
695 mri_pending_align = 0;
696 }
697
6efd877d 698 /* Print the error msg now, while we still can */
8ff6f40e 699 if (pop == NULL)
6efd877d
KR
700 {
701 as_bad ("Unknown pseudo-op: `%s'", s);
f8701a3f 702 *input_line_pointer = c;
6efd877d 703 s_ignore (0);
46b81190 704 continue;
6efd877d
KR
705 }
706
707 /* Put it back for error messages etc. */
708 *input_line_pointer = c;
9c6d3f66
KR
709 /* The following skip of whitespace is compulsory.
710 A well shaped space is sometimes all that separates
711 keyword from operands. */
6efd877d 712 if (c == ' ' || c == '\t')
d4c8cbd8 713 input_line_pointer++;
6efd877d 714 /*
9471a360
KR
715 * Input_line is restored.
716 * Input_line_pointer->1st non-blank char
717 * after pseudo-operation.
718 */
46b81190 719 (*pop->poc_handler) (pop->poc_val);
e28c40d7
ILT
720
721 /* If that was .end, just get out now. */
722 if (pop->poc_handler == s_end)
723 goto quit;
6efd877d
KR
724 }
725 else
6efd877d 726 { /* machine instruction */
4026c122
ILT
727 int inquote = 0;
728
286cb27a
ILT
729 if (mri_pending_align)
730 {
731 do_align (1, (char *) NULL);
732 mri_pending_align = 0;
733 }
734
6efd877d
KR
735 /* WARNING: c has char, which may be end-of-line. */
736 /* Also: input_line_pointer->`\0` where c was. */
737 *input_line_pointer = c;
58d4951d 738 while (!is_end_of_line[(unsigned char) *input_line_pointer]
4026c122 739 || inquote
4064305e
SS
740#ifdef TC_EOL_IN_INSN
741 || TC_EOL_IN_INSN (input_line_pointer)
742#endif
743 )
6efd877d 744 {
4026c122
ILT
745 if (flag_mri && *input_line_pointer == '\'')
746 inquote = ! inquote;
6efd877d
KR
747 input_line_pointer++;
748 }
f8701a3f 749
6efd877d
KR
750 c = *input_line_pointer;
751 *input_line_pointer = '\0';
f8701a3f 752
326d16ca
KH
753#ifdef OBJ_GENERATE_ASM_LINENO
754 if (generate_asm_lineno == 0)
755 {
f10a96cb 756 if (ecoff_no_current_file ())
326d16ca
KH
757 generate_asm_lineno = 1;
758 }
f10a96cb
ILT
759 if (generate_asm_lineno == 1)
760 {
1b434ced
ILT
761 unsigned int lineno;
762 char *s;
763
daad3bbf 764 as_where (&s, &lineno);
326d16ca 765 OBJ_GENERATE_ASM_LINENO (s, lineno);
f10a96cb 766 }
daad3bbf
KH
767#endif
768
7e047ac2
ILT
769 if (macro_defined)
770 {
771 sb out;
772 const char *err;
773
774 if (check_macro (s, &out, '\0', &err))
775 {
776 if (err != NULL)
777 as_bad (err);
778 *input_line_pointer++ = c;
779 input_scrub_include_sb (&out,
780 input_line_pointer);
781 sb_kill (&out);
782 buffer_limit =
783 input_scrub_next_buffer (&input_line_pointer);
784 continue;
785 }
786 }
787
6efd877d 788 md_assemble (s); /* Assemble 1 instruction. */
f8701a3f 789
6efd877d 790 *input_line_pointer++ = c;
f8701a3f 791
d4c8cbd8
JL
792 /* We resume loop AFTER the end-of-line from
793 this instruction. */
6efd877d 794 } /* if (*s=='.') */
6efd877d 795 } /* if c==':' */
f8701a3f 796 continue;
6efd877d 797 } /* if (is_name_beginner(c) */
f8701a3f 798
f8701a3f 799
d4c8cbd8 800 /* Empty statement? */
58d4951d 801 if (is_end_of_line[(unsigned char) c])
d4c8cbd8 802 continue;
6efd877d 803
9777b772
KR
804 if ((LOCAL_LABELS_DOLLAR || LOCAL_LABELS_FB)
805 && isdigit (c))
d4c8cbd8
JL
806 {
807 /* local label ("4:") */
6efd877d
KR
808 char *backup = input_line_pointer;
809
810 HANDLE_CONDITIONAL_ASSEMBLY ();
811
812 temp = c - '0';
813
814 while (isdigit (*input_line_pointer))
815 {
816 temp = (temp * 10) + *input_line_pointer - '0';
817 ++input_line_pointer;
818 } /* read the whole number */
819
9777b772
KR
820 if (LOCAL_LABELS_DOLLAR
821 && *input_line_pointer == '$'
6efd877d
KR
822 && *(input_line_pointer + 1) == ':')
823 {
824 input_line_pointer += 2;
825
826 if (dollar_label_defined (temp))
827 {
828 as_fatal ("label \"%d$\" redefined", temp);
829 }
830
831 define_dollar_label (temp);
832 colon (dollar_label_name (temp, 0));
833 continue;
834 }
6efd877d 835
9777b772
KR
836 if (LOCAL_LABELS_FB
837 && *input_line_pointer++ == ':')
6efd877d
KR
838 {
839 fb_label_instance_inc (temp);
840 colon (fb_label_name (temp, 0));
841 continue;
842 }
6efd877d
KR
843
844 input_line_pointer = backup;
845 } /* local label ("4:") */
f8701a3f 846
6efd877d
KR
847 if (c && strchr (line_comment_chars, c))
848 { /* Its a comment. Better say APP or NO_APP */
f8701a3f
SC
849 char *ends;
850 char *new_buf;
851 char *new_tmp;
604633ae 852 unsigned int new_length;
f8701a3f 853 char *tmp_buf = 0;
6efd877d
KR
854
855 bump_line_counters ();
856 s = input_line_pointer;
857 if (strncmp (s, "APP\n", 4))
858 continue; /* We ignore it */
859 s += 4;
860
861 ends = strstr (s, "#NO_APP\n");
862
863 if (!ends)
864 {
604633ae
ILT
865 unsigned int tmp_len;
866 unsigned int num;
6efd877d 867
f8701a3f
SC
868 /* The end of the #APP wasn't in this buffer. We
869 keep reading in buffers until we find the #NO_APP
870 that goes with this #APP There is one. The specs
871 guarentee it. . . */
6efd877d 872 tmp_len = buffer_limit - s;
85825401 873 tmp_buf = xmalloc (tmp_len + 1);
4380166d 874 memcpy (tmp_buf, s, tmp_len);
6efd877d
KR
875 do
876 {
877 new_tmp = input_scrub_next_buffer (&buffer);
f8701a3f 878 if (!new_tmp)
6efd877d 879 break;
f8701a3f 880 else
6efd877d 881 buffer_limit = new_tmp;
f8701a3f 882 input_line_pointer = buffer;
6efd877d 883 ends = strstr (buffer, "#NO_APP\n");
f8701a3f 884 if (ends)
6efd877d 885 num = ends - buffer;
f8701a3f 886 else
6efd877d
KR
887 num = buffer_limit - buffer;
888
889 tmp_buf = xrealloc (tmp_buf, tmp_len + num);
9eb5f4b8 890 memcpy (tmp_buf + tmp_len, buffer, num);
6efd877d
KR
891 tmp_len += num;
892 }
893 while (!ends);
894
895 input_line_pointer = ends ? ends + 8 : NULL;
896
897 s = tmp_buf;
898 ends = s + tmp_len;
899
900 }
901 else
902 {
903 input_line_pointer = ends + 8;
904 }
6efd877d
KR
905
906 scrub_string = s;
86038ada
ILT
907 scrub_string_end = ends;
908
909 new_length = ends - s;
910 new_buf = (char *) xmalloc (new_length);
911 new_tmp = new_buf;
6efd877d
KR
912 for (;;)
913 {
86038ada
ILT
914 int space;
915 int size;
f8701a3f 916
86038ada
ILT
917 space = (new_buf + new_length) - new_tmp;
918 size = do_scrub_chars (scrub_from_string, new_tmp, space);
919
920 if (size < space)
6efd877d 921 {
86038ada
ILT
922 new_tmp += size;
923 break;
f8701a3f 924 }
86038ada
ILT
925
926 new_buf = xrealloc (new_buf, new_length + 100);
927 new_tmp = new_buf + new_length;
928 new_length += 100;
fecd2382 929 }
f8701a3f
SC
930
931 if (tmp_buf)
6efd877d
KR
932 free (tmp_buf);
933 old_buffer = buffer;
934 old_input = input_line_pointer;
935 old_limit = buffer_limit;
936 buffer = new_buf;
937 input_line_pointer = new_buf;
938 buffer_limit = new_tmp;
f8701a3f
SC
939 continue;
940 }
941
6efd877d 942 HANDLE_CONDITIONAL_ASSEMBLY ();
f8701a3f
SC
943
944 /* as_warn("Junk character %d.",c); Now done by ignore_rest */
945 input_line_pointer--; /* Report unknown char as ignored. */
6efd877d
KR
946 ignore_rest_of_line ();
947 } /* while (input_line_pointer<buffer_limit) */
a2a5a4fa
KR
948
949#ifdef md_after_pass_hook
950 md_after_pass_hook ();
951#endif
952
6efd877d
KR
953 if (old_buffer)
954 {
86038ada 955 free (buffer);
6efd877d
KR
956 bump_line_counters ();
957 if (old_input != 0)
958 {
959 buffer = old_buffer;
960 input_line_pointer = old_input;
961 buffer_limit = old_limit;
f8701a3f
SC
962 old_buffer = 0;
963 goto contin;
964 }
965 }
6efd877d 966 } /* while (more buffers to scan) */
f8701a3f 967
e28c40d7
ILT
968 quit:
969 input_scrub_close (); /* Close the input file */
4075afe1 970}
fecd2382 971
18c9057f
ILT
972/* For most MRI pseudo-ops, the line actually ends at the first
973 nonquoted space. This function looks for that point, stuffs a null
974 in, and sets *STOPCP to the character that used to be there, and
42ac8fa8
ILT
975 returns the location.
976
977 Until I hear otherwise, I am going to assume that this is only true
978 for the m68k MRI assembler. */
18c9057f
ILT
979
980char *
981mri_comment_field (stopcp)
982 char *stopcp;
983{
42ac8fa8
ILT
984#ifdef TC_M68K
985
18c9057f
ILT
986 char *s;
987 int inquote = 0;
988
989 know (flag_mri);
990
991 for (s = input_line_pointer;
992 ((! is_end_of_line[(unsigned char) *s] && *s != ' ' && *s != '\t')
993 || inquote);
994 s++)
995 {
996 if (*s == '\'')
997 inquote = ! inquote;
998 }
999 *stopcp = *s;
1000 *s = '\0';
1001 return s;
42ac8fa8
ILT
1002
1003#else
1004
1005 char *s;
1006
1007 for (s = input_line_pointer; ! is_end_of_line[(unsigned char) *s]; s++)
1008 ;
1009 *stopcp = *s;
1010 *s = '\0';
1011 return s;
1012
1013#endif
1014
18c9057f
ILT
1015}
1016
1017/* Skip to the end of an MRI comment field. */
1018
1019void
1020mri_comment_end (stop, stopc)
1021 char *stop;
1022 int stopc;
1023{
1024 know (flag_mri);
1025
1026 input_line_pointer = stop;
1027 *stop = stopc;
1028 while (! is_end_of_line[(unsigned char) *input_line_pointer])
1029 ++input_line_pointer;
1030}
1031
6efd877d 1032void
604633ae
ILT
1033s_abort (ignore)
1034 int ignore;
6efd877d
KR
1035{
1036 as_fatal (".abort detected. Abandoning ship.");
4075afe1
KR
1037}
1038
1039/* Guts of .align directive. */
1040static void
1041do_align (n, fill)
1042 int n;
1043 char *fill;
1044{
1045#ifdef md_do_align
1046 md_do_align (n, fill, just_record_alignment);
1047#endif
1048 if (!fill)
1049 {
1050 /* @@ Fix this right for BFD! */
1051 static char zero;
1052 static char nop_opcode = NOP_OPCODE;
1053
1054 if (now_seg != data_section && now_seg != bss_section)
1055 {
1056 fill = &nop_opcode;
1057 }
1058 else
1059 {
1060 fill = &zero;
1061 }
1062 }
1063 /* Only make a frag if we HAVE to. . . */
1064 if (n && !need_pass_2)
1065 frag_align (n, *fill);
1066
c02fd8dc 1067#ifdef md_do_align
4075afe1 1068 just_record_alignment:
c02fd8dc
ILT
1069#endif
1070
4075afe1
KR
1071 record_alignment (now_seg, n);
1072}
fecd2382
RP
1073
1074/* For machines where ".align 4" means align to a 4 byte boundary. */
6efd877d
KR
1075void
1076s_align_bytes (arg)
1077 int arg;
fecd2382 1078{
6efd877d 1079 register unsigned int temp;
4075afe1 1080 char temp_fill;
6efd877d
KR
1081 unsigned int i = 0;
1082 unsigned long max_alignment = 1 << 15;
18c9057f
ILT
1083 char *stop = NULL;
1084 char stopc;
1085
1086 if (flag_mri)
1087 stop = mri_comment_field (&stopc);
f8701a3f 1088
58d4951d 1089 if (is_end_of_line[(unsigned char) *input_line_pointer])
6efd877d
KR
1090 temp = arg; /* Default value from pseudo-op table */
1091 else
1092 temp = get_absolute_expression ();
f8701a3f 1093
6efd877d
KR
1094 if (temp > max_alignment)
1095 {
1096 as_bad ("Alignment too large: %d. assumed.", temp = max_alignment);
f8701a3f
SC
1097 }
1098
4075afe1
KR
1099 /* For the sparc, `.align (1<<n)' actually means `.align n' so we
1100 have to convert it. */
6efd877d
KR
1101 if (temp != 0)
1102 {
1103 for (i = 0; (temp & 1) == 0; temp >>= 1, ++i)
1104 ;
f8701a3f 1105 }
6efd877d
KR
1106 if (temp != 1)
1107 as_bad ("Alignment not a power of 2");
f8701a3f 1108
6efd877d
KR
1109 temp = i;
1110 if (*input_line_pointer == ',')
1111 {
1112 input_line_pointer++;
1113 temp_fill = get_absolute_expression ();
4075afe1 1114 do_align (temp, &temp_fill);
f8701a3f 1115 }
6efd877d 1116 else
4075afe1 1117 do_align (temp, (char *) 0);
49864cfa 1118
18c9057f
ILT
1119 if (flag_mri)
1120 mri_comment_end (stop, stopc);
1121
6efd877d 1122 demand_empty_rest_of_line ();
4075afe1 1123}
fecd2382
RP
1124
1125/* For machines where ".align 4" means align to 2**4 boundary. */
6efd877d 1126void
604633ae
ILT
1127s_align_ptwo (ignore)
1128 int ignore;
6efd877d
KR
1129{
1130 register int temp;
4075afe1 1131 char temp_fill;
6efd877d 1132 long max_alignment = 15;
18c9057f
ILT
1133 char *stop = NULL;
1134 char stopc;
1135
1136 if (flag_mri)
1137 stop = mri_comment_field (&stopc);
6efd877d
KR
1138
1139 temp = get_absolute_expression ();
1140 if (temp > max_alignment)
1141 as_bad ("Alignment too large: %d. assumed.", temp = max_alignment);
1142 else if (temp < 0)
1143 {
1144 as_bad ("Alignment negative. 0 assumed.");
1145 temp = 0;
1146 }
1147 if (*input_line_pointer == ',')
1148 {
1149 input_line_pointer++;
1150 temp_fill = get_absolute_expression ();
4075afe1 1151 do_align (temp, &temp_fill);
6efd877d
KR
1152 }
1153 else
4075afe1 1154 do_align (temp, (char *) 0);
6efd877d 1155
18c9057f
ILT
1156 if (flag_mri)
1157 mri_comment_end (stop, stopc);
1158
6efd877d 1159 demand_empty_rest_of_line ();
4075afe1 1160}
6efd877d
KR
1161
1162void
604633ae
ILT
1163s_comm (ignore)
1164 int ignore;
6efd877d
KR
1165{
1166 register char *name;
1167 register char c;
1168 register char *p;
58d4951d 1169 offsetT temp;
6efd877d 1170 register symbolS *symbolP;
18c9057f
ILT
1171 char *stop = NULL;
1172 char stopc;
1173
1174 if (flag_mri)
1175 stop = mri_comment_field (&stopc);
6efd877d
KR
1176
1177 name = input_line_pointer;
1178 c = get_symbol_end ();
1179 /* just after name is now '\0' */
1180 p = input_line_pointer;
1181 *p = c;
1182 SKIP_WHITESPACE ();
1183 if (*input_line_pointer != ',')
1184 {
1185 as_bad ("Expected comma after symbol-name: rest of line ignored.");
18c9057f
ILT
1186 if (flag_mri)
1187 mri_comment_end (stop, stopc);
6efd877d
KR
1188 ignore_rest_of_line ();
1189 return;
1190 }
1191 input_line_pointer++; /* skip ',' */
1192 if ((temp = get_absolute_expression ()) < 0)
1193 {
58d4951d 1194 as_warn (".COMMon length (%ld.) <0! Ignored.", (long) temp);
18c9057f
ILT
1195 if (flag_mri)
1196 mri_comment_end (stop, stopc);
6efd877d
KR
1197 ignore_rest_of_line ();
1198 return;
1199 }
1200 *p = 0;
1201 symbolP = symbol_find_or_make (name);
1202 *p = c;
1203 if (S_IS_DEFINED (symbolP))
1204 {
6ef37255
KR
1205 as_bad ("Ignoring attempt to re-define symbol `%s'.",
1206 S_GET_NAME (symbolP));
18c9057f
ILT
1207 if (flag_mri)
1208 mri_comment_end (stop, stopc);
6efd877d
KR
1209 ignore_rest_of_line ();
1210 return;
1211 }
1212 if (S_GET_VALUE (symbolP))
1213 {
58d4951d
ILT
1214 if (S_GET_VALUE (symbolP) != (valueT) temp)
1215 as_bad ("Length of .comm \"%s\" is already %ld. Not changed to %ld.",
6efd877d 1216 S_GET_NAME (symbolP),
58d4951d
ILT
1217 (long) S_GET_VALUE (symbolP),
1218 (long) temp);
6efd877d
KR
1219 }
1220 else
1221 {
58d4951d 1222 S_SET_VALUE (symbolP, (valueT) temp);
6efd877d
KR
1223 S_SET_EXTERNAL (symbolP);
1224 }
9471a360 1225#ifdef OBJ_VMS
def66e24
DM
1226 {
1227 extern int flag_one;
1228 if ( (!temp) || !flag_one)
1229 S_GET_OTHER(symbolP) = const_flag;
1230 }
9471a360 1231#endif /* not OBJ_VMS */
6efd877d 1232 know (symbolP->sy_frag == &zero_address_frag);
18c9057f
ILT
1233
1234 if (flag_mri)
1235 mri_comment_end (stop, stopc);
1236
6efd877d
KR
1237 demand_empty_rest_of_line ();
1238} /* s_comm() */
fecd2382 1239
1356d77d
ILT
1240/* The MRI COMMON pseudo-op. We handle this by creating a common
1241 symbol with the appropriate name. We make s_space do the right
1242 thing by increasing the size. */
1243
1244void
1245s_mri_common (small)
1246 int small;
1247{
1248 char *name;
1249 char c;
1250 char *alc = NULL;
1251 symbolS *sym;
1252 offsetT align;
18c9057f
ILT
1253 char *stop = NULL;
1254 char stopc;
1356d77d
ILT
1255
1256 if (! flag_mri)
1257 {
1258 s_comm (0);
1259 return;
1260 }
1261
18c9057f
ILT
1262 stop = mri_comment_field (&stopc);
1263
1356d77d
ILT
1264 SKIP_WHITESPACE ();
1265
1266 name = input_line_pointer;
1267 if (! isdigit ((unsigned char) *name))
1268 c = get_symbol_end ();
1269 else
1270 {
1271 do
1272 {
1273 ++input_line_pointer;
1274 }
1275 while (isdigit ((unsigned char) *input_line_pointer));
1276 c = *input_line_pointer;
1277 *input_line_pointer = '\0';
1278
7e047ac2 1279 if (line_label != NULL)
1356d77d 1280 {
7e047ac2 1281 alc = (char *) xmalloc (strlen (S_GET_NAME (line_label))
1356d77d
ILT
1282 + (input_line_pointer - name)
1283 + 1);
7e047ac2 1284 sprintf (alc, "%s%s", name, S_GET_NAME (line_label));
1356d77d
ILT
1285 name = alc;
1286 }
1287 }
1288
1289 sym = symbol_find_or_make (name);
1290 *input_line_pointer = c;
1291 if (alc != NULL)
1292 free (alc);
1293
1294 if (*input_line_pointer != ',')
1295 align = 0;
1296 else
1297 {
1298 ++input_line_pointer;
1299 align = get_absolute_expression ();
1300 }
1301
1302 if (S_IS_DEFINED (sym))
1303 {
1304#if defined (S_IS_COMMON) || defined (BFD_ASSEMBLER)
1305 if (! S_IS_COMMON (sym))
1306#endif
1307 {
1308 as_bad ("attempt to re-define symbol `%s'", S_GET_NAME (sym));
18c9057f 1309 mri_comment_end (stop, stopc);
1356d77d
ILT
1310 ignore_rest_of_line ();
1311 return;
1312 }
1313 }
1314
1315 S_SET_EXTERNAL (sym);
1316 mri_common_symbol = sym;
1317
1318#ifdef S_SET_ALIGN
1319 if (align != 0)
1320 S_SET_ALIGN (sym, align);
1321#endif
1322
7e047ac2 1323 if (line_label != NULL)
1356d77d 1324 {
7e047ac2
ILT
1325 line_label->sy_value.X_op = O_symbol;
1326 line_label->sy_value.X_add_symbol = sym;
1327 line_label->sy_value.X_add_number = S_GET_VALUE (sym);
1328 line_label->sy_frag = &zero_address_frag;
1329 S_SET_SEGMENT (line_label, expr_section);
1356d77d
ILT
1330 }
1331
1332 /* FIXME: We just ignore the small argument, which distinguishes
1333 COMMON and COMMON.S. I don't know what we can do about it. */
1334
1335 /* Ignore the type and hptype. */
1336 if (*input_line_pointer == ',')
1337 input_line_pointer += 2;
1338 if (*input_line_pointer == ',')
1339 input_line_pointer += 2;
18c9057f
ILT
1340
1341 mri_comment_end (stop, stopc);
1342
1356d77d
ILT
1343 demand_empty_rest_of_line ();
1344}
1345
fecd2382 1346void
604633ae
ILT
1347s_data (ignore)
1348 int ignore;
fecd2382 1349{
ffffc8fb 1350 segT section;
6efd877d 1351 register int temp;
f8701a3f 1352
6efd877d 1353 temp = get_absolute_expression ();
def66e24 1354 if (flag_readonly_data_in_text)
ffffc8fb
ILT
1355 {
1356 section = text_section;
1357 temp += 1000;
1358 }
1359 else
1360 section = data_section;
1361
ffffc8fb 1362 subseg_set (section, (subsegT) temp);
f8701a3f 1363
9471a360 1364#ifdef OBJ_VMS
6efd877d 1365 const_flag = 0;
fecd2382 1366#endif
6efd877d 1367 demand_empty_rest_of_line ();
fecd2382
RP
1368}
1369
9a7d824a 1370/* Handle the .appfile pseudo-op. This is automatically generated by
86038ada
ILT
1371 do_scrub_chars when a preprocessor # line comment is seen with a
1372 file name. This default definition may be overridden by the object
1373 or CPU specific pseudo-ops. This function is also the default
1374 definition for .file; the APPFILE argument is 1 for .appfile, 0 for
1375 .file. */
9a7d824a 1376
6efd877d 1377void
9a7d824a
ILT
1378s_app_file (appfile)
1379 int appfile;
6efd877d
KR
1380{
1381 register char *s;
1382 int length;
f8701a3f 1383
6efd877d
KR
1384 /* Some assemblers tolerate immediately following '"' */
1385 if ((s = demand_copy_string (&length)) != 0)
1386 {
9a7d824a
ILT
1387 /* If this is a fake .appfile, a fake newline was inserted into
1388 the buffer. Passing -2 to new_logical_line tells it to
1389 account for it. */
1390 new_logical_line (s, appfile ? -2 : -1);
6efd877d 1391 demand_empty_rest_of_line ();
9a7d824a
ILT
1392#ifdef LISTING
1393 if (listing)
1394 listing_source_file (s);
1395#endif
6efd877d 1396 }
2209b19c
KR
1397#ifdef obj_app_file
1398 obj_app_file (s);
40324362
KR
1399#endif
1400}
fecd2382 1401
9a7d824a 1402/* Handle the .appline pseudo-op. This is automatically generated by
86038ada
ILT
1403 do_scrub_chars when a preprocessor # line comment is seen. This
1404 default definition may be overridden by the object or CPU specific
1405 pseudo-ops. */
9a7d824a
ILT
1406
1407void
604633ae
ILT
1408s_app_line (ignore)
1409 int ignore;
9a7d824a
ILT
1410{
1411 int l;
1412
1413 /* The given number is that of the next line. */
1414 l = get_absolute_expression () - 1;
931a8fab
KR
1415 if (l < 0)
1416 /* Some of the back ends can't deal with non-positive line numbers.
1417 Besides, it's silly. */
1418 as_warn ("Line numbers must be positive; line number %d rejected.", l+1);
1419 else
1420 {
1421 new_logical_line ((char *) NULL, l);
9a7d824a 1422#ifdef LISTING
931a8fab
KR
1423 if (listing)
1424 listing_source_line (l);
9a7d824a 1425#endif
931a8fab 1426 }
9a7d824a
ILT
1427 demand_empty_rest_of_line ();
1428}
1429
e28c40d7
ILT
1430/* Handle the .end pseudo-op. Actually, the real work is done in
1431 read_a_source_file. */
1432
1433void
1434s_end (ignore)
1435 int ignore;
1436{
1437 if (flag_mri)
1438 {
1439 /* The MRI assembler permits the start symbol to follow .end,
1440 but we don't support that. */
1441 SKIP_WHITESPACE ();
18c9057f
ILT
1442 if (! is_end_of_line[(unsigned char) *input_line_pointer]
1443 && *input_line_pointer != '*'
1444 && *input_line_pointer != '!')
e28c40d7
ILT
1445 as_warn ("start address not supported");
1446 }
1447}
1448
42ac8fa8
ILT
1449/* Handle the .err pseudo-op. */
1450
1451void
1452s_err (ignore)
1453 int ignore;
1454{
1455 as_bad (".err encountered");
1456 demand_empty_rest_of_line ();
1457}
1458
e28c40d7
ILT
1459/* Handle the MRI fail pseudo-op. */
1460
1461void
1462s_fail (ignore)
1463 int ignore;
1464{
1465 offsetT temp;
18c9057f
ILT
1466 char *stop = NULL;
1467 char stopc;
1468
1469 if (flag_mri)
1470 stop = mri_comment_field (&stopc);
e28c40d7
ILT
1471
1472 temp = get_absolute_expression ();
1473 if (temp >= 500)
1474 as_warn (".fail %ld encountered", (long) temp);
1475 else
1476 as_bad (".fail %ld encountered", (long) temp);
18c9057f
ILT
1477
1478 if (flag_mri)
1479 mri_comment_end (stop, stopc);
1480
e28c40d7
ILT
1481 demand_empty_rest_of_line ();
1482}
1483
6efd877d 1484void
604633ae
ILT
1485s_fill (ignore)
1486 int ignore;
6efd877d
KR
1487{
1488 long temp_repeat = 0;
1489 long temp_size = 1;
1490 register long temp_fill = 0;
1491 char *p;
f8701a3f 1492
7c2d4011 1493
6efd877d
KR
1494 temp_repeat = get_absolute_expression ();
1495 if (*input_line_pointer == ',')
1496 {
1497 input_line_pointer++;
1498 temp_size = get_absolute_expression ();
1499 if (*input_line_pointer == ',')
7c2d4011
SC
1500 {
1501 input_line_pointer++;
6efd877d 1502 temp_fill = get_absolute_expression ();
fecd2382 1503 }
6efd877d 1504 }
c8863a58 1505 /* This is to be compatible with BSD 4.2 AS, not for any rational reason. */
fecd2382 1506#define BSD_FILL_SIZE_CROCK_8 (8)
6efd877d
KR
1507 if (temp_size > BSD_FILL_SIZE_CROCK_8)
1508 {
1509 as_warn (".fill size clamped to %d.", BSD_FILL_SIZE_CROCK_8);
1510 temp_size = BSD_FILL_SIZE_CROCK_8;
1511 }
1512 if (temp_size < 0)
1513 {
1514 as_warn ("Size negative: .fill ignored.");
1515 temp_size = 0;
1516 }
1517 else if (temp_repeat <= 0)
1518 {
1519 as_warn ("Repeat < 0, .fill ignored");
1520 temp_size = 0;
1521 }
7fd3560a 1522
6efd877d
KR
1523 if (temp_size && !need_pass_2)
1524 {
1525 p = frag_var (rs_fill, (int) temp_size, (int) temp_size, (relax_substateT) 0, (symbolS *) 0, temp_repeat, (char *) 0);
604633ae 1526 memset (p, 0, (unsigned int) temp_size);
c8863a58
KR
1527 /* The magic number BSD_FILL_SIZE_CROCK_4 is from BSD 4.2 VAX
1528 * flavoured AS. The following bizzare behaviour is to be
1529 * compatible with above. I guess they tried to take up to 8
1530 * bytes from a 4-byte expression and they forgot to sign
1531 * extend. Un*x Sux. */
fecd2382 1532#define BSD_FILL_SIZE_CROCK_4 (4)
604633ae 1533 md_number_to_chars (p, (valueT) temp_fill,
c8863a58
KR
1534 (temp_size > BSD_FILL_SIZE_CROCK_4
1535 ? BSD_FILL_SIZE_CROCK_4
1536 : (int) temp_size));
1537 /* Note: .fill (),0 emits no frag (since we are asked to .fill 0 bytes)
1538 * but emits no error message because it seems a legal thing to do.
1539 * It is a degenerate case of .fill but could be emitted by a compiler.
1540 */
6efd877d 1541 }
6efd877d 1542 demand_empty_rest_of_line ();
f8701a3f
SC
1543}
1544
6efd877d 1545void
604633ae
ILT
1546s_globl (ignore)
1547 int ignore;
6efd877d 1548{
40324362
KR
1549 char *name;
1550 int c;
1551 symbolS *symbolP;
18c9057f
ILT
1552 char *stop = NULL;
1553 char stopc;
1554
1555 if (flag_mri)
1556 stop = mri_comment_field (&stopc);
fecd2382 1557
6efd877d
KR
1558 do
1559 {
1560 name = input_line_pointer;
1561 c = get_symbol_end ();
1562 symbolP = symbol_find_or_make (name);
1563 *input_line_pointer = c;
1564 SKIP_WHITESPACE ();
1565 S_SET_EXTERNAL (symbolP);
1566 if (c == ',')
1567 {
1568 input_line_pointer++;
1569 SKIP_WHITESPACE ();
1570 if (*input_line_pointer == '\n')
1571 c = '\n';
1572 }
1573 }
1574 while (c == ',');
18c9057f
ILT
1575
1576 if (flag_mri)
1577 mri_comment_end (stop, stopc);
1578
6efd877d 1579 demand_empty_rest_of_line ();
40324362 1580}
6efd877d 1581
7e047ac2
ILT
1582/* Handle the MRI IRP and IRPC pseudo-ops. */
1583
1584void
1585s_irp (irpc)
1586 int irpc;
1587{
1588 char *file;
1589 unsigned int line;
1590 sb s;
1591 const char *err;
1592 sb out;
1593
1594 as_where (&file, &line);
1595
1596 sb_new (&s);
1597 while (! is_end_of_line[(unsigned char) *input_line_pointer])
1598 sb_add_char (&s, *input_line_pointer++);
1599
1600 sb_new (&out);
1601
1602 err = expand_irp (irpc, 0, &s, &out, get_line_sb, '\0');
1603 if (err != NULL)
1604 as_bad_where (file, line, "%s", err);
1605
1606 sb_kill (&s);
1607
1608 input_scrub_include_sb (&out, input_line_pointer);
1609 sb_kill (&out);
1610 buffer_limit = input_scrub_next_buffer (&input_line_pointer);
1611}
1612
6efd877d
KR
1613void
1614s_lcomm (needs_align)
c8863a58
KR
1615 /* 1 if this was a ".bss" directive, which may require a 3rd argument
1616 (alignment); 0 if it was an ".lcomm" (2 args only) */
1617 int needs_align;
fecd2382 1618{
6efd877d
KR
1619 register char *name;
1620 register char c;
1621 register char *p;
1622 register int temp;
1623 register symbolS *symbolP;
9a7d824a
ILT
1624 segT current_seg = now_seg;
1625 subsegT current_subseg = now_subseg;
6efd877d
KR
1626 const int max_alignment = 15;
1627 int align = 0;
9a7d824a 1628 segT bss_seg = bss_section;
6efd877d
KR
1629
1630 name = input_line_pointer;
1631 c = get_symbol_end ();
1632 p = input_line_pointer;
1633 *p = c;
1634 SKIP_WHITESPACE ();
46b81190
ILT
1635
1636 /* Accept an optional comma after the name. The comma used to be
1637 required, but Irix 5 cc does not generate it. */
1638 if (*input_line_pointer == ',')
6efd877d 1639 {
46b81190
ILT
1640 ++input_line_pointer;
1641 SKIP_WHITESPACE ();
6efd877d 1642 }
f8701a3f 1643
6efd877d
KR
1644 if (*input_line_pointer == '\n')
1645 {
1646 as_bad ("Missing size expression");
1647 return;
1648 }
f8701a3f 1649
6efd877d
KR
1650 if ((temp = get_absolute_expression ()) < 0)
1651 {
1652 as_warn ("BSS length (%d.) <0! Ignored.", temp);
1653 ignore_rest_of_line ();
1654 return;
1655 }
f8701a3f 1656
2ef7731d 1657#if defined (TC_MIPS) || defined (TC_ALPHA)
a2a5a4fa
KR
1658 if (OUTPUT_FLAVOR == bfd_target_ecoff_flavour
1659 || OUTPUT_FLAVOR == bfd_target_elf_flavour)
46b81190 1660 {
a2a5a4fa
KR
1661 /* For MIPS and Alpha ECOFF or ELF, small objects are put in .sbss. */
1662 if (temp <= bfd_get_gp_size (stdoutput))
1663 {
1664 bss_seg = subseg_new (".sbss", 1);
1665 seg_info (bss_seg)->bss = 1;
1666 }
46b81190 1667 }
9a7d824a 1668#endif
ede7bc1c
SC
1669 if (!needs_align)
1670 {
1671 /* FIXME. This needs to be machine independent. */
9d90491e
ILT
1672 if (temp >= 8)
1673 align = 3;
1674 else if (temp >= 4)
ede7bc1c
SC
1675 align = 2;
1676 else if (temp >= 2)
1677 align = 1;
1678 else
c71a604a 1679 align = 0;
ede7bc1c
SC
1680
1681 record_alignment(bss_seg, align);
1682 }
9a7d824a 1683
6efd877d
KR
1684 if (needs_align)
1685 {
1686 align = 0;
1687 SKIP_WHITESPACE ();
1688 if (*input_line_pointer != ',')
1689 {
1690 as_bad ("Expected comma after size");
1691 ignore_rest_of_line ();
1692 return;
1693 }
1694 input_line_pointer++;
1695 SKIP_WHITESPACE ();
1696 if (*input_line_pointer == '\n')
1697 {
1698 as_bad ("Missing alignment");
1699 return;
1700 }
1701 align = get_absolute_expression ();
1702 if (align > max_alignment)
1703 {
1704 align = max_alignment;
1705 as_warn ("Alignment too large: %d. assumed.", align);
1706 }
1707 else if (align < 0)
1708 {
1709 align = 0;
1710 as_warn ("Alignment negative. 0 assumed.");
1711 }
9a7d824a 1712 record_alignment (bss_seg, align);
6efd877d 1713 } /* if needs align */
4075afe1
KR
1714 else
1715 {
1716 /* Assume some objects may require alignment on some systems. */
1717#ifdef TC_ALPHA
1718 if (temp > 1)
1719 {
1720 align = ffs (temp) - 1;
1721 if (temp % (1 << align))
1722 abort ();
1723 }
1724#endif
1725 }
f8701a3f 1726
6efd877d
KR
1727 *p = 0;
1728 symbolP = symbol_find_or_make (name);
1729 *p = c;
f8701a3f 1730
6efd877d 1731 if (
fecd2382 1732#if defined(OBJ_AOUT) | defined(OBJ_BOUT)
6efd877d
KR
1733 S_GET_OTHER (symbolP) == 0 &&
1734 S_GET_DESC (symbolP) == 0 &&
fecd2382 1735#endif /* OBJ_AOUT or OBJ_BOUT */
9a7d824a 1736 (S_GET_SEGMENT (symbolP) == bss_seg
6efd877d
KR
1737 || (!S_IS_DEFINED (symbolP) && S_GET_VALUE (symbolP) == 0)))
1738 {
604633ae 1739 char *pfrag;
85825401 1740
9a7d824a 1741 subseg_set (bss_seg, 1);
85825401
ILT
1742
1743 if (align)
1744 frag_align (align, 0);
1745 /* detach from old frag */
9a7d824a 1746 if (S_GET_SEGMENT (symbolP) == bss_seg)
85825401
ILT
1747 symbolP->sy_frag->fr_symbol = NULL;
1748
1749 symbolP->sy_frag = frag_now;
604633ae
ILT
1750 pfrag = frag_var (rs_org, 1, 1, (relax_substateT)0, symbolP,
1751 temp, (char *)0);
1752 *pfrag = 0;
f8701a3f 1753
9a7d824a 1754 S_SET_SEGMENT (symbolP, bss_seg);
85825401 1755
fecd2382 1756#ifdef OBJ_COFF
6efd877d 1757 /* The symbol may already have been created with a preceding
c8863a58
KR
1758 ".globl" directive -- be careful not to step on storage class
1759 in that case. Otherwise, set it to static. */
6efd877d
KR
1760 if (S_GET_STORAGE_CLASS (symbolP) != C_EXT)
1761 {
1762 S_SET_STORAGE_CLASS (symbolP, C_STAT);
fecd2382 1763 }
6efd877d 1764#endif /* OBJ_COFF */
6efd877d
KR
1765 }
1766 else
6ef37255
KR
1767 as_bad ("Ignoring attempt to re-define symbol `%s'.",
1768 S_GET_NAME (symbolP));
f8701a3f 1769
9a7d824a 1770 subseg_set (current_seg, current_subseg);
9a7d824a
ILT
1771
1772 demand_empty_rest_of_line ();
6efd877d 1773} /* s_lcomm() */
fecd2382 1774
6efd877d 1775void
604633ae
ILT
1776s_lsym (ignore)
1777 int ignore;
6efd877d
KR
1778{
1779 register char *name;
1780 register char c;
1781 register char *p;
6efd877d
KR
1782 expressionS exp;
1783 register symbolS *symbolP;
1784
1785 /* we permit ANY defined expression: BSD4.2 demands constants */
1786 name = input_line_pointer;
1787 c = get_symbol_end ();
1788 p = input_line_pointer;
1789 *p = c;
1790 SKIP_WHITESPACE ();
1791 if (*input_line_pointer != ',')
1792 {
1793 *p = 0;
1794 as_bad ("Expected comma after name \"%s\"", name);
1795 *p = c;
1796 ignore_rest_of_line ();
1797 return;
1798 }
1799 input_line_pointer++;
b31f2abb
KR
1800 expression (&exp);
1801 if (exp.X_op != O_constant
1802 && exp.X_op != O_register)
1803 {
1804 as_bad ("bad expression");
1805 ignore_rest_of_line ();
1806 return;
1807 }
6efd877d
KR
1808 *p = 0;
1809 symbolP = symbol_find_or_make (name);
f8701a3f 1810
c8863a58
KR
1811 /* FIXME-SOON I pulled a (&& symbolP->sy_other == 0 &&
1812 symbolP->sy_desc == 0) out of this test because coff doesn't have
1813 those fields, and I can't see when they'd ever be tripped. I
1814 don't think I understand why they were here so I may have
1815 introduced a bug. As recently as 1.37 didn't have this test
1816 anyway. xoxorich. */
f8701a3f 1817
9471a360 1818 if (S_GET_SEGMENT (symbolP) == undefined_section
6efd877d
KR
1819 && S_GET_VALUE (symbolP) == 0)
1820 {
c8863a58
KR
1821 /* The name might be an undefined .global symbol; be sure to
1822 keep the "external" bit. */
b31f2abb
KR
1823 S_SET_SEGMENT (symbolP,
1824 (exp.X_op == O_constant
1825 ? absolute_section
1826 : reg_section));
1827 S_SET_VALUE (symbolP, (valueT) exp.X_add_number);
6efd877d
KR
1828 }
1829 else
1830 {
1831 as_bad ("Symbol %s already defined", name);
1832 }
1833 *p = c;
1834 demand_empty_rest_of_line ();
1835} /* s_lsym() */
1836
7e047ac2
ILT
1837/* Read a line into an sb. */
1838
1839static int
1840get_line_sb (line)
1841 sb *line;
1842{
1843 if (input_line_pointer >= buffer_limit)
1844 {
1845 buffer_limit = input_scrub_next_buffer (&input_line_pointer);
1846 if (buffer_limit == 0)
1847 return 0;
1848 }
1849
1850 while (! is_end_of_line[(unsigned char) *input_line_pointer])
1851 sb_add_char (line, *input_line_pointer++);
42ac8fa8
ILT
1852 while (input_line_pointer < buffer_limit
1853 && is_end_of_line[(unsigned char) *input_line_pointer])
7e047ac2
ILT
1854 {
1855 if (*input_line_pointer == '\n')
1856 {
1857 bump_line_counters ();
1858 LISTING_NEWLINE ();
1859 }
1860 ++input_line_pointer;
1861 }
1862 return 1;
1863}
1864
1865/* Define a macro. This is an interface to macro.c, which is shared
1866 between gas and gasp. */
1867
1868void
1869s_macro (ignore)
1870 int ignore;
1871{
1872 char *file;
1873 unsigned int line;
1874 sb s;
1875 sb label;
1876 const char *err;
1877
1878 as_where (&file, &line);
1879
1880 sb_new (&s);
1881 while (! is_end_of_line[(unsigned char) *input_line_pointer])
1882 sb_add_char (&s, *input_line_pointer++);
1883
1884 sb_new (&label);
1885 if (line_label != NULL)
1886 sb_add_string (&label, S_GET_NAME (line_label));
1887
1888 demand_empty_rest_of_line ();
1889
1890 err = define_macro (0, &s, &label, get_line_sb);
1891 if (err != NULL)
1892 as_bad_where (file, line, "%s", err);
1893 else
1894 {
1895 if (line_label != NULL)
1896 {
1897 S_SET_SEGMENT (line_label, undefined_section);
1898 S_SET_VALUE (line_label, 0);
1899 line_label->sy_frag = &zero_address_frag;
1900 }
1901 }
1902
1903 sb_kill (&s);
1904}
1905
1906/* Handle the .mexit pseudo-op, which immediately exits a macro
1907 expansion. */
1908
1909void
1910s_mexit (ignore)
1911 int ignore;
1912{
1913 buffer_limit = input_scrub_next_buffer (&input_line_pointer);
1914}
1915
e28c40d7
ILT
1916/* Handle changing the location counter. */
1917
1918static void
1919do_org (segment, exp, fill)
1920 segT segment;
1921 expressionS *exp;
1922 int fill;
1923{
1924 if (segment != now_seg && segment != absolute_section)
1925 as_bad ("invalid segment \"%s\"; segment \"%s\" assumed",
1926 segment_name (segment), segment_name (now_seg));
1927
1928 if (now_seg == absolute_section)
1929 {
1930 if (fill != 0)
1931 as_warn ("ignoring fill value in absolute section");
1932 if (exp->X_op != O_constant)
1933 {
1934 as_bad ("only constant offsets supported in absolute section");
1935 exp->X_add_number = 0;
1936 }
1937 abs_section_offset = exp->X_add_number;
1938 }
1939 else
1940 {
1941 char *p;
1942
1943 p = frag_var (rs_org, 1, 1, (relax_substateT) 0, exp->X_add_symbol,
1944 exp->X_add_number, (char *) NULL);
1945 *p = fill;
1946 }
1947}
1948
6efd877d 1949void
604633ae
ILT
1950s_org (ignore)
1951 int ignore;
6efd877d
KR
1952{
1953 register segT segment;
1954 expressionS exp;
1955 register long temp_fill;
e28c40d7 1956
42ac8fa8
ILT
1957#ifdef TC_M68K
1958 /* The m68k MRI assembler has a different meaning for .org. It
1959 means to create an absolute section at a given address. We can't
1960 support that--use a linker script instead. */
69e077f3
ILT
1961 if (flag_mri)
1962 {
1963 as_bad ("MRI style ORG pseudo-op not supported");
1964 ignore_rest_of_line ();
1965 return;
1966 }
42ac8fa8 1967#endif
69e077f3 1968
9471a360
KR
1969 /* Don't believe the documentation of BSD 4.2 AS. There is no such
1970 thing as a sub-segment-relative origin. Any absolute origin is
1971 given a warning, then assumed to be segment-relative. Any
1972 segmented origin expression ("foo+42") had better be in the right
1973 segment or the .org is ignored.
1974
1975 BSD 4.2 AS warns if you try to .org backwards. We cannot because
1976 we never know sub-segment sizes when we are reading code. BSD
1977 will crash trying to emit negative numbers of filler bytes in
1978 certain .orgs. We don't crash, but see as-write for that code.
1979
1980 Don't make frag if need_pass_2==1. */
6efd877d
KR
1981 segment = get_known_segmented_expression (&exp);
1982 if (*input_line_pointer == ',')
1983 {
1984 input_line_pointer++;
1985 temp_fill = get_absolute_expression ();
1986 }
1987 else
1988 temp_fill = 0;
e28c40d7 1989
6efd877d 1990 if (!need_pass_2)
e28c40d7
ILT
1991 do_org (segment, &exp, temp_fill);
1992
6efd877d
KR
1993 demand_empty_rest_of_line ();
1994} /* s_org() */
1995
e14994d9
ILT
1996/* Handle parsing for the MRI SECT/SECTION pseudo-op. This should be
1997 called by the obj-format routine which handles section changing
1998 when in MRI mode. It will create a new section, and return it. It
1999 will set *TYPE to the section type: one of '\0' (unspecified), 'C'
2000 (code), 'D' (data), 'M' (mixed), or 'R' (romable). If
2001 BFD_ASSEMBLER is defined, the flags will be set in the section. */
2002
2003void
2004s_mri_sect (type)
2005 char *type;
2006{
42ac8fa8
ILT
2007#ifdef TC_M68K
2008
e14994d9
ILT
2009 char *name;
2010 char c;
2011 segT seg;
2012
2013 SKIP_WHITESPACE ();
2014
2015 name = input_line_pointer;
2016 if (! isdigit ((unsigned char) *name))
2017 c = get_symbol_end ();
2018 else
2019 {
2020 do
2021 {
2022 ++input_line_pointer;
2023 }
2024 while (isdigit ((unsigned char) *input_line_pointer));
2025 c = *input_line_pointer;
2026 *input_line_pointer = '\0';
2027 }
2028
2029 name = strdup (name);
2030 if (name == NULL)
2031 as_fatal ("virtual memory exhausted");
2032
2033 *input_line_pointer = c;
2034
2035 seg = subseg_new (name, 0);
2036
2037 if (*input_line_pointer == ',')
2038 {
2039 int align;
2040
2041 ++input_line_pointer;
2042 align = get_absolute_expression ();
2043 record_alignment (seg, align);
2044 }
2045
2046 *type = '\0';
2047 if (*input_line_pointer == ',')
2048 {
2049 c = *++input_line_pointer;
2050 c = toupper ((unsigned char) c);
2051 if (c == 'C' || c == 'D' || c == 'M' || c == 'R')
2052 *type = c;
2053 else
2054 as_bad ("unrecognized section type");
2055 ++input_line_pointer;
2056
2057#ifdef BFD_ASSEMBLER
2058 {
2059 flagword flags;
2060
2061 flags = SEC_NO_FLAGS;
ca232972 2062 if (*type == 'C')
e14994d9 2063 flags = SEC_CODE;
ca232972 2064 else if (*type == 'D')
e14994d9 2065 flags = SEC_DATA;
ca232972 2066 else if (*type == 'R')
e14994d9
ILT
2067 flags = SEC_ROM;
2068 if (flags != SEC_NO_FLAGS)
2069 {
2070 if (! bfd_set_section_flags (stdoutput, seg, flags))
2071 as_warn ("error setting flags for \"%s\": %s",
ca232972 2072 bfd_section_name (stdoutput, seg),
e14994d9
ILT
2073 bfd_errmsg (bfd_get_error ()));
2074 }
2075 }
2076#endif
2077 }
2078
2079 /* Ignore the HP type. */
2080 if (*input_line_pointer == ',')
2081 input_line_pointer += 2;
2082
2083 demand_empty_rest_of_line ();
42ac8fa8
ILT
2084
2085#else /* ! TC_M68K */
2086#ifdef TC_I960
2087
2088 char *name;
2089 char c;
2090 segT seg;
2091
2092 SKIP_WHITESPACE ();
2093
2094 name = input_line_pointer;
2095 c = get_symbol_end ();
2096
2097 name = strdup (name);
2098 if (name == NULL)
2099 as_fatal ("virtual memory exhausted");
2100
2101 *input_line_pointer = c;
2102
2103 seg = subseg_new (name, 0);
2104
2105 if (*input_line_pointer != ',')
2106 *type = 'C';
2107 else
2108 {
2109 char *sectype;
2110
2111 ++input_line_pointer;
2112 SKIP_WHITESPACE ();
2113 sectype = input_line_pointer;
2114 c = get_symbol_end ();
2115 if (*sectype == '\0')
2116 *type = 'C';
2117 else if (strcasecmp (sectype, "text") == 0)
2118 *type = 'C';
2119 else if (strcasecmp (sectype, "data") == 0)
2120 *type = 'D';
2121 else if (strcasecmp (sectype, "romdata") == 0)
2122 *type = 'R';
2123 else
2124 as_warn ("unrecognized section type `%s'", sectype);
2125 *input_line_pointer = c;
2126 }
2127
2128 if (*input_line_pointer == ',')
2129 {
2130 char *seccmd;
2131
2132 ++input_line_pointer;
2133 SKIP_WHITESPACE ();
2134 seccmd = input_line_pointer;
2135 c = get_symbol_end ();
2136 if (strcasecmp (seccmd, "absolute") == 0)
2137 {
2138 as_bad ("absolute sections are not supported");
2139 *input_line_pointer = c;
2140 ignore_rest_of_line ();
2141 return;
2142 }
2143 else if (strcasecmp (seccmd, "align") == 0)
2144 {
2145 int align;
2146
2147 *input_line_pointer = c;
2148 align = get_absolute_expression ();
2149 record_alignment (seg, align);
2150 }
2151 else
2152 {
2153 as_warn ("unrecognized section command `%s'", seccmd);
2154 *input_line_pointer = c;
2155 }
2156 }
2157
2158 demand_empty_rest_of_line ();
2159
2160#else /* ! TC_I960 */
2161 /* The MRI assembler seems to use different forms of .sect for
2162 different targets. */
2163 abort ();
2164#endif /* ! TC_I960 */
2165#endif /* ! TC_M68K */
2166}
2167
2168/* Handle the .print pseudo-op. */
2169
2170void
2171s_print (ignore)
2172 int ignore;
2173{
2174 char *s;
2175 int len;
2176
2177 s = demand_copy_C_string (&len);
2178 printf ("%s\n", s);
2179 demand_empty_rest_of_line ();
2180}
2181
2182/* Handle the .purgem pseudo-op. */
2183
2184void
2185s_purgem (ignore)
2186 int ignore;
2187{
2188 if (is_it_end_of_statement ())
2189 {
2190 demand_empty_rest_of_line ();
2191 return;
2192 }
2193
2194 do
2195 {
2196 char *name;
2197 char c;
2198
2199 SKIP_WHITESPACE ();
2200 name = input_line_pointer;
2201 c = get_symbol_end ();
2202 delete_macro (name);
2203 *input_line_pointer = c;
2204 SKIP_WHITESPACE ();
2205 }
2206 while (*input_line_pointer++ == ',');
2207
2208 --input_line_pointer;
2209 demand_empty_rest_of_line ();
e14994d9
ILT
2210}
2211
7e047ac2
ILT
2212/* Handle the .rept pseudo-op. */
2213
2214void
2215s_rept (ignore)
2216 int ignore;
2217{
2218 int count;
2219 sb one;
2220 sb many;
2221
2222 count = get_absolute_expression ();
2223
2224 sb_new (&one);
2225 if (! buffer_and_nest ("REPT", "ENDR", &one, get_line_sb))
2226 {
2227 as_bad ("rept without endr");
2228 return;
2229 }
2230
2231 sb_new (&many);
2232 while (count-- > 0)
2233 sb_add_sb (&many, &one);
2234
2235 sb_kill (&one);
2236
2237 input_scrub_include_sb (&many, input_line_pointer);
2238 sb_kill (&many);
2239 buffer_limit = input_scrub_next_buffer (&input_line_pointer);
2240}
2241
6efd877d 2242void
604633ae
ILT
2243s_set (ignore)
2244 int ignore;
6efd877d
KR
2245{
2246 register char *name;
2247 register char delim;
2248 register char *end_name;
2249 register symbolS *symbolP;
2250
2251 /*
c8863a58
KR
2252 * Especial apologies for the random logic:
2253 * this just grew, and could be parsed much more simply!
2254 * Dean in haste.
2255 */
6efd877d
KR
2256 name = input_line_pointer;
2257 delim = get_symbol_end ();
2258 end_name = input_line_pointer;
2259 *end_name = delim;
2260 SKIP_WHITESPACE ();
f8701a3f 2261
6efd877d
KR
2262 if (*input_line_pointer != ',')
2263 {
2264 *end_name = 0;
2265 as_bad ("Expected comma after name \"%s\"", name);
2266 *end_name = delim;
2267 ignore_rest_of_line ();
2268 return;
2269 }
2270
2271 input_line_pointer++;
2272 *end_name = 0;
2273
2274 if (name[0] == '.' && name[1] == '\0')
2275 {
2276 /* Turn '. = mumble' into a .org mumble */
2277 register segT segment;
2278 expressionS exp;
6efd877d
KR
2279
2280 segment = get_known_segmented_expression (&exp);
f8701a3f 2281
6efd877d 2282 if (!need_pass_2)
e28c40d7 2283 do_org (segment, &exp, 0);
6efd877d
KR
2284
2285 *end_name = delim;
2286 return;
2287 }
2288
2289 if ((symbolP = symbol_find (name)) == NULL
2290 && (symbolP = md_undefined_symbol (name)) == NULL)
2291 {
9471a360 2292 symbolP = symbol_new (name, undefined_section, 0, &zero_address_frag);
fecd2382 2293#ifdef OBJ_COFF
6efd877d
KR
2294 /* "set" symbols are local unless otherwise specified. */
2295 SF_SET_LOCAL (symbolP);
fecd2382 2296#endif /* OBJ_COFF */
f8701a3f 2297
6efd877d 2298 } /* make a new symbol */
f8701a3f 2299
6efd877d 2300 symbol_table_insert (symbolP);
f8701a3f 2301
6efd877d
KR
2302 *end_name = delim;
2303 pseudo_set (symbolP);
2304 demand_empty_rest_of_line ();
2305} /* s_set() */
fecd2382 2306
6efd877d
KR
2307void
2308s_space (mult)
2309 int mult;
b53ccaac 2310{
cd3b81bd 2311 expressionS exp;
931a8fab 2312 long temp_fill;
cd3b81bd 2313 char *p = 0;
3dce804d
ILT
2314 char *stop = NULL;
2315 char stopc;
6efd877d 2316
a2a5a4fa
KR
2317#ifdef md_flush_pending_output
2318 md_flush_pending_output ();
2319#endif
2320
3dce804d 2321 if (flag_mri)
18c9057f 2322 stop = mri_comment_field (&stopc);
3dce804d 2323
6efd877d 2324 /* Just like .fill, but temp_size = 1 */
cd3b81bd 2325 expression (&exp);
931a8fab 2326 if (exp.X_op == O_constant)
6efd877d 2327 {
cd3b81bd
KR
2328 long repeat;
2329
2330 repeat = exp.X_add_number;
2331 if (mult)
2332 repeat *= mult;
2333 if (repeat <= 0)
2334 {
4026c122
ILT
2335 if (! flag_mri || repeat < 0)
2336 as_warn (".space repeat count is %s, ignored",
2337 repeat ? "negative" : "zero");
3dce804d 2338 goto getout;
cd3b81bd
KR
2339 }
2340
e28c40d7
ILT
2341 /* If we are in the absolute section, just bump the offset. */
2342 if (now_seg == absolute_section)
2343 {
2344 abs_section_offset += repeat;
3dce804d 2345 goto getout;
e28c40d7
ILT
2346 }
2347
1356d77d
ILT
2348 /* If we are secretly in an MRI common section, then creating
2349 space just increases the size of the common symbol. */
2350 if (mri_common_symbol != NULL)
2351 {
2352 S_SET_VALUE (mri_common_symbol,
2353 S_GET_VALUE (mri_common_symbol) + repeat);
3dce804d 2354 goto getout;
1356d77d
ILT
2355 }
2356
cd3b81bd
KR
2357 if (!need_pass_2)
2358 p = frag_var (rs_fill, 1, 1, (relax_substateT) 0, (symbolS *) 0,
931a8fab 2359 repeat, (char *) 0);
6efd877d
KR
2360 }
2361 else
2362 {
e28c40d7
ILT
2363 if (now_seg == absolute_section)
2364 {
2365 as_bad ("space allocation too complex in absolute section");
2366 subseg_set (text_section, 0);
2367 }
1356d77d
ILT
2368 if (mri_common_symbol != NULL)
2369 {
2370 as_bad ("space allocation too complex in common section");
2371 mri_common_symbol = NULL;
2372 }
cd3b81bd
KR
2373 if (!need_pass_2)
2374 p = frag_var (rs_space, 1, 1, (relax_substateT) 0,
2375 make_expr_symbol (&exp), 0L, (char *) 0);
6efd877d 2376 }
931a8fab
KR
2377 SKIP_WHITESPACE ();
2378 if (*input_line_pointer == ',')
6efd877d 2379 {
931a8fab 2380 input_line_pointer++;
cd3b81bd 2381 temp_fill = get_absolute_expression ();
6efd877d 2382 }
cd3b81bd 2383 else
6efd877d 2384 {
cd3b81bd 2385 temp_fill = 0;
6efd877d 2386 }
cd3b81bd 2387 if (p)
6efd877d 2388 {
6efd877d
KR
2389 *p = temp_fill;
2390 }
3dce804d
ILT
2391
2392 getout:
2393 if (flag_mri)
18c9057f 2394 mri_comment_end (stop, stopc);
3dce804d 2395
6efd877d 2396 demand_empty_rest_of_line ();
cd3b81bd 2397}
fecd2382 2398
e28c40d7
ILT
2399/* This is like s_space, but the value is a floating point number with
2400 the given precision. This is for the MRI dcb.s pseudo-op and
2401 friends. */
2402
2403void
2404s_float_space (float_type)
2405 int float_type;
2406{
2407 offsetT count;
2408 int flen;
2409 char temp[MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT];
18c9057f
ILT
2410 char *stop = NULL;
2411 char stopc;
2412
2413 if (flag_mri)
2414 stop = mri_comment_field (&stopc);
e28c40d7
ILT
2415
2416 count = get_absolute_expression ();
2417
2418 SKIP_WHITESPACE ();
2419 if (*input_line_pointer != ',')
2420 {
2421 as_bad ("missing value");
18c9057f
ILT
2422 if (flag_mri)
2423 mri_comment_end (stop, stopc);
e28c40d7
ILT
2424 ignore_rest_of_line ();
2425 return;
2426 }
2427
2428 ++input_line_pointer;
2429
2430 SKIP_WHITESPACE ();
2431
2432 /* Skip any 0{letter} that may be present. Don't even check if the
2433 * letter is legal. */
2434 if (input_line_pointer[0] == '0' && isalpha (input_line_pointer[1]))
2435 input_line_pointer += 2;
2436
2437 /* Accept :xxxx, where the x's are hex digits, for a floating point
2438 with the exact digits specified. */
2439 if (input_line_pointer[0] == ':')
2440 {
2441 flen = hex_float (float_type, temp);
2442 if (flen < 0)
2443 {
18c9057f
ILT
2444 if (flag_mri)
2445 mri_comment_end (stop, stopc);
e28c40d7
ILT
2446 ignore_rest_of_line ();
2447 return;
2448 }
2449 }
2450 else
2451 {
2452 char *err;
2453
2454 err = md_atof (float_type, temp, &flen);
2455 know (flen <= MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT);
2456 know (flen > 0);
2457 if (err)
2458 {
2459 as_bad ("Bad floating literal: %s", err);
18c9057f
ILT
2460 if (flag_mri)
2461 mri_comment_end (stop, stopc);
e28c40d7
ILT
2462 ignore_rest_of_line ();
2463 return;
2464 }
2465 }
2466
2467 while (--count >= 0)
2468 {
2469 char *p;
2470
2471 p = frag_more (flen);
2472 memcpy (p, temp, (unsigned int) flen);
2473 }
2474
18c9057f
ILT
2475 if (flag_mri)
2476 mri_comment_end (stop, stopc);
2477
e28c40d7
ILT
2478 demand_empty_rest_of_line ();
2479}
2480
2481/* Handle the .struct pseudo-op, as found in MIPS assemblers. */
2482
2483void
2484s_struct (ignore)
2485 int ignore;
2486{
18c9057f
ILT
2487 char *stop = NULL;
2488 char stopc;
2489
2490 if (flag_mri)
2491 stop = mri_comment_field (&stopc);
e28c40d7
ILT
2492 abs_section_offset = get_absolute_expression ();
2493 subseg_set (absolute_section, 0);
18c9057f
ILT
2494 if (flag_mri)
2495 mri_comment_end (stop, stopc);
e28c40d7
ILT
2496 demand_empty_rest_of_line ();
2497}
2498
fecd2382 2499void
604633ae
ILT
2500s_text (ignore)
2501 int ignore;
fecd2382 2502{
6efd877d 2503 register int temp;
f8701a3f 2504
6efd877d 2505 temp = get_absolute_expression ();
9471a360 2506 subseg_set (text_section, (subsegT) temp);
6efd877d 2507 demand_empty_rest_of_line ();
80d80c64
KR
2508#ifdef OBJ_VMS
2509 const_flag &= ~IN_DEFAULT_SECTION;
2510#endif
6efd877d 2511} /* s_text() */
fecd2382 2512\f
6efd877d 2513
6efd877d
KR
2514void
2515demand_empty_rest_of_line ()
2516{
2517 SKIP_WHITESPACE ();
58d4951d 2518 if (is_end_of_line[(unsigned char) *input_line_pointer])
6efd877d
KR
2519 {
2520 input_line_pointer++;
2521 }
2522 else
2523 {
2524 ignore_rest_of_line ();
2525 }
2526 /* Return having already swallowed end-of-line. */
2527} /* Return pointing just after end-of-line. */
fecd2382
RP
2528
2529void
6efd877d 2530ignore_rest_of_line () /* For suspect lines: gives warning. */
fecd2382 2531{
58d4951d 2532 if (!is_end_of_line[(unsigned char) *input_line_pointer])
f8701a3f 2533 {
6efd877d
KR
2534 if (isprint (*input_line_pointer))
2535 as_bad ("Rest of line ignored. First ignored character is `%c'.",
f8701a3f
SC
2536 *input_line_pointer);
2537 else
6efd877d 2538 as_bad ("Rest of line ignored. First ignored character valued 0x%x.",
f8701a3f
SC
2539 *input_line_pointer);
2540 while (input_line_pointer < buffer_limit
58d4951d 2541 && !is_end_of_line[(unsigned char) *input_line_pointer])
f8701a3f 2542 {
6efd877d 2543 input_line_pointer++;
f8701a3f
SC
2544 }
2545 }
6efd877d 2546 input_line_pointer++; /* Return pointing just after end-of-line. */
58d4951d 2547 know (is_end_of_line[(unsigned char) input_line_pointer[-1]]);
fecd2382
RP
2548}
2549
2550/*
2551 * pseudo_set()
2552 *
2553 * In: Pointer to a symbol.
2554 * Input_line_pointer->expression.
2555 *
2556 * Out: Input_line_pointer->just after any whitespace after expression.
2557 * Tried to set symbol to value of expression.
2558 * Will change symbols type, value, and frag;
fecd2382
RP
2559 */
2560void
f8701a3f 2561pseudo_set (symbolP)
6efd877d 2562 symbolS *symbolP;
fecd2382 2563{
6efd877d 2564 expressionS exp;
daad3bbf 2565#if (defined (OBJ_AOUT) || defined (OBJ_BOUT)) && ! defined (BFD_ASSEMBLER)
f8701a3f 2566 int ext;
fecd2382 2567#endif /* OBJ_AOUT or OBJ_BOUT */
f8701a3f 2568
6efd877d 2569 know (symbolP); /* NULL pointer is logic error. */
daad3bbf 2570#if (defined (OBJ_AOUT) || defined (OBJ_BOUT)) && ! defined (BFD_ASSEMBLER)
6efd877d 2571 ext = S_IS_EXTERNAL (symbolP);
fecd2382 2572#endif /* OBJ_AOUT or OBJ_BOUT */
f8701a3f 2573
5ac34ac3 2574 (void) expression (&exp);
f8701a3f 2575
5ac34ac3
ILT
2576 if (exp.X_op == O_illegal)
2577 as_bad ("illegal expression; zero assumed");
2578 else if (exp.X_op == O_absent)
2579 as_bad ("missing expression; zero assumed");
2580 else if (exp.X_op == O_big)
2581 as_bad ("%s number invalid; zero assumed",
2582 exp.X_add_number > 0 ? "bignum" : "floating point");
2583 else if (exp.X_op == O_subtract
2584 && (S_GET_SEGMENT (exp.X_add_symbol)
2585 == S_GET_SEGMENT (exp.X_op_symbol))
2586 && SEG_NORMAL (S_GET_SEGMENT (exp.X_add_symbol))
2587 && exp.X_add_symbol->sy_frag == exp.X_op_symbol->sy_frag)
9471a360 2588 {
5ac34ac3
ILT
2589 exp.X_op = O_constant;
2590 exp.X_add_number = (S_GET_VALUE (exp.X_add_symbol)
2591 - S_GET_VALUE (exp.X_op_symbol));
9471a360 2592 }
5ac34ac3
ILT
2593
2594 switch (exp.X_op)
9471a360 2595 {
5ac34ac3
ILT
2596 case O_illegal:
2597 case O_absent:
2598 case O_big:
2599 exp.X_add_number = 0;
2600 /* Fall through. */
2601 case O_constant:
9471a360 2602 S_SET_SEGMENT (symbolP, absolute_section);
daad3bbf 2603#if (defined (OBJ_AOUT) || defined (OBJ_BOUT)) && ! defined (BFD_ASSEMBLER)
5ac34ac3
ILT
2604 if (ext)
2605 S_SET_EXTERNAL (symbolP);
6efd877d 2606 else
6efd877d 2607 S_CLEAR_EXTERNAL (symbolP);
fecd2382 2608#endif /* OBJ_AOUT or OBJ_BOUT */
604633ae 2609 S_SET_VALUE (symbolP, (valueT) exp.X_add_number);
6efd877d 2610 symbolP->sy_frag = &zero_address_frag;
5ac34ac3 2611 break;
f8701a3f 2612
5ac34ac3
ILT
2613 case O_register:
2614 S_SET_SEGMENT (symbolP, reg_section);
604633ae 2615 S_SET_VALUE (symbolP, (valueT) exp.X_add_number);
5ac34ac3
ILT
2616 symbolP->sy_frag = &zero_address_frag;
2617 break;
2618
2619 case O_symbol:
ef198870
KR
2620 if (S_GET_SEGMENT (exp.X_add_symbol) == undefined_section
2621 || exp.X_add_number != 0)
5ac34ac3 2622 symbolP->sy_value = exp;
6efd877d
KR
2623 else
2624 {
80d80c64
KR
2625 symbolS *s = exp.X_add_symbol;
2626
2627 S_SET_SEGMENT (symbolP, S_GET_SEGMENT (s));
daad3bbf 2628#if (defined (OBJ_AOUT) || defined (OBJ_BOUT)) && ! defined (BFD_ASSEMBLER)
5ac34ac3
ILT
2629 if (ext)
2630 S_SET_EXTERNAL (symbolP);
2631 else
2632 S_CLEAR_EXTERNAL (symbolP);
fecd2382 2633#endif /* OBJ_AOUT or OBJ_BOUT */
5ac34ac3 2634 S_SET_VALUE (symbolP,
80d80c64
KR
2635 exp.X_add_number + S_GET_VALUE (s));
2636 symbolP->sy_frag = s->sy_frag;
ef198870 2637 copy_symbol_attributes (symbolP, s);
5ac34ac3
ILT
2638 }
2639 break;
f8701a3f 2640
5ac34ac3
ILT
2641 default:
2642 /* The value is some complex expression.
2643 FIXME: Should we set the segment to anything? */
2644 symbolP->sy_value = exp;
2645 break;
f8701a3f 2646 }
fecd2382
RP
2647}
2648\f
2649/*
2650 * cons()
2651 *
2652 * CONStruct more frag of .bytes, or .words etc.
2653 * Should need_pass_2 be 1 then emit no frag(s).
80aab579 2654 * This understands EXPRESSIONS.
fecd2382
RP
2655 *
2656 * Bug (?)
2657 *
2658 * This has a split personality. We use expression() to read the
2659 * value. We can detect if the value won't fit in a byte or word.
2660 * But we can't detect if expression() discarded significant digits
2661 * in the case of a long. Not worth the crocks required to fix it.
2662 */
2663
40324362
KR
2664/* Select a parser for cons expressions. */
2665
2666/* Some targets need to parse the expression in various fancy ways.
2667 You can define TC_PARSE_CONS_EXPRESSION to do whatever you like
2668 (for example, the HPPA does this). Otherwise, you can define
2669 BITFIELD_CONS_EXPRESSIONS to permit bitfields to be specified, or
2670 REPEAT_CONS_EXPRESSIONS to permit repeat counts. If none of these
2671 are defined, which is the normal case, then only simple expressions
2672 are permitted. */
2673
1356d77d
ILT
2674static void
2675parse_mri_cons PARAMS ((expressionS *exp, unsigned int nbytes));
2676
40324362
KR
2677#ifndef TC_PARSE_CONS_EXPRESSION
2678#ifdef BITFIELD_CONS_EXPRESSIONS
2679#define TC_PARSE_CONS_EXPRESSION(EXP, NBYTES) parse_bitfield_cons (EXP, NBYTES)
2680static void
2681parse_bitfield_cons PARAMS ((expressionS *exp, unsigned int nbytes));
2682#endif
40324362
KR
2683#ifdef REPEAT_CONS_EXPRESSIONS
2684#define TC_PARSE_CONS_EXPRESSION(EXP, NBYTES) parse_repeat_cons (EXP, NBYTES)
2685static void
2686parse_repeat_cons PARAMS ((expressionS *exp, unsigned int nbytes));
2687#endif
2688
2689/* If we haven't gotten one yet, just call expression. */
2690#ifndef TC_PARSE_CONS_EXPRESSION
2691#define TC_PARSE_CONS_EXPRESSION(EXP, NBYTES) expression (EXP)
2692#endif
2693#endif
2694
6efd877d
KR
2695/* worker to do .byte etc statements */
2696/* clobbers input_line_pointer, checks */
2697/* end-of-line. */
86038ada
ILT
2698static void
2699cons_worker (nbytes, rva)
604633ae 2700 register int nbytes; /* 1=.byte, 2=.word, 4=.long */
86038ada 2701 int rva;
fecd2382 2702{
286cb27a 2703 int c;
6efd877d 2704 expressionS exp;
86038ada 2705 char *stop = NULL;
3dce804d 2706 char stopc;
f8701a3f 2707
a2a5a4fa
KR
2708#ifdef md_flush_pending_output
2709 md_flush_pending_output ();
2710#endif
2711
18c9057f
ILT
2712 if (flag_mri)
2713 stop = mri_comment_field (&stopc);
2714
40324362 2715 if (is_it_end_of_statement ())
6efd877d 2716 {
18c9057f 2717 mri_comment_end (stop, stopc);
40324362
KR
2718 demand_empty_rest_of_line ();
2719 return;
6efd877d 2720 }
40324362 2721
286cb27a 2722 c = 0;
40324362 2723 do
6efd877d 2724 {
1356d77d
ILT
2725 if (flag_mri)
2726 parse_mri_cons (&exp, (unsigned int) nbytes);
2727 else
2728 TC_PARSE_CONS_EXPRESSION (&exp, (unsigned int) nbytes);
6594d6b9
KR
2729
2730 if (rva)
2731 {
2732 if (exp.X_op == O_symbol)
2733 exp.X_op = O_symbol_rva;
2734 else
2735 as_fatal ("rva without symbol");
2736 }
2737 emit_expr (&exp, (unsigned int) nbytes);
286cb27a 2738 ++c;
40324362 2739 }
18c9057f 2740 while (*input_line_pointer++ == ',');
40324362 2741
286cb27a
ILT
2742 /* In MRI mode, after an odd number of bytes, we must align to an
2743 even word boundary, unless the next instruction is a dc.b, ds.b
2744 or dcb.b. */
2745 if (flag_mri && nbytes == 1 && (c & 1) != 0)
2746 mri_pending_align = 1;
2747
40324362 2748 input_line_pointer--; /* Put terminator back into stream. */
86038ada
ILT
2749
2750 if (flag_mri)
18c9057f 2751 mri_comment_end (stop, stopc);
86038ada 2752
40324362 2753 demand_empty_rest_of_line ();
30d3a445 2754}
f8701a3f 2755
86038ada
ILT
2756
2757void
2758cons (size)
2759 int size;
2760{
2761 cons_worker (size, 0);
2762}
2763
2764void
2765s_rva (size)
2766 int size;
2767{
2768 cons_worker (size, 1);
2769}
2770
2771
40324362
KR
2772/* Put the contents of expression EXP into the object file using
2773 NBYTES bytes. If need_pass_2 is 1, this does nothing. */
f8701a3f 2774
40324362
KR
2775void
2776emit_expr (exp, nbytes)
2777 expressionS *exp;
2778 unsigned int nbytes;
2779{
5ac34ac3 2780 operatorT op;
40324362 2781 register char *p;
80aab579 2782 valueT extra_digit = 0;
f8701a3f 2783
40324362
KR
2784 /* Don't do anything if we are going to make another pass. */
2785 if (need_pass_2)
2786 return;
2787
5ac34ac3 2788 op = exp->X_op;
40324362 2789
e28c40d7
ILT
2790 /* Allow `.word 0' in the absolute section. */
2791 if (now_seg == absolute_section)
2792 {
2793 if (op != O_constant || exp->X_add_number != 0)
2794 as_bad ("attempt to store value in absolute section");
2795 abs_section_offset += nbytes;
2796 return;
2797 }
2798
80aab579
ILT
2799 /* Handle a negative bignum. */
2800 if (op == O_uminus
2801 && exp->X_add_number == 0
2802 && exp->X_add_symbol->sy_value.X_op == O_big
2803 && exp->X_add_symbol->sy_value.X_add_number > 0)
2804 {
2805 int i;
2806 unsigned long carry;
2807
2808 exp = &exp->X_add_symbol->sy_value;
2809
2810 /* Negate the bignum: one's complement each digit and add 1. */
2811 carry = 1;
2812 for (i = 0; i < exp->X_add_number; i++)
2813 {
2814 unsigned long next;
2815
2816 next = (((~ (generic_bignum[i] & LITTLENUM_MASK))
2817 & LITTLENUM_MASK)
2818 + carry);
2819 generic_bignum[i] = next & LITTLENUM_MASK;
2820 carry = next >> LITTLENUM_NUMBER_OF_BITS;
2821 }
2822
2823 /* We can ignore any carry out, because it will be handled by
2824 extra_digit if it is needed. */
2825
2826 extra_digit = (valueT) -1;
2827 op = O_big;
2828 }
2829
5ac34ac3 2830 if (op == O_absent || op == O_illegal)
6efd877d 2831 {
5ac34ac3
ILT
2832 as_warn ("zero assumed for missing expression");
2833 exp->X_add_number = 0;
2834 op = O_constant;
6efd877d 2835 }
80aab579 2836 else if (op == O_big && exp->X_add_number <= 0)
6efd877d 2837 {
80aab579 2838 as_bad ("floating point number invalid; zero assumed");
40324362 2839 exp->X_add_number = 0;
5ac34ac3 2840 op = O_constant;
40324362 2841 }
5ac34ac3 2842 else if (op == O_register)
6efd877d 2843 {
5ac34ac3
ILT
2844 as_warn ("register value used as expression");
2845 op = O_constant;
40324362 2846 }
6efd877d 2847
604633ae 2848 p = frag_more ((int) nbytes);
6efd877d 2849
40324362
KR
2850#ifndef WORKING_DOT_WORD
2851 /* If we have the difference of two symbols in a word, save it on
2852 the broken_words list. See the code in write.c. */
5ac34ac3 2853 if (op == O_subtract && nbytes == 2)
40324362
KR
2854 {
2855 struct broken_word *x;
2856
2857 x = (struct broken_word *) xmalloc (sizeof (struct broken_word));
2858 x->next_broken_word = broken_words;
2859 broken_words = x;
2860 x->frag = frag_now;
2861 x->word_goes_here = p;
2862 x->dispfrag = 0;
2863 x->add = exp->X_add_symbol;
5ac34ac3 2864 x->sub = exp->X_op_symbol;
40324362
KR
2865 x->addnum = exp->X_add_number;
2866 x->added = 0;
2867 new_broken_words++;
2868 return;
2869 }
f8701a3f 2870#endif
6efd877d 2871
80aab579
ILT
2872 /* If we have an integer, but the number of bytes is too large to
2873 pass to md_number_to_chars, handle it as a bignum. */
2874 if (op == O_constant && nbytes > sizeof (valueT))
2875 {
2876 valueT val;
2877 int gencnt;
2878
2879 if (! exp->X_unsigned && exp->X_add_number < 0)
2880 extra_digit = (valueT) -1;
2881 val = (valueT) exp->X_add_number;
2882 gencnt = 0;
2883 do
2884 {
2885 generic_bignum[gencnt] = val & LITTLENUM_MASK;
2886 val >>= LITTLENUM_NUMBER_OF_BITS;
2887 ++gencnt;
2888 }
2889 while (val != 0);
2890 op = exp->X_op = O_big;
2891 exp->X_add_number = gencnt;
2892 }
2893
5ac34ac3 2894 if (op == O_constant)
40324362 2895 {
44ce2f32
DE
2896 register valueT get;
2897 register valueT use;
2898 register valueT mask;
2899 register valueT unmask;
40324362
KR
2900
2901 /* JF << of >= number of bits in the object is undefined. In
2902 particular SPARC (Sun 4) has problems */
44ce2f32 2903 if (nbytes >= sizeof (valueT))
40324362
KR
2904 mask = 0;
2905 else
d2550c72 2906 mask = ~(valueT) 0 << (BITS_PER_CHAR * nbytes); /* Don't store these bits. */
6efd877d 2907
40324362 2908 unmask = ~mask; /* Do store these bits. */
6efd877d 2909
40324362
KR
2910#ifdef NEVER
2911 "Do this mod if you want every overflow check to assume SIGNED 2's complement data.";
2912 mask = ~(unmask >> 1); /* Includes sign bit now. */
2913#endif
6efd877d 2914
40324362
KR
2915 get = exp->X_add_number;
2916 use = get & unmask;
2917 if ((get & mask) != 0 && (get & mask) != mask)
2918 { /* Leading bits contain both 0s & 1s. */
58d4951d 2919 as_warn ("Value 0x%lx truncated to 0x%lx.", get, use);
40324362 2920 }
604633ae 2921 /* put bytes in right order. */
44ce2f32 2922 md_number_to_chars (p, use, (int) nbytes);
40324362 2923 }
80aab579
ILT
2924 else if (op == O_big)
2925 {
2926 int size;
2927 LITTLENUM_TYPE *nums;
2928
2929 know (nbytes % CHARS_PER_LITTLENUM == 0);
2930
2931 size = exp->X_add_number * CHARS_PER_LITTLENUM;
2932 if (nbytes < size)
2933 {
2934 as_warn ("Bignum truncated to %d bytes", nbytes);
2935 size = nbytes;
2936 }
2937
2938 if (target_big_endian)
2939 {
2940 while (nbytes > size)
2941 {
2942 md_number_to_chars (p, extra_digit, CHARS_PER_LITTLENUM);
2943 nbytes -= CHARS_PER_LITTLENUM;
2944 p += CHARS_PER_LITTLENUM;
2945 }
2946
2947 nums = generic_bignum + size / CHARS_PER_LITTLENUM;
2948 while (size > 0)
2949 {
2950 --nums;
2951 md_number_to_chars (p, (valueT) *nums, CHARS_PER_LITTLENUM);
2952 size -= CHARS_PER_LITTLENUM;
2953 p += CHARS_PER_LITTLENUM;
2954 }
2955 }
2956 else
2957 {
2958 nums = generic_bignum;
2959 while (size > 0)
2960 {
2961 md_number_to_chars (p, (valueT) *nums, CHARS_PER_LITTLENUM);
2962 ++nums;
2963 size -= CHARS_PER_LITTLENUM;
2964 p += CHARS_PER_LITTLENUM;
2965 nbytes -= CHARS_PER_LITTLENUM;
2966 }
2967
2968 while (nbytes > 0)
2969 {
2970 md_number_to_chars (p, extra_digit, CHARS_PER_LITTLENUM);
2971 nbytes -= CHARS_PER_LITTLENUM;
2972 p += CHARS_PER_LITTLENUM;
2973 }
2974 }
2975 }
40324362
KR
2976 else
2977 {
1fbfe108 2978 memset (p, 0, nbytes);
6efd877d 2979
40324362
KR
2980 /* Now we need to generate a fixS to record the symbol value.
2981 This is easy for BFD. For other targets it can be more
2982 complex. For very complex cases (currently, the HPPA and
2983 NS32K), you can define TC_CONS_FIX_NEW to do whatever you
2984 want. For simpler cases, you can define TC_CONS_RELOC to be
2985 the name of the reloc code that should be stored in the fixS.
2986 If neither is defined, the code uses NO_RELOC if it is
2987 defined, and otherwise uses 0. */
6efd877d 2988
40324362 2989#ifdef BFD_ASSEMBLER
4064305e
SS
2990#ifdef TC_CONS_FIX_NEW
2991 TC_CONS_FIX_NEW (frag_now, p - frag_now->fr_literal, nbytes, exp);
2992#else
604633ae 2993 fix_new_exp (frag_now, p - frag_now->fr_literal, (int) nbytes, exp, 0,
5ac34ac3 2994 /* @@ Should look at CPU word size. */
ba71c54d 2995 nbytes == 2 ? BFD_RELOC_16
86038ada
ILT
2996 : nbytes == 8 ? BFD_RELOC_64
2997 : BFD_RELOC_32);
4064305e 2998#endif
40324362
KR
2999#else
3000#ifdef TC_CONS_FIX_NEW
3001 TC_CONS_FIX_NEW (frag_now, p - frag_now->fr_literal, nbytes, exp);
3002#else
3003 /* Figure out which reloc number to use. Use TC_CONS_RELOC if
3004 it is defined, otherwise use NO_RELOC if it is defined,
3005 otherwise use 0. */
3006#ifndef TC_CONS_RELOC
3007#ifdef NO_RELOC
3008#define TC_CONS_RELOC NO_RELOC
3009#else
3010#define TC_CONS_RELOC 0
3011#endif
3012#endif
80aab579 3013 fix_new_exp (frag_now, p - frag_now->fr_literal, (int) nbytes, exp, 0,
5ac34ac3 3014 TC_CONS_RELOC);
40324362
KR
3015#endif /* TC_CONS_FIX_NEW */
3016#endif /* BFD_ASSEMBLER */
3017 }
3018}
3019\f
3020#ifdef BITFIELD_CONS_EXPRESSIONS
6efd877d 3021
40324362
KR
3022/* i960 assemblers, (eg, asm960), allow bitfields after ".byte" as
3023 w:x,y:z, where w and y are bitwidths and x and y are values. They
3024 then pack them all together. We do a little better in that we allow
3025 them in words, longs, etc. and we'll pack them in target byte order
3026 for you.
6efd877d 3027
40324362
KR
3028 The rules are: pack least significat bit first, if a field doesn't
3029 entirely fit, put it in the next unit. Overflowing the bitfield is
3030 explicitly *not* even a warning. The bitwidth should be considered
3031 a "mask".
6efd877d 3032
40324362
KR
3033 To use this function the tc-XXX.h file should define
3034 BITFIELD_CONS_EXPRESSIONS. */
f8701a3f 3035
40324362
KR
3036static void
3037parse_bitfield_cons (exp, nbytes)
3038 expressionS *exp;
3039 unsigned int nbytes;
3040{
3041 unsigned int bits_available = BITS_PER_CHAR * nbytes;
3042 char *hold = input_line_pointer;
f8701a3f 3043
5ac34ac3 3044 (void) expression (exp);
f8701a3f 3045
40324362
KR
3046 if (*input_line_pointer == ':')
3047 { /* bitfields */
3048 long value = 0;
f8701a3f 3049
40324362
KR
3050 for (;;)
3051 {
3052 unsigned long width;
f8701a3f 3053
40324362
KR
3054 if (*input_line_pointer != ':')
3055 {
3056 input_line_pointer = hold;
3057 break;
3058 } /* next piece is not a bitfield */
3059
3060 /* In the general case, we can't allow
3061 full expressions with symbol
3062 differences and such. The relocation
3063 entries for symbols not defined in this
3064 assembly would require arbitrary field
3065 widths, positions, and masks which most
3066 of our current object formats don't
3067 support.
cd3b81bd 3068
40324362
KR
3069 In the specific case where a symbol
3070 *is* defined in this assembly, we
3071 *could* build fixups and track it, but
3072 this could lead to confusion for the
3073 backends. I'm lazy. I'll take any
3074 SEG_ABSOLUTE. I think that means that
3075 you can use a previous .set or
3076 .equ type symbol. xoxorich. */
3077
5ac34ac3 3078 if (exp->X_op == O_absent)
6efd877d 3079 {
5ac34ac3 3080 as_warn ("using a bit field width of zero");
40324362 3081 exp->X_add_number = 0;
5ac34ac3 3082 exp->X_op = O_constant;
40324362
KR
3083 } /* implied zero width bitfield */
3084
5ac34ac3 3085 if (exp->X_op != O_constant)
6efd877d 3086 {
40324362 3087 *input_line_pointer = '\0';
5ac34ac3 3088 as_bad ("field width \"%s\" too complex for a bitfield", hold);
40324362
KR
3089 *input_line_pointer = ':';
3090 demand_empty_rest_of_line ();
3091 return;
3092 } /* too complex */
3093
3094 if ((width = exp->X_add_number) > (BITS_PER_CHAR * nbytes))
9471a360 3095 {
80aab579 3096 as_warn ("field width %lu too big to fit in %d bytes: truncated to %d bits",
40324362
KR
3097 width, nbytes, (BITS_PER_CHAR * nbytes));
3098 width = BITS_PER_CHAR * nbytes;
3099 } /* too big */
3100
3101 if (width > bits_available)
9471a360 3102 {
40324362
KR
3103 /* FIXME-SOMEDAY: backing up and reparsing is wasteful. */
3104 input_line_pointer = hold;
3105 exp->X_add_number = value;
3106 break;
3107 } /* won't fit */
3108
3109 hold = ++input_line_pointer; /* skip ':' */
3110
5ac34ac3
ILT
3111 (void) expression (exp);
3112 if (exp->X_op != O_constant)
9471a360 3113 {
40324362
KR
3114 char cache = *input_line_pointer;
3115
3116 *input_line_pointer = '\0';
5ac34ac3 3117 as_bad ("field value \"%s\" too complex for a bitfield", hold);
40324362
KR
3118 *input_line_pointer = cache;
3119 demand_empty_rest_of_line ();
3120 return;
3121 } /* too complex */
3122
5ac34ac3
ILT
3123 value |= ((~(-1 << width) & exp->X_add_number)
3124 << ((BITS_PER_CHAR * nbytes) - bits_available));
40324362
KR
3125
3126 if ((bits_available -= width) == 0
3127 || is_it_end_of_statement ()
3128 || *input_line_pointer != ',')
3129 {
3130 break;
3131 } /* all the bitfields we're gonna get */
3132
3133 hold = ++input_line_pointer;
5ac34ac3 3134 (void) expression (exp);
40324362
KR
3135 } /* forever loop */
3136
3137 exp->X_add_number = value;
5ac34ac3 3138 exp->X_op = O_constant;
80aab579 3139 exp->X_unsigned = 1;
40324362
KR
3140 } /* if looks like a bitfield */
3141} /* parse_bitfield_cons() */
3142
3143#endif /* BITFIELD_CONS_EXPRESSIONS */
3144\f
1356d77d 3145/* Handle an MRI style string expression. */
40324362
KR
3146
3147static void
3148parse_mri_cons (exp, nbytes)
3149 expressionS *exp;
3150 unsigned int nbytes;
3151{
1356d77d
ILT
3152 if (*input_line_pointer != '\''
3153 && (input_line_pointer[1] != '\''
3154 || (*input_line_pointer != 'A'
3155 && *input_line_pointer != 'E')))
3156 TC_PARSE_CONS_EXPRESSION (exp, nbytes);
3157 else
40324362 3158 {
40324362
KR
3159 int scan = 0;
3160 unsigned int result = 0;
1356d77d
ILT
3161
3162 /* An MRI style string. Cut into as many bytes as will fit into
3163 a nbyte chunk, left justify if necessary, and separate with
3164 commas so we can try again later. */
3165 if (*input_line_pointer == 'A')
3166 ++input_line_pointer;
3167 else if (*input_line_pointer == 'E')
3168 {
3169 as_bad ("EBCDIC constants are not supported");
3170 ++input_line_pointer;
3171 }
3172
40324362
KR
3173 input_line_pointer++;
3174 for (scan = 0; scan < nbytes; scan++)
3175 {
3176 if (*input_line_pointer == '\'')
3177 {
3178 if (input_line_pointer[1] == '\'')
6efd877d 3179 {
40324362 3180 input_line_pointer++;
f8701a3f 3181 }
40324362
KR
3182 else
3183 break;
9471a360 3184 }
40324362
KR
3185 result = (result << 8) | (*input_line_pointer++);
3186 }
f8701a3f 3187
40324362
KR
3188 /* Left justify */
3189 while (scan < nbytes)
3190 {
3191 result <<= 8;
3192 scan++;
3193 }
3194 /* Create correct expression */
5ac34ac3 3195 exp->X_op = O_constant;
40324362 3196 exp->X_add_number = result;
40324362
KR
3197 /* Fake it so that we can read the next char too */
3198 if (input_line_pointer[0] != '\'' ||
3199 (input_line_pointer[0] == '\'' && input_line_pointer[1] == '\''))
3200 {
3201 input_line_pointer -= 2;
3202 input_line_pointer[0] = ',';
3203 input_line_pointer[1] = '\'';
3204 }
3205 else
3206 input_line_pointer++;
3207 }
40324362 3208}
40324362
KR
3209\f
3210#ifdef REPEAT_CONS_EXPRESSIONS
3211
3212/* Parse a repeat expression for cons. This is used by the MIPS
3213 assembler. The format is NUMBER:COUNT; NUMBER appears in the
3214 object file COUNT times.
3215
3216 To use this for a target, define REPEAT_CONS_EXPRESSIONS. */
3217
3218static void
3219parse_repeat_cons (exp, nbytes)
3220 expressionS *exp;
3221 unsigned int nbytes;
3222{
3223 expressionS count;
40324362
KR
3224 register int i;
3225
3226 expression (exp);
3227
3228 if (*input_line_pointer != ':')
3229 {
3230 /* No repeat count. */
3231 return;
3232 }
3233
3234 ++input_line_pointer;
5ac34ac3
ILT
3235 expression (&count);
3236 if (count.X_op != O_constant
40324362
KR
3237 || count.X_add_number <= 0)
3238 {
3239 as_warn ("Unresolvable or nonpositive repeat count; using 1");
3240 return;
3241 }
3242
3243 /* The cons function is going to output this expression once. So we
3244 output it count - 1 times. */
3245 for (i = count.X_add_number - 1; i > 0; i--)
3246 emit_expr (exp, nbytes);
3247}
3248
3249#endif /* REPEAT_CONS_EXPRESSIONS */
fecd2382 3250\f
e28c40d7
ILT
3251/* Parse a floating point number represented as a hex constant. This
3252 permits users to specify the exact bits they want in the floating
3253 point number. */
3254
3255static int
3256hex_float (float_type, bytes)
3257 int float_type;
3258 char *bytes;
3259{
3260 int length;
3261 int i;
3262
3263 switch (float_type)
3264 {
3265 case 'f':
3266 case 'F':
3267 case 's':
3268 case 'S':
3269 length = 4;
3270 break;
3271
3272 case 'd':
3273 case 'D':
3274 case 'r':
3275 case 'R':
3276 length = 8;
3277 break;
3278
3279 case 'x':
3280 case 'X':
3281 length = 12;
3282 break;
3283
3284 case 'p':
3285 case 'P':
3286 length = 12;
3287 break;
3288
3289 default:
3290 as_bad ("Unknown floating type type '%c'", float_type);
3291 return -1;
3292 }
3293
3294 /* It would be nice if we could go through expression to parse the
3295 hex constant, but if we get a bignum it's a pain to sort it into
3296 the buffer correctly. */
3297 i = 0;
3298 while (hex_p (*input_line_pointer) || *input_line_pointer == '_')
3299 {
3300 int d;
3301
3302 /* The MRI assembler accepts arbitrary underscores strewn about
3303 through the hex constant, so we ignore them as well. */
3304 if (*input_line_pointer == '_')
3305 {
3306 ++input_line_pointer;
3307 continue;
3308 }
3309
3310 if (i >= length)
3311 {
3312 as_warn ("Floating point constant too large");
3313 return -1;
3314 }
3315 d = hex_value (*input_line_pointer) << 4;
3316 ++input_line_pointer;
3317 while (*input_line_pointer == '_')
3318 ++input_line_pointer;
3319 if (hex_p (*input_line_pointer))
3320 {
3321 d += hex_value (*input_line_pointer);
3322 ++input_line_pointer;
3323 }
a920b693
ILT
3324 if (target_big_endian)
3325 bytes[i] = d;
3326 else
3327 bytes[length - i - 1] = d;
3328 ++i;
e28c40d7
ILT
3329 }
3330
3331 if (i < length)
a920b693
ILT
3332 {
3333 if (target_big_endian)
3334 memset (bytes + i, 0, length - i);
3335 else
3336 memset (bytes, 0, length - i);
3337 }
e28c40d7
ILT
3338
3339 return length;
3340}
3341
fecd2382
RP
3342/*
3343 * float_cons()
3344 *
3345 * CONStruct some more frag chars of .floats .ffloats etc.
3346 * Makes 0 or more new frags.
3347 * If need_pass_2 == 1, no frags are emitted.
3348 * This understands only floating literals, not expressions. Sorry.
3349 *
3350 * A floating constant is defined by atof_generic(), except it is preceded
3351 * by 0d 0f 0g or 0h. After observing the STRANGE way my BSD AS does its
3352 * reading, I decided to be incompatible. This always tries to give you
3353 * rounded bits to the precision of the pseudo-op. Former AS did premature
3354 * truncatation, restored noisy bits instead of trailing 0s AND gave you
3355 * a choice of 2 flavours of noise according to which of 2 floating-point
3356 * scanners you directed AS to use.
3357 *
3358 * In: input_line_pointer->whitespace before, or '0' of flonum.
3359 *
3360 */
3361
ba71c54d
KR
3362void
3363float_cons (float_type)
6efd877d 3364 /* Clobbers input_line-pointer, checks end-of-line. */
f8701a3f 3365 register int float_type; /* 'f':.ffloat ... 'F':.float ... */
fecd2382 3366{
6efd877d 3367 register char *p;
6efd877d
KR
3368 int length; /* Number of chars in an object. */
3369 register char *err; /* Error from scanning floating literal. */
3370 char temp[MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT];
f8701a3f 3371
6efd877d 3372 if (is_it_end_of_statement ())
f8701a3f 3373 {
1e9cf565
ILT
3374 demand_empty_rest_of_line ();
3375 return;
f8701a3f 3376 }
1e9cf565
ILT
3377
3378 do
f8701a3f
SC
3379 {
3380 /* input_line_pointer->1st char of a flonum (we hope!). */
6efd877d 3381 SKIP_WHITESPACE ();
1e9cf565 3382
f8701a3f
SC
3383 /* Skip any 0{letter} that may be present. Don't even check if the
3384 * letter is legal. Someone may invent a "z" format and this routine
3385 * has no use for such information. Lusers beware: you get
3386 * diagnostics if your input is ill-conditioned.
3387 */
6efd877d
KR
3388 if (input_line_pointer[0] == '0' && isalpha (input_line_pointer[1]))
3389 input_line_pointer += 2;
f8701a3f 3390
1356d77d
ILT
3391 /* Accept :xxxx, where the x's are hex digits, for a floating
3392 point with the exact digits specified. */
3393 if (input_line_pointer[0] == ':')
f8701a3f 3394 {
e28c40d7
ILT
3395 ++input_line_pointer;
3396 length = hex_float (float_type, temp);
3397 if (length < 0)
1356d77d 3398 {
1356d77d
ILT
3399 ignore_rest_of_line ();
3400 return;
3401 }
1356d77d
ILT
3402 }
3403 else
3404 {
3405 err = md_atof (float_type, temp, &length);
3406 know (length <= MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT);
3407 know (length > 0);
3408 if (err)
3409 {
3410 as_bad ("Bad floating literal: %s", err);
3411 ignore_rest_of_line ();
3412 return;
3413 }
f8701a3f 3414 }
1e9cf565
ILT
3415
3416 if (!need_pass_2)
f8701a3f 3417 {
1e9cf565
ILT
3418 int count;
3419
3420 count = 1;
3421
3422#ifdef REPEAT_CONS_EXPRESSIONS
3423 if (*input_line_pointer == ':')
3424 {
1e9cf565
ILT
3425 expressionS count_exp;
3426
3427 ++input_line_pointer;
5ac34ac3
ILT
3428 expression (&count_exp);
3429 if (count_exp.X_op != O_constant
1e9cf565
ILT
3430 || count_exp.X_add_number <= 0)
3431 {
5ac34ac3 3432 as_warn ("unresolvable or nonpositive repeat count; using 1");
1e9cf565
ILT
3433 }
3434 else
3435 count = count_exp.X_add_number;
3436 }
3437#endif
3438
3439 while (--count >= 0)
a39116f1 3440 {
f8701a3f 3441 p = frag_more (length);
604633ae 3442 memcpy (p, temp, (unsigned int) length);
a39116f1 3443 }
542e1629 3444 }
1e9cf565 3445 SKIP_WHITESPACE ();
f8701a3f 3446 }
1e9cf565
ILT
3447 while (*input_line_pointer++ == ',');
3448
3449 --input_line_pointer; /* Put terminator back into stream. */
6efd877d 3450 demand_empty_rest_of_line ();
f8701a3f 3451} /* float_cons() */
fecd2382
RP
3452\f
3453/*
3454 * stringer()
3455 *
3456 * We read 0 or more ',' seperated, double-quoted strings.
3457 *
3458 * Caller should have checked need_pass_2 is FALSE because we don't check it.
3459 */
a39116f1
RP
3460
3461
6efd877d
KR
3462void
3463stringer (append_zero) /* Worker to do .ascii etc statements. */
3464 /* Checks end-of-line. */
f8701a3f 3465 register int append_zero; /* 0: don't append '\0', else 1 */
fecd2382 3466{
f8701a3f 3467 register unsigned int c;
6efd877d 3468
a2a5a4fa
KR
3469#ifdef md_flush_pending_output
3470 md_flush_pending_output ();
3471#endif
3472
f8701a3f
SC
3473 /*
3474 * The following awkward logic is to parse ZERO or more strings,
3475 * comma seperated. Recall a string expression includes spaces
3476 * before the opening '\"' and spaces after the closing '\"'.
3477 * We fake a leading ',' if there is (supposed to be)
3478 * a 1st, expression. We keep demanding expressions for each
3479 * ','.
3480 */
6efd877d
KR
3481 if (is_it_end_of_statement ())
3482 {
3483 c = 0; /* Skip loop. */
3484 ++input_line_pointer; /* Compensate for end of loop. */
3485 }
f8701a3f 3486 else
6efd877d
KR
3487 {
3488 c = ','; /* Do loop. */
3489 }
3490 while (c == ',' || c == '<' || c == '"')
3491 {
3492 SKIP_WHITESPACE ();
3493 switch (*input_line_pointer)
3494 {
3495 case '\"':
3496 ++input_line_pointer; /*->1st char of string. */
3497 while (is_a_char (c = next_char_of_string ()))
3498 {
3499 FRAG_APPEND_1_CHAR (c);
3500 }
3501 if (append_zero)
3502 {
3503 FRAG_APPEND_1_CHAR (0);
3504 }
3505 know (input_line_pointer[-1] == '\"');
3506 break;
3507 case '<':
3508 input_line_pointer++;
3509 c = get_single_number ();
3510 FRAG_APPEND_1_CHAR (c);
3511 if (*input_line_pointer != '>')
3512 {
3513 as_bad ("Expected <nn>");
3514 }
3515 input_line_pointer++;
3516 break;
3517 case ',':
3518 input_line_pointer++;
3519 break;
3520 }
3521 SKIP_WHITESPACE ();
3522 c = *input_line_pointer;
f8701a3f 3523 }
f8701a3f 3524
6efd877d
KR
3525 demand_empty_rest_of_line ();
3526} /* stringer() */
fecd2382 3527\f
6efd877d 3528/* FIXME-SOMEDAY: I had trouble here on characters with the
f8701a3f
SC
3529 high bits set. We'll probably also have trouble with
3530 multibyte chars, wide chars, etc. Also be careful about
3531 returning values bigger than 1 byte. xoxorich. */
fecd2382 3532
6efd877d
KR
3533unsigned int
3534next_char_of_string ()
3535{
3536 register unsigned int c;
3537
3538 c = *input_line_pointer++ & CHAR_MASK;
3539 switch (c)
3540 {
3541 case '\"':
3542 c = NOT_A_CHAR;
3543 break;
3544
ddb393cf 3545#ifndef NO_STRING_ESCAPES
6efd877d
KR
3546 case '\\':
3547 switch (c = *input_line_pointer++)
3548 {
3549 case 'b':
3550 c = '\b';
3551 break;
3552
3553 case 'f':
3554 c = '\f';
3555 break;
3556
3557 case 'n':
3558 c = '\n';
3559 break;
3560
3561 case 'r':
3562 c = '\r';
3563 break;
3564
3565 case 't':
3566 c = '\t';
3567 break;
3568
6efd877d
KR
3569 case 'v':
3570 c = '\013';
3571 break;
6efd877d
KR
3572
3573 case '\\':
3574 case '"':
3575 break; /* As itself. */
3576
3577 case '0':
3578 case '1':
3579 case '2':
3580 case '3':
3581 case '4':
3582 case '5':
3583 case '6':
3584 case '7':
3585 case '8':
3586 case '9':
3587 {
3588 long number;
d4c8cbd8 3589 int i;
6efd877d 3590
d4c8cbd8 3591 for (i = 0, number = 0; isdigit (c) && i < 3; c = *input_line_pointer++, i++)
6efd877d
KR
3592 {
3593 number = number * 8 + c - '0';
3594 }
3595 c = number & 0xff;
3596 }
3597 --input_line_pointer;
3598 break;
3599
d4c8cbd8
JL
3600 case 'x':
3601 case 'X':
3602 {
3603 long number;
3604
3605 number = 0;
3606 c = *input_line_pointer++;
3607 while (isxdigit (c))
3608 {
3609 if (isdigit (c))
3610 number = number * 16 + c - '0';
3611 else if (isupper (c))
3612 number = number * 16 + c - 'A' + 10;
3613 else
3614 number = number * 16 + c - 'a' + 10;
3615 c = *input_line_pointer++;
3616 }
3617 c = number & 0xff;
3618 --input_line_pointer;
3619 }
3620 break;
3621
6efd877d
KR
3622 case '\n':
3623 /* To be compatible with BSD 4.2 as: give the luser a linefeed!! */
3624 as_warn ("Unterminated string: Newline inserted.");
3625 c = '\n';
3626 break;
3627
3628 default:
3629
fecd2382 3630#ifdef ONLY_STANDARD_ESCAPES
6efd877d
KR
3631 as_bad ("Bad escaped character in string, '?' assumed");
3632 c = '?';
fecd2382 3633#endif /* ONLY_STANDARD_ESCAPES */
6efd877d
KR
3634
3635 break;
3636 } /* switch on escaped char */
3637 break;
ddb393cf 3638#endif /* ! defined (NO_STRING_ESCAPES) */
6efd877d
KR
3639
3640 default:
3641 break;
3642 } /* switch on char */
3643 return (c);
3644} /* next_char_of_string() */
fecd2382
RP
3645\f
3646static segT
f8701a3f 3647get_segmented_expression (expP)
6efd877d 3648 register expressionS *expP;
fecd2382 3649{
6efd877d 3650 register segT retval;
f8701a3f 3651
9471a360 3652 retval = expression (expP);
5ac34ac3
ILT
3653 if (expP->X_op == O_illegal
3654 || expP->X_op == O_absent
3655 || expP->X_op == O_big)
f8701a3f 3656 {
5ac34ac3
ILT
3657 as_bad ("expected address expression; zero assumed");
3658 expP->X_op = O_constant;
6efd877d 3659 expP->X_add_number = 0;
5ac34ac3 3660 retval = absolute_section;
f8701a3f 3661 }
5ac34ac3 3662 return retval;
fecd2382
RP
3663}
3664
6efd877d
KR
3665static segT
3666get_known_segmented_expression (expP)
3667 register expressionS *expP;
fecd2382 3668{
6efd877d 3669 register segT retval;
f8701a3f 3670
9471a360 3671 if ((retval = get_segmented_expression (expP)) == undefined_section)
f8701a3f 3672 {
5ac34ac3
ILT
3673 /* There is no easy way to extract the undefined symbol from the
3674 expression. */
3675 if (expP->X_add_symbol != NULL
3676 && S_GET_SEGMENT (expP->X_add_symbol) != expr_section)
3677 as_warn ("symbol \"%s\" undefined; zero assumed",
3678 S_GET_NAME (expP->X_add_symbol));
f8701a3f 3679 else
5ac34ac3
ILT
3680 as_warn ("some symbol undefined; zero assumed");
3681 retval = absolute_section;
3682 expP->X_op = O_constant;
6efd877d 3683 expP->X_add_number = 0;
f8701a3f 3684 }
5ac34ac3 3685 know (retval == absolute_section || SEG_NORMAL (retval));
f8701a3f 3686 return (retval);
fecd2382
RP
3687} /* get_known_segmented_expression() */
3688
58d4951d 3689offsetT
f8701a3f 3690get_absolute_expression ()
fecd2382 3691{
6efd877d 3692 expressionS exp;
f8701a3f 3693
5ac34ac3
ILT
3694 expression (&exp);
3695 if (exp.X_op != O_constant)
f8701a3f 3696 {
5ac34ac3 3697 if (exp.X_op != O_absent)
cd3b81bd 3698 as_bad ("bad or irreducible absolute expression; zero assumed");
6efd877d 3699 exp.X_add_number = 0;
f8701a3f 3700 }
5ac34ac3 3701 return exp.X_add_number;
fecd2382
RP
3702}
3703
6efd877d
KR
3704char /* return terminator */
3705get_absolute_expression_and_terminator (val_pointer)
3706 long *val_pointer; /* return value of expression */
fecd2382 3707{
58d4951d
ILT
3708 /* FIXME: val_pointer should probably be offsetT *. */
3709 *val_pointer = (long) get_absolute_expression ();
6efd877d 3710 return (*input_line_pointer++);
fecd2382
RP
3711}
3712\f
3713/*
3714 * demand_copy_C_string()
3715 *
3716 * Like demand_copy_string, but return NULL if the string contains any '\0's.
3717 * Give a warning if that happens.
3718 */
3719char *
f8701a3f 3720demand_copy_C_string (len_pointer)
6efd877d 3721 int *len_pointer;
fecd2382 3722{
6efd877d 3723 register char *s;
f8701a3f 3724
6efd877d 3725 if ((s = demand_copy_string (len_pointer)) != 0)
f8701a3f
SC
3726 {
3727 register int len;
3728
6594d6b9 3729 for (len = *len_pointer; len > 0; len--)
f8701a3f 3730 {
6efd877d 3731 if (*s == 0)
fecd2382 3732 {
f8701a3f
SC
3733 s = 0;
3734 len = 1;
6efd877d
KR
3735 *len_pointer = 0;
3736 as_bad ("This string may not contain \'\\0\'");
fecd2382 3737 }
f8701a3f
SC
3738 }
3739 }
6594d6b9 3740 return s;
fecd2382
RP
3741}
3742\f
3743/*
3744 * demand_copy_string()
3745 *
3746 * Demand string, but return a safe (=private) copy of the string.
3747 * Return NULL if we can't read a string here.
3748 */
6ef37255 3749char *
6efd877d
KR
3750demand_copy_string (lenP)
3751 int *lenP;
fecd2382 3752{
6efd877d
KR
3753 register unsigned int c;
3754 register int len;
3755 char *retval;
3756
3757 len = 0;
3758 SKIP_WHITESPACE ();
3759 if (*input_line_pointer == '\"')
3760 {
3761 input_line_pointer++; /* Skip opening quote. */
3762
3763 while (is_a_char (c = next_char_of_string ()))
3764 {
3765 obstack_1grow (&notes, c);
3766 len++;
fecd2382 3767 }
42ac8fa8
ILT
3768 /* JF this next line is so demand_copy_C_string will return a
3769 null terminated string. */
6efd877d
KR
3770 obstack_1grow (&notes, '\0');
3771 retval = obstack_finish (&notes);
3772 }
3773 else
3774 {
3775 as_warn ("Missing string");
3776 retval = NULL;
3777 ignore_rest_of_line ();
3778 }
3779 *lenP = len;
3780 return (retval);
3781} /* demand_copy_string() */
fecd2382
RP
3782\f
3783/*
3784 * is_it_end_of_statement()
3785 *
3786 * In: Input_line_pointer->next character.
3787 *
3788 * Do: Skip input_line_pointer over all whitespace.
3789 *
3790 * Out: 1 if input_line_pointer->end-of-line.
f8701a3f 3791*/
6efd877d
KR
3792int
3793is_it_end_of_statement ()
3794{
3795 SKIP_WHITESPACE ();
58d4951d 3796 return (is_end_of_line[(unsigned char) *input_line_pointer]);
6efd877d 3797} /* is_it_end_of_statement() */
fecd2382 3798
6efd877d
KR
3799void
3800equals (sym_name)
3801 char *sym_name;
fecd2382 3802{
6efd877d 3803 register symbolS *symbolP; /* symbol we are working with */
86038ada 3804 char *stop;
18c9057f 3805 char stopc;
f8701a3f
SC
3806
3807 input_line_pointer++;
6efd877d 3808 if (*input_line_pointer == '=')
f8701a3f
SC
3809 input_line_pointer++;
3810
6efd877d 3811 while (*input_line_pointer == ' ' || *input_line_pointer == '\t')
f8701a3f
SC
3812 input_line_pointer++;
3813
86038ada 3814 if (flag_mri)
18c9057f 3815 stop = mri_comment_field (&stopc);
86038ada 3816
6efd877d
KR
3817 if (sym_name[0] == '.' && sym_name[1] == '\0')
3818 {
3819 /* Turn '. = mumble' into a .org mumble */
3820 register segT segment;
3821 expressionS exp;
f8701a3f 3822
6efd877d
KR
3823 segment = get_known_segmented_expression (&exp);
3824 if (!need_pass_2)
e28c40d7 3825 do_org (segment, &exp, 0);
6efd877d
KR
3826 }
3827 else
3828 {
3829 symbolP = symbol_find_or_make (sym_name);
3830 pseudo_set (symbolP);
3831 }
86038ada
ILT
3832
3833 if (flag_mri)
18c9057f 3834 mri_comment_end (stop, stopc);
6efd877d 3835} /* equals() */
fecd2382
RP
3836
3837/* .include -- include a file at this point. */
3838
3839/* ARGSUSED */
6efd877d
KR
3840void
3841s_include (arg)
3842 int arg;
fecd2382 3843{
f8701a3f
SC
3844 char *newbuf;
3845 char *filename;
3846 int i;
3847 FILE *try;
3848 char *path;
3849
ca232972
ILT
3850 if (! flag_mri)
3851 filename = demand_copy_string (&i);
3852 else
3853 {
3854 SKIP_WHITESPACE ();
3855 i = 0;
3856 while (! is_end_of_line[(unsigned char) *input_line_pointer]
3857 && *input_line_pointer != ' '
3858 && *input_line_pointer != '\t')
3859 {
3860 obstack_1grow (&notes, *input_line_pointer);
3861 ++input_line_pointer;
3862 ++i;
3863 }
3864 obstack_1grow (&notes, '\0');
3865 filename = obstack_finish (&notes);
42ac8fa8
ILT
3866 while (! is_end_of_line[(unsigned char) *input_line_pointer])
3867 ++input_line_pointer;
ca232972 3868 }
6efd877d 3869 demand_empty_rest_of_line ();
604633ae 3870 path = xmalloc ((unsigned long) i + include_dir_maxlen + 5 /* slop */ );
6efd877d
KR
3871 for (i = 0; i < include_dir_count; i++)
3872 {
3873 strcpy (path, include_dirs[i]);
3874 strcat (path, "/");
3875 strcat (path, filename);
f2889110 3876 if (0 != (try = fopen (path, "r")))
6efd877d
KR
3877 {
3878 fclose (try);
3879 goto gotit;
3880 }
3881 }
3882 free (path);
f8701a3f
SC
3883 path = filename;
3884gotit:
3885 /* malloc Storage leak when file is found on path. FIXME-SOMEDAY. */
3886 newbuf = input_scrub_include_file (path, input_line_pointer);
3887 buffer_limit = input_scrub_next_buffer (&input_line_pointer);
6efd877d 3888} /* s_include() */
fecd2382 3889
6efd877d
KR
3890void
3891add_include_dir (path)
3892 char *path;
fecd2382 3893{
f8701a3f
SC
3894 int i;
3895
3896 if (include_dir_count == 0)
3897 {
6efd877d 3898 include_dirs = (char **) xmalloc (2 * sizeof (*include_dirs));
f8701a3f
SC
3899 include_dirs[0] = "."; /* Current dir */
3900 include_dir_count = 2;
3901 }
3902 else
3903 {
3904 include_dir_count++;
6efd877d
KR
3905 include_dirs = (char **) realloc (include_dirs,
3906 include_dir_count * sizeof (*include_dirs));
f8701a3f
SC
3907 }
3908
6efd877d 3909 include_dirs[include_dir_count - 1] = path; /* New one */
f8701a3f 3910
6efd877d
KR
3911 i = strlen (path);
3912 if (i > include_dir_maxlen)
3913 include_dir_maxlen = i;
3914} /* add_include_dir() */
fecd2382 3915
6efd877d
KR
3916void
3917s_ignore (arg)
3918 int arg;
fecd2382 3919{
58d4951d 3920 while (!is_end_of_line[(unsigned char) *input_line_pointer])
6efd877d
KR
3921 {
3922 ++input_line_pointer;
3923 }
3924 ++input_line_pointer;
4064305e
SS
3925}
3926
604633ae 3927
6594d6b9
KR
3928void
3929read_print_statistics (file)
3930 FILE *file;
3931{
3932 hash_print_statistics (file, "pseudo-op table", po_hash);
3933}
3934
fecd2382 3935/* end of read.c */
This page took 0.427677 seconds and 4 git commands to generate.