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