Commit | Line | Data |
---|---|---|
fecd2382 | 1 | /* as.h - global header file |
3340f7e5 | 2 | Copyright (C) 1987, 1990, 1991, 1992 Free Software Foundation, Inc. |
6efd877d | 3 | |
a39116f1 | 4 | This file is part of GAS, the GNU Assembler. |
6efd877d | 5 | |
a39116f1 RP |
6 | GAS is free software; you can redistribute it and/or modify |
7 | it under the terms of the GNU General Public License as published by | |
8 | the Free Software Foundation; either version 2, or (at your option) | |
9 | any later version. | |
6efd877d | 10 | |
a39116f1 RP |
11 | GAS is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | GNU General Public License for more details. | |
6efd877d | 15 | |
a39116f1 RP |
16 | You should have received a copy of the GNU General Public License |
17 | along with GAS; see the file COPYING. If not, write to | |
18 | the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ | |
fecd2382 | 19 | |
7f955c18 | 20 | #ifndef GAS |
fecd2382 | 21 | #define GAS 1 |
fecd2382 RP |
22 | /* |
23 | * I think this stuff is largely out of date. xoxorich. | |
24 | * | |
25 | * CAPITALISED names are #defined. | |
26 | * "lowercaseH" is #defined if "lowercase.h" has been #include-d. | |
27 | * "lowercaseT" is a typedef of "lowercase" objects. | |
28 | * "lowercaseP" is type "pointer to object of type 'lowercase'". | |
29 | * "lowercaseS" is typedef struct ... lowercaseS. | |
30 | * | |
31 | * #define DEBUG to enable all the "know" assertion tests. | |
68878ef1 | 32 | * #define SUSPECT when debugging hash code. |
fecd2382 RP |
33 | * #define COMMON as "extern" for all modules except one, where you #define |
34 | * COMMON as "". | |
35 | * If TEST is #defined, then we are testing a module: #define COMMON as "". | |
36 | */ | |
37 | ||
460531da | 38 | #include "config.h" |
fecd2382 | 39 | |
87e48495 | 40 | /* This is the code recommended in the autoconf documentation, almost |
460531da KR |
41 | verbatim. If it doesn't work for you, let me know, and notify |
42 | djm@gnu.ai.mit.edu as well. */ | |
87e48495 KR |
43 | /* Added #undef for DJ Delorie. The right fix is to ensure that as.h |
44 | is included first, before even any system header files, in all files | |
45 | that use it. KR 1994.11.03 */ | |
46 | ||
460531da KR |
47 | /* AIX requires this to be the first thing in the file. */ |
48 | #ifdef __GNUC__ | |
87e48495 | 49 | # undef alloca |
460531da KR |
50 | # define alloca __builtin_alloca |
51 | #else | |
52 | # if HAVE_ALLOCA_H | |
53 | # include <alloca.h> | |
54 | # else | |
55 | # ifdef _AIX | |
56 | #pragma alloca | |
57 | # else | |
58 | # ifndef alloca /* predefined by HP cc +Olibcalls */ | |
59 | char *alloca (); | |
60 | # endif | |
61 | # endif | |
62 | # endif | |
63 | #endif | |
fecd2382 | 64 | |
b11fb939 | 65 | /* Now, tend to the rest of the configuration. */ |
7f955c18 | 66 | |
b11fb939 | 67 | /* System include files first... */ |
fecd2382 | 68 | #include <stdio.h> |
b11fb939 KR |
69 | #include <ctype.h> |
70 | #ifdef HAVE_STRING_H | |
71 | #include <string.h> | |
72 | #else | |
73 | #include <strings.h> | |
74 | #endif | |
75 | #ifdef HAVE_STDLIB_H | |
76 | #include <stdlib.h> | |
77 | #endif | |
78 | #ifdef HAVE_UNISTD_H | |
79 | #include <unistd.h> | |
80 | #endif | |
81 | #ifdef HAVE_SYS_TYPES_H | |
82 | /* for size_t, pid_t */ | |
83 | #include <sys/types.h> | |
84 | #endif | |
85 | ||
86 | /* Some systems do declare this, but this seems to be the universal | |
87 | declaration, though the parameter type varies. (It ought to use | |
88 | `const' but many systems prototype it without.) Include it here | |
89 | for systems that don't declare it. If conflicts arise, just add | |
90 | another autoconf test... */ | |
91 | extern char *strdup (/* const char * */); | |
92 | ||
f3d817d8 DM |
93 | #include <getopt.h> |
94 | /* The first getopt value for machine-independent long options. | |
95 | 150 isn't special; it's just an arbitrary non-ASCII char value. */ | |
96 | #define OPTION_STD_BASE 150 | |
97 | /* The first getopt value for machine-dependent long options. | |
98 | 170 gives the standard options room to grow. */ | |
99 | #define OPTION_MD_BASE 170 | |
100 | ||
68878ef1 KR |
101 | #ifdef DEBUG |
102 | #undef NDEBUG | |
103 | #endif | |
d5f41403 KR |
104 | #if !defined (__GNUC__) || __GNUC_MINOR__ <= 5 |
105 | #define __PRETTY_FUNCTION__ ((char*)0) | |
106 | #endif | |
107 | #if 0 | |
9777b772 | 108 | |
b11fb939 KR |
109 | /* Handle lossage with assert.h. */ |
110 | #ifndef BROKEN_ASSERT | |
fecd2382 | 111 | #include <assert.h> |
b11fb939 KR |
112 | #else /* BROKEN_ASSERT */ |
113 | #ifndef NDEBUG | |
d5f41403 | 114 | #define assert(p) ((p) ? 0 : (as_assert (__FILE__, __LINE__, __PRETTY_FUNCTION__), 0)) |
b11fb939 KR |
115 | #else |
116 | #define assert(p) ((p), 0) | |
117 | #endif | |
118 | #endif /* BROKEN_ASSERT */ | |
9777b772 | 119 | |
d5f41403 | 120 | #else |
9777b772 | 121 | |
d5f41403 | 122 | #define assert(P) ((P) ? 0 : (as_assert (__FILE__, __LINE__, __PRETTY_FUNCTION__), 0)) |
9777b772 KR |
123 | #undef abort |
124 | #define abort() as_abort (__FILE__, __LINE__, __PRETTY_FUNCTION__) | |
125 | ||
d5f41403 | 126 | #endif |
c593cf41 | 127 | |
b11fb939 KR |
128 | |
129 | /* Now GNU header files... */ | |
68878ef1 KR |
130 | #include <ansidecl.h> |
131 | #ifdef BFD_ASSEMBLER | |
132 | #include <bfd.h> | |
133 | #endif | |
b11fb939 | 134 | |
87e48495 KR |
135 | /* Define the standard progress macros. */ |
136 | #include <progress.h> | |
b11fb939 | 137 | |
b11fb939 KR |
138 | /* This doesn't get taken care of anywhere. */ |
139 | #if !defined (__GNUC__) && !defined (inline) | |
140 | #define inline | |
141 | #endif | |
142 | ||
143 | /* Other stuff from config.h. */ | |
87e48495 | 144 | #ifdef NEED_DECLARATION_MALLOC |
b11fb939 KR |
145 | extern PTR malloc (); |
146 | extern PTR realloc (); | |
147 | #endif | |
87e48495 | 148 | #ifdef NEED_DECLARATION_FREE |
b11fb939 KR |
149 | extern void free (); |
150 | #endif | |
87e48495 KR |
151 | #ifdef NEED_DECLARATION_ERRNO |
152 | extern int errno; | |
153 | #endif | |
b11fb939 | 154 | |
b9419dd2 | 155 | /* This is needed for VMS. */ |
87e48495 KR |
156 | #if ! defined (HAVE_UNLINK) && defined (HAVE_REMOVE) |
157 | #define unlink remove | |
460531da KR |
158 | #endif |
159 | ||
9777b772 KR |
160 | /* Hack to make "gcc -Wall" not complain about obstack macros. */ |
161 | #if !defined (memcpy) && !defined (bcopy) | |
162 | #define bcopy(src,dest,size) memcpy(dest,src,size) | |
163 | #endif | |
164 | ||
b11fb939 KR |
165 | #ifdef BFD_ASSEMBLER |
166 | /* This one doesn't get declared, but we're using it anyways. This | |
167 | should be fixed -- either it's part of the external interface or | |
168 | it's not. */ | |
169 | extern PTR bfd_alloc_by_size_t PARAMS ((bfd *abfd, size_t sz)); | |
170 | #endif | |
68878ef1 | 171 | |
b17c891e KR |
172 | /* Make Saber happier on obstack.h. */ |
173 | #ifdef SABER | |
174 | #undef __PTR_TO_INT | |
175 | #define __PTR_TO_INT(P) ((int)(P)) | |
176 | #undef __INT_TO_PTR | |
177 | #define __INT_TO_PTR(P) ((char *)(P)) | |
178 | #endif | |
179 | ||
68878ef1 KR |
180 | #ifndef __LINE__ |
181 | #define __LINE__ "unknown" | |
182 | #endif /* __LINE__ */ | |
183 | ||
184 | #ifndef __FILE__ | |
185 | #define __FILE__ "unknown" | |
186 | #endif /* __FILE__ */ | |
187 | ||
b17c891e KR |
188 | #ifndef __STDC__ |
189 | #ifndef const | |
190 | #define const | |
191 | #endif | |
192 | #ifndef volatile | |
193 | #define volatile | |
194 | #endif | |
195 | #endif /* ! __STDC__ */ | |
196 | ||
98c6bbbe KR |
197 | #if !defined (__GNUC__) && !defined (inline) |
198 | #define inline | |
199 | #endif | |
200 | ||
7f955c18 | 201 | #ifndef FOPEN_WB |
b11fb939 KR |
202 | #ifdef GO32 |
203 | #include "fopen-bin.h" | |
204 | #else | |
7f955c18 KR |
205 | #include "fopen-same.h" |
206 | #endif | |
b11fb939 | 207 | #endif |
7f955c18 | 208 | |
460531da KR |
209 | #ifndef EXIT_SUCCESS |
210 | #define EXIT_SUCCESS 0 | |
211 | #define EXIT_FAILURE 1 | |
212 | #endif | |
213 | ||
3340f7e5 RP |
214 | #define obstack_chunk_alloc xmalloc |
215 | #define obstack_chunk_free xfree | |
fecd2382 | 216 | |
a39116f1 RP |
217 | #define xfree free |
218 | ||
b17c891e | 219 | #define BAD_CASE(val) \ |
a39116f1 | 220 | { \ |
58d4951d ILT |
221 | as_fatal("Case value %ld unexpected at line %d of file \"%s\"\n", \ |
222 | (long) val, __LINE__, __FILE__); \ | |
a39116f1 | 223 | } |
a193acc0 ILT |
224 | |
225 | /* Version 2.1 of Solaris had problems with this declaration, but I | |
226 | think that bug has since been fixed. If it causes problems on your | |
227 | system, just delete it. */ | |
228 | extern char *strstr (); | |
fecd2382 | 229 | \f |
b11fb939 | 230 | #include "flonum.h" |
6efd877d | 231 | |
fecd2382 RP |
232 | /* These are assembler-wide concepts */ |
233 | ||
68878ef1 KR |
234 | #ifdef BFD_ASSEMBLER |
235 | extern bfd *stdoutput; | |
b17c891e KR |
236 | typedef bfd_vma addressT; |
237 | typedef bfd_signed_vma offsetT; | |
238 | #else | |
239 | typedef unsigned long addressT; | |
240 | typedef long offsetT; | |
68878ef1 | 241 | #endif |
fecd2382 | 242 | |
b17c891e KR |
243 | /* Type of symbol value, etc. For use in prototypes. */ |
244 | typedef addressT valueT; | |
245 | ||
fecd2382 RP |
246 | #ifndef COMMON |
247 | #ifdef TEST | |
248 | #define COMMON /* declare our COMMONs storage here. */ | |
249 | #else | |
250 | #define COMMON extern /* our commons live elswhere */ | |
251 | #endif | |
252 | #endif | |
a39116f1 | 253 | /* COMMON now defined */ |
c8c7e0bf | 254 | |
fecd2382 | 255 | #ifdef DEBUG |
ace68c4e | 256 | #ifndef know |
fecd2382 | 257 | #define know(p) assert(p) /* Verify our assumptions! */ |
ace68c4e | 258 | #endif /* not yet defined */ |
fecd2382 RP |
259 | #else |
260 | #define know(p) /* know() checks are no-op.ed */ | |
261 | #endif | |
fecd2382 RP |
262 | \f |
263 | /* input_scrub.c */ | |
264 | ||
265 | /* | |
266 | * Supplies sanitised buffers to read.c. | |
267 | * Also understands printing line-number part of error messages. | |
268 | */ | |
fecd2382 | 269 | \f |
6efd877d | 270 | |
fecd2382 RP |
271 | /* subsegs.c Sub-segments. Also, segment(=expression type)s.*/ |
272 | ||
68878ef1 | 273 | #ifndef BFD_ASSEMBLER |
ace68c4e | 274 | |
58721107 | 275 | #ifdef MANY_SEGMENTS |
c8c7e0bf | 276 | #include "bfd.h" |
ace68c4e | 277 | #define N_SEGMENTS 10 |
58721107 | 278 | #define SEG_NORMAL(x) ((x) >= SEG_E0 && (x) <= SEG_E9) |
ace68c4e | 279 | #define SEG_LIST SEG_E0,SEG_E1,SEG_E2,SEG_E3,SEG_E4,SEG_E5,SEG_E6,SEG_E7,SEG_E8,SEG_E9 |
ada269da | 280 | #define SEG_TEXT SEG_E0 |
68878ef1 | 281 | #define SEG_DATA SEG_E1 |
ada269da | 282 | #define SEG_BSS SEG_E2 |
58721107 | 283 | #else |
ace68c4e | 284 | #define N_SEGMENTS 3 |
58721107 | 285 | #define SEG_NORMAL(x) ((x) == SEG_TEXT || (x) == SEG_DATA || (x) == SEG_BSS) |
ace68c4e | 286 | #define SEG_LIST SEG_TEXT,SEG_DATA,SEG_BSS |
58721107 SC |
287 | #endif |
288 | ||
6efd877d KR |
289 | typedef enum _segT |
290 | { | |
291 | SEG_ABSOLUTE = 0, | |
292 | SEG_LIST, | |
293 | SEG_UNKNOWN, | |
6efd877d KR |
294 | SEG_GOOF, /* Only happens if AS has a logic error. */ |
295 | /* Invented so we don't crash printing */ | |
296 | /* error message involving weird segment. */ | |
58d4951d | 297 | SEG_EXPR, /* Intermediate expression values. */ |
6efd877d KR |
298 | SEG_DEBUG, /* Debug segment */ |
299 | SEG_NTV, /* Transfert vector preload segment */ | |
300 | SEG_PTV, /* Transfert vector postload segment */ | |
b17c891e | 301 | SEG_REGISTER /* Mythical: a register-valued expression */ |
6efd877d | 302 | } segT; |
fecd2382 RP |
303 | |
304 | #define SEG_MAXIMUM_ORDINAL (SEG_REGISTER) | |
68878ef1 KR |
305 | #else |
306 | typedef asection *segT; | |
307 | #define SEG_NORMAL(SEG) ((SEG) != absolute_section \ | |
308 | && (SEG) != undefined_section \ | |
68878ef1 | 309 | && (SEG) != reg_section \ |
58d4951d | 310 | && (SEG) != expr_section) |
68878ef1 | 311 | #endif |
fecd2382 RP |
312 | typedef int subsegT; |
313 | ||
a39116f1 | 314 | /* What subseg we are accreting now? */ |
7f2cb270 | 315 | COMMON subsegT now_subseg; |
fecd2382 | 316 | |
a39116f1 | 317 | /* Segment our instructions emit to. */ |
7f2cb270 | 318 | COMMON segT now_seg; |
fecd2382 | 319 | |
68878ef1 KR |
320 | #ifdef BFD_ASSEMBLER |
321 | #define segment_name(SEG) bfd_get_section_name (stdoutput, SEG) | |
322 | #else | |
9777b772 | 323 | extern char const *const seg_name[]; |
68878ef1 KR |
324 | #define segment_name(SEG) seg_name[(int) (SEG)] |
325 | #endif | |
326 | ||
327 | #ifndef BFD_ASSEMBLER | |
fecd2382 | 328 | extern int section_alignment[]; |
68878ef1 | 329 | #endif |
fecd2382 | 330 | |
68878ef1 | 331 | #ifdef BFD_ASSEMBLER |
58d4951d | 332 | extern segT reg_section, expr_section; |
68878ef1 KR |
333 | /* Shouldn't these be eliminated someday? */ |
334 | extern segT text_section, data_section, bss_section; | |
b11fb939 KR |
335 | #define absolute_section bfd_abs_section_ptr |
336 | #define undefined_section bfd_und_section_ptr | |
68878ef1 | 337 | #else |
68878ef1 | 338 | #define reg_section SEG_REGISTER |
58d4951d | 339 | #define expr_section SEG_EXPR |
68878ef1 KR |
340 | #define text_section SEG_TEXT |
341 | #define data_section SEG_DATA | |
342 | #define bss_section SEG_BSS | |
343 | #define absolute_section SEG_ABSOLUTE | |
344 | #define undefined_section SEG_UNKNOWN | |
345 | #endif | |
fecd2382 RP |
346 | |
347 | /* relax() */ | |
348 | ||
d5f41403 | 349 | enum _relax_state |
6efd877d | 350 | { |
7f2cb270 KR |
351 | /* Variable chars to be repeated fr_offset times. |
352 | Fr_symbol unused. Used with fr_offset == 0 for a | |
353 | constant length frag. */ | |
354 | rs_fill = 1, | |
6efd877d | 355 | |
98c6bbbe | 356 | /* Align: Fr_offset: power of 2. Variable chars: fill pattern. */ |
7f2cb270 | 357 | rs_align, |
6efd877d | 358 | |
d5f41403 KR |
359 | /* Align code: fr_offset: power of 2. Fill pattern is machine |
360 | specific, defaulting to all zeros. */ | |
361 | rs_align_code, | |
362 | ||
7f2cb270 KR |
363 | /* Org: Fr_offset, fr_symbol: address. 1 variable char: fill |
364 | character. */ | |
365 | rs_org, | |
6efd877d | 366 | |
fecd2382 | 367 | #ifndef WORKING_DOT_WORD |
7f2cb270 | 368 | /* JF: gunpoint */ |
d5f41403 | 369 | rs_broken_word, |
fecd2382 | 370 | #endif |
fecd2382 | 371 | |
d5f41403 KR |
372 | /* machine-specific relaxable (or similarly alterable) instruction */ |
373 | rs_machine_dependent, | |
374 | ||
375 | /* .space directive with expression operand that needs to be computed | |
376 | later. Similar to rs_org, but different. | |
377 | fr_symbol: operand | |
378 | 1 variable char: fill character */ | |
379 | rs_space | |
380 | }; | |
381 | ||
382 | typedef enum _relax_state relax_stateT; | |
383 | ||
384 | /* This type is used in prototypes, so it can't be a type that will be | |
385 | widened for argument passing. */ | |
386 | typedef unsigned int relax_substateT; | |
fecd2382 | 387 | |
7f2cb270 KR |
388 | /* Enough bits for address, but still an integer type. |
389 | Could be a problem, cross-assembling for 64-bit machines. */ | |
b17c891e | 390 | typedef addressT relax_addressT; |
fecd2382 | 391 | \f |
6efd877d | 392 | |
fecd2382 RP |
393 | /* frags.c */ |
394 | ||
395 | /* | |
396 | * A code fragment (frag) is some known number of chars, followed by some | |
397 | * unknown number of chars. Typically the unknown number of chars is an | |
398 | * instruction address whose size is yet unknown. We always know the greatest | |
399 | * possible size the unknown number of chars may become, and reserve that | |
400 | * much room at the end of the frag. | |
401 | * Once created, frags do not change address during assembly. | |
402 | * We chain the frags in (a) forward-linked list(s). The object-file address | |
403 | * of the 1st char of a frag is generally not known until after relax(). | |
404 | * Many things at assembly time describe an address by {object-file-address | |
405 | * of a particular frag}+offset. | |
6efd877d | 406 | |
fecd2382 | 407 | BUG: it may be smarter to have a single pointer off to various different |
6efd877d | 408 | notes for different frag kinds. See how code pans |
fecd2382 | 409 | */ |
68878ef1 | 410 | struct frag |
fecd2382 | 411 | { |
7f2cb270 | 412 | /* Object file address. */ |
b17c891e | 413 | addressT fr_address; |
68878ef1 | 414 | /* Chain forward; ascending address order. Rooted in frch_root. */ |
7f2cb270 | 415 | struct frag *fr_next; |
6efd877d | 416 | |
68878ef1 | 417 | /* (Fixed) number of chars we know we have. May be 0. */ |
b17c891e | 418 | offsetT fr_fix; |
68878ef1 | 419 | /* (Variable) number of chars after above. May be 0. */ |
b17c891e | 420 | offsetT fr_var; |
7f2cb270 KR |
421 | /* For variable-length tail. */ |
422 | struct symbol *fr_symbol; | |
423 | /* For variable-length tail. */ | |
b17c891e | 424 | offsetT fr_offset; |
68878ef1 | 425 | /* Points to opcode low addr byte, for relaxation. */ |
7f2cb270 | 426 | char *fr_opcode; |
68878ef1 KR |
427 | |
428 | #ifndef NO_LISTING | |
429 | struct list_info_struct *line; | |
430 | #endif | |
431 | ||
7f2cb270 KR |
432 | /* What state is my tail in? */ |
433 | relax_stateT fr_type; | |
6efd877d | 434 | relax_substateT fr_subtype; |
7f2cb270 | 435 | |
87e48495 KR |
436 | /* Track the alignment and offset of the current frag. With this, |
437 | sometimes we can avoid creating new frags for .align directives. */ | |
438 | unsigned short align_mask; | |
439 | unsigned short align_offset; | |
87e48495 | 440 | |
e9296bdb KR |
441 | /* These are needed only on the NS32K machines. But since we don't |
442 | include targ-cpu.h until after this structure has been defined, | |
443 | we can't really conditionalize it. This code should be | |
444 | rearranged a bit to make that possible. | |
68878ef1 | 445 | |
e9296bdb KR |
446 | In the meantime, if we get stuck like this with any other target, |
447 | create a union here. */ | |
448 | char fr_pcrel_adjust, fr_bsr; | |
449 | ||
450 | /* Data begins here. */ | |
7f2cb270 | 451 | char fr_literal[1]; |
fecd2382 | 452 | }; |
6efd877d | 453 | |
fecd2382 | 454 | #define SIZEOF_STRUCT_FRAG \ |
e9296bdb | 455 | ((char *)zero_address_frag.fr_literal-(char *)&zero_address_frag) |
a39116f1 | 456 | /* We want to say fr_literal[0] above. */ |
fecd2382 RP |
457 | |
458 | typedef struct frag fragS; | |
459 | ||
7f2cb270 KR |
460 | /* Current frag we are building. This frag is incomplete. It is, however, |
461 | included in frchain_now. The fr_fix field is bogus; instead, use: | |
462 | obstack_next_free(&frags)-frag_now->fr_literal. */ | |
463 | COMMON fragS *frag_now; | |
87e48495 | 464 | extern int frag_now_fix (); |
fecd2382 | 465 | |
7f2cb270 KR |
466 | /* For foreign-segment symbol fixups. */ |
467 | COMMON fragS zero_address_frag; | |
468 | /* For local common (N_BSS segment) fixups. */ | |
469 | COMMON fragS bss_address_frag; | |
fecd2382 RP |
470 | |
471 | /* main program "as.c" (command arguments etc) */ | |
472 | ||
def66e24 DM |
473 | COMMON unsigned char flag_no_comments; /* -f */ |
474 | COMMON unsigned char flag_debug; /* -D */ | |
475 | COMMON unsigned char flag_signed_overflow_ok; /* -J */ | |
a7aa7a2b | 476 | #ifndef WORKING_DOT_WORD |
def66e24 | 477 | COMMON unsigned char flag_warn_displacement; /* -K */ |
a7aa7a2b | 478 | #endif |
e9296bdb KR |
479 | |
480 | /* True if local symbols should be retained. */ | |
def66e24 | 481 | COMMON unsigned char flag_keep_locals; /* -L */ |
e9296bdb KR |
482 | |
483 | /* Should the data section be made read-only and appended to the text | |
484 | section? */ | |
def66e24 | 485 | COMMON unsigned char flag_readonly_data_in_text; /* -R */ |
e9296bdb KR |
486 | |
487 | /* True if warnings should be inhibited. */ | |
def66e24 | 488 | COMMON unsigned char flag_no_warnings; /* -W */ |
e9296bdb KR |
489 | |
490 | /* True if we should attempt to generate output even if non-fatal errors | |
491 | are detected. */ | |
def66e24 | 492 | COMMON unsigned char flag_always_generate_output; /* -Z */ |
fecd2382 | 493 | |
e9296bdb KR |
494 | /* This is true if the assembler should output time and space usage. */ |
495 | ||
496 | COMMON unsigned char flag_print_statistics; | |
497 | ||
7f2cb270 KR |
498 | /* name of emitted object file */ |
499 | COMMON char *out_file_name; | |
fecd2382 | 500 | |
7f2cb270 KR |
501 | /* TRUE if we need a second pass. */ |
502 | COMMON int need_pass_2; | |
09952cd9 | 503 | |
7f2cb270 KR |
504 | /* TRUE if we should do no relaxing, and |
505 | leave lots of padding. */ | |
506 | COMMON int linkrelax; | |
fecd2382 | 507 | |
7f955c18 KR |
508 | /* TRUE if we should produce a listing. */ |
509 | extern int listing; | |
510 | ||
7f2cb270 | 511 | struct _pseudo_type |
6efd877d | 512 | { |
7f2cb270 | 513 | /* assembler mnemonic, lower case, no '.' */ |
9777b772 | 514 | const char *poc_name; |
7f2cb270 | 515 | /* Do the work */ |
604633ae | 516 | void (*poc_handler) PARAMS ((int)); |
7f2cb270 KR |
517 | /* Value to pass to handler */ |
518 | int poc_val; | |
519 | }; | |
6efd877d | 520 | |
7f2cb270 | 521 | typedef struct _pseudo_type pseudo_typeS; |
fecd2382 | 522 | |
87e48495 KR |
523 | /* Prefer varargs for non-ANSI compiler, since some will barf if the |
524 | ellipsis definition is used with a no-arguments declaration. */ | |
525 | #if defined (HAVE_VARARGS_H) && !defined (__STDC__) | |
526 | #undef HAVE_STDARG_H | |
527 | #endif | |
528 | ||
529 | #if defined (HAVE_STDARG_H) | |
530 | #define USE_STDARG | |
531 | #endif | |
532 | #if !defined (USE_STDARG) && defined (HAVE_VARARGS_H) | |
533 | #define USE_VARARGS | |
534 | #endif | |
fecd2382 | 535 | |
87e48495 | 536 | #ifdef USE_STDARG |
68878ef1 KR |
537 | #if __GNUC__ >= 2 |
538 | /* for use with -Wformat */ | |
7f955c18 | 539 | #define PRINTF_LIKE(FCN) void FCN (const char *format, ...) \ |
68878ef1 | 540 | __attribute__ ((format (printf, 1, 2))) |
a57180ad ILT |
541 | #define PRINTF_WHERE_LIKE(FCN) void FCN (char *file, unsigned int line, \ |
542 | const char *format, ...) \ | |
543 | __attribute__ ((format (printf, 3, 4))) | |
68878ef1 | 544 | #else /* ANSI C with stdarg, but not GNU C */ |
87e48495 KR |
545 | #define PRINTF_LIKE(FCN) void FCN PARAMS ((const char *format, ...)) |
546 | #define PRINTF_WHERE_LIKE(FCN) void FCN PARAMS ((char *file, \ | |
547 | unsigned int line, \ | |
548 | const char *format, ...)) | |
68878ef1 | 549 | #endif |
87e48495 | 550 | #else /* not using stdarg */ |
68878ef1 | 551 | #define PRINTF_LIKE(FCN) void FCN () |
a57180ad | 552 | #define PRINTF_WHERE_LIKE(FCN) void FCN () |
68878ef1 | 553 | #endif |
fecd2382 | 554 | |
68878ef1 KR |
555 | PRINTF_LIKE (as_bad); |
556 | PRINTF_LIKE (as_fatal); | |
557 | PRINTF_LIKE (as_tsktsk); | |
558 | PRINTF_LIKE (as_warn); | |
a57180ad ILT |
559 | PRINTF_WHERE_LIKE (as_bad_where); |
560 | PRINTF_WHERE_LIKE (as_warn_where); | |
d5f41403 | 561 | void as_assert PARAMS ((const char *, int, const char *)); |
9777b772 | 562 | void as_abort PARAMS ((const char *, int, const char *)); |
7f955c18 | 563 | |
b17c891e KR |
564 | void fprint_value PARAMS ((FILE *file, addressT value)); |
565 | void sprint_value PARAMS ((char *buf, addressT value)); | |
fecd2382 | 566 | |
68878ef1 KR |
567 | int had_errors PARAMS ((void)); |
568 | int had_warnings PARAMS ((void)); | |
fecd2382 | 569 | |
604633ae | 570 | void print_version_id PARAMS ((void)); |
7f2cb270 KR |
571 | char *app_push PARAMS ((void)); |
572 | char *atof_ieee PARAMS ((char *str, int what_kind, LITTLENUM_TYPE * words)); | |
573 | char *input_scrub_include_file PARAMS ((char *filename, char *position)); | |
574 | char *input_scrub_new_file PARAMS ((char *filename)); | |
575 | char *input_scrub_next_buffer PARAMS ((char **bufp)); | |
a193acc0 ILT |
576 | PTR xmalloc PARAMS ((unsigned long size)); |
577 | PTR xrealloc PARAMS ((PTR ptr, unsigned long n)); | |
604633ae | 578 | int do_scrub_next_char PARAMS ((int (*get) (void), void (*unget) (int))); |
7f2cb270 KR |
579 | int gen_to_words PARAMS ((LITTLENUM_TYPE * words, int precision, |
580 | long exponent_bits)); | |
581 | int had_err PARAMS ((void)); | |
7f2cb270 KR |
582 | int ignore_input PARAMS ((void)); |
583 | int scrub_from_file PARAMS ((void)); | |
7f2cb270 KR |
584 | int scrub_from_string PARAMS ((void)); |
585 | int seen_at_least_1_file PARAMS ((void)); | |
586 | void app_pop PARAMS ((char *arg)); | |
587 | void as_howmuch PARAMS ((FILE * stream)); | |
a193acc0 | 588 | void as_perror PARAMS ((const char *gripe, const char *filename)); |
7f955c18 | 589 | void as_where PARAMS ((char **namep, unsigned int *linep)); |
7f2cb270 KR |
590 | void bump_line_counters PARAMS ((void)); |
591 | void do_scrub_begin PARAMS ((void)); | |
592 | void input_scrub_begin PARAMS ((void)); | |
593 | void input_scrub_close PARAMS ((void)); | |
594 | void input_scrub_end PARAMS ((void)); | |
7f2cb270 KR |
595 | void new_logical_line PARAMS ((char *fname, int line_number)); |
596 | void scrub_to_file PARAMS ((int ch)); | |
597 | void scrub_to_string PARAMS ((int ch)); | |
68878ef1 | 598 | void subsegs_begin PARAMS ((void)); |
7f2cb270 | 599 | void subseg_change PARAMS ((segT seg, int subseg)); |
b17c891e | 600 | segT subseg_new PARAMS ((const char *name, subsegT subseg)); |
e7501ac7 | 601 | segT subseg_force_new PARAMS ((const char *name, subsegT subseg)); |
68878ef1 | 602 | void subseg_set PARAMS ((segT seg, subsegT subseg)); |
a193acc0 ILT |
603 | #ifdef BFD_ASSEMBLER |
604 | segT subseg_get PARAMS ((const char *, int)); | |
605 | #endif | |
fecd2382 | 606 | |
7f955c18 KR |
607 | struct expressionS; |
608 | struct fix; | |
609 | struct symbol; | |
9777b772 | 610 | struct relax_type; |
7f955c18 KR |
611 | |
612 | #ifdef BFD_ASSEMBLER | |
613 | /* literal.c */ | |
614 | valueT add_to_literal_pool PARAMS ((struct symbol *, valueT, segT, int)); | |
615 | #endif | |
616 | ||
b11fb939 KR |
617 | #include "expr.h" /* Before targ-*.h */ |
618 | ||
a39116f1 | 619 | /* this one starts the chain of target dependant headers */ |
fecd2382 RP |
620 | #include "targ-env.h" |
621 | ||
fecd2382 | 622 | #include "struc-symbol.h" |
fecd2382 | 623 | #include "write.h" |
fecd2382 RP |
624 | #include "frags.h" |
625 | #include "hash.h" | |
626 | #include "read.h" | |
627 | #include "symbols.h" | |
628 | ||
629 | #include "tc.h" | |
630 | #include "obj.h" | |
631 | ||
a7aa7a2b ILT |
632 | #ifdef USE_EMULATIONS |
633 | #include "emul.h" | |
634 | #endif | |
c593cf41 SC |
635 | #include "listing.h" |
636 | ||
9777b772 KR |
637 | #ifndef LOCAL_LABELS_DOLLAR |
638 | #define LOCAL_LABELS_DOLLAR 0 | |
b17c891e | 639 | #endif |
9777b772 KR |
640 | |
641 | #ifndef LOCAL_LABELS_FB | |
642 | #define LOCAL_LABELS_FB 0 | |
b17c891e | 643 | #endif |
b17c891e | 644 | |
7f955c18 KR |
645 | #endif /* GAS */ |
646 | ||
a39116f1 | 647 | /* end of as.h */ |