as.h revision 89857
133965Sjdp/* as.h - global header file
278828Sobrien   Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
378828Sobrien   1999, 2000, 2001
433965Sjdp   Free Software Foundation, Inc.
533965Sjdp
633965Sjdp   This file is part of GAS, the GNU Assembler.
733965Sjdp
833965Sjdp   GAS is free software; you can redistribute it and/or modify
933965Sjdp   it under the terms of the GNU General Public License as published by
1033965Sjdp   the Free Software Foundation; either version 2, or (at your option)
1133965Sjdp   any later version.
1233965Sjdp
1333965Sjdp   GAS is distributed in the hope that it will be useful,
1433965Sjdp   but WITHOUT ANY WARRANTY; without even the implied warranty of
1533965Sjdp   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1633965Sjdp   GNU General Public License for more details.
1733965Sjdp
1833965Sjdp   You should have received a copy of the GNU General Public License
1933965Sjdp   along with GAS; see the file COPYING.  If not, write to the Free
2033965Sjdp   Software Foundation, 59 Temple Place - Suite 330, Boston, MA
2133965Sjdp   02111-1307, USA.  */
2233965Sjdp
2333965Sjdp#ifndef GAS
2433965Sjdp#define GAS 1
2577298Sobrien/* I think this stuff is largely out of date.  xoxorich.
2633965Sjdp *
2733965Sjdp * CAPITALISED names are #defined.
2833965Sjdp * "lowercaseH" is #defined if "lowercase.h" has been #include-d.
2933965Sjdp * "lowercaseT" is a typedef of "lowercase" objects.
3033965Sjdp * "lowercaseP" is type "pointer to object of type 'lowercase'".
3133965Sjdp * "lowercaseS" is typedef struct ... lowercaseS.
3233965Sjdp *
3333965Sjdp * #define DEBUG to enable all the "know" assertion tests.
3433965Sjdp * #define SUSPECT when debugging hash code.
3533965Sjdp * #define COMMON as "extern" for all modules except one, where you #define
3633965Sjdp *	COMMON as "".
3733965Sjdp * If TEST is #defined, then we are testing a module: #define COMMON as "".
3833965Sjdp */
3933965Sjdp
4033965Sjdp#include "config.h"
4160484Sobrien#include "bin-bugs.h"
4233965Sjdp
4333965Sjdp/* This is the code recommended in the autoconf documentation, almost
4433965Sjdp   verbatim.  If it doesn't work for you, let me know, and notify
4533965Sjdp   djm@gnu.ai.mit.edu as well.  */
4633965Sjdp/* Added void* version for STDC case.  This is to be compatible with
4733965Sjdp   the declaration in bison.simple, used for m68k operand parsing.
4833965Sjdp   --KR 1995.08.08 */
4933965Sjdp/* Force void* decl for hpux.  This is what Bison uses.  --KR 1995.08.16 */
5033965Sjdp
5189857Sobrien#ifndef __GNUC__
5233965Sjdp# if HAVE_ALLOCA_H
5333965Sjdp#  include <alloca.h>
5433965Sjdp# else
5533965Sjdp#  ifdef _AIX
5689857Sobrien/* Indented so that pre-ansi C compilers will ignore it, rather than
5789857Sobrien   choke on it.  Some versions of AIX require this to be the first
5889857Sobrien   thing in the file.  */
5933965Sjdp #pragma alloca
6033965Sjdp#  else
6133965Sjdp#   ifndef alloca /* predefined by HP cc +Olibcalls */
6233965Sjdp#    if !defined (__STDC__) && !defined (__hpux)
6338889Sjdpextern char *alloca ();
6433965Sjdp#    else
6538889Sjdpextern void *alloca ();
6633965Sjdp#    endif /* __STDC__, __hpux */
6733965Sjdp#   endif /* alloca */
6833965Sjdp#  endif /* _AIX */
6933965Sjdp# endif /* HAVE_ALLOCA_H */
7089857Sobrien#endif /* __GNUC__ */
7133965Sjdp
7233965Sjdp/* Now, tend to the rest of the configuration.  */
7333965Sjdp
7477298Sobrien/* System include files first...  */
7533965Sjdp#include <stdio.h>
7633965Sjdp#ifdef HAVE_STRING_H
7733965Sjdp#include <string.h>
7833965Sjdp#else
7933965Sjdp#ifdef HAVE_STRINGS_H
8033965Sjdp#include <strings.h>
8133965Sjdp#endif
8233965Sjdp#endif
8333965Sjdp#ifdef HAVE_STDLIB_H
8433965Sjdp#include <stdlib.h>
8533965Sjdp#endif
8633965Sjdp#ifdef HAVE_UNISTD_H
8733965Sjdp#include <unistd.h>
8833965Sjdp#endif
8933965Sjdp#ifdef HAVE_SYS_TYPES_H
9033965Sjdp/* for size_t, pid_t */
9133965Sjdp#include <sys/types.h>
9233965Sjdp#endif
9333965Sjdp
9433965Sjdp#include <getopt.h>
9533965Sjdp/* The first getopt value for machine-independent long options.
9633965Sjdp   150 isn't special; it's just an arbitrary non-ASCII char value.  */
9733965Sjdp#define OPTION_STD_BASE 150
9833965Sjdp/* The first getopt value for machine-dependent long options.
9977298Sobrien   190 gives the standard options room to grow.  */
10077298Sobrien#define OPTION_MD_BASE 190
10133965Sjdp
10233965Sjdp#ifdef DEBUG
10333965Sjdp#undef NDEBUG
10433965Sjdp#endif
10560484Sobrien#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 6)
10633965Sjdp#define __PRETTY_FUNCTION__  ((char*)0)
10733965Sjdp#endif
10833965Sjdp#if 0
10933965Sjdp
11033965Sjdp/* Handle lossage with assert.h.  */
11133965Sjdp#ifndef BROKEN_ASSERT
11233965Sjdp#include <assert.h>
11333965Sjdp#else /* BROKEN_ASSERT */
11433965Sjdp#ifndef NDEBUG
11533965Sjdp#define assert(p) ((p) ? 0 : (as_assert (__FILE__, __LINE__, __PRETTY_FUNCTION__), 0))
11633965Sjdp#else
11733965Sjdp#define assert(p) ((p), 0)
11833965Sjdp#endif
11933965Sjdp#endif /* BROKEN_ASSERT */
12033965Sjdp
12133965Sjdp#else
12233965Sjdp
12333965Sjdp#define assert(P) ((P) ? 0 : (as_assert (__FILE__, __LINE__, __PRETTY_FUNCTION__), 0))
12433965Sjdp#undef abort
12533965Sjdp#define abort()		as_abort (__FILE__, __LINE__, __PRETTY_FUNCTION__)
12633965Sjdp
12733965Sjdp#endif
12833965Sjdp
12977298Sobrien/* Now GNU header files...  */
13060484Sobrien#include "ansidecl.h"
13133965Sjdp#ifdef BFD_ASSEMBLER
13260484Sobrien#include "bfd.h"
13333965Sjdp#endif
13460484Sobrien#include "libiberty.h"
13533965Sjdp
13633965Sjdp/* Define the standard progress macros.  */
13760484Sobrien#include "progress.h"
13833965Sjdp
13933965Sjdp/* This doesn't get taken care of anywhere.  */
14033965Sjdp#ifndef __MWERKS__  /* Metrowerks C chokes on the "defined (inline)" */
14133965Sjdp#if !defined (__GNUC__) && !defined (inline)
14233965Sjdp#define inline
14333965Sjdp#endif
14433965Sjdp#endif /* !__MWERKS__ */
14533965Sjdp
14633965Sjdp/* Other stuff from config.h.  */
14733965Sjdp#ifdef NEED_DECLARATION_STRSTR
14833965Sjdpextern char *strstr ();
14933965Sjdp#endif
15033965Sjdp#ifdef NEED_DECLARATION_MALLOC
15133965Sjdpextern PTR malloc ();
15233965Sjdpextern PTR realloc ();
15333965Sjdp#endif
15433965Sjdp#ifdef NEED_DECLARATION_FREE
15533965Sjdpextern void free ();
15633965Sjdp#endif
15733965Sjdp#ifdef NEED_DECLARATION_ERRNO
15833965Sjdpextern int errno;
15933965Sjdp#endif
16060484Sobrien#ifdef NEED_DECLARATION_ENVIRON
16160484Sobrienextern char **environ;
16260484Sobrien#endif
16333965Sjdp
16438889Sjdp/* This is needed for VMS.  */
16538889Sjdp#if ! defined (HAVE_UNLINK) && defined (HAVE_REMOVE)
16633965Sjdp#define unlink remove
16733965Sjdp#endif
16833965Sjdp
16933965Sjdp/* Hack to make "gcc -Wall" not complain about obstack macros.  */
17033965Sjdp#if !defined (memcpy) && !defined (bcopy)
17133965Sjdp#define bcopy(src,dest,size)	memcpy(dest,src,size)
17233965Sjdp#endif
17333965Sjdp
17433965Sjdp/* Make Saber happier on obstack.h.  */
17533965Sjdp#ifdef SABER
17633965Sjdp#undef  __PTR_TO_INT
17777298Sobrien#define __PTR_TO_INT(P) ((int) (P))
17833965Sjdp#undef  __INT_TO_PTR
17977298Sobrien#define __INT_TO_PTR(P) ((char *) (P))
18033965Sjdp#endif
18133965Sjdp
18233965Sjdp#ifndef __LINE__
18333965Sjdp#define __LINE__ "unknown"
18433965Sjdp#endif /* __LINE__ */
18533965Sjdp
18633965Sjdp#ifndef __FILE__
18733965Sjdp#define __FILE__ "unknown"
18833965Sjdp#endif /* __FILE__ */
18933965Sjdp
19033965Sjdp#ifndef FOPEN_WB
19133965Sjdp#ifdef GO32
19233965Sjdp#include "fopen-bin.h"
19333965Sjdp#else
19433965Sjdp#include "fopen-same.h"
19533965Sjdp#endif
19633965Sjdp#endif
19733965Sjdp
19833965Sjdp#ifndef EXIT_SUCCESS
19933965Sjdp#define EXIT_SUCCESS 0
20033965Sjdp#define EXIT_FAILURE 1
20133965Sjdp#endif
20233965Sjdp
20360484Sobrien#ifndef SEEK_SET
20460484Sobrien#define SEEK_SET 0
20560484Sobrien#endif
20660484Sobrien
20733965Sjdp#define obstack_chunk_alloc xmalloc
20833965Sjdp#define obstack_chunk_free xfree
20933965Sjdp
21033965Sjdp#define xfree free
21133965Sjdp
21260484Sobrien#include "asintl.h"
21360484Sobrien
21477298Sobrien#define BAD_CASE(val)							    \
21577298Sobrien  {									    \
21677298Sobrien    as_fatal (_("Case value %ld unexpected at line %d of file \"%s\"\n"),   \
21777298Sobrien	      (long) val, __LINE__, __FILE__);				    \
21877298Sobrien  }
21933965Sjdp
22033965Sjdp#include "flonum.h"
22133965Sjdp
22233965Sjdp/* These are assembler-wide concepts */
22333965Sjdp
22433965Sjdp#ifdef BFD_ASSEMBLER
22533965Sjdpextern bfd *stdoutput;
22633965Sjdptypedef bfd_vma addressT;
22733965Sjdptypedef bfd_signed_vma offsetT;
22833965Sjdp#else
22933965Sjdptypedef unsigned long addressT;
23033965Sjdptypedef long offsetT;
23133965Sjdp#endif
23233965Sjdp
23333965Sjdp/* Type of symbol value, etc.  For use in prototypes.  */
23433965Sjdptypedef addressT valueT;
23533965Sjdp
23633965Sjdp#ifndef COMMON
23733965Sjdp#ifdef TEST
23877298Sobrien#define COMMON			/* declare our COMMONs storage here.  */
23933965Sjdp#else
24033965Sjdp#define COMMON extern		/* our commons live elswhere */
24133965Sjdp#endif
24233965Sjdp#endif
24333965Sjdp/* COMMON now defined */
24433965Sjdp
24533965Sjdp#ifdef DEBUG
24633965Sjdp#ifndef know
24733965Sjdp#define know(p) assert(p)	/* Verify our assumptions! */
24833965Sjdp#endif /* not yet defined */
24933965Sjdp#else
25033965Sjdp#define know(p)			/* know() checks are no-op.ed */
25133965Sjdp#endif
25233965Sjdp
25333965Sjdp/* input_scrub.c */
25433965Sjdp
25577298Sobrien/* Supplies sanitised buffers to read.c.
25677298Sobrien   Also understands printing line-number part of error messages.  */
25733965Sjdp
25833965Sjdp/* subsegs.c     Sub-segments. Also, segment(=expression type)s.*/
25933965Sjdp
26033965Sjdp#ifndef BFD_ASSEMBLER
26133965Sjdp
26233965Sjdp#ifdef MANY_SEGMENTS
26333965Sjdp#include "bfd.h"
26433965Sjdp#define N_SEGMENTS 40
26533965Sjdp#define SEG_NORMAL(x) ((x) >= SEG_E0 && (x) <= SEG_E39)
26633965Sjdp#define SEG_LIST SEG_E0,SEG_E1,SEG_E2,SEG_E3,SEG_E4,SEG_E5,SEG_E6,SEG_E7,SEG_E8,SEG_E9,\
26733965Sjdp		 SEG_E10,SEG_E11,SEG_E12,SEG_E13,SEG_E14,SEG_E15,SEG_E16,SEG_E17,SEG_E18,SEG_E19,\
26833965Sjdp		 SEG_E20,SEG_E21,SEG_E22,SEG_E23,SEG_E24,SEG_E25,SEG_E26,SEG_E27,SEG_E28,SEG_E29,\
26933965Sjdp		 SEG_E30,SEG_E31,SEG_E32,SEG_E33,SEG_E34,SEG_E35,SEG_E36,SEG_E37,SEG_E38,SEG_E39
27033965Sjdp#define SEG_TEXT SEG_E0
27133965Sjdp#define SEG_DATA SEG_E1
27233965Sjdp#define SEG_BSS SEG_E2
27333965Sjdp#define SEG_LAST SEG_E39
27433965Sjdp#else
27533965Sjdp#define N_SEGMENTS 3
27633965Sjdp#define SEG_NORMAL(x) ((x) == SEG_TEXT || (x) == SEG_DATA || (x) == SEG_BSS)
27733965Sjdp#define SEG_LIST SEG_TEXT,SEG_DATA,SEG_BSS
27833965Sjdp#endif
27933965Sjdp
28077298Sobrientypedef enum _segT {
28177298Sobrien  SEG_ABSOLUTE = 0,
28277298Sobrien  SEG_LIST,
28377298Sobrien  SEG_UNKNOWN,
28477298Sobrien  SEG_GOOF,			/* Only happens if AS has a logic error.  */
28577298Sobrien  /* Invented so we don't crash printing */
28677298Sobrien  /* error message involving weird segment.  */
28777298Sobrien  SEG_EXPR,			/* Intermediate expression values.  */
28877298Sobrien  SEG_DEBUG,			/* Debug segment */
28977298Sobrien  SEG_NTV,			/* Transfert vector preload segment */
29077298Sobrien  SEG_PTV,			/* Transfert vector postload segment */
29177298Sobrien  SEG_REGISTER			/* Mythical: a register-valued expression */
29277298Sobrien} segT;
29333965Sjdp
29433965Sjdp#define SEG_MAXIMUM_ORDINAL (SEG_REGISTER)
29533965Sjdp#else
29633965Sjdptypedef asection *segT;
29733965Sjdp#define SEG_NORMAL(SEG)		((SEG) != absolute_section	\
29833965Sjdp				 && (SEG) != undefined_section	\
29933965Sjdp				 && (SEG) != reg_section	\
30033965Sjdp				 && (SEG) != expr_section)
30133965Sjdp#endif
30233965Sjdptypedef int subsegT;
30333965Sjdp
30433965Sjdp/* What subseg we are accreting now? */
30533965SjdpCOMMON subsegT now_subseg;
30633965Sjdp
30777298Sobrien/* Segment our instructions emit to.  */
30833965SjdpCOMMON segT now_seg;
30933965Sjdp
31033965Sjdp#ifdef BFD_ASSEMBLER
31133965Sjdp#define segment_name(SEG)	bfd_get_section_name (stdoutput, SEG)
31233965Sjdp#else
31333965Sjdpextern char const *const seg_name[];
31433965Sjdp#define segment_name(SEG)	seg_name[(int) (SEG)]
31533965Sjdp#endif
31633965Sjdp
31733965Sjdp#ifndef BFD_ASSEMBLER
31833965Sjdpextern int section_alignment[];
31933965Sjdp#endif
32033965Sjdp
32133965Sjdp#ifdef BFD_ASSEMBLER
32233965Sjdpextern segT reg_section, expr_section;
32333965Sjdp/* Shouldn't these be eliminated someday?  */
32433965Sjdpextern segT text_section, data_section, bss_section;
32533965Sjdp#define absolute_section	bfd_abs_section_ptr
32633965Sjdp#define undefined_section	bfd_und_section_ptr
32733965Sjdp#else
32833965Sjdp#define reg_section		SEG_REGISTER
32933965Sjdp#define expr_section		SEG_EXPR
33033965Sjdp#define text_section		SEG_TEXT
33133965Sjdp#define data_section		SEG_DATA
33233965Sjdp#define bss_section		SEG_BSS
33333965Sjdp#define absolute_section	SEG_ABSOLUTE
33433965Sjdp#define undefined_section	SEG_UNKNOWN
33533965Sjdp#endif
33633965Sjdp
33733965Sjdp/* relax() */
33833965Sjdp
33977298Sobrienenum _relax_state {
34077298Sobrien  /* Variable chars to be repeated fr_offset times.
34177298Sobrien     Fr_symbol unused. Used with fr_offset == 0 for a
34277298Sobrien     constant length frag.  */
34377298Sobrien  rs_fill = 1,
34433965Sjdp
34577298Sobrien  /* Align.  The fr_offset field holds the power of 2 to which to
34677298Sobrien     align.  The fr_var field holds the number of characters in the
34777298Sobrien     fill pattern.  The fr_subtype field holds the maximum number of
34877298Sobrien     bytes to skip when aligning, or 0 if there is no maximum.  */
34977298Sobrien  rs_align,
35033965Sjdp
35177298Sobrien  /* Align code.  The fr_offset field holds the power of 2 to which
35277298Sobrien     to align.  This type is only generated by machine specific
35377298Sobrien     code, which is normally responsible for handling the fill
35477298Sobrien     pattern.  The fr_subtype field holds the maximum number of
35577298Sobrien     bytes to skip when aligning, or 0 if there is no maximum.  */
35677298Sobrien  rs_align_code,
35733965Sjdp
35877298Sobrien  /* Test for alignment.  Like rs_align, but used by several targets
35977298Sobrien     to warn if data is not properly aligned.  */
36077298Sobrien  rs_align_test,
36133965Sjdp
36277298Sobrien  /* Org: Fr_offset, fr_symbol: address. 1 variable char: fill
36377298Sobrien     character.  */
36477298Sobrien  rs_org,
36577298Sobrien
36633965Sjdp#ifndef WORKING_DOT_WORD
36777298Sobrien  /* JF: gunpoint */
36877298Sobrien  rs_broken_word,
36933965Sjdp#endif
37033965Sjdp
37177298Sobrien  /* machine-specific relaxable (or similarly alterable) instruction */
37277298Sobrien  rs_machine_dependent,
37333965Sjdp
37477298Sobrien  /* .space directive with expression operand that needs to be computed
37577298Sobrien     later.  Similar to rs_org, but different.
37677298Sobrien     fr_symbol: operand
37777298Sobrien     1 variable char: fill character  */
37877298Sobrien  rs_space,
37938889Sjdp
38077298Sobrien  /* A DWARF leb128 value; only ELF uses this.  The subtype is 0 for
38177298Sobrien     unsigned, 1 for signed.  */
38277298Sobrien  rs_leb128,
38338889Sjdp
38477298Sobrien  /* Exception frame information which we may be able to optimize.  */
38577298Sobrien  rs_cfa,
38633965Sjdp
38777298Sobrien  /* Cross-fragment dwarf2 line number optimization.  */
38877298Sobrien  rs_dwarf2dbg
38977298Sobrien};
39077298Sobrien
39133965Sjdptypedef enum _relax_state relax_stateT;
39233965Sjdp
39333965Sjdp/* This type is used in prototypes, so it can't be a type that will be
39433965Sjdp   widened for argument passing.  */
39533965Sjdptypedef unsigned int relax_substateT;
39633965Sjdp
39733965Sjdp/* Enough bits for address, but still an integer type.
39833965Sjdp   Could be a problem, cross-assembling for 64-bit machines.  */
39933965Sjdptypedef addressT relax_addressT;
40033965Sjdp
40133965Sjdp/* main program "as.c" (command arguments etc) */
40233965Sjdp
40333965SjdpCOMMON unsigned char flag_no_comments; /* -f */
40433965SjdpCOMMON unsigned char flag_debug; /* -D */
40533965SjdpCOMMON unsigned char flag_signed_overflow_ok; /* -J */
40633965Sjdp#ifndef WORKING_DOT_WORD
40733965SjdpCOMMON unsigned char flag_warn_displacement; /* -K */
40833965Sjdp#endif
40933965Sjdp
41033965Sjdp/* True if local symbols should be retained.  */
41133965SjdpCOMMON int flag_keep_locals; /* -L */
41233965Sjdp
41333965Sjdp/* True if we are assembling in MRI mode.  */
41433965SjdpCOMMON int flag_mri;
41533965Sjdp
41633965Sjdp/* Should the data section be made read-only and appended to the text
41733965Sjdp   section?  */
41833965SjdpCOMMON unsigned char flag_readonly_data_in_text; /* -R */
41933965Sjdp
42033965Sjdp/* True if warnings should be inhibited.  */
42133965SjdpCOMMON int flag_no_warnings; /* -W */
42233965Sjdp
42360484Sobrien/* True if warnings count as errors.  */
42460484SobrienCOMMON int flag_fatal_warnings; /* --fatal-warnings */
42560484Sobrien
42633965Sjdp/* True if we should attempt to generate output even if non-fatal errors
42733965Sjdp   are detected.  */
42833965SjdpCOMMON unsigned char flag_always_generate_output; /* -Z */
42933965Sjdp
43077298Sobrien/* This is true if the assembler should output time and space usage.  */
43133965SjdpCOMMON unsigned char flag_print_statistics;
43233965Sjdp
43338889Sjdp/* True if local absolute symbols are to be stripped.  */
43438889SjdpCOMMON int flag_strip_local_absolute;
43538889Sjdp
43638889Sjdp/* True if we should generate a traditional format object file.  */
43738889SjdpCOMMON int flag_traditional_format;
43838889Sjdp
43933965Sjdp/* name of emitted object file */
44033965SjdpCOMMON char *out_file_name;
44133965Sjdp
44233965Sjdp/* name of file defining extensions to the basic instruction set */
44333965SjdpCOMMON char *insttbl_file_name;
44433965Sjdp
44577298Sobrien/* TRUE if we need a second pass.  */
44633965SjdpCOMMON int need_pass_2;
44733965Sjdp
44833965Sjdp/* TRUE if we should do no relaxing, and
44933965Sjdp   leave lots of padding.  */
45033965SjdpCOMMON int linkrelax;
45133965Sjdp
45233965Sjdp/* TRUE if we should produce a listing.  */
45333965Sjdpextern int listing;
45433965Sjdp
45577298Sobrien/* Type of debugging information we should generate.  We currently support
45677298Sobrien   stabs, ECOFF, and DWARF2.
45738889Sjdp
45877298Sobrien   NOTE!  This means debug information about the assembly source code itself
45977298Sobrien   and _not_ about possible debug information from a high-level language.
46077298Sobrien   This is especially relevant to DWARF2, since the compiler may emit line
46177298Sobrien   number directives that the assembler resolves.  */
46238889Sjdp
46377298Sobrienenum debug_info_type {
46477298Sobrien  DEBUG_UNSPECIFIED,
46577298Sobrien  DEBUG_NONE,
46677298Sobrien  DEBUG_STABS,
46777298Sobrien  DEBUG_ECOFF,
46877298Sobrien  DEBUG_DWARF,
46977298Sobrien  DEBUG_DWARF2
47077298Sobrien};
47177298Sobrien
47238889Sjdpextern enum debug_info_type debug_type;
47338889Sjdp
47433965Sjdp/* Maximum level of macro nesting.  */
47533965Sjdpextern int max_macro_nest;
47633965Sjdp
47733965Sjdp/* Obstack chunk size.  Keep large for efficient space use, make small to
47833965Sjdp   increase malloc calls for monitoring memory allocation.  */
47933965Sjdpextern int chunksize;
48033965Sjdp
48177298Sobrienstruct _pseudo_type {
48277298Sobrien  /* assembler mnemonic, lower case, no '.' */
48377298Sobrien  const char *poc_name;
48477298Sobrien  /* Do the work */
48577298Sobrien  void (*poc_handler) PARAMS ((int));
48677298Sobrien  /* Value to pass to handler */
48777298Sobrien  int poc_val;
48877298Sobrien};
48933965Sjdp
49033965Sjdptypedef struct _pseudo_type pseudo_typeS;
49133965Sjdp
49233965Sjdp/* Prefer varargs for non-ANSI compiler, since some will barf if the
49333965Sjdp   ellipsis definition is used with a no-arguments declaration.  */
49433965Sjdp#if defined (HAVE_VARARGS_H) && !defined (__STDC__)
49533965Sjdp#undef HAVE_STDARG_H
49633965Sjdp#endif
49733965Sjdp
49833965Sjdp#if defined (HAVE_STDARG_H)
49933965Sjdp#define USE_STDARG
50033965Sjdp#endif
50133965Sjdp#if !defined (USE_STDARG) && defined (HAVE_VARARGS_H)
50233965Sjdp#define USE_VARARGS
50333965Sjdp#endif
50433965Sjdp
50533965Sjdp#ifdef USE_STDARG
50633965Sjdp#if (__GNUC__ >= 2) && !defined(VMS)
50733965Sjdp/* for use with -Wformat */
50838889Sjdp
50960484Sobrien#if __GNUC__ == 2 && __GNUC_MINOR__ < 6
51038889Sjdp/* Support for double underscores in attribute names was added in gcc
51138889Sjdp   2.6, so avoid them if we are using an earlier version.  */
51238889Sjdp#define __printf__ printf
51338889Sjdp#define __format__ format
51438889Sjdp#endif
51538889Sjdp
51638889Sjdp#define PRINTF_LIKE(FCN) \
51738889Sjdp  void FCN (const char *format, ...) \
51838889Sjdp    __attribute__ ((__format__ (__printf__, 1, 2)))
51938889Sjdp#define PRINTF_WHERE_LIKE(FCN) \
52038889Sjdp  void FCN (char *file, unsigned int line, const char *format, ...) \
52138889Sjdp    __attribute__ ((__format__ (__printf__, 3, 4)))
52238889Sjdp
52338889Sjdp#else /* __GNUC__ < 2 || defined(VMS) */
52438889Sjdp
52533965Sjdp#define PRINTF_LIKE(FCN)	void FCN PARAMS ((const char *format, ...))
52633965Sjdp#define PRINTF_WHERE_LIKE(FCN)	void FCN PARAMS ((char *file, \
52733965Sjdp						  unsigned int line, \
52833965Sjdp					  	  const char *format, ...))
52938889Sjdp
53038889Sjdp#endif /* __GNUC__ < 2 || defined(VMS) */
53138889Sjdp
53238889Sjdp#else /* ! USE_STDARG */
53338889Sjdp
53433965Sjdp#define PRINTF_LIKE(FCN)	void FCN ()
53533965Sjdp#define PRINTF_WHERE_LIKE(FCN)	void FCN ()
53633965Sjdp
53738889Sjdp#endif /* ! USE_STDARG */
53838889Sjdp
53933965SjdpPRINTF_LIKE (as_bad);
54060484SobrienPRINTF_LIKE (as_fatal) ATTRIBUTE_NORETURN;
54133965SjdpPRINTF_LIKE (as_tsktsk);
54233965SjdpPRINTF_LIKE (as_warn);
54333965SjdpPRINTF_WHERE_LIKE (as_bad_where);
54433965SjdpPRINTF_WHERE_LIKE (as_warn_where);
54538889Sjdp
54633965Sjdpvoid as_assert PARAMS ((const char *, int, const char *));
54760484Sobrienvoid as_abort PARAMS ((const char *, int, const char *)) ATTRIBUTE_NORETURN;
54833965Sjdp
54933965Sjdpvoid fprint_value PARAMS ((FILE *file, addressT value));
55033965Sjdpvoid sprint_value PARAMS ((char *buf, addressT value));
55133965Sjdp
55233965Sjdpint had_errors PARAMS ((void));
55333965Sjdpint had_warnings PARAMS ((void));
55433965Sjdp
55533965Sjdpvoid print_version_id PARAMS ((void));
55633965Sjdpchar *app_push PARAMS ((void));
55733965Sjdpchar *atof_ieee PARAMS ((char *str, int what_kind, LITTLENUM_TYPE * words));
55833965Sjdpchar *input_scrub_include_file PARAMS ((char *filename, char *position));
55960484Sobrienextern void input_scrub_insert_line PARAMS((const char *line));
56060484Sobrienextern void input_scrub_insert_file PARAMS((char *path));
56133965Sjdpchar *input_scrub_new_file PARAMS ((char *filename));
56233965Sjdpchar *input_scrub_next_buffer PARAMS ((char **bufp));
56360484Sobrienint do_scrub_chars PARAMS ((int (*get) (char *, int), char *to, int tolen));
56433965Sjdpint gen_to_words PARAMS ((LITTLENUM_TYPE * words, int precision,
56533965Sjdp			  long exponent_bits));
56633965Sjdpint had_err PARAMS ((void));
56733965Sjdpint ignore_input PARAMS ((void));
56833965Sjdpvoid cond_finish_check PARAMS ((int));
56933965Sjdpvoid cond_exit_macro PARAMS ((int));
57033965Sjdpint seen_at_least_1_file PARAMS ((void));
57133965Sjdpvoid app_pop PARAMS ((char *arg));
57233965Sjdpvoid as_howmuch PARAMS ((FILE * stream));
57333965Sjdpvoid as_perror PARAMS ((const char *gripe, const char *filename));
57433965Sjdpvoid as_where PARAMS ((char **namep, unsigned int *linep));
57533965Sjdpvoid bump_line_counters PARAMS ((void));
57633965Sjdpvoid do_scrub_begin PARAMS ((int));
57733965Sjdpvoid input_scrub_begin PARAMS ((void));
57833965Sjdpvoid input_scrub_close PARAMS ((void));
57933965Sjdpvoid input_scrub_end PARAMS ((void));
58038889Sjdpint new_logical_line PARAMS ((char *fname, int line_number));
58133965Sjdpvoid subsegs_begin PARAMS ((void));
58233965Sjdpvoid subseg_change PARAMS ((segT seg, int subseg));
58333965SjdpsegT subseg_new PARAMS ((const char *name, subsegT subseg));
58433965SjdpsegT subseg_force_new PARAMS ((const char *name, subsegT subseg));
58533965Sjdpvoid subseg_set PARAMS ((segT seg, subsegT subseg));
58633965Sjdp#ifdef BFD_ASSEMBLER
58733965SjdpsegT subseg_get PARAMS ((const char *, int));
58833965Sjdp#endif
58960484Sobrienint subseg_text_p PARAMS ((segT));
59033965Sjdp
59138889Sjdpvoid start_dependencies PARAMS ((char *));
59238889Sjdpvoid register_dependency PARAMS ((char *));
59338889Sjdpvoid print_dependencies PARAMS ((void));
59438889Sjdp
59533965Sjdpstruct expressionS;
59633965Sjdpstruct fix;
59760484Sobrientypedef struct symbol symbolS;
59833965Sjdpstruct relax_type;
59938889Sjdptypedef struct frag fragS;
60033965Sjdp
60133965Sjdp#ifdef BFD_ASSEMBLER
60233965Sjdp/* literal.c */
60360484SobrienvalueT add_to_literal_pool PARAMS ((symbolS *, valueT, segT, int));
60433965Sjdp#endif
60533965Sjdp
60638889Sjdpint check_eh_frame PARAMS ((struct expressionS *, unsigned int *));
60738889Sjdpint eh_frame_estimate_size_before_relax PARAMS ((fragS *));
60838889Sjdpint eh_frame_relax_frag PARAMS ((fragS *));
60938889Sjdpvoid eh_frame_convert_frag PARAMS ((fragS *));
61038889Sjdp
61133965Sjdp#include "expr.h"		/* Before targ-*.h */
61233965Sjdp
61333965Sjdp/* this one starts the chain of target dependant headers */
61433965Sjdp#include "targ-env.h"
61533965Sjdp
61677298Sobrien#ifdef TC_ARC
61777298Sobrien#include "struc-symbol.h"
61877298Sobrien#endif
61977298Sobrien
62033965Sjdp#include "write.h"
62133965Sjdp#include "frags.h"
62233965Sjdp#include "hash.h"
62333965Sjdp#include "read.h"
62433965Sjdp#include "symbols.h"
62533965Sjdp
62633965Sjdp#include "tc.h"
62733965Sjdp#include "obj.h"
62833965Sjdp
62933965Sjdp#ifdef USE_EMULATIONS
63033965Sjdp#include "emul.h"
63133965Sjdp#endif
63233965Sjdp#include "listing.h"
63333965Sjdp
63460484Sobrien#ifdef TC_M68K
63560484Sobrien/* True if we are assembling in m68k MRI mode.  */
63660484SobrienCOMMON int flag_m68k_mri;
63760484Sobrien#else
63860484Sobrien#define flag_m68k_mri 0
63960484Sobrien#endif
64060484Sobrien
64177298Sobrien#ifdef WARN_COMMENTS
64277298SobrienCOMMON int warn_comment;
64377298SobrienCOMMON unsigned int found_comment;
64477298SobrienCOMMON char *found_comment_file;
64577298Sobrien#endif
64677298Sobrien
64760484Sobrien#ifndef NUMBERS_WITH_SUFFIX
64860484Sobrien#define NUMBERS_WITH_SUFFIX 0
64960484Sobrien#endif
65060484Sobrien
65133965Sjdp#ifndef LOCAL_LABELS_DOLLAR
65233965Sjdp#define LOCAL_LABELS_DOLLAR 0
65333965Sjdp#endif
65433965Sjdp
65533965Sjdp#ifndef LOCAL_LABELS_FB
65633965Sjdp#define LOCAL_LABELS_FB 0
65733965Sjdp#endif
65833965Sjdp
65960484Sobrien#ifndef LABELS_WITHOUT_COLONS
66060484Sobrien#define LABELS_WITHOUT_COLONS 0
66160484Sobrien#endif
66260484Sobrien
66360484Sobrien#ifndef NO_PSEUDO_DOT
66460484Sobrien#define NO_PSEUDO_DOT 0
66560484Sobrien#endif
66660484Sobrien
66738889Sjdp#ifndef TEXT_SECTION_NAME
66838889Sjdp#define TEXT_SECTION_NAME	".text"
66938889Sjdp#define DATA_SECTION_NAME	".data"
67038889Sjdp#define BSS_SECTION_NAME	".bss"
67138889Sjdp#endif
67238889Sjdp
67360484Sobrien#ifndef OCTETS_PER_BYTE_POWER
67460484Sobrien#define OCTETS_PER_BYTE_POWER 0
67560484Sobrien#endif
67660484Sobrien#ifndef OCTETS_PER_BYTE
67760484Sobrien#define OCTETS_PER_BYTE (1<<OCTETS_PER_BYTE_POWER)
67860484Sobrien#endif
67960484Sobrien#if OCTETS_PER_BYTE != (1<<OCTETS_PER_BYTE_POWER)
68060484Sobrien #error "Octets per byte conflicts with its power-of-two definition!"
68160484Sobrien#endif
68260484Sobrien
68333965Sjdp#endif /* GAS */
684