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