Add -lbsd to XM_CLIBS so that we get the right version of setpgrp.
[deliverable/binutils-gdb.git] / gas / as.h
CommitLineData
fecd2382
RP
1/* as.h - global header file
2 Copyright (C) 1987, 1990, 1991 Free Software Foundation, Inc.
3
4This file is part of GAS, the GNU Assembler.
5
6GAS is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
617ee8ed 8the Free Software Foundation; either version 2, or (at your option)
fecd2382
RP
9any later version.
10
11GAS is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with GAS; see the file COPYING. If not, write to
18the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
19
20/* static const char rcsid[] = "$Id$"; */
21
22#define GAS 1
23
24#include "host.h"
25#include "flonum.h"
26
27#ifndef __STDC__
28#define volatile /**/
29#ifndef const
30#define const /**/
31#endif /* const */
32#endif /* __STDC__ */
33
34#ifdef __GNUC__
35#define alloca __builtin_alloca
36#define register
37#endif /* __GNUC__ */
38
39#ifndef __LINE__
40#define __LINE__ "unknown"
41#endif /* __LINE__ */
42
43#ifndef __FILE__
44#define __FILE__ "unknown"
45#endif /* __FILE__ */
46
47/*
48 * I think this stuff is largely out of date. xoxorich.
49 *
50 * CAPITALISED names are #defined.
51 * "lowercaseH" is #defined if "lowercase.h" has been #include-d.
52 * "lowercaseT" is a typedef of "lowercase" objects.
53 * "lowercaseP" is type "pointer to object of type 'lowercase'".
54 * "lowercaseS" is typedef struct ... lowercaseS.
55 *
56 * #define DEBUG to enable all the "know" assertion tests.
57 * #define SUSPECT when debugging.
58 * #define COMMON as "extern" for all modules except one, where you #define
59 * COMMON as "".
60 * If TEST is #defined, then we are testing a module: #define COMMON as "".
61 */
62
63/* These #defines are for parameters of entire assembler. */
64
65/* #define SUSPECT JF remove for speed testing */
66/* These #includes are for type definitions etc. */
67
68#include <stdio.h>
69#include <assert.h>
70
58721107
SC
71#define obstack_chunk_alloc xmalloc
72#define obstack_chunk_free xfree
fecd2382
RP
73
74#define BAD_CASE(value) \
75{ \
76 as_fatal("Case value %d unexpected at line %d of file \"%s\"\n", \
77 value, __LINE__, __FILE__); \
78}
79
80\f
81/* These are assembler-wide concepts */
82
83
84#ifndef COMMON
85#ifdef TEST
86#define COMMON /* declare our COMMONs storage here. */
87#else
88#define COMMON extern /* our commons live elswhere */
89#endif
90#endif
91 /* COMMON now defined */
92#define DEBUG /* temporary */
93
94#ifdef DEBUG
95#undef NDEBUG
96#define know(p) assert(p) /* Verify our assumptions! */
97#else
98#define know(p) /* know() checks are no-op.ed */
99#endif
100
101
102#define xfree free
103\f
104/* input_scrub.c */
105
106/*
107 * Supplies sanitised buffers to read.c.
108 * Also understands printing line-number part of error messages.
109 */
110
111\f
112/* subsegs.c Sub-segments. Also, segment(=expression type)s.*/
113
114/*
115 * This table describes the use of segments as EXPRESSION types.
116 *
117 * X_seg X_add_symbol X_subtract_symbol X_add_number
118 * SEG_ABSENT no (legal) expression
119 * SEG_PASS1 no (defined) "
120 * SEG_BIG * > 32 bits const.
121 * SEG_ABSOLUTE 0
122 * SEG_DATA * 0
123 * SEG_TEXT * 0
124 * SEG_BSS * 0
125 * SEG_UNKNOWN * 0
126 * SEG_DIFFERENCE 0 * 0
127 * SEG_REGISTER *
128 *
129 * The blank fields MUST be 0, and are nugatory.
130 * The '0' fields MAY be 0. The '*' fields MAY NOT be 0.
131 *
132 * SEG_BIG: X_add_number is < 0 if the result is in
133 * generic_floating_point_number. The value is -'c' where c is the
134 * character that introduced the constant. e.g. "0f6.9" will have -'f'
135 * as a X_add_number value.
136 * X_add_number > 0 is a count of how many littlenums it took to
137 * represent a bignum.
138 * SEG_DIFFERENCE:
139 * If segments of both symbols are known, they are the same segment.
140 * X_add_symbol != X_sub_symbol (then we just cancel them, => SEG_ABSOLUTE).
141 */
142
58721107
SC
143#ifdef MANY_SEGMENTS
144#define SEG_NORMAL(x) ((x) >= SEG_E0 && (x) <= SEG_E9)
145#else
146#define SEG_NORMAL(x) ((x) == SEG_TEXT || (x) == SEG_DATA || (x) == SEG_BSS)
147#endif
148
617ee8ed 149typedef enum _segT {
fecd2382 150 SEG_ABSOLUTE = 0,
58721107
SC
151#ifdef MANY_SEGMENTS
152 /* For the moment, we allow only 10 extra segments to be specified by the user */
153 SEG_E0, SEG_E1,SEG_E2,SEG_E3,SEG_E4,SEG_E5,SEG_E6,SEG_E7,SEG_E8,SEG_E9,
154#else
fecd2382
RP
155 SEG_TEXT,
156 SEG_DATA,
157 SEG_BSS,
58721107 158#endif
fecd2382
RP
159 SEG_UNKNOWN,
160 SEG_ABSENT, /* Mythical Segment (absent): NO expression seen. */
161 SEG_PASS1, /* Mythical Segment: Need another pass. */
162 SEG_GOOF, /* Only happens if AS has a logic error. */
163 /* Invented so we don't crash printing */
164 /* error message involving weird segment. */
165 SEG_BIG, /* Bigger than 32 bits constant. */
166 SEG_DIFFERENCE, /* Mythical Segment: absolute difference. */
167 SEG_DEBUG, /* Debug segment */
168 SEG_NTV, /* Transfert vector preload segment */
169 SEG_PTV, /* Transfert vector postload segment */
170 SEG_REGISTER, /* Mythical: a register-valued expression */
171} segT;
172
173#define SEG_MAXIMUM_ORDINAL (SEG_REGISTER)
174
175typedef int subsegT;
176
177COMMON subsegT now_subseg;
178 /* What subseg we are accreting now? */
179
180
181COMMON segT now_seg;
182 /* Segment our instructions emit to. */
183 /* Only OK values are SEG_TEXT or SEG_DATA. */
184
185
186extern char *const seg_name[];
187extern int section_alignment[];
188
189
190/* relax() */
191
617ee8ed
RP
192typedef enum _relax_state {
193 rs_fill, /* Variable chars to be repeated fr_offset times. Fr_symbol
194 unused. Used with fr_offset == 0 for a constant length
195 frag. */
196
197 rs_align, /* Align: Fr_offset: power of 2. 1 variable char: fill
198 character. */
199
200 rs_org, /* Org: Fr_offset, fr_symbol: address. 1 variable char: fill
201 character. */
202
fecd2382 203 rs_machine_dependent,
617ee8ed 204
fecd2382
RP
205#ifndef WORKING_DOT_WORD
206 rs_broken_word, /* JF: gunpoint */
207#endif
617ee8ed 208} relax_stateT;
fecd2382
RP
209
210/* typedef unsigned char relax_substateT; */
211/* JF this is more likely to leave the end of a struct frag on an align
212 boundry. Be very careful with this. */
213typedef unsigned long relax_substateT;
214
215typedef unsigned long relax_addressT;/* Enough bits for address. */
216 /* Still an integer type. */
217
218\f
219/* frags.c */
220
221/*
222 * A code fragment (frag) is some known number of chars, followed by some
223 * unknown number of chars. Typically the unknown number of chars is an
224 * instruction address whose size is yet unknown. We always know the greatest
225 * possible size the unknown number of chars may become, and reserve that
226 * much room at the end of the frag.
227 * Once created, frags do not change address during assembly.
228 * We chain the frags in (a) forward-linked list(s). The object-file address
229 * of the 1st char of a frag is generally not known until after relax().
230 * Many things at assembly time describe an address by {object-file-address
231 * of a particular frag}+offset.
232
233 BUG: it may be smarter to have a single pointer off to various different
234notes for different frag kinds. See how code pans
235 */
236struct frag /* a code fragment */
237{
238 unsigned long fr_address; /* Object file address. */
239 struct frag *fr_next; /* Chain forward; ascending address order. */
240 /* Rooted in frch_root. */
241
242 long fr_fix; /* (Fixed) number of chars we know we have. */
243 /* May be 0. */
244 long fr_var; /* (Variable) number of chars after above. */
245 /* May be 0. */
246 struct symbol *fr_symbol; /* For variable-length tail. */
247 long fr_offset; /* For variable-length tail. */
248 char *fr_opcode; /*->opcode low addr byte,for relax()ation*/
249 relax_stateT fr_type; /* What state is my tail in? */
250 relax_substateT fr_subtype;
251 /* These are needed only on the NS32K machines */
252 char fr_pcrel_adjust;
253 char fr_bsr;
254 char fr_literal [1]; /* Chars begin here. */
255 /* One day we will compile fr_literal[0]. */
256};
257#define SIZEOF_STRUCT_FRAG \
258 ((int)zero_address_frag.fr_literal-(int)&zero_address_frag)
259 /* We want to say fr_literal[0] above. */
260
261typedef struct frag fragS;
262
263COMMON fragS * frag_now; /* -> current frag we are building. */
264 /* This frag is incomplete. */
265 /* It is, however, included in frchain_now. */
266 /* Frag_now->fr_fix is bogus. Use: */
267/* Virtual frag_now->fr_fix==obstack_next_free(&frags)-frag_now->fr_literal.*/
268
269COMMON fragS zero_address_frag; /* For foreign-segment symbol fixups. */
270COMMON fragS bss_address_frag; /* For local common (N_BSS segment) fixups. */
271
272/* main program "as.c" (command arguments etc) */
273
274COMMON char
275flagseen[128]; /* ['x'] TRUE if "-x" seen. */
276
277COMMON char *
278out_file_name; /* name of emitted object file */
279
280COMMON int need_pass_2; /* TRUE if we need a second pass. */
281
282typedef struct {
283 char * poc_name; /* assembler mnemonic, lower case, no '.' */
284 void (*poc_handler)(); /* Do the work */
285 int poc_val; /* Value to pass to handler */
286} pseudo_typeS;
287
288#if defined(__STDC__) & !defined(NO_STDARG)
289
290int had_errors(void);
291int had_warnings(void);
292void as_bad(const char *Format, ...);
293void as_fatal(const char *Format, ...);
294void as_tsktsk(const char *Format, ...);
295void as_warn(const char *Format, ...);
296
297#else
298
299int had_errors();
300int had_warnings();
301void as_bad();
302void as_fatal();
303void as_tsktsk();
304void as_warn();
305
306#endif /* __STDC__ & !NO_STDARG */
307
308#ifdef __STDC__
309
310char *app_push(void);
311char *atof_ieee(char *str, int what_kind, LITTLENUM_TYPE *words);
312char *input_scrub_include_file(char *filename, char *position);
313char *input_scrub_new_file(char *filename);
314char *input_scrub_next_buffer(char **bufp);
315char *strstr(const char *s, const char *wanted);
316char *xmalloc(int size);
317char *xrealloc(char *ptr, long n);
318int do_scrub_next_char(int (*get)(), void (*unget)());
319int gen_to_words(LITTLENUM_TYPE *words, int precision, long exponent_bits);
320int had_err(void);
321int had_errors(void);
322int had_warnings(void);
323int ignore_input(void);
324int scrub_from_file(void);
325int scrub_from_file(void);
326int scrub_from_string(void);
327int seen_at_least_1_file(void);
328void app_pop(char *arg);
329void as_howmuch(FILE *stream);
330void as_perror(char *gripe, char *filename);
331void as_where(void);
332void bump_line_counters(void);
333void do_scrub_begin(void);
334void input_scrub_begin(void);
335void input_scrub_close(void);
336void input_scrub_end(void);
337void int_to_gen(long x);
338void new_logical_line(char *fname, int line_number);
339void scrub_to_file(int ch);
340void scrub_to_string(int ch);
341void subseg_change(segT seg, int subseg);
342void subseg_new(segT seg, subsegT subseg);
343void subsegs_begin(void);
344
345#else /* __STDC__ */
346
347char *app_push();
348char *atof_ieee();
349char *input_scrub_include_file();
350char *input_scrub_new_file();
351char *input_scrub_next_buffer();
352char *strstr();
353char *xmalloc();
354char *xrealloc();
355int do_scrub_next_char();
356int gen_to_words();
357int had_err();
358int had_errors();
359int had_warnings();
360int ignore_input();
361int scrub_from_file();
362int scrub_from_file();
363int scrub_from_string();
364int seen_at_least_1_file();
365void app_pop();
366void as_howmuch();
367void as_perror();
368void as_where();
369void bump_line_counters();
370void do_scrub_begin();
371void input_scrub_begin();
372void input_scrub_close();
373void input_scrub_end();
374void int_to_gen();
375void new_logical_line();
376void scrub_to_file();
377void scrub_to_string();
378void subseg_change();
379void subseg_new();
380void subsegs_begin();
381
382#endif /* __STDC__ */
383
384 /* this one starts the chain of target dependant headers */
385#include "targ-env.h"
386
387 /* these define types needed by the interfaces */
388#include "struc-symbol.h"
389#include "reloc.h"
390#include "write.h"
391#include "expr.h"
392#include "frags.h"
393#include "hash.h"
394#include "read.h"
395#include "symbols.h"
396
397#include "tc.h"
398#include "obj.h"
399
400/*
401 * Local Variables:
402 * comment-column: 0
403 * fill-column: 131
404 * End:
405 */
406
407/* end: as.h */
58721107 408
This page took 0.075733 seconds and 4 git commands to generate.