as.h revision 78828
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 #undef for DJ Delorie.  The right fix is to ensure that as.h
4733965Sjdp   is included first, before even any system header files, in all files
4833965Sjdp   that use it.  KR 1994.11.03 */
4933965Sjdp/* Added void* version for STDC case.  This is to be compatible with
5033965Sjdp   the declaration in bison.simple, used for m68k operand parsing.
5133965Sjdp   --KR 1995.08.08 */
5233965Sjdp/* Force void* decl for hpux.  This is what Bison uses.  --KR 1995.08.16 */
5333965Sjdp
5433965Sjdp/* AIX requires this to be the first thing in the file.  */
5533965Sjdp#ifdef __GNUC__
5638889Sjdp# ifndef alloca
5738889Sjdp#  ifdef __STDC__
5838889Sjdpextern void *alloca ();
5938889Sjdp#  else
6038889Sjdpextern char *alloca ();
6138889Sjdp#  endif
6238889Sjdp# endif
6333965Sjdp#else
6433965Sjdp# if HAVE_ALLOCA_H
6533965Sjdp#  include <alloca.h>
6633965Sjdp# else
6733965Sjdp#  ifdef _AIX
6833965Sjdp #pragma alloca
6933965Sjdp#  else
7033965Sjdp#   ifndef alloca /* predefined by HP cc +Olibcalls */
7133965Sjdp#    if !defined (__STDC__) && !defined (__hpux)
7238889Sjdpextern char *alloca ();
7333965Sjdp#    else
7438889Sjdpextern void *alloca ();
7533965Sjdp#    endif /* __STDC__, __hpux */
7633965Sjdp#   endif /* alloca */
7733965Sjdp#  endif /* _AIX */
7833965Sjdp# endif /* HAVE_ALLOCA_H */
7933965Sjdp#endif
8033965Sjdp
8133965Sjdp/* Now, tend to the rest of the configuration.  */
8233965Sjdp
8377298Sobrien/* System include files first...  */
8433965Sjdp#include <stdio.h>
8533965Sjdp#include <ctype.h>
8633965Sjdp#ifdef HAVE_STRING_H
8733965Sjdp#include <string.h>
8833965Sjdp#else
8933965Sjdp#ifdef HAVE_STRINGS_H
9033965Sjdp#include <strings.h>
9133965Sjdp#endif
9233965Sjdp#endif
9333965Sjdp#ifdef HAVE_STDLIB_H
9433965Sjdp#include <stdlib.h>
9533965Sjdp#endif
9633965Sjdp#ifdef HAVE_UNISTD_H
9733965Sjdp#include <unistd.h>
9833965Sjdp#endif
9933965Sjdp#ifdef HAVE_SYS_TYPES_H
10033965Sjdp/* for size_t, pid_t */
10133965Sjdp#include <sys/types.h>
10233965Sjdp#endif
10333965Sjdp
10433965Sjdp#include <getopt.h>
10533965Sjdp/* The first getopt value for machine-independent long options.
10633965Sjdp   150 isn't special; it's just an arbitrary non-ASCII char value.  */
10733965Sjdp#define OPTION_STD_BASE 150
10833965Sjdp/* The first getopt value for machine-dependent long options.
10977298Sobrien   190 gives the standard options room to grow.  */
11077298Sobrien#define OPTION_MD_BASE 190
11133965Sjdp
11233965Sjdp#ifdef DEBUG
11333965Sjdp#undef NDEBUG
11433965Sjdp#endif
11560484Sobrien#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 6)
11633965Sjdp#define __PRETTY_FUNCTION__  ((char*)0)
11733965Sjdp#endif
11833965Sjdp#if 0
11933965Sjdp
12033965Sjdp/* Handle lossage with assert.h.  */
12133965Sjdp#ifndef BROKEN_ASSERT
12233965Sjdp#include <assert.h>
12333965Sjdp#else /* BROKEN_ASSERT */
12433965Sjdp#ifndef NDEBUG
12533965Sjdp#define assert(p) ((p) ? 0 : (as_assert (__FILE__, __LINE__, __PRETTY_FUNCTION__), 0))
12633965Sjdp#else
12733965Sjdp#define assert(p) ((p), 0)
12833965Sjdp#endif
12933965Sjdp#endif /* BROKEN_ASSERT */
13033965Sjdp
13133965Sjdp#else
13233965Sjdp
13333965Sjdp#define assert(P) ((P) ? 0 : (as_assert (__FILE__, __LINE__, __PRETTY_FUNCTION__), 0))
13433965Sjdp#undef abort
13533965Sjdp#define abort()		as_abort (__FILE__, __LINE__, __PRETTY_FUNCTION__)
13633965Sjdp
13733965Sjdp#endif
13833965Sjdp
13977298Sobrien/* Now GNU header files...  */
14060484Sobrien#include "ansidecl.h"
14133965Sjdp#ifdef BFD_ASSEMBLER
14260484Sobrien#include "bfd.h"
14333965Sjdp#endif
14460484Sobrien#include "libiberty.h"
14533965Sjdp
14633965Sjdp/* Define the standard progress macros.  */
14760484Sobrien#include "progress.h"
14833965Sjdp
14933965Sjdp/* This doesn't get taken care of anywhere.  */
15033965Sjdp#ifndef __MWERKS__  /* Metrowerks C chokes on the "defined (inline)" */
15133965Sjdp#if !defined (__GNUC__) && !defined (inline)
15233965Sjdp#define inline
15333965Sjdp#endif
15433965Sjdp#endif /* !__MWERKS__ */
15533965Sjdp
15633965Sjdp/* Other stuff from config.h.  */
15733965Sjdp#ifdef NEED_DECLARATION_STRSTR
15833965Sjdpextern char *strstr ();
15933965Sjdp#endif
16033965Sjdp#ifdef NEED_DECLARATION_MALLOC
16133965Sjdpextern PTR malloc ();
16233965Sjdpextern PTR realloc ();
16333965Sjdp#endif
16433965Sjdp#ifdef NEED_DECLARATION_FREE
16533965Sjdpextern void free ();
16633965Sjdp#endif
16733965Sjdp#ifdef NEED_DECLARATION_ERRNO
16833965Sjdpextern int errno;
16933965Sjdp#endif
17060484Sobrien#ifdef NEED_DECLARATION_ENVIRON
17160484Sobrienextern char **environ;
17260484Sobrien#endif
17333965Sjdp
17438889Sjdp/* This is needed for VMS.  */
17538889Sjdp#if ! defined (HAVE_UNLINK) && defined (HAVE_REMOVE)
17633965Sjdp#define unlink remove
17733965Sjdp#endif
17833965Sjdp
17933965Sjdp/* Hack to make "gcc -Wall" not complain about obstack macros.  */
18033965Sjdp#if !defined (memcpy) && !defined (bcopy)
18133965Sjdp#define bcopy(src,dest,size)	memcpy(dest,src,size)
18233965Sjdp#endif
18333965Sjdp
18433965Sjdp/* Make Saber happier on obstack.h.  */
18533965Sjdp#ifdef SABER
18633965Sjdp#undef  __PTR_TO_INT
18777298Sobrien#define __PTR_TO_INT(P) ((int) (P))
18833965Sjdp#undef  __INT_TO_PTR
18977298Sobrien#define __INT_TO_PTR(P) ((char *) (P))
19033965Sjdp#endif
19133965Sjdp
19233965Sjdp#ifndef __LINE__
19333965Sjdp#define __LINE__ "unknown"
19433965Sjdp#endif /* __LINE__ */
19533965Sjdp
19633965Sjdp#ifndef __FILE__
19733965Sjdp#define __FILE__ "unknown"
19833965Sjdp#endif /* __FILE__ */
19933965Sjdp
20033965Sjdp#ifndef FOPEN_WB
20133965Sjdp#ifdef GO32
20233965Sjdp#include "fopen-bin.h"
20333965Sjdp#else
20433965Sjdp#include "fopen-same.h"
20533965Sjdp#endif
20633965Sjdp#endif
20733965Sjdp
20833965Sjdp#ifndef EXIT_SUCCESS
20933965Sjdp#define EXIT_SUCCESS 0
21033965Sjdp#define EXIT_FAILURE 1
21133965Sjdp#endif
21233965Sjdp
21360484Sobrien#ifndef SEEK_SET
21460484Sobrien#define SEEK_SET 0
21560484Sobrien#endif
21660484Sobrien
21733965Sjdp#define obstack_chunk_alloc xmalloc
21833965Sjdp#define obstack_chunk_free xfree
21933965Sjdp
22033965Sjdp#define xfree free
22133965Sjdp
22260484Sobrien#include "asintl.h"
22360484Sobrien
22477298Sobrien#define BAD_CASE(val)							    \
22577298Sobrien  {									    \
22677298Sobrien    as_fatal (_("Case value %ld unexpected at line %d of file \"%s\"\n"),   \
22777298Sobrien	      (long) val, __LINE__, __FILE__);				    \
22877298Sobrien  }
22933965Sjdp
23033965Sjdp#include "flonum.h"
23133965Sjdp
23233965Sjdp/* These are assembler-wide concepts */
23333965Sjdp
23433965Sjdp#ifdef BFD_ASSEMBLER
23533965Sjdpextern bfd *stdoutput;
23633965Sjdptypedef bfd_vma addressT;
23733965Sjdptypedef bfd_signed_vma offsetT;
23833965Sjdp#else
23933965Sjdptypedef unsigned long addressT;
24033965Sjdptypedef long offsetT;
24133965Sjdp#endif
24233965Sjdp
24333965Sjdp/* Type of symbol value, etc.  For use in prototypes.  */
24433965Sjdptypedef addressT valueT;
24533965Sjdp
24633965Sjdp#ifndef COMMON
24733965Sjdp#ifdef TEST
24877298Sobrien#define COMMON			/* declare our COMMONs storage here.  */
24933965Sjdp#else
25033965Sjdp#define COMMON extern		/* our commons live elswhere */
25133965Sjdp#endif
25233965Sjdp#endif
25333965Sjdp/* COMMON now defined */
25433965Sjdp
25533965Sjdp#ifdef DEBUG
25633965Sjdp#ifndef know
25733965Sjdp#define know(p) assert(p)	/* Verify our assumptions! */
25833965Sjdp#endif /* not yet defined */
25933965Sjdp#else
26033965Sjdp#define know(p)			/* know() checks are no-op.ed */
26133965Sjdp#endif
26233965Sjdp
26333965Sjdp/* input_scrub.c */
26433965Sjdp
26577298Sobrien/* Supplies sanitised buffers to read.c.
26677298Sobrien   Also understands printing line-number part of error messages.  */
26733965Sjdp
26833965Sjdp/* subsegs.c     Sub-segments. Also, segment(=expression type)s.*/
26933965Sjdp
27033965Sjdp#ifndef BFD_ASSEMBLER
27133965Sjdp
27233965Sjdp#ifdef MANY_SEGMENTS
27333965Sjdp#include "bfd.h"
27433965Sjdp#define N_SEGMENTS 40
27533965Sjdp#define SEG_NORMAL(x) ((x) >= SEG_E0 && (x) <= SEG_E39)
27633965Sjdp#define SEG_LIST SEG_E0,SEG_E1,SEG_E2,SEG_E3,SEG_E4,SEG_E5,SEG_E6,SEG_E7,SEG_E8,SEG_E9,\
27733965Sjdp		 SEG_E10,SEG_E11,SEG_E12,SEG_E13,SEG_E14,SEG_E15,SEG_E16,SEG_E17,SEG_E18,SEG_E19,\
27833965Sjdp		 SEG_E20,SEG_E21,SEG_E22,SEG_E23,SEG_E24,SEG_E25,SEG_E26,SEG_E27,SEG_E28,SEG_E29,\
27933965Sjdp		 SEG_E30,SEG_E31,SEG_E32,SEG_E33,SEG_E34,SEG_E35,SEG_E36,SEG_E37,SEG_E38,SEG_E39
28033965Sjdp#define SEG_TEXT SEG_E0
28133965Sjdp#define SEG_DATA SEG_E1
28233965Sjdp#define SEG_BSS SEG_E2
28333965Sjdp#define SEG_LAST SEG_E39
28433965Sjdp#else
28533965Sjdp#define N_SEGMENTS 3
28633965Sjdp#define SEG_NORMAL(x) ((x) == SEG_TEXT || (x) == SEG_DATA || (x) == SEG_BSS)
28733965Sjdp#define SEG_LIST SEG_TEXT,SEG_DATA,SEG_BSS
28833965Sjdp#endif
28933965Sjdp
29077298Sobrientypedef enum _segT {
29177298Sobrien  SEG_ABSOLUTE = 0,
29277298Sobrien  SEG_LIST,
29377298Sobrien  SEG_UNKNOWN,
29477298Sobrien  SEG_GOOF,			/* Only happens if AS has a logic error.  */
29577298Sobrien  /* Invented so we don't crash printing */
29677298Sobrien  /* error message involving weird segment.  */
29777298Sobrien  SEG_EXPR,			/* Intermediate expression values.  */
29877298Sobrien  SEG_DEBUG,			/* Debug segment */
29977298Sobrien  SEG_NTV,			/* Transfert vector preload segment */
30077298Sobrien  SEG_PTV,			/* Transfert vector postload segment */
30177298Sobrien  SEG_REGISTER			/* Mythical: a register-valued expression */
30277298Sobrien} segT;
30333965Sjdp
30433965Sjdp#define SEG_MAXIMUM_ORDINAL (SEG_REGISTER)
30533965Sjdp#else
30633965Sjdptypedef asection *segT;
30733965Sjdp#define SEG_NORMAL(SEG)		((SEG) != absolute_section	\
30833965Sjdp				 && (SEG) != undefined_section	\
30933965Sjdp				 && (SEG) != reg_section	\
31033965Sjdp				 && (SEG) != expr_section)
31133965Sjdp#endif
31233965Sjdptypedef int subsegT;
31333965Sjdp
31433965Sjdp/* What subseg we are accreting now? */
31533965SjdpCOMMON subsegT now_subseg;
31633965Sjdp
31777298Sobrien/* Segment our instructions emit to.  */
31833965SjdpCOMMON segT now_seg;
31933965Sjdp
32033965Sjdp#ifdef BFD_ASSEMBLER
32133965Sjdp#define segment_name(SEG)	bfd_get_section_name (stdoutput, SEG)
32233965Sjdp#else
32333965Sjdpextern char const *const seg_name[];
32433965Sjdp#define segment_name(SEG)	seg_name[(int) (SEG)]
32533965Sjdp#endif
32633965Sjdp
32733965Sjdp#ifndef BFD_ASSEMBLER
32833965Sjdpextern int section_alignment[];
32933965Sjdp#endif
33033965Sjdp
33133965Sjdp#ifdef BFD_ASSEMBLER
33233965Sjdpextern segT reg_section, expr_section;
33333965Sjdp/* Shouldn't these be eliminated someday?  */
33433965Sjdpextern segT text_section, data_section, bss_section;
33533965Sjdp#define absolute_section	bfd_abs_section_ptr
33633965Sjdp#define undefined_section	bfd_und_section_ptr
33733965Sjdp#else
33833965Sjdp#define reg_section		SEG_REGISTER
33933965Sjdp#define expr_section		SEG_EXPR
34033965Sjdp#define text_section		SEG_TEXT
34133965Sjdp#define data_section		SEG_DATA
34233965Sjdp#define bss_section		SEG_BSS
34333965Sjdp#define absolute_section	SEG_ABSOLUTE
34433965Sjdp#define undefined_section	SEG_UNKNOWN
34533965Sjdp#endif
34633965Sjdp
34733965Sjdp/* relax() */
34833965Sjdp
34977298Sobrienenum _relax_state {
35077298Sobrien  /* Variable chars to be repeated fr_offset times.
35177298Sobrien     Fr_symbol unused. Used with fr_offset == 0 for a
35277298Sobrien     constant length frag.  */
35377298Sobrien  rs_fill = 1,
35433965Sjdp
35577298Sobrien  /* Align.  The fr_offset field holds the power of 2 to which to
35677298Sobrien     align.  The fr_var field holds the number of characters in the
35777298Sobrien     fill pattern.  The fr_subtype field holds the maximum number of
35877298Sobrien     bytes to skip when aligning, or 0 if there is no maximum.  */
35977298Sobrien  rs_align,
36033965Sjdp
36177298Sobrien  /* Align code.  The fr_offset field holds the power of 2 to which
36277298Sobrien     to align.  This type is only generated by machine specific
36377298Sobrien     code, which is normally responsible for handling the fill
36477298Sobrien     pattern.  The fr_subtype field holds the maximum number of
36577298Sobrien     bytes to skip when aligning, or 0 if there is no maximum.  */
36677298Sobrien  rs_align_code,
36733965Sjdp
36877298Sobrien  /* Test for alignment.  Like rs_align, but used by several targets
36977298Sobrien     to warn if data is not properly aligned.  */
37077298Sobrien  rs_align_test,
37133965Sjdp
37277298Sobrien  /* Org: Fr_offset, fr_symbol: address. 1 variable char: fill
37377298Sobrien     character.  */
37477298Sobrien  rs_org,
37577298Sobrien
37633965Sjdp#ifndef WORKING_DOT_WORD
37777298Sobrien  /* JF: gunpoint */
37877298Sobrien  rs_broken_word,
37933965Sjdp#endif
38033965Sjdp
38177298Sobrien  /* machine-specific relaxable (or similarly alterable) instruction */
38277298Sobrien  rs_machine_dependent,
38333965Sjdp
38477298Sobrien  /* .space directive with expression operand that needs to be computed
38577298Sobrien     later.  Similar to rs_org, but different.
38677298Sobrien     fr_symbol: operand
38777298Sobrien     1 variable char: fill character  */
38877298Sobrien  rs_space,
38938889Sjdp
39077298Sobrien  /* A DWARF leb128 value; only ELF uses this.  The subtype is 0 for
39177298Sobrien     unsigned, 1 for signed.  */
39277298Sobrien  rs_leb128,
39338889Sjdp
39477298Sobrien  /* Exception frame information which we may be able to optimize.  */
39577298Sobrien  rs_cfa,
39633965Sjdp
39777298Sobrien  /* Cross-fragment dwarf2 line number optimization.  */
39877298Sobrien  rs_dwarf2dbg
39977298Sobrien};
40077298Sobrien
40133965Sjdptypedef enum _relax_state relax_stateT;
40233965Sjdp
40333965Sjdp/* This type is used in prototypes, so it can't be a type that will be
40433965Sjdp   widened for argument passing.  */
40533965Sjdptypedef unsigned int relax_substateT;
40633965Sjdp
40733965Sjdp/* Enough bits for address, but still an integer type.
40833965Sjdp   Could be a problem, cross-assembling for 64-bit machines.  */
40933965Sjdptypedef addressT relax_addressT;
41033965Sjdp
41133965Sjdp/* main program "as.c" (command arguments etc) */
41233965Sjdp
41333965SjdpCOMMON unsigned char flag_no_comments; /* -f */
41433965SjdpCOMMON unsigned char flag_debug; /* -D */
41533965SjdpCOMMON unsigned char flag_signed_overflow_ok; /* -J */
41633965Sjdp#ifndef WORKING_DOT_WORD
41733965SjdpCOMMON unsigned char flag_warn_displacement; /* -K */
41833965Sjdp#endif
41933965Sjdp
42033965Sjdp/* True if local symbols should be retained.  */
42133965SjdpCOMMON int flag_keep_locals; /* -L */
42233965Sjdp
42333965Sjdp/* True if we are assembling in MRI mode.  */
42433965SjdpCOMMON int flag_mri;
42533965Sjdp
42633965Sjdp/* Should the data section be made read-only and appended to the text
42733965Sjdp   section?  */
42833965SjdpCOMMON unsigned char flag_readonly_data_in_text; /* -R */
42933965Sjdp
43033965Sjdp/* True if warnings should be inhibited.  */
43133965SjdpCOMMON int flag_no_warnings; /* -W */
43233965Sjdp
43360484Sobrien/* True if warnings count as errors.  */
43460484SobrienCOMMON int flag_fatal_warnings; /* --fatal-warnings */
43560484Sobrien
43633965Sjdp/* True if we should attempt to generate output even if non-fatal errors
43733965Sjdp   are detected.  */
43833965SjdpCOMMON unsigned char flag_always_generate_output; /* -Z */
43933965Sjdp
44077298Sobrien/* This is true if the assembler should output time and space usage.  */
44133965SjdpCOMMON unsigned char flag_print_statistics;
44233965Sjdp
44338889Sjdp/* True if local absolute symbols are to be stripped.  */
44438889SjdpCOMMON int flag_strip_local_absolute;
44538889Sjdp
44638889Sjdp/* True if we should generate a traditional format object file.  */
44738889SjdpCOMMON int flag_traditional_format;
44838889Sjdp
44933965Sjdp/* name of emitted object file */
45033965SjdpCOMMON char *out_file_name;
45133965Sjdp
45233965Sjdp/* name of file defining extensions to the basic instruction set */
45333965SjdpCOMMON char *insttbl_file_name;
45433965Sjdp
45577298Sobrien/* TRUE if we need a second pass.  */
45633965SjdpCOMMON int need_pass_2;
45733965Sjdp
45833965Sjdp/* TRUE if we should do no relaxing, and
45933965Sjdp   leave lots of padding.  */
46033965SjdpCOMMON int linkrelax;
46133965Sjdp
46233965Sjdp/* TRUE if we should produce a listing.  */
46333965Sjdpextern int listing;
46433965Sjdp
46577298Sobrien/* Type of debugging information we should generate.  We currently support
46677298Sobrien   stabs, ECOFF, and DWARF2.
46738889Sjdp
46877298Sobrien   NOTE!  This means debug information about the assembly source code itself
46977298Sobrien   and _not_ about possible debug information from a high-level language.
47077298Sobrien   This is especially relevant to DWARF2, since the compiler may emit line
47177298Sobrien   number directives that the assembler resolves.  */
47238889Sjdp
47377298Sobrienenum debug_info_type {
47477298Sobrien  DEBUG_UNSPECIFIED,
47577298Sobrien  DEBUG_NONE,
47677298Sobrien  DEBUG_STABS,
47777298Sobrien  DEBUG_ECOFF,
47877298Sobrien  DEBUG_DWARF,
47977298Sobrien  DEBUG_DWARF2
48077298Sobrien};
48177298Sobrien
48238889Sjdpextern enum debug_info_type debug_type;
48338889Sjdp
48433965Sjdp/* Maximum level of macro nesting.  */
48533965Sjdpextern int max_macro_nest;
48633965Sjdp
48733965Sjdp/* Obstack chunk size.  Keep large for efficient space use, make small to
48833965Sjdp   increase malloc calls for monitoring memory allocation.  */
48933965Sjdpextern int chunksize;
49033965Sjdp
49177298Sobrienstruct _pseudo_type {
49277298Sobrien  /* assembler mnemonic, lower case, no '.' */
49377298Sobrien  const char *poc_name;
49477298Sobrien  /* Do the work */
49577298Sobrien  void (*poc_handler) PARAMS ((int));
49677298Sobrien  /* Value to pass to handler */
49777298Sobrien  int poc_val;
49877298Sobrien};
49933965Sjdp
50033965Sjdptypedef struct _pseudo_type pseudo_typeS;
50133965Sjdp
50233965Sjdp/* Prefer varargs for non-ANSI compiler, since some will barf if the
50333965Sjdp   ellipsis definition is used with a no-arguments declaration.  */
50433965Sjdp#if defined (HAVE_VARARGS_H) && !defined (__STDC__)
50533965Sjdp#undef HAVE_STDARG_H
50633965Sjdp#endif
50733965Sjdp
50833965Sjdp#if defined (HAVE_STDARG_H)
50933965Sjdp#define USE_STDARG
51033965Sjdp#endif
51133965Sjdp#if !defined (USE_STDARG) && defined (HAVE_VARARGS_H)
51233965Sjdp#define USE_VARARGS
51333965Sjdp#endif
51433965Sjdp
51533965Sjdp#ifdef USE_STDARG
51633965Sjdp#if (__GNUC__ >= 2) && !defined(VMS)
51733965Sjdp/* for use with -Wformat */
51838889Sjdp
51960484Sobrien#if __GNUC__ == 2 && __GNUC_MINOR__ < 6
52038889Sjdp/* Support for double underscores in attribute names was added in gcc
52138889Sjdp   2.6, so avoid them if we are using an earlier version.  */
52238889Sjdp#define __printf__ printf
52338889Sjdp#define __format__ format
52438889Sjdp#endif
52538889Sjdp
52638889Sjdp#define PRINTF_LIKE(FCN) \
52738889Sjdp  void FCN (const char *format, ...) \
52838889Sjdp    __attribute__ ((__format__ (__printf__, 1, 2)))
52938889Sjdp#define PRINTF_WHERE_LIKE(FCN) \
53038889Sjdp  void FCN (char *file, unsigned int line, const char *format, ...) \
53138889Sjdp    __attribute__ ((__format__ (__printf__, 3, 4)))
53238889Sjdp
53338889Sjdp#else /* __GNUC__ < 2 || defined(VMS) */
53438889Sjdp
53533965Sjdp#define PRINTF_LIKE(FCN)	void FCN PARAMS ((const char *format, ...))
53633965Sjdp#define PRINTF_WHERE_LIKE(FCN)	void FCN PARAMS ((char *file, \
53733965Sjdp						  unsigned int line, \
53833965Sjdp					  	  const char *format, ...))
53938889Sjdp
54038889Sjdp#endif /* __GNUC__ < 2 || defined(VMS) */
54138889Sjdp
54238889Sjdp#else /* ! USE_STDARG */
54338889Sjdp
54433965Sjdp#define PRINTF_LIKE(FCN)	void FCN ()
54533965Sjdp#define PRINTF_WHERE_LIKE(FCN)	void FCN ()
54633965Sjdp
54738889Sjdp#endif /* ! USE_STDARG */
54838889Sjdp
54933965SjdpPRINTF_LIKE (as_bad);
55060484SobrienPRINTF_LIKE (as_fatal) ATTRIBUTE_NORETURN;
55133965SjdpPRINTF_LIKE (as_tsktsk);
55233965SjdpPRINTF_LIKE (as_warn);
55333965SjdpPRINTF_WHERE_LIKE (as_bad_where);
55433965SjdpPRINTF_WHERE_LIKE (as_warn_where);
55538889Sjdp
55633965Sjdpvoid as_assert PARAMS ((const char *, int, const char *));
55760484Sobrienvoid as_abort PARAMS ((const char *, int, const char *)) ATTRIBUTE_NORETURN;
55833965Sjdp
55933965Sjdpvoid fprint_value PARAMS ((FILE *file, addressT value));
56033965Sjdpvoid sprint_value PARAMS ((char *buf, addressT value));
56133965Sjdp
56233965Sjdpint had_errors PARAMS ((void));
56333965Sjdpint had_warnings PARAMS ((void));
56433965Sjdp
56533965Sjdpvoid print_version_id PARAMS ((void));
56633965Sjdpchar *app_push PARAMS ((void));
56733965Sjdpchar *atof_ieee PARAMS ((char *str, int what_kind, LITTLENUM_TYPE * words));
56833965Sjdpchar *input_scrub_include_file PARAMS ((char *filename, char *position));
56960484Sobrienextern void input_scrub_insert_line PARAMS((const char *line));
57060484Sobrienextern void input_scrub_insert_file PARAMS((char *path));
57133965Sjdpchar *input_scrub_new_file PARAMS ((char *filename));
57233965Sjdpchar *input_scrub_next_buffer PARAMS ((char **bufp));
57360484Sobrienint do_scrub_chars PARAMS ((int (*get) (char *, int), char *to, int tolen));
57433965Sjdpint gen_to_words PARAMS ((LITTLENUM_TYPE * words, int precision,
57533965Sjdp			  long exponent_bits));
57633965Sjdpint had_err PARAMS ((void));
57733965Sjdpint ignore_input PARAMS ((void));
57833965Sjdpvoid cond_finish_check PARAMS ((int));
57933965Sjdpvoid cond_exit_macro PARAMS ((int));
58033965Sjdpint seen_at_least_1_file PARAMS ((void));
58133965Sjdpvoid app_pop PARAMS ((char *arg));
58233965Sjdpvoid as_howmuch PARAMS ((FILE * stream));
58333965Sjdpvoid as_perror PARAMS ((const char *gripe, const char *filename));
58433965Sjdpvoid as_where PARAMS ((char **namep, unsigned int *linep));
58533965Sjdpvoid bump_line_counters PARAMS ((void));
58633965Sjdpvoid do_scrub_begin PARAMS ((int));
58733965Sjdpvoid input_scrub_begin PARAMS ((void));
58833965Sjdpvoid input_scrub_close PARAMS ((void));
58933965Sjdpvoid input_scrub_end PARAMS ((void));
59038889Sjdpint new_logical_line PARAMS ((char *fname, int line_number));
59133965Sjdpvoid subsegs_begin PARAMS ((void));
59233965Sjdpvoid subseg_change PARAMS ((segT seg, int subseg));
59333965SjdpsegT subseg_new PARAMS ((const char *name, subsegT subseg));
59433965SjdpsegT subseg_force_new PARAMS ((const char *name, subsegT subseg));
59533965Sjdpvoid subseg_set PARAMS ((segT seg, subsegT subseg));
59633965Sjdp#ifdef BFD_ASSEMBLER
59733965SjdpsegT subseg_get PARAMS ((const char *, int));
59833965Sjdp#endif
59960484Sobrienint subseg_text_p PARAMS ((segT));
60033965Sjdp
60138889Sjdpvoid start_dependencies PARAMS ((char *));
60238889Sjdpvoid register_dependency PARAMS ((char *));
60338889Sjdpvoid print_dependencies PARAMS ((void));
60438889Sjdp
60533965Sjdpstruct expressionS;
60633965Sjdpstruct fix;
60760484Sobrientypedef struct symbol symbolS;
60833965Sjdpstruct relax_type;
60938889Sjdptypedef struct frag fragS;
61033965Sjdp
61133965Sjdp#ifdef BFD_ASSEMBLER
61233965Sjdp/* literal.c */
61360484SobrienvalueT add_to_literal_pool PARAMS ((symbolS *, valueT, segT, int));
61433965Sjdp#endif
61533965Sjdp
61638889Sjdpint check_eh_frame PARAMS ((struct expressionS *, unsigned int *));
61738889Sjdpint eh_frame_estimate_size_before_relax PARAMS ((fragS *));
61838889Sjdpint eh_frame_relax_frag PARAMS ((fragS *));
61938889Sjdpvoid eh_frame_convert_frag PARAMS ((fragS *));
62038889Sjdp
62133965Sjdp#include "expr.h"		/* Before targ-*.h */
62233965Sjdp
62333965Sjdp/* this one starts the chain of target dependant headers */
62433965Sjdp#include "targ-env.h"
62533965Sjdp
62677298Sobrien#ifdef TC_ARC
62777298Sobrien#include "struc-symbol.h"
62877298Sobrien#endif
62977298Sobrien
63033965Sjdp#include "write.h"
63133965Sjdp#include "frags.h"
63233965Sjdp#include "hash.h"
63333965Sjdp#include "read.h"
63433965Sjdp#include "symbols.h"
63533965Sjdp
63633965Sjdp#include "tc.h"
63733965Sjdp#include "obj.h"
63833965Sjdp
63933965Sjdp#ifdef USE_EMULATIONS
64033965Sjdp#include "emul.h"
64133965Sjdp#endif
64233965Sjdp#include "listing.h"
64333965Sjdp
64460484Sobrien#ifdef TC_M68K
64560484Sobrien/* True if we are assembling in m68k MRI mode.  */
64660484SobrienCOMMON int flag_m68k_mri;
64760484Sobrien#else
64860484Sobrien#define flag_m68k_mri 0
64960484Sobrien#endif
65060484Sobrien
65177298Sobrien#ifdef WARN_COMMENTS
65277298SobrienCOMMON int warn_comment;
65377298SobrienCOMMON unsigned int found_comment;
65477298SobrienCOMMON char *found_comment_file;
65577298Sobrien#endif
65677298Sobrien
65760484Sobrien#ifndef NUMBERS_WITH_SUFFIX
65860484Sobrien#define NUMBERS_WITH_SUFFIX 0
65960484Sobrien#endif
66060484Sobrien
66133965Sjdp#ifndef LOCAL_LABELS_DOLLAR
66233965Sjdp#define LOCAL_LABELS_DOLLAR 0
66333965Sjdp#endif
66433965Sjdp
66533965Sjdp#ifndef LOCAL_LABELS_FB
66633965Sjdp#define LOCAL_LABELS_FB 0
66733965Sjdp#endif
66833965Sjdp
66960484Sobrien#ifndef LABELS_WITHOUT_COLONS
67060484Sobrien#define LABELS_WITHOUT_COLONS 0
67160484Sobrien#endif
67260484Sobrien
67360484Sobrien#ifndef NO_PSEUDO_DOT
67460484Sobrien#define NO_PSEUDO_DOT 0
67560484Sobrien#endif
67660484Sobrien
67738889Sjdp#ifndef TEXT_SECTION_NAME
67838889Sjdp#define TEXT_SECTION_NAME	".text"
67938889Sjdp#define DATA_SECTION_NAME	".data"
68038889Sjdp#define BSS_SECTION_NAME	".bss"
68138889Sjdp#endif
68238889Sjdp
68360484Sobrien#ifndef OCTETS_PER_BYTE_POWER
68460484Sobrien#define OCTETS_PER_BYTE_POWER 0
68560484Sobrien#endif
68660484Sobrien#ifndef OCTETS_PER_BYTE
68760484Sobrien#define OCTETS_PER_BYTE (1<<OCTETS_PER_BYTE_POWER)
68860484Sobrien#endif
68960484Sobrien#if OCTETS_PER_BYTE != (1<<OCTETS_PER_BYTE_POWER)
69060484Sobrien #error "Octets per byte conflicts with its power-of-two definition!"
69160484Sobrien#endif
69260484Sobrien
69333965Sjdp#endif /* GAS */
694