as.h revision 60484
133965Sjdp/* as.h - global header file
260484Sobrien   Copyright (C) 1987, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000
333965Sjdp   Free Software Foundation, Inc.
433965Sjdp
533965Sjdp   This file is part of GAS, the GNU Assembler.
633965Sjdp
733965Sjdp   GAS is free software; you can redistribute it and/or modify
833965Sjdp   it under the terms of the GNU General Public License as published by
933965Sjdp   the Free Software Foundation; either version 2, or (at your option)
1033965Sjdp   any later version.
1133965Sjdp
1233965Sjdp   GAS is distributed in the hope that it will be useful,
1333965Sjdp   but WITHOUT ANY WARRANTY; without even the implied warranty of
1433965Sjdp   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1533965Sjdp   GNU General Public License for more details.
1633965Sjdp
1733965Sjdp   You should have received a copy of the GNU General Public License
1833965Sjdp   along with GAS; see the file COPYING.  If not, write to the Free
1933965Sjdp   Software Foundation, 59 Temple Place - Suite 330, Boston, MA
2033965Sjdp   02111-1307, USA.  */
2133965Sjdp
2233965Sjdp#ifndef GAS
2333965Sjdp#define GAS 1
2433965Sjdp/*
2533965Sjdp * 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
8333965Sjdp/* 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.
10933965Sjdp   170 gives the standard options room to grow.  */
11033965Sjdp#define OPTION_MD_BASE 170
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
13933965Sjdp
14033965Sjdp/* Now GNU header files... */
14160484Sobrien#include "ansidecl.h"
14233965Sjdp#ifdef BFD_ASSEMBLER
14360484Sobrien#include "bfd.h"
14433965Sjdp#endif
14560484Sobrien#include "libiberty.h"
14633965Sjdp
14733965Sjdp/* Define the standard progress macros.  */
14860484Sobrien#include "progress.h"
14933965Sjdp
15033965Sjdp/* This doesn't get taken care of anywhere.  */
15133965Sjdp#ifndef __MWERKS__  /* Metrowerks C chokes on the "defined (inline)" */
15233965Sjdp#if !defined (__GNUC__) && !defined (inline)
15333965Sjdp#define inline
15433965Sjdp#endif
15533965Sjdp#endif /* !__MWERKS__ */
15633965Sjdp
15733965Sjdp/* Other stuff from config.h.  */
15833965Sjdp#ifdef NEED_DECLARATION_STRSTR
15933965Sjdpextern char *strstr ();
16033965Sjdp#endif
16133965Sjdp#ifdef NEED_DECLARATION_MALLOC
16233965Sjdpextern PTR malloc ();
16333965Sjdpextern PTR realloc ();
16433965Sjdp#endif
16533965Sjdp#ifdef NEED_DECLARATION_FREE
16633965Sjdpextern void free ();
16733965Sjdp#endif
16833965Sjdp#ifdef NEED_DECLARATION_ERRNO
16933965Sjdpextern int errno;
17033965Sjdp#endif
17160484Sobrien#ifdef NEED_DECLARATION_ENVIRON
17260484Sobrienextern char **environ;
17360484Sobrien#endif
17433965Sjdp
17538889Sjdp/* This is needed for VMS.  */
17638889Sjdp#if ! defined (HAVE_UNLINK) && defined (HAVE_REMOVE)
17733965Sjdp#define unlink remove
17833965Sjdp#endif
17933965Sjdp
18033965Sjdp/* Hack to make "gcc -Wall" not complain about obstack macros.  */
18133965Sjdp#if !defined (memcpy) && !defined (bcopy)
18233965Sjdp#define bcopy(src,dest,size)	memcpy(dest,src,size)
18333965Sjdp#endif
18433965Sjdp
18533965Sjdp/* Make Saber happier on obstack.h.  */
18633965Sjdp#ifdef SABER
18733965Sjdp#undef  __PTR_TO_INT
18833965Sjdp#define __PTR_TO_INT(P) ((int)(P))
18933965Sjdp#undef  __INT_TO_PTR
19033965Sjdp#define __INT_TO_PTR(P) ((char *)(P))
19133965Sjdp#endif
19233965Sjdp
19333965Sjdp#ifndef __LINE__
19433965Sjdp#define __LINE__ "unknown"
19533965Sjdp#endif /* __LINE__ */
19633965Sjdp
19733965Sjdp#ifndef __FILE__
19833965Sjdp#define __FILE__ "unknown"
19933965Sjdp#endif /* __FILE__ */
20033965Sjdp
20133965Sjdp#ifndef FOPEN_WB
20233965Sjdp#ifdef GO32
20333965Sjdp#include "fopen-bin.h"
20433965Sjdp#else
20533965Sjdp#include "fopen-same.h"
20633965Sjdp#endif
20733965Sjdp#endif
20833965Sjdp
20933965Sjdp#ifndef EXIT_SUCCESS
21033965Sjdp#define EXIT_SUCCESS 0
21133965Sjdp#define EXIT_FAILURE 1
21233965Sjdp#endif
21333965Sjdp
21460484Sobrien#ifndef SEEK_SET
21560484Sobrien#define SEEK_SET 0
21660484Sobrien#endif
21760484Sobrien
21833965Sjdp#define obstack_chunk_alloc xmalloc
21933965Sjdp#define obstack_chunk_free xfree
22033965Sjdp
22133965Sjdp#define xfree free
22233965Sjdp
22360484Sobrien#include "asintl.h"
22460484Sobrien
22533965Sjdp#define BAD_CASE(val) \
22633965Sjdp{ \
22760484Sobrien      as_fatal(_("Case value %ld unexpected at line %d of file \"%s\"\n"), \
22833965Sjdp	       (long) val, __LINE__, __FILE__); \
22933965Sjdp	   }
23033965Sjdp
23133965Sjdp#include "flonum.h"
23233965Sjdp
23333965Sjdp/* These are assembler-wide concepts */
23433965Sjdp
23533965Sjdp#ifdef BFD_ASSEMBLER
23633965Sjdpextern bfd *stdoutput;
23733965Sjdptypedef bfd_vma addressT;
23833965Sjdptypedef bfd_signed_vma offsetT;
23933965Sjdp#else
24033965Sjdptypedef unsigned long addressT;
24133965Sjdptypedef long offsetT;
24233965Sjdp#endif
24333965Sjdp
24433965Sjdp/* Type of symbol value, etc.  For use in prototypes.  */
24533965Sjdptypedef addressT valueT;
24633965Sjdp
24733965Sjdp#ifndef COMMON
24833965Sjdp#ifdef TEST
24933965Sjdp#define COMMON			/* declare our COMMONs storage here. */
25033965Sjdp#else
25133965Sjdp#define COMMON extern		/* our commons live elswhere */
25233965Sjdp#endif
25333965Sjdp#endif
25433965Sjdp/* COMMON now defined */
25533965Sjdp
25633965Sjdp#ifdef DEBUG
25733965Sjdp#ifndef know
25833965Sjdp#define know(p) assert(p)	/* Verify our assumptions! */
25933965Sjdp#endif /* not yet defined */
26033965Sjdp#else
26133965Sjdp#define know(p)			/* know() checks are no-op.ed */
26233965Sjdp#endif
26333965Sjdp
26433965Sjdp/* input_scrub.c */
26533965Sjdp
26633965Sjdp/*
26733965Sjdp * Supplies sanitised buffers to read.c.
26833965Sjdp * Also understands printing line-number part of error messages.
26933965Sjdp */
27033965Sjdp
27133965Sjdp
27233965Sjdp/* subsegs.c     Sub-segments. Also, segment(=expression type)s.*/
27333965Sjdp
27433965Sjdp#ifndef BFD_ASSEMBLER
27533965Sjdp
27633965Sjdp#ifdef MANY_SEGMENTS
27733965Sjdp#include "bfd.h"
27833965Sjdp#define N_SEGMENTS 40
27933965Sjdp#define SEG_NORMAL(x) ((x) >= SEG_E0 && (x) <= SEG_E39)
28033965Sjdp#define SEG_LIST SEG_E0,SEG_E1,SEG_E2,SEG_E3,SEG_E4,SEG_E5,SEG_E6,SEG_E7,SEG_E8,SEG_E9,\
28133965Sjdp		 SEG_E10,SEG_E11,SEG_E12,SEG_E13,SEG_E14,SEG_E15,SEG_E16,SEG_E17,SEG_E18,SEG_E19,\
28233965Sjdp		 SEG_E20,SEG_E21,SEG_E22,SEG_E23,SEG_E24,SEG_E25,SEG_E26,SEG_E27,SEG_E28,SEG_E29,\
28333965Sjdp		 SEG_E30,SEG_E31,SEG_E32,SEG_E33,SEG_E34,SEG_E35,SEG_E36,SEG_E37,SEG_E38,SEG_E39
28433965Sjdp#define SEG_TEXT SEG_E0
28533965Sjdp#define SEG_DATA SEG_E1
28633965Sjdp#define SEG_BSS SEG_E2
28733965Sjdp#define SEG_LAST SEG_E39
28833965Sjdp#else
28933965Sjdp#define N_SEGMENTS 3
29033965Sjdp#define SEG_NORMAL(x) ((x) == SEG_TEXT || (x) == SEG_DATA || (x) == SEG_BSS)
29133965Sjdp#define SEG_LIST SEG_TEXT,SEG_DATA,SEG_BSS
29233965Sjdp#endif
29333965Sjdp
29433965Sjdptypedef enum _segT
29533965Sjdp  {
29633965Sjdp    SEG_ABSOLUTE = 0,
29733965Sjdp    SEG_LIST,
29833965Sjdp    SEG_UNKNOWN,
29933965Sjdp    SEG_GOOF,			/* Only happens if AS has a logic error. */
30033965Sjdp    /* Invented so we don't crash printing */
30133965Sjdp    /* error message involving weird segment. */
30233965Sjdp    SEG_EXPR,			/* Intermediate expression values. */
30333965Sjdp    SEG_DEBUG,			/* Debug segment */
30433965Sjdp    SEG_NTV,			/* Transfert vector preload segment */
30533965Sjdp    SEG_PTV,			/* Transfert vector postload segment */
30633965Sjdp    SEG_REGISTER		/* Mythical: a register-valued expression */
30733965Sjdp  } segT;
30833965Sjdp
30933965Sjdp#define SEG_MAXIMUM_ORDINAL (SEG_REGISTER)
31033965Sjdp#else
31133965Sjdptypedef asection *segT;
31233965Sjdp#define SEG_NORMAL(SEG)		((SEG) != absolute_section	\
31333965Sjdp				 && (SEG) != undefined_section	\
31433965Sjdp				 && (SEG) != reg_section	\
31533965Sjdp				 && (SEG) != expr_section)
31633965Sjdp#endif
31733965Sjdptypedef int subsegT;
31833965Sjdp
31933965Sjdp/* What subseg we are accreting now? */
32033965SjdpCOMMON subsegT now_subseg;
32133965Sjdp
32233965Sjdp/* Segment our instructions emit to. */
32333965SjdpCOMMON segT now_seg;
32433965Sjdp
32533965Sjdp#ifdef BFD_ASSEMBLER
32633965Sjdp#define segment_name(SEG)	bfd_get_section_name (stdoutput, SEG)
32733965Sjdp#else
32833965Sjdpextern char const *const seg_name[];
32933965Sjdp#define segment_name(SEG)	seg_name[(int) (SEG)]
33033965Sjdp#endif
33133965Sjdp
33233965Sjdp#ifndef BFD_ASSEMBLER
33333965Sjdpextern int section_alignment[];
33433965Sjdp#endif
33533965Sjdp
33633965Sjdp#ifdef BFD_ASSEMBLER
33733965Sjdpextern segT reg_section, expr_section;
33833965Sjdp/* Shouldn't these be eliminated someday?  */
33933965Sjdpextern segT text_section, data_section, bss_section;
34033965Sjdp#define absolute_section	bfd_abs_section_ptr
34133965Sjdp#define undefined_section	bfd_und_section_ptr
34233965Sjdp#else
34333965Sjdp#define reg_section		SEG_REGISTER
34433965Sjdp#define expr_section		SEG_EXPR
34533965Sjdp#define text_section		SEG_TEXT
34633965Sjdp#define data_section		SEG_DATA
34733965Sjdp#define bss_section		SEG_BSS
34833965Sjdp#define absolute_section	SEG_ABSOLUTE
34933965Sjdp#define undefined_section	SEG_UNKNOWN
35033965Sjdp#endif
35133965Sjdp
35233965Sjdp/* relax() */
35333965Sjdp
35433965Sjdpenum _relax_state
35533965Sjdp  {
35633965Sjdp    /* Variable chars to be repeated fr_offset times.
35733965Sjdp       Fr_symbol unused. Used with fr_offset == 0 for a
35833965Sjdp       constant length frag. */
35933965Sjdp    rs_fill = 1,
36033965Sjdp
36133965Sjdp    /* Align.  The fr_offset field holds the power of 2 to which to
36233965Sjdp       align.  The fr_var field holds the number of characters in the
36333965Sjdp       fill pattern.  The fr_subtype field holds the maximum number of
36433965Sjdp       bytes to skip when aligning, or 0 if there is no maximum.  */
36533965Sjdp    rs_align,
36633965Sjdp
36733965Sjdp    /* Align code.  The fr_offset field holds the power of 2 to which
36833965Sjdp       to align.  This type is only generated by machine specific
36933965Sjdp       code, which is normally responsible for handling the fill
37033965Sjdp       pattern.  The fr_subtype field holds the maximum number of
37133965Sjdp       bytes to skip when aligning, or 0 if there is no maximum.  */
37233965Sjdp    rs_align_code,
37333965Sjdp
37433965Sjdp    /* Org: Fr_offset, fr_symbol: address. 1 variable char: fill
37533965Sjdp       character. */
37633965Sjdp    rs_org,
37733965Sjdp
37833965Sjdp#ifndef WORKING_DOT_WORD
37933965Sjdp    /* JF: gunpoint */
38033965Sjdp    rs_broken_word,
38133965Sjdp#endif
38233965Sjdp
38333965Sjdp    /* machine-specific relaxable (or similarly alterable) instruction */
38433965Sjdp    rs_machine_dependent,
38533965Sjdp
38633965Sjdp    /* .space directive with expression operand that needs to be computed
38733965Sjdp       later.  Similar to rs_org, but different.
38833965Sjdp       fr_symbol: operand
38933965Sjdp       1 variable char: fill character  */
39038889Sjdp    rs_space,
39138889Sjdp
39238889Sjdp    /* A DWARF leb128 value; only ELF uses this.  The subtype is 0 for
39338889Sjdp       unsigned, 1 for signed.  */
39438889Sjdp    rs_leb128,
39538889Sjdp
39638889Sjdp    /* Exception frame information which we may be able to optimize.  */
39738889Sjdp    rs_cfa
39833965Sjdp  };
39933965Sjdp
40033965Sjdptypedef enum _relax_state relax_stateT;
40133965Sjdp
40233965Sjdp/* This type is used in prototypes, so it can't be a type that will be
40333965Sjdp   widened for argument passing.  */
40433965Sjdptypedef unsigned int relax_substateT;
40533965Sjdp
40633965Sjdp/* Enough bits for address, but still an integer type.
40733965Sjdp   Could be a problem, cross-assembling for 64-bit machines.  */
40833965Sjdptypedef addressT relax_addressT;
40933965Sjdp
41033965Sjdp/* main program "as.c" (command arguments etc) */
41133965Sjdp
41233965SjdpCOMMON unsigned char flag_no_comments; /* -f */
41333965SjdpCOMMON unsigned char flag_debug; /* -D */
41433965SjdpCOMMON unsigned char flag_signed_overflow_ok; /* -J */
41533965Sjdp#ifndef WORKING_DOT_WORD
41633965SjdpCOMMON unsigned char flag_warn_displacement; /* -K */
41733965Sjdp#endif
41833965Sjdp
41933965Sjdp/* True if local symbols should be retained.  */
42033965SjdpCOMMON int flag_keep_locals; /* -L */
42133965Sjdp
42233965Sjdp/* True if we are assembling in MRI mode.  */
42333965SjdpCOMMON int flag_mri;
42433965Sjdp
42533965Sjdp/* Should the data section be made read-only and appended to the text
42633965Sjdp   section?  */
42733965SjdpCOMMON unsigned char flag_readonly_data_in_text; /* -R */
42833965Sjdp
42933965Sjdp/* True if warnings should be inhibited.  */
43033965SjdpCOMMON int flag_no_warnings; /* -W */
43133965Sjdp
43260484Sobrien/* True if warnings count as errors.  */
43360484SobrienCOMMON int flag_fatal_warnings; /* --fatal-warnings */
43460484Sobrien
43533965Sjdp/* True if we should attempt to generate output even if non-fatal errors
43633965Sjdp   are detected.  */
43733965SjdpCOMMON unsigned char flag_always_generate_output; /* -Z */
43833965Sjdp
43933965Sjdp/* This is true if the assembler should output time and space usage. */
44033965SjdpCOMMON unsigned char flag_print_statistics;
44133965Sjdp
44238889Sjdp/* True if local absolute symbols are to be stripped.  */
44338889SjdpCOMMON int flag_strip_local_absolute;
44438889Sjdp
44538889Sjdp/* True if we should generate a traditional format object file.  */
44638889SjdpCOMMON int flag_traditional_format;
44738889Sjdp
44833965Sjdp/* name of emitted object file */
44933965SjdpCOMMON char *out_file_name;
45033965Sjdp
45133965Sjdp/* name of file defining extensions to the basic instruction set */
45233965SjdpCOMMON char *insttbl_file_name;
45333965Sjdp
45433965Sjdp/* TRUE if we need a second pass. */
45533965SjdpCOMMON int need_pass_2;
45633965Sjdp
45733965Sjdp/* TRUE if we should do no relaxing, and
45833965Sjdp   leave lots of padding.  */
45933965SjdpCOMMON int linkrelax;
46033965Sjdp
46133965Sjdp/* TRUE if we should produce a listing.  */
46233965Sjdpextern int listing;
46333965Sjdp
46438889Sjdp/* Type of debugging information we should generate.  We currently
46560484Sobrien   support stabs, ECOFF, and DWARF2.  */
46638889Sjdp
46760484Sobrienenum debug_info_type
46860484Sobrien  {
46960484Sobrien    DEBUG_UNSPECIFIED,
47060484Sobrien    DEBUG_NONE,
47160484Sobrien    DEBUG_STABS,
47260484Sobrien    DEBUG_ECOFF,
47360484Sobrien    DEBUG_DWARF,
47460484Sobrien    DEBUG_DWARF2
47560484Sobrien  };
47638889Sjdp
47738889Sjdpextern enum debug_info_type debug_type;
47838889Sjdp
47933965Sjdp/* Maximum level of macro nesting.  */
48033965Sjdpextern int max_macro_nest;
48133965Sjdp
48233965Sjdp/* Obstack chunk size.  Keep large for efficient space use, make small to
48333965Sjdp   increase malloc calls for monitoring memory allocation.  */
48433965Sjdpextern int chunksize;
48533965Sjdp
48633965Sjdpstruct _pseudo_type
48733965Sjdp  {
48833965Sjdp    /* assembler mnemonic, lower case, no '.' */
48933965Sjdp    const char *poc_name;
49033965Sjdp    /* Do the work */
49133965Sjdp    void (*poc_handler) PARAMS ((int));
49233965Sjdp    /* Value to pass to handler */
49333965Sjdp    int poc_val;
49433965Sjdp  };
49533965Sjdp
49633965Sjdptypedef struct _pseudo_type pseudo_typeS;
49733965Sjdp
49833965Sjdp/* Prefer varargs for non-ANSI compiler, since some will barf if the
49933965Sjdp   ellipsis definition is used with a no-arguments declaration.  */
50033965Sjdp#if defined (HAVE_VARARGS_H) && !defined (__STDC__)
50133965Sjdp#undef HAVE_STDARG_H
50233965Sjdp#endif
50333965Sjdp
50433965Sjdp#if defined (HAVE_STDARG_H)
50533965Sjdp#define USE_STDARG
50633965Sjdp#endif
50733965Sjdp#if !defined (USE_STDARG) && defined (HAVE_VARARGS_H)
50833965Sjdp#define USE_VARARGS
50933965Sjdp#endif
51033965Sjdp
51133965Sjdp#ifdef USE_STDARG
51233965Sjdp#if (__GNUC__ >= 2) && !defined(VMS)
51333965Sjdp/* for use with -Wformat */
51438889Sjdp
51560484Sobrien#if __GNUC__ == 2 && __GNUC_MINOR__ < 6
51638889Sjdp/* Support for double underscores in attribute names was added in gcc
51738889Sjdp   2.6, so avoid them if we are using an earlier version.  */
51838889Sjdp#define __printf__ printf
51938889Sjdp#define __format__ format
52038889Sjdp#endif
52138889Sjdp
52238889Sjdp#define PRINTF_LIKE(FCN) \
52338889Sjdp  void FCN (const char *format, ...) \
52438889Sjdp    __attribute__ ((__format__ (__printf__, 1, 2)))
52538889Sjdp#define PRINTF_WHERE_LIKE(FCN) \
52638889Sjdp  void FCN (char *file, unsigned int line, const char *format, ...) \
52738889Sjdp    __attribute__ ((__format__ (__printf__, 3, 4)))
52838889Sjdp
52938889Sjdp#else /* __GNUC__ < 2 || defined(VMS) */
53038889Sjdp
53133965Sjdp#define PRINTF_LIKE(FCN)	void FCN PARAMS ((const char *format, ...))
53233965Sjdp#define PRINTF_WHERE_LIKE(FCN)	void FCN PARAMS ((char *file, \
53333965Sjdp						  unsigned int line, \
53433965Sjdp					  	  const char *format, ...))
53538889Sjdp
53638889Sjdp#endif /* __GNUC__ < 2 || defined(VMS) */
53738889Sjdp
53838889Sjdp#else /* ! USE_STDARG */
53938889Sjdp
54033965Sjdp#define PRINTF_LIKE(FCN)	void FCN ()
54133965Sjdp#define PRINTF_WHERE_LIKE(FCN)	void FCN ()
54233965Sjdp
54338889Sjdp#endif /* ! USE_STDARG */
54438889Sjdp
54533965SjdpPRINTF_LIKE (as_bad);
54660484SobrienPRINTF_LIKE (as_fatal) ATTRIBUTE_NORETURN;
54733965SjdpPRINTF_LIKE (as_tsktsk);
54833965SjdpPRINTF_LIKE (as_warn);
54933965SjdpPRINTF_WHERE_LIKE (as_bad_where);
55033965SjdpPRINTF_WHERE_LIKE (as_warn_where);
55138889Sjdp
55233965Sjdpvoid as_assert PARAMS ((const char *, int, const char *));
55360484Sobrienvoid as_abort PARAMS ((const char *, int, const char *)) ATTRIBUTE_NORETURN;
55433965Sjdp
55533965Sjdpvoid fprint_value PARAMS ((FILE *file, addressT value));
55633965Sjdpvoid sprint_value PARAMS ((char *buf, addressT value));
55733965Sjdp
55833965Sjdpint had_errors PARAMS ((void));
55933965Sjdpint had_warnings PARAMS ((void));
56033965Sjdp
56133965Sjdpvoid print_version_id PARAMS ((void));
56233965Sjdpchar *app_push PARAMS ((void));
56333965Sjdpchar *atof_ieee PARAMS ((char *str, int what_kind, LITTLENUM_TYPE * words));
56433965Sjdpchar *input_scrub_include_file PARAMS ((char *filename, char *position));
56560484Sobrienextern void input_scrub_insert_line PARAMS((const char *line));
56660484Sobrienextern void input_scrub_insert_file PARAMS((char *path));
56733965Sjdpchar *input_scrub_new_file PARAMS ((char *filename));
56833965Sjdpchar *input_scrub_next_buffer PARAMS ((char **bufp));
56960484Sobrienint do_scrub_chars PARAMS ((int (*get) (char *, int), char *to, int tolen));
57033965Sjdpint gen_to_words PARAMS ((LITTLENUM_TYPE * words, int precision,
57133965Sjdp			  long exponent_bits));
57233965Sjdpint had_err PARAMS ((void));
57333965Sjdpint ignore_input PARAMS ((void));
57433965Sjdpvoid cond_finish_check PARAMS ((int));
57533965Sjdpvoid cond_exit_macro PARAMS ((int));
57633965Sjdpint seen_at_least_1_file PARAMS ((void));
57733965Sjdpvoid app_pop PARAMS ((char *arg));
57833965Sjdpvoid as_howmuch PARAMS ((FILE * stream));
57933965Sjdpvoid as_perror PARAMS ((const char *gripe, const char *filename));
58033965Sjdpvoid as_where PARAMS ((char **namep, unsigned int *linep));
58133965Sjdpvoid bump_line_counters PARAMS ((void));
58233965Sjdpvoid do_scrub_begin PARAMS ((int));
58333965Sjdpvoid input_scrub_begin PARAMS ((void));
58433965Sjdpvoid input_scrub_close PARAMS ((void));
58533965Sjdpvoid input_scrub_end PARAMS ((void));
58638889Sjdpint new_logical_line PARAMS ((char *fname, int line_number));
58733965Sjdpvoid subsegs_begin PARAMS ((void));
58833965Sjdpvoid subseg_change PARAMS ((segT seg, int subseg));
58933965SjdpsegT subseg_new PARAMS ((const char *name, subsegT subseg));
59033965SjdpsegT subseg_force_new PARAMS ((const char *name, subsegT subseg));
59133965Sjdpvoid subseg_set PARAMS ((segT seg, subsegT subseg));
59233965Sjdp#ifdef BFD_ASSEMBLER
59333965SjdpsegT subseg_get PARAMS ((const char *, int));
59433965Sjdp#endif
59560484Sobrienint subseg_text_p PARAMS ((segT));
59633965Sjdp
59738889Sjdpvoid start_dependencies PARAMS ((char *));
59838889Sjdpvoid register_dependency PARAMS ((char *));
59938889Sjdpvoid print_dependencies PARAMS ((void));
60038889Sjdp
60133965Sjdpstruct expressionS;
60233965Sjdpstruct fix;
60360484Sobrientypedef struct symbol symbolS;
60433965Sjdpstruct relax_type;
60538889Sjdptypedef struct frag fragS;
60633965Sjdp
60733965Sjdp#ifdef BFD_ASSEMBLER
60833965Sjdp/* literal.c */
60960484SobrienvalueT add_to_literal_pool PARAMS ((symbolS *, valueT, segT, int));
61033965Sjdp#endif
61133965Sjdp
61238889Sjdpint check_eh_frame PARAMS ((struct expressionS *, unsigned int *));
61338889Sjdpint eh_frame_estimate_size_before_relax PARAMS ((fragS *));
61438889Sjdpint eh_frame_relax_frag PARAMS ((fragS *));
61538889Sjdpvoid eh_frame_convert_frag PARAMS ((fragS *));
61638889Sjdp
61733965Sjdp#include "expr.h"		/* Before targ-*.h */
61833965Sjdp
61933965Sjdp/* this one starts the chain of target dependant headers */
62033965Sjdp#include "targ-env.h"
62133965Sjdp
62233965Sjdp#include "write.h"
62333965Sjdp#include "frags.h"
62433965Sjdp#include "hash.h"
62533965Sjdp#include "read.h"
62633965Sjdp#include "symbols.h"
62733965Sjdp
62833965Sjdp#include "tc.h"
62933965Sjdp#include "obj.h"
63033965Sjdp
63133965Sjdp#ifdef USE_EMULATIONS
63233965Sjdp#include "emul.h"
63333965Sjdp#endif
63433965Sjdp#include "listing.h"
63533965Sjdp
63660484Sobrien#ifdef TC_M68K
63760484Sobrien/* True if we are assembling in m68k MRI mode.  */
63860484SobrienCOMMON int flag_m68k_mri;
63960484Sobrien#else
64060484Sobrien#define flag_m68k_mri 0
64160484Sobrien#endif
64260484Sobrien
64360484Sobrien#ifndef NUMBERS_WITH_SUFFIX
64460484Sobrien#define NUMBERS_WITH_SUFFIX 0
64560484Sobrien#endif
64660484Sobrien
64733965Sjdp#ifndef LOCAL_LABELS_DOLLAR
64833965Sjdp#define LOCAL_LABELS_DOLLAR 0
64933965Sjdp#endif
65033965Sjdp
65133965Sjdp#ifndef LOCAL_LABELS_FB
65233965Sjdp#define LOCAL_LABELS_FB 0
65333965Sjdp#endif
65433965Sjdp
65560484Sobrien#ifndef LABELS_WITHOUT_COLONS
65660484Sobrien#define LABELS_WITHOUT_COLONS 0
65760484Sobrien#endif
65860484Sobrien
65960484Sobrien#ifndef NO_PSEUDO_DOT
66060484Sobrien#define NO_PSEUDO_DOT 0
66160484Sobrien#endif
66260484Sobrien
66338889Sjdp#ifndef TEXT_SECTION_NAME
66438889Sjdp#define TEXT_SECTION_NAME	".text"
66538889Sjdp#define DATA_SECTION_NAME	".data"
66638889Sjdp#define BSS_SECTION_NAME	".bss"
66738889Sjdp#endif
66838889Sjdp
66960484Sobrien#ifndef OCTETS_PER_BYTE_POWER
67060484Sobrien#define OCTETS_PER_BYTE_POWER 0
67160484Sobrien#endif
67260484Sobrien#ifndef OCTETS_PER_BYTE
67360484Sobrien#define OCTETS_PER_BYTE (1<<OCTETS_PER_BYTE_POWER)
67460484Sobrien#endif
67560484Sobrien#if OCTETS_PER_BYTE != (1<<OCTETS_PER_BYTE_POWER)
67660484Sobrien #error "Octets per byte conflicts with its power-of-two definition!"
67760484Sobrien#endif
67860484Sobrien
67933965Sjdp#endif /* GAS */
68033965Sjdp
68133965Sjdp/* end of as.h */
682