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