133965Sjdp/* as.h - global header file
278828Sobrien   Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
3218822Sdim   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
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
20218822Sdim   Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
21218822Sdim   02110-1301, USA.  */
2233965Sjdp
2333965Sjdp#ifndef GAS
2433965Sjdp#define GAS 1
2577298Sobrien/* I think this stuff is largely out of date.  xoxorich.
26218822Sdim
27218822Sdim   CAPITALISED names are #defined.
28218822Sdim   "lowercaseH" is #defined if "lowercase.h" has been #include-d.
29218822Sdim   "lowercaseT" is a typedef of "lowercase" objects.
30218822Sdim   "lowercaseP" is type "pointer to object of type 'lowercase'".
31218822Sdim   "lowercaseS" is typedef struct ... lowercaseS.
32218822Sdim
33218822Sdim   #define DEBUG to enable all the "know" assertion tests.
34218822Sdim   #define SUSPECT when debugging hash code.
35218822Sdim   #define COMMON as "extern" for all modules except one, where you #define
36218822Sdim  	COMMON as "".
37218822Sdim   If TEST is #defined, then we are testing a module: #define COMMON as "".  */
3833965Sjdp
3933965Sjdp#include "config.h"
4033965Sjdp
4133965Sjdp/* This is the code recommended in the autoconf documentation, almost
4233965Sjdp   verbatim.  If it doesn't work for you, let me know, and notify
4333965Sjdp   djm@gnu.ai.mit.edu as well.  */
4433965Sjdp/* Added void* version for STDC case.  This is to be compatible with
4533965Sjdp   the declaration in bison.simple, used for m68k operand parsing.
4633965Sjdp   --KR 1995.08.08 */
4733965Sjdp/* Force void* decl for hpux.  This is what Bison uses.  --KR 1995.08.16 */
4833965Sjdp
4989857Sobrien#ifndef __GNUC__
5033965Sjdp# if HAVE_ALLOCA_H
5133965Sjdp#  include <alloca.h>
5233965Sjdp# else
5333965Sjdp#  ifdef _AIX
5489857Sobrien/* Indented so that pre-ansi C compilers will ignore it, rather than
5589857Sobrien   choke on it.  Some versions of AIX require this to be the first
5689857Sobrien   thing in the file.  */
5733965Sjdp #pragma alloca
5833965Sjdp#  else
5933965Sjdp#   ifndef alloca /* predefined by HP cc +Olibcalls */
6033965Sjdp#    if !defined (__STDC__) && !defined (__hpux)
6138889Sjdpextern char *alloca ();
6233965Sjdp#    else
6338889Sjdpextern void *alloca ();
6433965Sjdp#    endif /* __STDC__, __hpux */
6533965Sjdp#   endif /* alloca */
6633965Sjdp#  endif /* _AIX */
6733965Sjdp# endif /* HAVE_ALLOCA_H */
6889857Sobrien#endif /* __GNUC__ */
6933965Sjdp
70218822Sdim/* Prefer varargs for non-ANSI compiler, since some will barf if the
71218822Sdim   ellipsis definition is used with a no-arguments declaration.  */
72218822Sdim#if defined (HAVE_VARARGS_H) && !defined (__STDC__)
73218822Sdim#undef HAVE_STDARG_H
74218822Sdim#endif
75218822Sdim
76218822Sdim#if defined (HAVE_STDARG_H)
77218822Sdim#define USE_STDARG
78218822Sdim#endif
79218822Sdim#if !defined (USE_STDARG) && defined (HAVE_VARARGS_H)
80218822Sdim#define USE_VARARGS
81218822Sdim#endif
82218822Sdim
8333965Sjdp/* Now, tend to the rest of the configuration.  */
8433965Sjdp
8577298Sobrien/* System include files first...  */
8633965Sjdp#include <stdio.h>
8733965Sjdp#ifdef HAVE_STRING_H
8833965Sjdp#include <string.h>
8933965Sjdp#else
9033965Sjdp#ifdef HAVE_STRINGS_H
9133965Sjdp#include <strings.h>
9233965Sjdp#endif
9333965Sjdp#endif
9433965Sjdp#ifdef HAVE_STDLIB_H
9533965Sjdp#include <stdlib.h>
9633965Sjdp#endif
9733965Sjdp#ifdef HAVE_UNISTD_H
9833965Sjdp#include <unistd.h>
9933965Sjdp#endif
10033965Sjdp#ifdef HAVE_SYS_TYPES_H
10133965Sjdp/* for size_t, pid_t */
10233965Sjdp#include <sys/types.h>
10333965Sjdp#endif
10433965Sjdp
105218822Sdim#ifdef HAVE_ERRNO_H
106218822Sdim#include <errno.h>
107218822Sdim#endif
108218822Sdim
109218822Sdim#ifdef USE_STDARG
110218822Sdim#include <stdarg.h>
111218822Sdim#endif
112218822Sdim
113218822Sdim#ifdef USE_VARARGS
114218822Sdim#include <varargs.h>
115218822Sdim#endif
116218822Sdim
117218822Sdim#if !defined (USE_STDARG) && !defined (USE_VARARGS)
118218822Sdim/* Roll our own.  */
119218822Sdim#define va_alist REST
120218822Sdim#define va_dcl
121218822Sdimtypedef int * va_list;
122218822Sdim#define va_start(ARGS)	ARGS = &REST
123218822Sdim#define va_end(ARGS)
124218822Sdim#endif
125218822Sdim
126104834Sobrien#include "getopt.h"
12733965Sjdp/* The first getopt value for machine-independent long options.
12833965Sjdp   150 isn't special; it's just an arbitrary non-ASCII char value.  */
12933965Sjdp#define OPTION_STD_BASE 150
13033965Sjdp/* The first getopt value for machine-dependent long options.
13177298Sobrien   190 gives the standard options room to grow.  */
13277298Sobrien#define OPTION_MD_BASE 190
13333965Sjdp
13433965Sjdp#ifdef DEBUG
13533965Sjdp#undef NDEBUG
13633965Sjdp#endif
13760484Sobrien#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 6)
13833965Sjdp#define __PRETTY_FUNCTION__  ((char*)0)
13933965Sjdp#endif
140218822Sdim#define assert(P) \
141218822Sdim  ((void) ((P) ? 0 : (as_assert (__FILE__, __LINE__, __PRETTY_FUNCTION__), 0)))
14233965Sjdp#undef abort
14333965Sjdp#define abort()		as_abort (__FILE__, __LINE__, __PRETTY_FUNCTION__)
14433965Sjdp
14577298Sobrien/* Now GNU header files...  */
14660484Sobrien#include "ansidecl.h"
14760484Sobrien#include "bfd.h"
14860484Sobrien#include "libiberty.h"
14933965Sjdp
15033965Sjdp/* Define the standard progress macros.  */
15160484Sobrien#include "progress.h"
15233965Sjdp
15333965Sjdp/* This doesn't get taken care of anywhere.  */
154218822Sdim#ifndef __MWERKS__  /* Metrowerks C chokes on the "defined (inline)"  */
15533965Sjdp#if !defined (__GNUC__) && !defined (inline)
15633965Sjdp#define inline
15733965Sjdp#endif
15833965Sjdp#endif /* !__MWERKS__ */
15933965Sjdp
16033965Sjdp/* Other stuff from config.h.  */
161218822Sdim#ifdef NEED_DECLARATION_ENVIRON
162218822Sdimextern char **environ;
16333965Sjdp#endif
164218822Sdim#ifdef NEED_DECLARATION_ERRNO
165218822Sdimextern int errno;
16633965Sjdp#endif
167218822Sdim#ifdef NEED_DECLARATION_FFS
168218822Sdimextern int ffs (int);
169218822Sdim#endif
17033965Sjdp#ifdef NEED_DECLARATION_FREE
17133965Sjdpextern void free ();
17233965Sjdp#endif
173218822Sdim#ifdef NEED_DECLARATION_MALLOC
174218822Sdimextern PTR malloc ();
175218822Sdimextern PTR realloc ();
17633965Sjdp#endif
177218822Sdim#ifdef NEED_DECLARATION_STRSTR
178218822Sdimextern char *strstr ();
17960484Sobrien#endif
18033965Sjdp
181218822Sdim#if !HAVE_DECL_VSNPRINTF
182218822Sdimextern int vsnprintf(char *, size_t, const char *, va_list);
183218822Sdim#endif
184218822Sdim
18538889Sjdp/* This is needed for VMS.  */
18638889Sjdp#if ! defined (HAVE_UNLINK) && defined (HAVE_REMOVE)
18733965Sjdp#define unlink remove
18833965Sjdp#endif
18933965Sjdp
19033965Sjdp/* Hack to make "gcc -Wall" not complain about obstack macros.  */
19133965Sjdp#if !defined (memcpy) && !defined (bcopy)
192104834Sobrien#define bcopy(src,dest,size)	memcpy (dest, src, size)
19333965Sjdp#endif
19433965Sjdp
19533965Sjdp/* Make Saber happier on obstack.h.  */
19633965Sjdp#ifdef SABER
19733965Sjdp#undef  __PTR_TO_INT
19877298Sobrien#define __PTR_TO_INT(P) ((int) (P))
19933965Sjdp#undef  __INT_TO_PTR
20077298Sobrien#define __INT_TO_PTR(P) ((char *) (P))
20133965Sjdp#endif
20233965Sjdp
20333965Sjdp#ifndef __LINE__
20433965Sjdp#define __LINE__ "unknown"
20533965Sjdp#endif /* __LINE__ */
20633965Sjdp
20733965Sjdp#ifndef __FILE__
20833965Sjdp#define __FILE__ "unknown"
20933965Sjdp#endif /* __FILE__ */
21033965Sjdp
21133965Sjdp#ifndef FOPEN_WB
212218822Sdim#ifdef USE_BINARY_FOPEN
21333965Sjdp#include "fopen-bin.h"
21433965Sjdp#else
21533965Sjdp#include "fopen-same.h"
21633965Sjdp#endif
21733965Sjdp#endif
21833965Sjdp
21933965Sjdp#ifndef EXIT_SUCCESS
22033965Sjdp#define EXIT_SUCCESS 0
22133965Sjdp#define EXIT_FAILURE 1
22233965Sjdp#endif
22333965Sjdp
22460484Sobrien#ifndef SEEK_SET
22560484Sobrien#define SEEK_SET 0
22660484Sobrien#endif
22760484Sobrien
22833965Sjdp#define obstack_chunk_alloc xmalloc
22933965Sjdp#define obstack_chunk_free xfree
23033965Sjdp
23133965Sjdp#define xfree free
23233965Sjdp
23360484Sobrien#include "asintl.h"
23460484Sobrien
23577298Sobrien#define BAD_CASE(val)							    \
23677298Sobrien  {									    \
23777298Sobrien    as_fatal (_("Case value %ld unexpected at line %d of file \"%s\"\n"),   \
23877298Sobrien	      (long) val, __LINE__, __FILE__);				    \
23977298Sobrien  }
24033965Sjdp
24133965Sjdp#include "flonum.h"
24233965Sjdp
24333965Sjdp/* These are assembler-wide concepts */
24433965Sjdp
24533965Sjdpextern bfd *stdoutput;
24633965Sjdptypedef bfd_vma addressT;
24733965Sjdptypedef bfd_signed_vma offsetT;
24833965Sjdp
24933965Sjdp/* Type of symbol value, etc.  For use in prototypes.  */
25033965Sjdptypedef addressT valueT;
25133965Sjdp
25233965Sjdp#ifndef COMMON
25333965Sjdp#ifdef TEST
254218822Sdim#define COMMON			/* Declare our COMMONs storage here.  */
25533965Sjdp#else
256218822Sdim#define COMMON extern		/* Our commons live elsewhere.  */
25733965Sjdp#endif
25833965Sjdp#endif
25933965Sjdp/* COMMON now defined */
26033965Sjdp
261218822Sdim#ifndef ENABLE_CHECKING
262218822Sdim#define ENABLE_CHECKING 0
263218822Sdim#endif
264218822Sdim
265218822Sdim#if ENABLE_CHECKING || defined (DEBUG)
26633965Sjdp#ifndef know
267218822Sdim#define know(p) assert(p)	/* Verify our assumptions!  */
26833965Sjdp#endif /* not yet defined */
26933965Sjdp#else
270218822Sdim#define know(p)			/* know() checks are no-op.ed  */
27133965Sjdp#endif
27233965Sjdp
27333965Sjdp/* input_scrub.c */
27433965Sjdp
27577298Sobrien/* Supplies sanitised buffers to read.c.
27677298Sobrien   Also understands printing line-number part of error messages.  */
27733965Sjdp
27833965Sjdp/* subsegs.c     Sub-segments. Also, segment(=expression type)s.*/
27933965Sjdp
28033965Sjdptypedef asection *segT;
281218822Sdim#define SEG_NORMAL(SEG)		(   (SEG) != absolute_section	\
28233965Sjdp				 && (SEG) != undefined_section	\
28333965Sjdp				 && (SEG) != reg_section	\
28433965Sjdp				 && (SEG) != expr_section)
28533965Sjdptypedef int subsegT;
28633965Sjdp
287218822Sdim/* What subseg we are accessing now?  */
28833965SjdpCOMMON subsegT now_subseg;
28933965Sjdp
29077298Sobrien/* Segment our instructions emit to.  */
29133965SjdpCOMMON segT now_seg;
29233965Sjdp
29333965Sjdp#define segment_name(SEG)	bfd_get_section_name (stdoutput, SEG)
29433965Sjdp
29533965Sjdpextern segT reg_section, expr_section;
29633965Sjdp/* Shouldn't these be eliminated someday?  */
29733965Sjdpextern segT text_section, data_section, bss_section;
29833965Sjdp#define absolute_section	bfd_abs_section_ptr
29933965Sjdp#define undefined_section	bfd_und_section_ptr
30033965Sjdp
301218822Sdimenum _relax_state
302218822Sdim{
303218822Sdim  /* Dummy frag used by listing code.  */
304218822Sdim  rs_dummy = 0,
30533965Sjdp
30677298Sobrien  /* Variable chars to be repeated fr_offset times.
30777298Sobrien     Fr_symbol unused. Used with fr_offset == 0 for a
30877298Sobrien     constant length frag.  */
309218822Sdim  rs_fill,
31033965Sjdp
31177298Sobrien  /* Align.  The fr_offset field holds the power of 2 to which to
31277298Sobrien     align.  The fr_var field holds the number of characters in the
31377298Sobrien     fill pattern.  The fr_subtype field holds the maximum number of
31477298Sobrien     bytes to skip when aligning, or 0 if there is no maximum.  */
31577298Sobrien  rs_align,
31633965Sjdp
31777298Sobrien  /* Align code.  The fr_offset field holds the power of 2 to which
31877298Sobrien     to align.  This type is only generated by machine specific
31977298Sobrien     code, which is normally responsible for handling the fill
32077298Sobrien     pattern.  The fr_subtype field holds the maximum number of
32177298Sobrien     bytes to skip when aligning, or 0 if there is no maximum.  */
32277298Sobrien  rs_align_code,
32333965Sjdp
32477298Sobrien  /* Test for alignment.  Like rs_align, but used by several targets
32577298Sobrien     to warn if data is not properly aligned.  */
32677298Sobrien  rs_align_test,
32733965Sjdp
32877298Sobrien  /* Org: Fr_offset, fr_symbol: address. 1 variable char: fill
32977298Sobrien     character.  */
33077298Sobrien  rs_org,
33177298Sobrien
33233965Sjdp#ifndef WORKING_DOT_WORD
33377298Sobrien  /* JF: gunpoint */
33477298Sobrien  rs_broken_word,
33533965Sjdp#endif
33633965Sjdp
337218822Sdim  /* Machine specific relaxable (or similarly alterable) instruction.  */
33877298Sobrien  rs_machine_dependent,
33933965Sjdp
34077298Sobrien  /* .space directive with expression operand that needs to be computed
34177298Sobrien     later.  Similar to rs_org, but different.
34277298Sobrien     fr_symbol: operand
34377298Sobrien     1 variable char: fill character  */
34477298Sobrien  rs_space,
34538889Sjdp
34677298Sobrien  /* A DWARF leb128 value; only ELF uses this.  The subtype is 0 for
34777298Sobrien     unsigned, 1 for signed.  */
34877298Sobrien  rs_leb128,
34938889Sjdp
35077298Sobrien  /* Exception frame information which we may be able to optimize.  */
35177298Sobrien  rs_cfa,
35233965Sjdp
35377298Sobrien  /* Cross-fragment dwarf2 line number optimization.  */
35477298Sobrien  rs_dwarf2dbg
35577298Sobrien};
35677298Sobrien
35733965Sjdptypedef enum _relax_state relax_stateT;
35833965Sjdp
35933965Sjdp/* This type is used in prototypes, so it can't be a type that will be
36033965Sjdp   widened for argument passing.  */
36133965Sjdptypedef unsigned int relax_substateT;
36233965Sjdp
36333965Sjdp/* Enough bits for address, but still an integer type.
36433965Sjdp   Could be a problem, cross-assembling for 64-bit machines.  */
36533965Sjdptypedef addressT relax_addressT;
366168433Skan
367168433Skanstruct relax_type
368168433Skan{
369168433Skan  /* Forward reach. Signed number. > 0.  */
370168433Skan  offsetT rlx_forward;
371168433Skan  /* Backward reach. Signed number. < 0.  */
372168433Skan  offsetT rlx_backward;
373168433Skan
374168433Skan  /* Bytes length of this address.  */
375168433Skan  unsigned char rlx_length;
376168433Skan
377168433Skan  /* Next longer relax-state.  0 means there is no 'next' relax-state.  */
378168433Skan  relax_substateT rlx_more;
379168433Skan};
380168433Skan
381168433Skantypedef struct relax_type relax_typeS;
38233965Sjdp
383218822Sdim/* main program "as.c" (command arguments etc).  */
38433965Sjdp
38533965SjdpCOMMON unsigned char flag_no_comments; /* -f */
38633965SjdpCOMMON unsigned char flag_debug; /* -D */
38733965SjdpCOMMON unsigned char flag_signed_overflow_ok; /* -J */
38833965Sjdp#ifndef WORKING_DOT_WORD
38933965SjdpCOMMON unsigned char flag_warn_displacement; /* -K */
39033965Sjdp#endif
39133965Sjdp
39233965Sjdp/* True if local symbols should be retained.  */
39333965SjdpCOMMON int flag_keep_locals; /* -L */
39433965Sjdp
39533965Sjdp/* True if we are assembling in MRI mode.  */
39633965SjdpCOMMON int flag_mri;
39733965Sjdp
39833965Sjdp/* Should the data section be made read-only and appended to the text
39933965Sjdp   section?  */
40033965SjdpCOMMON unsigned char flag_readonly_data_in_text; /* -R */
40133965Sjdp
40233965Sjdp/* True if warnings should be inhibited.  */
40333965SjdpCOMMON int flag_no_warnings; /* -W */
40433965Sjdp
40560484Sobrien/* True if warnings count as errors.  */
40660484SobrienCOMMON int flag_fatal_warnings; /* --fatal-warnings */
40760484Sobrien
40833965Sjdp/* True if we should attempt to generate output even if non-fatal errors
40933965Sjdp   are detected.  */
41033965SjdpCOMMON unsigned char flag_always_generate_output; /* -Z */
41133965Sjdp
41277298Sobrien/* This is true if the assembler should output time and space usage.  */
41333965SjdpCOMMON unsigned char flag_print_statistics;
41433965Sjdp
41538889Sjdp/* True if local absolute symbols are to be stripped.  */
41638889SjdpCOMMON int flag_strip_local_absolute;
41738889Sjdp
41838889Sjdp/* True if we should generate a traditional format object file.  */
41938889SjdpCOMMON int flag_traditional_format;
42038889Sjdp
421130561Sobrien/* TRUE if .note.GNU-stack section with SEC_CODE should be created */
422130561SobrienCOMMON int flag_execstack;
423130561Sobrien
424130561Sobrien/* TRUE if .note.GNU-stack section with SEC_CODE should be created */
425130561SobrienCOMMON int flag_noexecstack;
426130561Sobrien
42733965Sjdp/* name of emitted object file */
42833965SjdpCOMMON char *out_file_name;
42933965Sjdp
43033965Sjdp/* name of file defining extensions to the basic instruction set */
43133965SjdpCOMMON char *insttbl_file_name;
43233965Sjdp
43377298Sobrien/* TRUE if we need a second pass.  */
43433965SjdpCOMMON int need_pass_2;
43533965Sjdp
43633965Sjdp/* TRUE if we should do no relaxing, and
43733965Sjdp   leave lots of padding.  */
43833965SjdpCOMMON int linkrelax;
43933965Sjdp
44033965Sjdp/* TRUE if we should produce a listing.  */
44133965Sjdpextern int listing;
44233965Sjdp
44377298Sobrien/* Type of debugging information we should generate.  We currently support
44477298Sobrien   stabs, ECOFF, and DWARF2.
44538889Sjdp
44677298Sobrien   NOTE!  This means debug information about the assembly source code itself
44777298Sobrien   and _not_ about possible debug information from a high-level language.
44877298Sobrien   This is especially relevant to DWARF2, since the compiler may emit line
44977298Sobrien   number directives that the assembler resolves.  */
45038889Sjdp
451218822Sdimenum debug_info_type
452218822Sdim{
45377298Sobrien  DEBUG_UNSPECIFIED,
45477298Sobrien  DEBUG_NONE,
45577298Sobrien  DEBUG_STABS,
45677298Sobrien  DEBUG_ECOFF,
45777298Sobrien  DEBUG_DWARF,
45877298Sobrien  DEBUG_DWARF2
45977298Sobrien};
46077298Sobrien
46138889Sjdpextern enum debug_info_type debug_type;
462130561Sobrienextern int use_gnu_debug_info_extensions;
46338889Sjdp
46433965Sjdp/* Maximum level of macro nesting.  */
46533965Sjdpextern int max_macro_nest;
46633965Sjdp
467130561Sobrien/* Verbosity level.  */
468130561Sobrienextern int verbose;
469130561Sobrien
47033965Sjdp/* Obstack chunk size.  Keep large for efficient space use, make small to
47133965Sjdp   increase malloc calls for monitoring memory allocation.  */
47233965Sjdpextern int chunksize;
47333965Sjdp
474218822Sdimstruct _pseudo_type
475218822Sdim{
47677298Sobrien  /* assembler mnemonic, lower case, no '.' */
47777298Sobrien  const char *poc_name;
47877298Sobrien  /* Do the work */
479130561Sobrien  void (*poc_handler) (int);
48077298Sobrien  /* Value to pass to handler */
48177298Sobrien  int poc_val;
48277298Sobrien};
48333965Sjdp
48433965Sjdptypedef struct _pseudo_type pseudo_typeS;
48533965Sjdp
48633965Sjdp#ifdef USE_STDARG
48733965Sjdp#if (__GNUC__ >= 2) && !defined(VMS)
48833965Sjdp/* for use with -Wformat */
48938889Sjdp
49060484Sobrien#if __GNUC__ == 2 && __GNUC_MINOR__ < 6
49138889Sjdp/* Support for double underscores in attribute names was added in gcc
49238889Sjdp   2.6, so avoid them if we are using an earlier version.  */
49338889Sjdp#define __printf__ printf
49438889Sjdp#define __format__ format
49538889Sjdp#endif
49638889Sjdp
49738889Sjdp#define PRINTF_LIKE(FCN) \
49838889Sjdp  void FCN (const char *format, ...) \
49938889Sjdp    __attribute__ ((__format__ (__printf__, 1, 2)))
50038889Sjdp#define PRINTF_WHERE_LIKE(FCN) \
50138889Sjdp  void FCN (char *file, unsigned int line, const char *format, ...) \
50238889Sjdp    __attribute__ ((__format__ (__printf__, 3, 4)))
50338889Sjdp
50438889Sjdp#else /* __GNUC__ < 2 || defined(VMS) */
50538889Sjdp
506130561Sobrien#define PRINTF_LIKE(FCN)	void FCN (const char *format, ...)
507130561Sobrien#define PRINTF_WHERE_LIKE(FCN)	void FCN (char *file, \
508130561Sobrien					  unsigned int line, \
509130561Sobrien					  const char *format, ...)
51038889Sjdp
51138889Sjdp#endif /* __GNUC__ < 2 || defined(VMS) */
51238889Sjdp
51338889Sjdp#else /* ! USE_STDARG */
51438889Sjdp
51533965Sjdp#define PRINTF_LIKE(FCN)	void FCN ()
51633965Sjdp#define PRINTF_WHERE_LIKE(FCN)	void FCN ()
51733965Sjdp
51838889Sjdp#endif /* ! USE_STDARG */
51938889Sjdp
52033965SjdpPRINTF_LIKE (as_bad);
52160484SobrienPRINTF_LIKE (as_fatal) ATTRIBUTE_NORETURN;
52233965SjdpPRINTF_LIKE (as_tsktsk);
52333965SjdpPRINTF_LIKE (as_warn);
52433965SjdpPRINTF_WHERE_LIKE (as_bad_where);
52533965SjdpPRINTF_WHERE_LIKE (as_warn_where);
52638889Sjdp
527218822Sdimvoid   as_assert (const char *, int, const char *);
528218822Sdimvoid   as_abort (const char *, int, const char *) ATTRIBUTE_NORETURN;
529218822Sdimvoid   sprint_value (char *, addressT);
530218822Sdimint    had_errors (void);
531218822Sdimint    had_warnings (void);
532218822Sdimvoid   as_warn_value_out_of_range (char *, offsetT, offsetT, offsetT, char *, unsigned);
533218822Sdimvoid   as_bad_value_out_of_range (char *, offsetT, offsetT, offsetT, char *, unsigned);
534218822Sdimvoid   print_version_id (void);
535218822Sdimchar * app_push (void);
536218822Sdimchar * atof_ieee (char *, int, LITTLENUM_TYPE *);
537218822Sdimchar * input_scrub_include_file (char *, char *);
538218822Sdimvoid   input_scrub_insert_line (const char *);
539218822Sdimvoid   input_scrub_insert_file (char *);
540218822Sdimchar * input_scrub_new_file (char *);
541218822Sdimchar * input_scrub_next_buffer (char **bufp);
542218822Sdimint    do_scrub_chars (int (*get) (char *, int), char *, int);
543218822Sdimint    gen_to_words (LITTLENUM_TYPE *, int, long);
544218822Sdimint    had_err (void);
545218822Sdimint    ignore_input (void);
546218822Sdimvoid   cond_finish_check (int);
547218822Sdimvoid   cond_exit_macro (int);
548218822Sdimint    seen_at_least_1_file (void);
549218822Sdimvoid   app_pop (char *);
550218822Sdimvoid   as_where (char **, unsigned int *);
551218822Sdimvoid   bump_line_counters (void);
552218822Sdimvoid   do_scrub_begin (int);
553218822Sdimvoid   input_scrub_begin (void);
554218822Sdimvoid   input_scrub_close (void);
555218822Sdimvoid   input_scrub_end (void);
556218822Sdimint    new_logical_line (char *, int);
557218822Sdimint    new_logical_line_flags (char *, int, int);
558218822Sdimvoid   subsegs_begin (void);
559218822Sdimvoid   subseg_change (segT, int);
560218822SdimsegT   subseg_new (const char *, subsegT);
561218822SdimsegT   subseg_force_new (const char *, subsegT);
562218822Sdimvoid   subseg_set (segT, subsegT);
563218822Sdimint    subseg_text_p (segT);
564218822Sdimint    seg_not_empty_p (segT);
565218822Sdimvoid   start_dependencies (char *);
566218822Sdimvoid   register_dependency (char *);
567218822Sdimvoid   print_dependencies (void);
568218822SdimsegT   subseg_get (const char *, int);
56933965Sjdp
57033965Sjdpstruct expressionS;
57133965Sjdpstruct fix;
57260484Sobrientypedef struct symbol symbolS;
57338889Sjdptypedef struct frag fragS;
57433965Sjdp
57533965Sjdp/* literal.c */
576130561SobrienvalueT add_to_literal_pool (symbolS *, valueT, segT, int);
57733965Sjdp
578130561Sobrienint check_eh_frame (struct expressionS *, unsigned int *);
579130561Sobrienint eh_frame_estimate_size_before_relax (fragS *);
580130561Sobrienint eh_frame_relax_frag (fragS *);
581130561Sobrienvoid eh_frame_convert_frag (fragS *);
582130561Sobrienint generic_force_reloc (struct fix *);
583130561Sobrien
58433965Sjdp#include "expr.h"		/* Before targ-*.h */
58533965Sjdp
586218822Sdim/* This one starts the chain of target dependant headers.  */
58733965Sjdp#include "targ-env.h"
58833965Sjdp
589130561Sobrien#ifdef OBJ_MAYBE_ELF
590130561Sobrien#define IS_ELF (OUTPUT_FLAVOR == bfd_target_elf_flavour)
591130561Sobrien#else
592130561Sobrien#ifdef OBJ_ELF
593130561Sobrien#define IS_ELF 1
594130561Sobrien#else
595130561Sobrien#define IS_ELF 0
59677298Sobrien#endif
597130561Sobrien#endif
59877298Sobrien
59933965Sjdp#include "write.h"
60033965Sjdp#include "frags.h"
60133965Sjdp#include "hash.h"
60233965Sjdp#include "read.h"
60333965Sjdp#include "symbols.h"
60433965Sjdp
60533965Sjdp#include "tc.h"
60633965Sjdp#include "obj.h"
60733965Sjdp
60833965Sjdp#ifdef USE_EMULATIONS
60933965Sjdp#include "emul.h"
61033965Sjdp#endif
61133965Sjdp#include "listing.h"
61233965Sjdp
61360484Sobrien#ifdef TC_M68K
61460484Sobrien/* True if we are assembling in m68k MRI mode.  */
61560484SobrienCOMMON int flag_m68k_mri;
616218822Sdim#define DOLLAR_AMBIGU flag_m68k_mri
61760484Sobrien#else
61860484Sobrien#define flag_m68k_mri 0
61960484Sobrien#endif
62060484Sobrien
62177298Sobrien#ifdef WARN_COMMENTS
622218822SdimCOMMON int           warn_comment;
623218822SdimCOMMON unsigned int  found_comment;
624218822SdimCOMMON char *        found_comment_file;
62577298Sobrien#endif
62677298Sobrien
627218822Sdim#ifndef DOLLAR_AMBIGU
628218822Sdim#define DOLLAR_AMBIGU 0
629218822Sdim#endif
630218822Sdim
63160484Sobrien#ifndef NUMBERS_WITH_SUFFIX
63260484Sobrien#define NUMBERS_WITH_SUFFIX 0
63360484Sobrien#endif
63460484Sobrien
63533965Sjdp#ifndef LOCAL_LABELS_DOLLAR
63633965Sjdp#define LOCAL_LABELS_DOLLAR 0
63733965Sjdp#endif
63833965Sjdp
63933965Sjdp#ifndef LOCAL_LABELS_FB
64033965Sjdp#define LOCAL_LABELS_FB 0
64133965Sjdp#endif
64233965Sjdp
64360484Sobrien#ifndef LABELS_WITHOUT_COLONS
64460484Sobrien#define LABELS_WITHOUT_COLONS 0
64560484Sobrien#endif
64660484Sobrien
64760484Sobrien#ifndef NO_PSEUDO_DOT
64860484Sobrien#define NO_PSEUDO_DOT 0
64960484Sobrien#endif
65060484Sobrien
65138889Sjdp#ifndef TEXT_SECTION_NAME
65238889Sjdp#define TEXT_SECTION_NAME	".text"
65338889Sjdp#define DATA_SECTION_NAME	".data"
65438889Sjdp#define BSS_SECTION_NAME	".bss"
65538889Sjdp#endif
65638889Sjdp
65760484Sobrien#ifndef OCTETS_PER_BYTE_POWER
65860484Sobrien#define OCTETS_PER_BYTE_POWER 0
65960484Sobrien#endif
66060484Sobrien#ifndef OCTETS_PER_BYTE
66160484Sobrien#define OCTETS_PER_BYTE (1<<OCTETS_PER_BYTE_POWER)
66260484Sobrien#endif
66360484Sobrien#if OCTETS_PER_BYTE != (1<<OCTETS_PER_BYTE_POWER)
66460484Sobrien #error "Octets per byte conflicts with its power-of-two definition!"
66560484Sobrien#endif
66660484Sobrien
66733965Sjdp#endif /* GAS */
668