* config/obj-elf.c (elf_begin): New function.
[deliverable/binutils-gdb.git] / gas / as.c
1 /* as.c - GAS main program.
2 Copyright (C) 1987, 90, 91, 92, 93, 94, 95, 1996
3 Free Software Foundation, Inc.
4
5 This file is part of GAS, the GNU Assembler.
6
7 GAS is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2, or (at your option)
10 any later version.
11
12 GAS is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with GAS; see the file COPYING. If not, write to the Free
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
20 02111-1307, USA. */
21
22 /*
23 * Main program for AS; a 32-bit assembler of GNU.
24 * Understands command arguments.
25 * Has a few routines that don't fit in other modules because they
26 * are shared.
27 *
28 *
29 * bugs
30 *
31 * : initialisers
32 * Since no-one else says they will support them in future: I
33 * don't support them now.
34 *
35 */
36
37 #include "ansidecl.h"
38 #include "libiberty.h"
39
40 #define COMMON
41
42 #include "as.h"
43 #include "subsegs.h"
44 #include "output-file.h"
45 #include "sb.h"
46 #include "macro.h"
47
48 #ifdef HAVE_SBRK
49 #ifdef NEED_DECLARATION_SBRK
50 extern PTR sbrk ();
51 #endif
52 #endif
53
54 static void perform_an_assembly_pass PARAMS ((int argc, char **argv));
55 static int macro_expr PARAMS ((const char *, int, sb *, int *));
56
57 int listing; /* true if a listing is wanted */
58
59 static char *listing_filename = NULL; /* Name of listing file. */
60
61 /* Maximum level of macro nesting. */
62
63 int max_macro_nest = 100;
64
65 char *myname; /* argv[0] */
66 #ifdef BFD_ASSEMBLER
67 segT reg_section, expr_section;
68 segT text_section, data_section, bss_section;
69 #endif
70
71 int chunksize = 5000;
72
73 /* To monitor memory allocation more effectively, make this non-zero.
74 Then the chunk sizes for gas and bfd will be reduced. */
75 int debug_memory = 0;
76
77 /* We build a list of defsyms as we read the options, and then define
78 them after we have initialized everything. */
79
80 struct defsym_list
81 {
82 struct defsym_list *next;
83 char *name;
84 valueT value;
85 };
86
87 static struct defsym_list *defsyms;
88 \f
89 void
90 print_version_id ()
91 {
92 static int printed;
93 if (printed)
94 return;
95 printed = 1;
96
97 fprintf (stderr, "GNU assembler version %s (%s)", GAS_VERSION, TARGET_ALIAS);
98 #ifdef BFD_ASSEMBLER
99 fprintf (stderr, ", using BFD version %s", BFD_VERSION);
100 #endif
101 fprintf (stderr, "\n");
102 }
103
104 void
105 show_usage (stream)
106 FILE *stream;
107 {
108 fprintf (stream, "Usage: %s [option...] [asmfile...]\n", myname);
109
110 fprintf (stream, "\
111 Options:\n\
112 -a[sub-option...] turn on listings\n\
113 Sub-options [default hls]:\n\
114 d omit debugging directives\n\
115 h include high-level source\n\
116 l include assembly\n\
117 n omit forms processing\n\
118 s include symbols\n\
119 =file set listing file name (must be last sub-option)\n");
120 fprintf (stream, "\
121 -D produce assembler debugging messages\n\
122 --defsym SYM=VAL define symbol SYM to given value\n\
123 -f skip whitespace and comment preprocessing\n\
124 --help show this message and exit\n\
125 -I DIR add DIR to search list for .include directives\n\
126 -J don't warn about signed overflow\n\
127 -K warn when differences altered for long displacements\n\
128 -L keep local symbols (starting with `L')\n");
129 fprintf (stream, "\
130 -M,--mri assemble in MRI compatibility mode\n\
131 -nocpp ignored\n\
132 -o OBJFILE name the object-file output OBJFILE (default a.out)\n\
133 -R fold data section into text section\n\
134 --statistics print various measured statistics from execution\n\
135 --version print assembler version number and exit\n\
136 -W suppress warnings\n\
137 -w ignored\n\
138 -X ignored\n\
139 -Z generate object file even after errors\n");
140
141 md_show_usage (stream);
142
143 fprintf (stream, "\nReport bugs to bug-gnu-utils@prep.ai.mit.edu\n");
144 }
145
146 #ifdef USE_EMULATIONS
147 #define EMULATION_ENVIRON "AS_EMULATION"
148
149 extern struct emulation mipsbelf, mipslelf, mipself;
150 extern struct emulation mipsbecoff, mipslecoff, mipsecoff;
151
152 static struct emulation *const emulations[] = { EMULATIONS };
153 static const int n_emulations = sizeof (emulations) / sizeof (emulations[0]);
154
155 static void
156 select_emulation_mode (argc, argv)
157 int argc;
158 char **argv;
159 {
160 int i;
161 char *p, *em = 0;
162
163 for (i = 1; i < argc; i++)
164 if (!strncmp ("--em", argv[i], 4))
165 break;
166
167 if (i == argc)
168 goto do_default;
169
170 p = strchr (argv[i], '=');
171 if (p)
172 p++;
173 else
174 p = argv[i+1];
175
176 if (!p || !*p)
177 as_fatal ("missing emulation mode name");
178 em = p;
179
180 do_default:
181 if (em == 0)
182 em = getenv (EMULATION_ENVIRON);
183 if (em == 0)
184 em = DEFAULT_EMULATION;
185
186 if (em)
187 {
188 for (i = 0; i < n_emulations; i++)
189 if (!strcmp (emulations[i]->name, em))
190 break;
191 if (i == n_emulations)
192 as_fatal ("unrecognized emulation name `%s'", em);
193 this_emulation = emulations[i];
194 }
195 else
196 this_emulation = emulations[0];
197
198 this_emulation->init ();
199 }
200
201 const char *
202 default_emul_bfd_name ()
203 {
204 abort ();
205 return NULL;
206 }
207
208 void
209 common_emul_init ()
210 {
211 this_format = this_emulation->format;
212
213 if (this_emulation->leading_underscore == 2)
214 this_emulation->leading_underscore = this_format->dfl_leading_underscore;
215
216 if (this_emulation->default_endian != 2)
217 target_big_endian = this_emulation->default_endian;
218
219 if (this_emulation->fake_label_name == 0)
220 {
221 if (this_emulation->leading_underscore)
222 this_emulation->fake_label_name = "L0\001";
223 else
224 /* What other parameters should we test? */
225 this_emulation->fake_label_name = ".L0\001";
226 }
227 }
228 #endif
229
230 /*
231 * Since it is easy to do here we interpret the special arg "-"
232 * to mean "use stdin" and we set that argv[] pointing to "".
233 * After we have munged argv[], the only things left are source file
234 * name(s) and ""(s) denoting stdin. These file names are used
235 * (perhaps more than once) later.
236 *
237 * check for new machine-dep cmdline options in
238 * md_parse_option definitions in config/tc-*.c
239 */
240
241 void
242 parse_args (pargc, pargv)
243 int *pargc;
244 char ***pargv;
245 {
246 int old_argc, new_argc;
247 char **old_argv, **new_argv;
248
249 /* Starting the short option string with '-' is for programs that
250 expect options and other ARGV-elements in any order and that care about
251 the ordering of the two. We describe each non-option ARGV-element
252 as if it were the argument of an option with character code 1. */
253
254 char *shortopts;
255 extern CONST char *md_shortopts;
256 static const char std_shortopts[] =
257 {
258 '-', 'J',
259 #ifndef WORKING_DOT_WORD
260 /* -K is not meaningful if .word is not being hacked. */
261 'K',
262 #endif
263 'L', 'M', 'R', 'W', 'Z', 'f', 'a', ':', ':', 'D', 'I', ':', 'o', ':',
264 #ifndef VMS
265 /* -v takes an argument on VMS, so we don't make it a generic
266 option. */
267 'v',
268 #endif
269 'w', 'X',
270 '\0'
271 };
272 struct option *longopts;
273 extern struct option md_longopts[];
274 extern size_t md_longopts_size;
275 static const struct option std_longopts[] = {
276 #define OPTION_HELP (OPTION_STD_BASE)
277 {"help", no_argument, NULL, OPTION_HELP},
278 {"mri", no_argument, NULL, 'M'},
279 #define OPTION_NOCPP (OPTION_STD_BASE + 1)
280 {"nocpp", no_argument, NULL, OPTION_NOCPP},
281 #define OPTION_STATISTICS (OPTION_STD_BASE + 2)
282 {"statistics", no_argument, NULL, OPTION_STATISTICS},
283 #define OPTION_VERSION (OPTION_STD_BASE + 3)
284 {"version", no_argument, NULL, OPTION_VERSION},
285 #define OPTION_DUMPCONFIG (OPTION_STD_BASE + 4)
286 {"dump-config", no_argument, NULL, OPTION_DUMPCONFIG},
287 #define OPTION_VERBOSE (OPTION_STD_BASE + 5)
288 {"verbose", no_argument, NULL, OPTION_VERBOSE},
289 #define OPTION_EMULATION (OPTION_STD_BASE + 6)
290 {"emulation", required_argument, NULL, OPTION_EMULATION},
291 #define OPTION_DEFSYM (OPTION_STD_BASE + 7)
292 {"defsym", required_argument, NULL, OPTION_DEFSYM}
293 };
294
295 /* Construct the option lists from the standard list and the
296 target dependent list. */
297 shortopts = concat (std_shortopts, md_shortopts, (char *) NULL);
298 longopts = (struct option *) xmalloc (sizeof (std_longopts) + md_longopts_size);
299 memcpy (longopts, std_longopts, sizeof (std_longopts));
300 memcpy ((char *) longopts + sizeof (std_longopts),
301 md_longopts, md_longopts_size);
302
303 /* Make a local copy of the old argv. */
304 old_argc = *pargc;
305 old_argv = *pargv;
306
307 /* Initialize a new argv that contains no options. */
308 new_argv = (char **) xmalloc (sizeof (char *) * (old_argc + 1));
309 new_argv[0] = old_argv[0];
310 new_argc = 1;
311 new_argv[new_argc] = NULL;
312
313 while (1)
314 {
315 /* getopt_long_only is like getopt_long, but '-' as well as '--' can
316 indicate a long option. */
317 int longind;
318 int optc = getopt_long_only (old_argc, old_argv, shortopts, longopts,
319 &longind);
320
321 if (optc == -1)
322 break;
323
324 switch (optc)
325 {
326 default:
327 /* md_parse_option should return 1 if it recognizes optc,
328 0 if not. */
329 if (md_parse_option (optc, optarg) != 0)
330 break;
331 /* `-v' isn't included in the general short_opts list, so check for
332 it explicity here before deciding we've gotten a bad argument. */
333 if (optc == 'v')
334 {
335 #ifdef VMS
336 /* Telling getopt to treat -v's value as optional can result
337 in it picking up a following filename argument here. The
338 VMS code in md_parse_option can return 0 in that case,
339 but it has no way of pushing the filename argument back. */
340 if (optarg && *optarg)
341 new_argv[new_argc++] = optarg, new_argv[new_argc] = NULL;
342 else
343 #else
344 case 'v':
345 #endif
346 case OPTION_VERBOSE:
347 print_version_id ();
348 break;
349 }
350 /*FALLTHRU*/
351
352 case '?':
353 exit (EXIT_FAILURE);
354
355 case 1: /* File name. */
356 if (!strcmp (optarg, "-"))
357 optarg = "";
358 new_argv[new_argc++] = optarg;
359 new_argv[new_argc] = NULL;
360 break;
361
362 case OPTION_HELP:
363 show_usage (stdout);
364 exit (EXIT_SUCCESS);
365
366 case OPTION_NOCPP:
367 break;
368
369 case OPTION_STATISTICS:
370 flag_print_statistics = 1;
371 break;
372
373 case OPTION_VERSION:
374 /* This output is intended to follow the GNU standards document. */
375 printf ("GNU assembler %s\n", GAS_VERSION);
376 printf ("Copyright 1996 Free Software Foundation, Inc.\n");
377 printf ("\
378 This program is free software; you may redistribute it under the terms of\n\
379 the GNU General Public License. This program has absolutely no warranty.\n");
380 printf ("This assembler was configured for a target of `%s'.\n",
381 TARGET_ALIAS);
382 exit (EXIT_SUCCESS);
383
384 case OPTION_EMULATION:
385 #ifdef USE_EMULATIONS
386 if (strcmp (optarg, this_emulation->name))
387 as_fatal ("multiple emulation names specified");
388 #else
389 as_fatal ("emulations not handled in this configuration");
390 #endif
391 break;
392
393 case OPTION_DUMPCONFIG:
394 fprintf (stderr, "alias = %s\n", TARGET_ALIAS);
395 fprintf (stderr, "canonical = %s\n", TARGET_CANONICAL);
396 fprintf (stderr, "cpu-type = %s\n", TARGET_CPU);
397 #ifdef TARGET_OBJ_FORMAT
398 fprintf (stderr, "format = %s\n", TARGET_OBJ_FORMAT);
399 #endif
400 #ifdef TARGET_FORMAT
401 fprintf (stderr, "bfd-target = %s\n", TARGET_FORMAT);
402 #endif
403 exit (EXIT_SUCCESS);
404
405 case OPTION_DEFSYM:
406 {
407 char *s;
408 long i;
409 struct defsym_list *n;
410
411 for (s = optarg; *s != '\0' && *s != '='; s++)
412 ;
413 if (*s == '\0')
414 as_fatal ("bad defsym; format is --defsym name=value");
415 *s++ = '\0';
416 i = strtol (s, (char **) NULL, 0);
417 n = (struct defsym_list *) xmalloc (sizeof *n);
418 n->next = defsyms;
419 n->name = optarg;
420 n->value = i;
421 defsyms = n;
422 }
423 break;
424
425 case 'J':
426 flag_signed_overflow_ok = 1;
427 break;
428
429 #ifndef WORKING_DOT_WORD
430 case 'K':
431 flag_warn_displacement = 1;
432 break;
433 #endif
434
435 case 'L':
436 flag_keep_locals = 1;
437 break;
438
439 case 'M':
440 flag_mri = 1;
441 #ifdef TC_M68K
442 flag_m68k_mri = 1;
443 #endif
444 break;
445
446 case 'R':
447 flag_readonly_data_in_text = 1;
448 break;
449
450 case 'W':
451 flag_no_warnings = 1;
452 break;
453
454 case 'Z':
455 flag_always_generate_output = 1;
456 break;
457
458 case 'a':
459 if (optarg)
460 {
461 while (*optarg)
462 {
463 switch (*optarg)
464 {
465 case 'd':
466 listing |= LISTING_NODEBUG;
467 break;
468 case 'h':
469 listing |= LISTING_HLL;
470 break;
471 case 'l':
472 listing |= LISTING_LISTING;
473 break;
474 case 'n':
475 listing |= LISTING_NOFORM;
476 break;
477 case 's':
478 listing |= LISTING_SYMBOLS;
479 break;
480 case '=':
481 listing_filename = xstrdup (optarg + 1);
482 optarg += strlen (listing_filename);
483 break;
484 default:
485 as_fatal ("invalid listing option `%c'", *optarg);
486 break;
487 }
488 optarg++;
489 }
490 }
491 if (!listing)
492 listing = LISTING_DEFAULT;
493 break;
494
495 case 'D':
496 /* DEBUG is implemented: it debugs different */
497 /* things from other people's assemblers. */
498 flag_debug = 1;
499 break;
500
501 case 'f':
502 flag_no_comments = 1;
503 break;
504
505 case 'I':
506 { /* Include file directory */
507 char *temp = xstrdup (optarg);
508 add_include_dir (temp);
509 break;
510 }
511
512 case 'o':
513 out_file_name = xstrdup (optarg);
514 break;
515
516 case 'w':
517 break;
518
519 case 'X':
520 /* -X means treat warnings as errors */
521 break;
522 }
523 }
524
525 free (shortopts);
526 free (longopts);
527
528 *pargc = new_argc;
529 *pargv = new_argv;
530 }
531
532 static void dump_statistics ();
533 static long start_time;
534
535 int
536 main (argc, argv)
537 int argc;
538 char **argv;
539 {
540 int macro_alternate;
541 int macro_strip_at;
542 int keep_it;
543
544 start_time = get_run_time ();
545
546 if (debug_memory)
547 {
548 #ifdef BFD_ASSEMBLER
549 extern long _bfd_chunksize;
550 _bfd_chunksize = 64;
551 #endif
552 chunksize = 64;
553 }
554
555 #ifdef HOST_SPECIAL_INIT
556 HOST_SPECIAL_INIT (argc, argv);
557 #endif
558
559 myname = argv[0];
560 xmalloc_set_program_name (myname);
561
562 START_PROGRESS (myname, 0);
563
564 #ifndef OBJ_DEFAULT_OUTPUT_FILE_NAME
565 #define OBJ_DEFAULT_OUTPUT_FILE_NAME "a.out"
566 #endif
567
568 out_file_name = OBJ_DEFAULT_OUTPUT_FILE_NAME;
569
570 hex_init ();
571 #ifdef BFD_ASSEMBLER
572 bfd_init ();
573 bfd_set_error_program_name (myname);
574 #endif
575
576 #ifdef USE_EMULATIONS
577 select_emulation_mode (argc, argv);
578 #endif
579
580 PROGRESS (1);
581 symbol_begin ();
582 frag_init ();
583 subsegs_begin ();
584 parse_args (&argc, &argv);
585 read_begin ();
586 input_scrub_begin ();
587 expr_begin ();
588
589 if (flag_print_statistics)
590 xatexit (dump_statistics);
591
592 macro_alternate = 0;
593 macro_strip_at = 0;
594 #ifdef TC_I960
595 macro_strip_at = flag_mri;
596 #endif
597 #ifdef TC_A29K
598 /* For compatibility with the AMD 29K family macro assembler
599 specification. */
600 macro_alternate = 1;
601 macro_strip_at = 1;
602 #endif
603
604 macro_init (macro_alternate, flag_mri, macro_strip_at, macro_expr);
605
606 PROGRESS (1);
607
608 #ifdef BFD_ASSEMBLER
609 output_file_create (out_file_name);
610 assert (stdoutput != 0);
611 #endif
612
613 #ifdef tc_init_after_args
614 tc_init_after_args ();
615 #endif
616
617 /* Now that we have fully initialized, and have created the output
618 file, define any symbols requested by --defsym command line
619 arguments. */
620 while (defsyms != NULL)
621 {
622 symbolS *sym;
623 struct defsym_list *next;
624
625 sym = symbol_new (defsyms->name, absolute_section, defsyms->value,
626 &zero_address_frag);
627 symbol_table_insert (sym);
628 next = defsyms->next;
629 free (defsyms);
630 defsyms = next;
631 }
632
633 PROGRESS (1);
634
635 perform_an_assembly_pass (argc, argv); /* Assemble it. */
636
637 #ifdef md_end
638 md_end ();
639 #endif
640
641 if (seen_at_least_1_file ()
642 && !((had_warnings () && flag_always_generate_output)
643 || had_errors () > 0))
644 keep_it = 1;
645 else
646 keep_it = 0;
647
648 if (keep_it)
649 write_object_file ();
650
651 #ifndef NO_LISTING
652 listing_print (listing_filename);
653 #endif
654
655 #ifndef OBJ_VMS /* does its own file handling */
656 #ifndef BFD_ASSEMBLER
657 if (keep_it)
658 #endif
659 output_file_close (out_file_name);
660 #endif
661
662 if (!keep_it)
663 unlink (out_file_name);
664
665 input_scrub_end ();
666
667 END_PROGRESS (myname);
668
669 /* Use xexit instead of return, because under VMS environments they
670 may not place the same interpretation on the value given. */
671 if ((had_warnings () && flag_always_generate_output)
672 || had_errors () > 0)
673 xexit (EXIT_FAILURE);
674 xexit (EXIT_SUCCESS);
675 }
676
677 static void
678 dump_statistics ()
679 {
680 extern char **environ;
681 #ifdef HAVE_SBRK
682 char *lim = (char *) sbrk (0);
683 #endif
684 long run_time = get_run_time () - start_time;
685
686 fprintf (stderr, "%s: total time in assembly: %ld.%06ld\n",
687 myname, run_time / 1000000, run_time % 1000000);
688 #ifdef HAVE_SBRK
689 fprintf (stderr, "%s: data size %ld\n",
690 myname, (long) (lim - (char *) &environ));
691 #endif
692
693 subsegs_print_statistics (stderr);
694 write_print_statistics (stderr);
695 symbol_print_statistics (stderr);
696 read_print_statistics (stderr);
697
698 #ifdef tc_print_statistics
699 tc_print_statistics (stderr);
700 #endif
701 #ifdef obj_print_statistics
702 obj_print_statistics (stderr);
703 #endif
704 }
705 \f
706
707 /* perform_an_assembly_pass()
708 *
709 * Here to attempt 1 pass over each input file.
710 * We scan argv[*] looking for filenames or exactly "" which is
711 * shorthand for stdin. Any argv that is NULL is not a file-name.
712 * We set need_pass_2 TRUE if, after this, we still have unresolved
713 * expressions of the form (unknown value)+-(unknown value).
714 *
715 * Note the un*x semantics: there is only 1 logical input file, but it
716 * may be a catenation of many 'physical' input files.
717 */
718 static void
719 perform_an_assembly_pass (argc, argv)
720 int argc;
721 char **argv;
722 {
723 int saw_a_file = 0;
724 #ifdef BFD_ASSEMBLER
725 flagword applicable;
726 #endif
727
728 need_pass_2 = 0;
729
730 #ifndef BFD_ASSEMBLER
731 #ifdef MANY_SEGMENTS
732 {
733 unsigned int i;
734 for (i = SEG_E0; i < SEG_UNKNOWN; i++)
735 segment_info[i].fix_root = 0;
736 }
737 /* Create the three fixed ones */
738 {
739 segT seg;
740
741 #ifdef TE_APOLLO
742 seg = subseg_new (".wtext", 0);
743 #else
744 seg = subseg_new (".text", 0);
745 #endif
746 assert (seg == SEG_E0);
747 seg = subseg_new (".data", 0);
748 assert (seg == SEG_E1);
749 seg = subseg_new (".bss", 0);
750 assert (seg == SEG_E2);
751 #ifdef TE_APOLLO
752 create_target_segments ();
753 #endif
754 }
755
756 #else /* not MANY_SEGMENTS */
757 text_fix_root = NULL;
758 data_fix_root = NULL;
759 bss_fix_root = NULL;
760 #endif /* not MANY_SEGMENTS */
761 #else /* BFD_ASSEMBLER */
762 /* Create the standard sections, and those the assembler uses
763 internally. */
764 text_section = subseg_new (".text", 0);
765 data_section = subseg_new (".data", 0);
766 bss_section = subseg_new (".bss", 0);
767 /* @@ FIXME -- we're setting the RELOC flag so that sections are assumed
768 to have relocs, otherwise we don't find out in time. */
769 applicable = bfd_applicable_section_flags (stdoutput);
770 bfd_set_section_flags (stdoutput, text_section,
771 applicable & (SEC_ALLOC | SEC_LOAD | SEC_RELOC
772 | SEC_CODE | SEC_READONLY));
773 /* @@ FIXME -- SEC_CODE seems to mean code only, rather than code possibly.*/
774 bfd_set_section_flags (stdoutput, data_section,
775 applicable & (SEC_ALLOC | SEC_LOAD | SEC_RELOC));
776 bfd_set_section_flags (stdoutput, bss_section, applicable & SEC_ALLOC);
777 seg_info (bss_section)->bss = 1;
778 subseg_new (BFD_ABS_SECTION_NAME, 0);
779 subseg_new (BFD_UND_SECTION_NAME, 0);
780 reg_section = subseg_new ("*GAS `reg' section*", 0);
781 expr_section = subseg_new ("*GAS `expr' section*", 0);
782
783 #endif /* BFD_ASSEMBLER */
784
785 subseg_set (text_section, 0);
786
787 /* This may add symbol table entries, which requires having an open BFD,
788 and sections already created, in BFD_ASSEMBLER mode. */
789 md_begin ();
790
791 #ifdef obj_begin
792 obj_begin ();
793 #endif
794
795 argv++; /* skip argv[0] */
796 argc--; /* skip argv[0] */
797 while (argc--)
798 {
799 if (*argv)
800 { /* Is it a file-name argument? */
801 PROGRESS (1);
802 saw_a_file++;
803 /* argv->"" if stdin desired, else->filename */
804 read_a_source_file (*argv);
805 }
806 argv++; /* completed that argv */
807 }
808 if (!saw_a_file)
809 read_a_source_file ("");
810 } /* perform_an_assembly_pass() */
811
812 /* The interface between the macro code and gas expression handling. */
813
814 static int
815 macro_expr (emsg, idx, in, val)
816 const char *emsg;
817 int idx;
818 sb *in;
819 int *val;
820 {
821 char *hold;
822 expressionS ex;
823
824 sb_terminate (in);
825
826 hold = input_line_pointer;
827 input_line_pointer = in->ptr + idx;
828 expression (&ex);
829 idx = input_line_pointer - in->ptr;
830 input_line_pointer = hold;
831
832 if (ex.X_op != O_constant)
833 as_bad ("%s", emsg);
834
835 *val = (int) ex.X_add_number;
836
837 return idx;
838 }
839
840 /* end of as.c */
This page took 0.047478 seconds and 5 git commands to generate.