as.h revision 77298
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 2477298Sobrien/* I think this stuff is largely out of date. xoxorich. 2533965Sjdp * 2633965Sjdp * CAPITALISED names are #defined. 2733965Sjdp * "lowercaseH" is #defined if "lowercase.h" has been #include-d. 2833965Sjdp * "lowercaseT" is a typedef of "lowercase" objects. 2933965Sjdp * "lowercaseP" is type "pointer to object of type 'lowercase'". 3033965Sjdp * "lowercaseS" is typedef struct ... lowercaseS. 3133965Sjdp * 3233965Sjdp * #define DEBUG to enable all the "know" assertion tests. 3333965Sjdp * #define SUSPECT when debugging hash code. 3433965Sjdp * #define COMMON as "extern" for all modules except one, where you #define 3533965Sjdp * COMMON as "". 3633965Sjdp * If TEST is #defined, then we are testing a module: #define COMMON as "". 3733965Sjdp */ 3833965Sjdp 3933965Sjdp#include "config.h" 4060484Sobrien#include "bin-bugs.h" 4133965Sjdp 4233965Sjdp/* This is the code recommended in the autoconf documentation, almost 4333965Sjdp verbatim. If it doesn't work for you, let me know, and notify 4433965Sjdp djm@gnu.ai.mit.edu as well. */ 4533965Sjdp/* Added #undef for DJ Delorie. The right fix is to ensure that as.h 4633965Sjdp is included first, before even any system header files, in all files 4733965Sjdp that use it. KR 1994.11.03 */ 4833965Sjdp/* Added void* version for STDC case. This is to be compatible with 4933965Sjdp the declaration in bison.simple, used for m68k operand parsing. 5033965Sjdp --KR 1995.08.08 */ 5133965Sjdp/* Force void* decl for hpux. This is what Bison uses. --KR 1995.08.16 */ 5233965Sjdp 5333965Sjdp/* AIX requires this to be the first thing in the file. */ 5433965Sjdp#ifdef __GNUC__ 5538889Sjdp# ifndef alloca 5638889Sjdp# ifdef __STDC__ 5738889Sjdpextern void *alloca (); 5838889Sjdp# else 5938889Sjdpextern char *alloca (); 6038889Sjdp# endif 6138889Sjdp# endif 6233965Sjdp#else 6333965Sjdp# if HAVE_ALLOCA_H 6433965Sjdp# include <alloca.h> 6533965Sjdp# else 6633965Sjdp# ifdef _AIX 6733965Sjdp #pragma alloca 6833965Sjdp# else 6933965Sjdp# ifndef alloca /* predefined by HP cc +Olibcalls */ 7033965Sjdp# if !defined (__STDC__) && !defined (__hpux) 7138889Sjdpextern char *alloca (); 7233965Sjdp# else 7338889Sjdpextern void *alloca (); 7433965Sjdp# endif /* __STDC__, __hpux */ 7533965Sjdp# endif /* alloca */ 7633965Sjdp# endif /* _AIX */ 7733965Sjdp# endif /* HAVE_ALLOCA_H */ 7833965Sjdp#endif 7933965Sjdp 8033965Sjdp/* Now, tend to the rest of the configuration. */ 8133965Sjdp 8277298Sobrien/* System include files first... */ 8333965Sjdp#include <stdio.h> 8433965Sjdp#include <ctype.h> 8533965Sjdp#ifdef HAVE_STRING_H 8633965Sjdp#include <string.h> 8733965Sjdp#else 8833965Sjdp#ifdef HAVE_STRINGS_H 8933965Sjdp#include <strings.h> 9033965Sjdp#endif 9133965Sjdp#endif 9233965Sjdp#ifdef HAVE_STDLIB_H 9333965Sjdp#include <stdlib.h> 9433965Sjdp#endif 9533965Sjdp#ifdef HAVE_UNISTD_H 9633965Sjdp#include <unistd.h> 9733965Sjdp#endif 9833965Sjdp#ifdef HAVE_SYS_TYPES_H 9933965Sjdp/* for size_t, pid_t */ 10033965Sjdp#include <sys/types.h> 10133965Sjdp#endif 10233965Sjdp 10333965Sjdp#include <getopt.h> 10433965Sjdp/* The first getopt value for machine-independent long options. 10533965Sjdp 150 isn't special; it's just an arbitrary non-ASCII char value. */ 10633965Sjdp#define OPTION_STD_BASE 150 10733965Sjdp/* The first getopt value for machine-dependent long options. 10877298Sobrien 190 gives the standard options room to grow. */ 10977298Sobrien#define OPTION_MD_BASE 190 11033965Sjdp 11133965Sjdp#ifdef DEBUG 11233965Sjdp#undef NDEBUG 11333965Sjdp#endif 11460484Sobrien#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 6) 11533965Sjdp#define __PRETTY_FUNCTION__ ((char*)0) 11633965Sjdp#endif 11733965Sjdp#if 0 11833965Sjdp 11933965Sjdp/* Handle lossage with assert.h. */ 12033965Sjdp#ifndef BROKEN_ASSERT 12133965Sjdp#include <assert.h> 12233965Sjdp#else /* BROKEN_ASSERT */ 12333965Sjdp#ifndef NDEBUG 12433965Sjdp#define assert(p) ((p) ? 0 : (as_assert (__FILE__, __LINE__, __PRETTY_FUNCTION__), 0)) 12533965Sjdp#else 12633965Sjdp#define assert(p) ((p), 0) 12733965Sjdp#endif 12833965Sjdp#endif /* BROKEN_ASSERT */ 12933965Sjdp 13033965Sjdp#else 13133965Sjdp 13233965Sjdp#define assert(P) ((P) ? 0 : (as_assert (__FILE__, __LINE__, __PRETTY_FUNCTION__), 0)) 13333965Sjdp#undef abort 13433965Sjdp#define abort() as_abort (__FILE__, __LINE__, __PRETTY_FUNCTION__) 13533965Sjdp 13633965Sjdp#endif 13733965Sjdp 13877298Sobrien/* Now GNU header files... */ 13960484Sobrien#include "ansidecl.h" 14033965Sjdp#ifdef BFD_ASSEMBLER 14160484Sobrien#include "bfd.h" 14233965Sjdp#endif 14360484Sobrien#include "libiberty.h" 14433965Sjdp 14533965Sjdp/* Define the standard progress macros. */ 14660484Sobrien#include "progress.h" 14733965Sjdp 14833965Sjdp/* This doesn't get taken care of anywhere. */ 14933965Sjdp#ifndef __MWERKS__ /* Metrowerks C chokes on the "defined (inline)" */ 15033965Sjdp#if !defined (__GNUC__) && !defined (inline) 15133965Sjdp#define inline 15233965Sjdp#endif 15333965Sjdp#endif /* !__MWERKS__ */ 15433965Sjdp 15533965Sjdp/* Other stuff from config.h. */ 15633965Sjdp#ifdef NEED_DECLARATION_STRSTR 15733965Sjdpextern char *strstr (); 15833965Sjdp#endif 15933965Sjdp#ifdef NEED_DECLARATION_MALLOC 16033965Sjdpextern PTR malloc (); 16133965Sjdpextern PTR realloc (); 16233965Sjdp#endif 16333965Sjdp#ifdef NEED_DECLARATION_FREE 16433965Sjdpextern void free (); 16533965Sjdp#endif 16633965Sjdp#ifdef NEED_DECLARATION_ERRNO 16733965Sjdpextern int errno; 16833965Sjdp#endif 16960484Sobrien#ifdef NEED_DECLARATION_ENVIRON 17060484Sobrienextern char **environ; 17160484Sobrien#endif 17233965Sjdp 17338889Sjdp/* This is needed for VMS. */ 17438889Sjdp#if ! defined (HAVE_UNLINK) && defined (HAVE_REMOVE) 17533965Sjdp#define unlink remove 17633965Sjdp#endif 17733965Sjdp 17833965Sjdp/* Hack to make "gcc -Wall" not complain about obstack macros. */ 17933965Sjdp#if !defined (memcpy) && !defined (bcopy) 18033965Sjdp#define bcopy(src,dest,size) memcpy(dest,src,size) 18133965Sjdp#endif 18233965Sjdp 18333965Sjdp/* Make Saber happier on obstack.h. */ 18433965Sjdp#ifdef SABER 18533965Sjdp#undef __PTR_TO_INT 18677298Sobrien#define __PTR_TO_INT(P) ((int) (P)) 18733965Sjdp#undef __INT_TO_PTR 18877298Sobrien#define __INT_TO_PTR(P) ((char *) (P)) 18933965Sjdp#endif 19033965Sjdp 19133965Sjdp#ifndef __LINE__ 19233965Sjdp#define __LINE__ "unknown" 19333965Sjdp#endif /* __LINE__ */ 19433965Sjdp 19533965Sjdp#ifndef __FILE__ 19633965Sjdp#define __FILE__ "unknown" 19733965Sjdp#endif /* __FILE__ */ 19833965Sjdp 19933965Sjdp#ifndef FOPEN_WB 20033965Sjdp#ifdef GO32 20133965Sjdp#include "fopen-bin.h" 20233965Sjdp#else 20333965Sjdp#include "fopen-same.h" 20433965Sjdp#endif 20533965Sjdp#endif 20633965Sjdp 20733965Sjdp#ifndef EXIT_SUCCESS 20833965Sjdp#define EXIT_SUCCESS 0 20933965Sjdp#define EXIT_FAILURE 1 21033965Sjdp#endif 21133965Sjdp 21260484Sobrien#ifndef SEEK_SET 21360484Sobrien#define SEEK_SET 0 21460484Sobrien#endif 21560484Sobrien 21633965Sjdp#define obstack_chunk_alloc xmalloc 21733965Sjdp#define obstack_chunk_free xfree 21833965Sjdp 21933965Sjdp#define xfree free 22033965Sjdp 22160484Sobrien#include "asintl.h" 22260484Sobrien 22377298Sobrien#define BAD_CASE(val) \ 22477298Sobrien { \ 22577298Sobrien as_fatal (_("Case value %ld unexpected at line %d of file \"%s\"\n"), \ 22677298Sobrien (long) val, __LINE__, __FILE__); \ 22777298Sobrien } 22833965Sjdp 22933965Sjdp#include "flonum.h" 23033965Sjdp 23133965Sjdp/* These are assembler-wide concepts */ 23233965Sjdp 23333965Sjdp#ifdef BFD_ASSEMBLER 23433965Sjdpextern bfd *stdoutput; 23533965Sjdptypedef bfd_vma addressT; 23633965Sjdptypedef bfd_signed_vma offsetT; 23733965Sjdp#else 23833965Sjdptypedef unsigned long addressT; 23933965Sjdptypedef long offsetT; 24033965Sjdp#endif 24133965Sjdp 24233965Sjdp/* Type of symbol value, etc. For use in prototypes. */ 24333965Sjdptypedef addressT valueT; 24433965Sjdp 24533965Sjdp#ifndef COMMON 24633965Sjdp#ifdef TEST 24777298Sobrien#define COMMON /* declare our COMMONs storage here. */ 24833965Sjdp#else 24933965Sjdp#define COMMON extern /* our commons live elswhere */ 25033965Sjdp#endif 25133965Sjdp#endif 25233965Sjdp/* COMMON now defined */ 25333965Sjdp 25433965Sjdp#ifdef DEBUG 25533965Sjdp#ifndef know 25633965Sjdp#define know(p) assert(p) /* Verify our assumptions! */ 25733965Sjdp#endif /* not yet defined */ 25833965Sjdp#else 25933965Sjdp#define know(p) /* know() checks are no-op.ed */ 26033965Sjdp#endif 26133965Sjdp 26233965Sjdp/* input_scrub.c */ 26333965Sjdp 26477298Sobrien/* Supplies sanitised buffers to read.c. 26577298Sobrien Also understands printing line-number part of error messages. */ 26633965Sjdp 26733965Sjdp/* subsegs.c Sub-segments. Also, segment(=expression type)s.*/ 26833965Sjdp 26933965Sjdp#ifndef BFD_ASSEMBLER 27033965Sjdp 27133965Sjdp#ifdef MANY_SEGMENTS 27233965Sjdp#include "bfd.h" 27333965Sjdp#define N_SEGMENTS 40 27433965Sjdp#define SEG_NORMAL(x) ((x) >= SEG_E0 && (x) <= SEG_E39) 27533965Sjdp#define SEG_LIST SEG_E0,SEG_E1,SEG_E2,SEG_E3,SEG_E4,SEG_E5,SEG_E6,SEG_E7,SEG_E8,SEG_E9,\ 27633965Sjdp SEG_E10,SEG_E11,SEG_E12,SEG_E13,SEG_E14,SEG_E15,SEG_E16,SEG_E17,SEG_E18,SEG_E19,\ 27733965Sjdp SEG_E20,SEG_E21,SEG_E22,SEG_E23,SEG_E24,SEG_E25,SEG_E26,SEG_E27,SEG_E28,SEG_E29,\ 27833965Sjdp SEG_E30,SEG_E31,SEG_E32,SEG_E33,SEG_E34,SEG_E35,SEG_E36,SEG_E37,SEG_E38,SEG_E39 27933965Sjdp#define SEG_TEXT SEG_E0 28033965Sjdp#define SEG_DATA SEG_E1 28133965Sjdp#define SEG_BSS SEG_E2 28233965Sjdp#define SEG_LAST SEG_E39 28333965Sjdp#else 28433965Sjdp#define N_SEGMENTS 3 28533965Sjdp#define SEG_NORMAL(x) ((x) == SEG_TEXT || (x) == SEG_DATA || (x) == SEG_BSS) 28633965Sjdp#define SEG_LIST SEG_TEXT,SEG_DATA,SEG_BSS 28733965Sjdp#endif 28833965Sjdp 28977298Sobrientypedef enum _segT { 29077298Sobrien SEG_ABSOLUTE = 0, 29177298Sobrien SEG_LIST, 29277298Sobrien SEG_UNKNOWN, 29377298Sobrien SEG_GOOF, /* Only happens if AS has a logic error. */ 29477298Sobrien /* Invented so we don't crash printing */ 29577298Sobrien /* error message involving weird segment. */ 29677298Sobrien SEG_EXPR, /* Intermediate expression values. */ 29777298Sobrien SEG_DEBUG, /* Debug segment */ 29877298Sobrien SEG_NTV, /* Transfert vector preload segment */ 29977298Sobrien SEG_PTV, /* Transfert vector postload segment */ 30077298Sobrien SEG_REGISTER /* Mythical: a register-valued expression */ 30177298Sobrien} segT; 30233965Sjdp 30333965Sjdp#define SEG_MAXIMUM_ORDINAL (SEG_REGISTER) 30433965Sjdp#else 30533965Sjdptypedef asection *segT; 30633965Sjdp#define SEG_NORMAL(SEG) ((SEG) != absolute_section \ 30733965Sjdp && (SEG) != undefined_section \ 30833965Sjdp && (SEG) != reg_section \ 30933965Sjdp && (SEG) != expr_section) 31033965Sjdp#endif 31133965Sjdptypedef int subsegT; 31233965Sjdp 31333965Sjdp/* What subseg we are accreting now? */ 31433965SjdpCOMMON subsegT now_subseg; 31533965Sjdp 31677298Sobrien/* Segment our instructions emit to. */ 31733965SjdpCOMMON segT now_seg; 31833965Sjdp 31933965Sjdp#ifdef BFD_ASSEMBLER 32033965Sjdp#define segment_name(SEG) bfd_get_section_name (stdoutput, SEG) 32133965Sjdp#else 32233965Sjdpextern char const *const seg_name[]; 32333965Sjdp#define segment_name(SEG) seg_name[(int) (SEG)] 32433965Sjdp#endif 32533965Sjdp 32633965Sjdp#ifndef BFD_ASSEMBLER 32733965Sjdpextern int section_alignment[]; 32833965Sjdp#endif 32933965Sjdp 33033965Sjdp#ifdef BFD_ASSEMBLER 33133965Sjdpextern segT reg_section, expr_section; 33233965Sjdp/* Shouldn't these be eliminated someday? */ 33333965Sjdpextern segT text_section, data_section, bss_section; 33433965Sjdp#define absolute_section bfd_abs_section_ptr 33533965Sjdp#define undefined_section bfd_und_section_ptr 33633965Sjdp#else 33733965Sjdp#define reg_section SEG_REGISTER 33833965Sjdp#define expr_section SEG_EXPR 33933965Sjdp#define text_section SEG_TEXT 34033965Sjdp#define data_section SEG_DATA 34133965Sjdp#define bss_section SEG_BSS 34233965Sjdp#define absolute_section SEG_ABSOLUTE 34333965Sjdp#define undefined_section SEG_UNKNOWN 34433965Sjdp#endif 34533965Sjdp 34633965Sjdp/* relax() */ 34733965Sjdp 34877298Sobrienenum _relax_state { 34977298Sobrien /* Variable chars to be repeated fr_offset times. 35077298Sobrien Fr_symbol unused. Used with fr_offset == 0 for a 35177298Sobrien constant length frag. */ 35277298Sobrien rs_fill = 1, 35333965Sjdp 35477298Sobrien /* Align. The fr_offset field holds the power of 2 to which to 35577298Sobrien align. The fr_var field holds the number of characters in the 35677298Sobrien fill pattern. The fr_subtype field holds the maximum number of 35777298Sobrien bytes to skip when aligning, or 0 if there is no maximum. */ 35877298Sobrien rs_align, 35933965Sjdp 36077298Sobrien /* Align code. The fr_offset field holds the power of 2 to which 36177298Sobrien to align. This type is only generated by machine specific 36277298Sobrien code, which is normally responsible for handling the fill 36377298Sobrien pattern. The fr_subtype field holds the maximum number of 36477298Sobrien bytes to skip when aligning, or 0 if there is no maximum. */ 36577298Sobrien rs_align_code, 36633965Sjdp 36777298Sobrien /* Test for alignment. Like rs_align, but used by several targets 36877298Sobrien to warn if data is not properly aligned. */ 36977298Sobrien rs_align_test, 37033965Sjdp 37177298Sobrien /* Org: Fr_offset, fr_symbol: address. 1 variable char: fill 37277298Sobrien character. */ 37377298Sobrien rs_org, 37477298Sobrien 37533965Sjdp#ifndef WORKING_DOT_WORD 37677298Sobrien /* JF: gunpoint */ 37777298Sobrien rs_broken_word, 37833965Sjdp#endif 37933965Sjdp 38077298Sobrien /* machine-specific relaxable (or similarly alterable) instruction */ 38177298Sobrien rs_machine_dependent, 38233965Sjdp 38377298Sobrien /* .space directive with expression operand that needs to be computed 38477298Sobrien later. Similar to rs_org, but different. 38577298Sobrien fr_symbol: operand 38677298Sobrien 1 variable char: fill character */ 38777298Sobrien rs_space, 38838889Sjdp 38977298Sobrien /* A DWARF leb128 value; only ELF uses this. The subtype is 0 for 39077298Sobrien unsigned, 1 for signed. */ 39177298Sobrien rs_leb128, 39238889Sjdp 39377298Sobrien /* Exception frame information which we may be able to optimize. */ 39477298Sobrien rs_cfa, 39533965Sjdp 39677298Sobrien /* Cross-fragment dwarf2 line number optimization. */ 39777298Sobrien rs_dwarf2dbg 39877298Sobrien}; 39977298Sobrien 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 43977298Sobrien/* 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 45477298Sobrien/* 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 46477298Sobrien/* Type of debugging information we should generate. We currently support 46577298Sobrien stabs, ECOFF, and DWARF2. 46638889Sjdp 46777298Sobrien NOTE! This means debug information about the assembly source code itself 46877298Sobrien and _not_ about possible debug information from a high-level language. 46977298Sobrien This is especially relevant to DWARF2, since the compiler may emit line 47077298Sobrien number directives that the assembler resolves. */ 47138889Sjdp 47277298Sobrienenum debug_info_type { 47377298Sobrien DEBUG_UNSPECIFIED, 47477298Sobrien DEBUG_NONE, 47577298Sobrien DEBUG_STABS, 47677298Sobrien DEBUG_ECOFF, 47777298Sobrien DEBUG_DWARF, 47877298Sobrien DEBUG_DWARF2 47977298Sobrien}; 48077298Sobrien 48138889Sjdpextern enum debug_info_type debug_type; 48238889Sjdp 48333965Sjdp/* Maximum level of macro nesting. */ 48433965Sjdpextern int max_macro_nest; 48533965Sjdp 48633965Sjdp/* Obstack chunk size. Keep large for efficient space use, make small to 48733965Sjdp increase malloc calls for monitoring memory allocation. */ 48833965Sjdpextern int chunksize; 48933965Sjdp 49077298Sobrienstruct _pseudo_type { 49177298Sobrien /* assembler mnemonic, lower case, no '.' */ 49277298Sobrien const char *poc_name; 49377298Sobrien /* Do the work */ 49477298Sobrien void (*poc_handler) PARAMS ((int)); 49577298Sobrien /* Value to pass to handler */ 49677298Sobrien int poc_val; 49777298Sobrien}; 49833965Sjdp 49933965Sjdptypedef struct _pseudo_type pseudo_typeS; 50033965Sjdp 50133965Sjdp/* Prefer varargs for non-ANSI compiler, since some will barf if the 50233965Sjdp ellipsis definition is used with a no-arguments declaration. */ 50333965Sjdp#if defined (HAVE_VARARGS_H) && !defined (__STDC__) 50433965Sjdp#undef HAVE_STDARG_H 50533965Sjdp#endif 50633965Sjdp 50733965Sjdp#if defined (HAVE_STDARG_H) 50833965Sjdp#define USE_STDARG 50933965Sjdp#endif 51033965Sjdp#if !defined (USE_STDARG) && defined (HAVE_VARARGS_H) 51133965Sjdp#define USE_VARARGS 51233965Sjdp#endif 51333965Sjdp 51433965Sjdp#ifdef USE_STDARG 51533965Sjdp#if (__GNUC__ >= 2) && !defined(VMS) 51633965Sjdp/* for use with -Wformat */ 51738889Sjdp 51860484Sobrien#if __GNUC__ == 2 && __GNUC_MINOR__ < 6 51938889Sjdp/* Support for double underscores in attribute names was added in gcc 52038889Sjdp 2.6, so avoid them if we are using an earlier version. */ 52138889Sjdp#define __printf__ printf 52238889Sjdp#define __format__ format 52338889Sjdp#endif 52438889Sjdp 52538889Sjdp#define PRINTF_LIKE(FCN) \ 52638889Sjdp void FCN (const char *format, ...) \ 52738889Sjdp __attribute__ ((__format__ (__printf__, 1, 2))) 52838889Sjdp#define PRINTF_WHERE_LIKE(FCN) \ 52938889Sjdp void FCN (char *file, unsigned int line, const char *format, ...) \ 53038889Sjdp __attribute__ ((__format__ (__printf__, 3, 4))) 53138889Sjdp 53238889Sjdp#else /* __GNUC__ < 2 || defined(VMS) */ 53338889Sjdp 53433965Sjdp#define PRINTF_LIKE(FCN) void FCN PARAMS ((const char *format, ...)) 53533965Sjdp#define PRINTF_WHERE_LIKE(FCN) void FCN PARAMS ((char *file, \ 53633965Sjdp unsigned int line, \ 53733965Sjdp const char *format, ...)) 53838889Sjdp 53938889Sjdp#endif /* __GNUC__ < 2 || defined(VMS) */ 54038889Sjdp 54138889Sjdp#else /* ! USE_STDARG */ 54238889Sjdp 54333965Sjdp#define PRINTF_LIKE(FCN) void FCN () 54433965Sjdp#define PRINTF_WHERE_LIKE(FCN) void FCN () 54533965Sjdp 54638889Sjdp#endif /* ! USE_STDARG */ 54738889Sjdp 54833965SjdpPRINTF_LIKE (as_bad); 54960484SobrienPRINTF_LIKE (as_fatal) ATTRIBUTE_NORETURN; 55033965SjdpPRINTF_LIKE (as_tsktsk); 55133965SjdpPRINTF_LIKE (as_warn); 55233965SjdpPRINTF_WHERE_LIKE (as_bad_where); 55333965SjdpPRINTF_WHERE_LIKE (as_warn_where); 55438889Sjdp 55533965Sjdpvoid as_assert PARAMS ((const char *, int, const char *)); 55660484Sobrienvoid as_abort PARAMS ((const char *, int, const char *)) ATTRIBUTE_NORETURN; 55733965Sjdp 55833965Sjdpvoid fprint_value PARAMS ((FILE *file, addressT value)); 55933965Sjdpvoid sprint_value PARAMS ((char *buf, addressT value)); 56033965Sjdp 56133965Sjdpint had_errors PARAMS ((void)); 56233965Sjdpint had_warnings PARAMS ((void)); 56333965Sjdp 56433965Sjdpvoid print_version_id PARAMS ((void)); 56533965Sjdpchar *app_push PARAMS ((void)); 56633965Sjdpchar *atof_ieee PARAMS ((char *str, int what_kind, LITTLENUM_TYPE * words)); 56733965Sjdpchar *input_scrub_include_file PARAMS ((char *filename, char *position)); 56860484Sobrienextern void input_scrub_insert_line PARAMS((const char *line)); 56960484Sobrienextern void input_scrub_insert_file PARAMS((char *path)); 57033965Sjdpchar *input_scrub_new_file PARAMS ((char *filename)); 57133965Sjdpchar *input_scrub_next_buffer PARAMS ((char **bufp)); 57260484Sobrienint do_scrub_chars PARAMS ((int (*get) (char *, int), char *to, int tolen)); 57333965Sjdpint gen_to_words PARAMS ((LITTLENUM_TYPE * words, int precision, 57433965Sjdp long exponent_bits)); 57533965Sjdpint had_err PARAMS ((void)); 57633965Sjdpint ignore_input PARAMS ((void)); 57733965Sjdpvoid cond_finish_check PARAMS ((int)); 57833965Sjdpvoid cond_exit_macro PARAMS ((int)); 57933965Sjdpint seen_at_least_1_file PARAMS ((void)); 58033965Sjdpvoid app_pop PARAMS ((char *arg)); 58133965Sjdpvoid as_howmuch PARAMS ((FILE * stream)); 58233965Sjdpvoid as_perror PARAMS ((const char *gripe, const char *filename)); 58333965Sjdpvoid as_where PARAMS ((char **namep, unsigned int *linep)); 58433965Sjdpvoid bump_line_counters PARAMS ((void)); 58533965Sjdpvoid do_scrub_begin PARAMS ((int)); 58633965Sjdpvoid input_scrub_begin PARAMS ((void)); 58733965Sjdpvoid input_scrub_close PARAMS ((void)); 58833965Sjdpvoid input_scrub_end PARAMS ((void)); 58938889Sjdpint new_logical_line PARAMS ((char *fname, int line_number)); 59033965Sjdpvoid subsegs_begin PARAMS ((void)); 59133965Sjdpvoid subseg_change PARAMS ((segT seg, int subseg)); 59233965SjdpsegT subseg_new PARAMS ((const char *name, subsegT subseg)); 59333965SjdpsegT subseg_force_new PARAMS ((const char *name, subsegT subseg)); 59433965Sjdpvoid subseg_set PARAMS ((segT seg, subsegT subseg)); 59533965Sjdp#ifdef BFD_ASSEMBLER 59633965SjdpsegT subseg_get PARAMS ((const char *, int)); 59733965Sjdp#endif 59860484Sobrienint subseg_text_p PARAMS ((segT)); 59933965Sjdp 60038889Sjdpvoid start_dependencies PARAMS ((char *)); 60138889Sjdpvoid register_dependency PARAMS ((char *)); 60238889Sjdpvoid print_dependencies PARAMS ((void)); 60338889Sjdp 60433965Sjdpstruct expressionS; 60533965Sjdpstruct fix; 60660484Sobrientypedef struct symbol symbolS; 60733965Sjdpstruct relax_type; 60838889Sjdptypedef struct frag fragS; 60933965Sjdp 61033965Sjdp#ifdef BFD_ASSEMBLER 61133965Sjdp/* literal.c */ 61260484SobrienvalueT add_to_literal_pool PARAMS ((symbolS *, valueT, segT, int)); 61333965Sjdp#endif 61433965Sjdp 61538889Sjdpint check_eh_frame PARAMS ((struct expressionS *, unsigned int *)); 61638889Sjdpint eh_frame_estimate_size_before_relax PARAMS ((fragS *)); 61738889Sjdpint eh_frame_relax_frag PARAMS ((fragS *)); 61838889Sjdpvoid eh_frame_convert_frag PARAMS ((fragS *)); 61938889Sjdp 62033965Sjdp#include "expr.h" /* Before targ-*.h */ 62133965Sjdp 62233965Sjdp/* this one starts the chain of target dependant headers */ 62333965Sjdp#include "targ-env.h" 62433965Sjdp 62577298Sobrien#ifdef TC_ARC 62677298Sobrien#include "struc-symbol.h" 62777298Sobrien#endif 62877298Sobrien 62933965Sjdp#include "write.h" 63033965Sjdp#include "frags.h" 63133965Sjdp#include "hash.h" 63233965Sjdp#include "read.h" 63333965Sjdp#include "symbols.h" 63433965Sjdp 63533965Sjdp#include "tc.h" 63633965Sjdp#include "obj.h" 63733965Sjdp 63833965Sjdp#ifdef USE_EMULATIONS 63933965Sjdp#include "emul.h" 64033965Sjdp#endif 64133965Sjdp#include "listing.h" 64233965Sjdp 64360484Sobrien#ifdef TC_M68K 64460484Sobrien/* True if we are assembling in m68k MRI mode. */ 64560484SobrienCOMMON int flag_m68k_mri; 64660484Sobrien#else 64760484Sobrien#define flag_m68k_mri 0 64860484Sobrien#endif 64960484Sobrien 65077298Sobrien#ifdef WARN_COMMENTS 65177298SobrienCOMMON int warn_comment; 65277298SobrienCOMMON unsigned int found_comment; 65377298SobrienCOMMON char *found_comment_file; 65477298Sobrien#endif 65577298Sobrien 65660484Sobrien#ifndef NUMBERS_WITH_SUFFIX 65760484Sobrien#define NUMBERS_WITH_SUFFIX 0 65860484Sobrien#endif 65960484Sobrien 66033965Sjdp#ifndef LOCAL_LABELS_DOLLAR 66133965Sjdp#define LOCAL_LABELS_DOLLAR 0 66233965Sjdp#endif 66333965Sjdp 66433965Sjdp#ifndef LOCAL_LABELS_FB 66533965Sjdp#define LOCAL_LABELS_FB 0 66633965Sjdp#endif 66733965Sjdp 66860484Sobrien#ifndef LABELS_WITHOUT_COLONS 66960484Sobrien#define LABELS_WITHOUT_COLONS 0 67060484Sobrien#endif 67160484Sobrien 67260484Sobrien#ifndef NO_PSEUDO_DOT 67360484Sobrien#define NO_PSEUDO_DOT 0 67460484Sobrien#endif 67560484Sobrien 67638889Sjdp#ifndef TEXT_SECTION_NAME 67738889Sjdp#define TEXT_SECTION_NAME ".text" 67838889Sjdp#define DATA_SECTION_NAME ".data" 67938889Sjdp#define BSS_SECTION_NAME ".bss" 68038889Sjdp#endif 68138889Sjdp 68260484Sobrien#ifndef OCTETS_PER_BYTE_POWER 68360484Sobrien#define OCTETS_PER_BYTE_POWER 0 68460484Sobrien#endif 68560484Sobrien#ifndef OCTETS_PER_BYTE 68660484Sobrien#define OCTETS_PER_BYTE (1<<OCTETS_PER_BYTE_POWER) 68760484Sobrien#endif 68860484Sobrien#if OCTETS_PER_BYTE != (1<<OCTETS_PER_BYTE_POWER) 68960484Sobrien #error "Octets per byte conflicts with its power-of-two definition!" 69060484Sobrien#endif 69160484Sobrien 69233965Sjdp#endif /* GAS */ 693