as.h revision 130561
133965Sjdp/* as.h - global header file 278828Sobrien Copyright 1987, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 3130561Sobrien 1999, 2000, 2001, 2002, 2003 433965Sjdp Free Software Foundation, Inc. 533965Sjdp 633965Sjdp This file is part of GAS, the GNU Assembler. 733965Sjdp 833965Sjdp GAS is free software; you can redistribute it and/or modify 933965Sjdp it under the terms of the GNU General Public License as published by 1033965Sjdp the Free Software Foundation; either version 2, or (at your option) 1133965Sjdp any later version. 1233965Sjdp 1333965Sjdp GAS is distributed in the hope that it will be useful, 1433965Sjdp but WITHOUT ANY WARRANTY; without even the implied warranty of 1533965Sjdp MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1633965Sjdp GNU General Public License for more details. 1733965Sjdp 1833965Sjdp You should have received a copy of the GNU General Public License 1933965Sjdp along with GAS; see the file COPYING. If not, write to the Free 2033965Sjdp Software Foundation, 59 Temple Place - Suite 330, Boston, MA 2133965Sjdp 02111-1307, USA. */ 2233965Sjdp 2333965Sjdp#ifndef GAS 2433965Sjdp#define GAS 1 2577298Sobrien/* I think this stuff is largely out of date. xoxorich. 2633965Sjdp * 2733965Sjdp * CAPITALISED names are #defined. 2833965Sjdp * "lowercaseH" is #defined if "lowercase.h" has been #include-d. 2933965Sjdp * "lowercaseT" is a typedef of "lowercase" objects. 3033965Sjdp * "lowercaseP" is type "pointer to object of type 'lowercase'". 3133965Sjdp * "lowercaseS" is typedef struct ... lowercaseS. 3233965Sjdp * 3333965Sjdp * #define DEBUG to enable all the "know" assertion tests. 3433965Sjdp * #define SUSPECT when debugging hash code. 3533965Sjdp * #define COMMON as "extern" for all modules except one, where you #define 3633965Sjdp * COMMON as "". 3733965Sjdp * If TEST is #defined, then we are testing a module: #define COMMON as "". 3833965Sjdp */ 3933965Sjdp 4033965Sjdp#include "config.h" 4160484Sobrien#include "bin-bugs.h" 4233965Sjdp 4333965Sjdp/* This is the code recommended in the autoconf documentation, almost 4433965Sjdp verbatim. If it doesn't work for you, let me know, and notify 4533965Sjdp djm@gnu.ai.mit.edu as well. */ 4633965Sjdp/* Added void* version for STDC case. This is to be compatible with 4733965Sjdp the declaration in bison.simple, used for m68k operand parsing. 4833965Sjdp --KR 1995.08.08 */ 4933965Sjdp/* Force void* decl for hpux. This is what Bison uses. --KR 1995.08.16 */ 5033965Sjdp 5189857Sobrien#ifndef __GNUC__ 5233965Sjdp# if HAVE_ALLOCA_H 5333965Sjdp# include <alloca.h> 5433965Sjdp# else 5533965Sjdp# ifdef _AIX 5689857Sobrien/* Indented so that pre-ansi C compilers will ignore it, rather than 5789857Sobrien choke on it. Some versions of AIX require this to be the first 5889857Sobrien thing in the file. */ 5933965Sjdp #pragma alloca 6033965Sjdp# else 6133965Sjdp# ifndef alloca /* predefined by HP cc +Olibcalls */ 6233965Sjdp# if !defined (__STDC__) && !defined (__hpux) 6338889Sjdpextern char *alloca (); 6433965Sjdp# else 6538889Sjdpextern void *alloca (); 6633965Sjdp# endif /* __STDC__, __hpux */ 6733965Sjdp# endif /* alloca */ 6833965Sjdp# endif /* _AIX */ 6933965Sjdp# endif /* HAVE_ALLOCA_H */ 7089857Sobrien#endif /* __GNUC__ */ 7133965Sjdp 7233965Sjdp/* Now, tend to the rest of the configuration. */ 7333965Sjdp 7477298Sobrien/* System include files first... */ 7533965Sjdp#include <stdio.h> 7633965Sjdp#ifdef HAVE_STRING_H 7733965Sjdp#include <string.h> 7833965Sjdp#else 7933965Sjdp#ifdef HAVE_STRINGS_H 8033965Sjdp#include <strings.h> 8133965Sjdp#endif 8233965Sjdp#endif 8333965Sjdp#ifdef HAVE_STDLIB_H 8433965Sjdp#include <stdlib.h> 8533965Sjdp#endif 8633965Sjdp#ifdef HAVE_UNISTD_H 8733965Sjdp#include <unistd.h> 8833965Sjdp#endif 8933965Sjdp#ifdef HAVE_SYS_TYPES_H 9033965Sjdp/* for size_t, pid_t */ 9133965Sjdp#include <sys/types.h> 9233965Sjdp#endif 9333965Sjdp 94104834Sobrien#include "getopt.h" 9533965Sjdp/* The first getopt value for machine-independent long options. 9633965Sjdp 150 isn't special; it's just an arbitrary non-ASCII char value. */ 9733965Sjdp#define OPTION_STD_BASE 150 9833965Sjdp/* The first getopt value for machine-dependent long options. 9977298Sobrien 190 gives the standard options room to grow. */ 10077298Sobrien#define OPTION_MD_BASE 190 10133965Sjdp 10233965Sjdp#ifdef DEBUG 10333965Sjdp#undef NDEBUG 10433965Sjdp#endif 10560484Sobrien#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 6) 10633965Sjdp#define __PRETTY_FUNCTION__ ((char*)0) 10733965Sjdp#endif 10833965Sjdp#if 0 10933965Sjdp 11033965Sjdp/* Handle lossage with assert.h. */ 11133965Sjdp#ifndef BROKEN_ASSERT 11233965Sjdp#include <assert.h> 11333965Sjdp#else /* BROKEN_ASSERT */ 11433965Sjdp#ifndef NDEBUG 11533965Sjdp#define assert(p) ((p) ? 0 : (as_assert (__FILE__, __LINE__, __PRETTY_FUNCTION__), 0)) 11633965Sjdp#else 11733965Sjdp#define assert(p) ((p), 0) 11833965Sjdp#endif 11933965Sjdp#endif /* BROKEN_ASSERT */ 12033965Sjdp 12133965Sjdp#else 12233965Sjdp 12333965Sjdp#define assert(P) ((P) ? 0 : (as_assert (__FILE__, __LINE__, __PRETTY_FUNCTION__), 0)) 12433965Sjdp#undef abort 12533965Sjdp#define abort() as_abort (__FILE__, __LINE__, __PRETTY_FUNCTION__) 12633965Sjdp 12733965Sjdp#endif 12833965Sjdp 12977298Sobrien/* Now GNU header files... */ 13060484Sobrien#include "ansidecl.h" 13133965Sjdp#ifdef BFD_ASSEMBLER 13260484Sobrien#include "bfd.h" 13333965Sjdp#endif 13460484Sobrien#include "libiberty.h" 13533965Sjdp 13633965Sjdp/* Define the standard progress macros. */ 13760484Sobrien#include "progress.h" 13833965Sjdp 13933965Sjdp/* This doesn't get taken care of anywhere. */ 14033965Sjdp#ifndef __MWERKS__ /* Metrowerks C chokes on the "defined (inline)" */ 14133965Sjdp#if !defined (__GNUC__) && !defined (inline) 14233965Sjdp#define inline 14333965Sjdp#endif 14433965Sjdp#endif /* !__MWERKS__ */ 14533965Sjdp 14633965Sjdp/* Other stuff from config.h. */ 14733965Sjdp#ifdef NEED_DECLARATION_STRSTR 14833965Sjdpextern char *strstr (); 14933965Sjdp#endif 15033965Sjdp#ifdef NEED_DECLARATION_MALLOC 15133965Sjdpextern PTR malloc (); 15233965Sjdpextern PTR realloc (); 15333965Sjdp#endif 15433965Sjdp#ifdef NEED_DECLARATION_FREE 15533965Sjdpextern void free (); 15633965Sjdp#endif 15733965Sjdp#ifdef NEED_DECLARATION_ERRNO 15833965Sjdpextern int errno; 15933965Sjdp#endif 16060484Sobrien#ifdef NEED_DECLARATION_ENVIRON 16160484Sobrienextern char **environ; 16260484Sobrien#endif 16333965Sjdp 16438889Sjdp/* This is needed for VMS. */ 16538889Sjdp#if ! defined (HAVE_UNLINK) && defined (HAVE_REMOVE) 16633965Sjdp#define unlink remove 16733965Sjdp#endif 16833965Sjdp 16933965Sjdp/* Hack to make "gcc -Wall" not complain about obstack macros. */ 17033965Sjdp#if !defined (memcpy) && !defined (bcopy) 171104834Sobrien#define bcopy(src,dest,size) memcpy (dest, src, size) 17233965Sjdp#endif 17333965Sjdp 17433965Sjdp/* Make Saber happier on obstack.h. */ 17533965Sjdp#ifdef SABER 17633965Sjdp#undef __PTR_TO_INT 17777298Sobrien#define __PTR_TO_INT(P) ((int) (P)) 17833965Sjdp#undef __INT_TO_PTR 17977298Sobrien#define __INT_TO_PTR(P) ((char *) (P)) 18033965Sjdp#endif 18133965Sjdp 18233965Sjdp#ifndef __LINE__ 18333965Sjdp#define __LINE__ "unknown" 18433965Sjdp#endif /* __LINE__ */ 18533965Sjdp 18633965Sjdp#ifndef __FILE__ 18733965Sjdp#define __FILE__ "unknown" 18833965Sjdp#endif /* __FILE__ */ 18933965Sjdp 19033965Sjdp#ifndef FOPEN_WB 191130561Sobrien#if defined GO32 || defined __MINGW32__ 19233965Sjdp#include "fopen-bin.h" 19333965Sjdp#else 19433965Sjdp#include "fopen-same.h" 19533965Sjdp#endif 19633965Sjdp#endif 19733965Sjdp 19833965Sjdp#ifndef EXIT_SUCCESS 19933965Sjdp#define EXIT_SUCCESS 0 20033965Sjdp#define EXIT_FAILURE 1 20133965Sjdp#endif 20233965Sjdp 20360484Sobrien#ifndef SEEK_SET 20460484Sobrien#define SEEK_SET 0 20560484Sobrien#endif 20660484Sobrien 20733965Sjdp#define obstack_chunk_alloc xmalloc 20833965Sjdp#define obstack_chunk_free xfree 20933965Sjdp 21033965Sjdp#define xfree free 21133965Sjdp 21260484Sobrien#include "asintl.h" 21360484Sobrien 21477298Sobrien#define BAD_CASE(val) \ 21577298Sobrien { \ 21677298Sobrien as_fatal (_("Case value %ld unexpected at line %d of file \"%s\"\n"), \ 21777298Sobrien (long) val, __LINE__, __FILE__); \ 21877298Sobrien } 21933965Sjdp 22033965Sjdp#include "flonum.h" 22133965Sjdp 22233965Sjdp/* These are assembler-wide concepts */ 22333965Sjdp 22433965Sjdp#ifdef BFD_ASSEMBLER 22533965Sjdpextern bfd *stdoutput; 22633965Sjdptypedef bfd_vma addressT; 22733965Sjdptypedef bfd_signed_vma offsetT; 22833965Sjdp#else 22933965Sjdptypedef unsigned long addressT; 23033965Sjdptypedef long offsetT; 23133965Sjdp#endif 23233965Sjdp 23333965Sjdp/* Type of symbol value, etc. For use in prototypes. */ 23433965Sjdptypedef addressT valueT; 23533965Sjdp 23633965Sjdp#ifndef COMMON 23733965Sjdp#ifdef TEST 23877298Sobrien#define COMMON /* declare our COMMONs storage here. */ 23933965Sjdp#else 240130561Sobrien#define COMMON extern /* our commons live elsewhere */ 24133965Sjdp#endif 24233965Sjdp#endif 24333965Sjdp/* COMMON now defined */ 24433965Sjdp 24533965Sjdp#ifdef DEBUG 24633965Sjdp#ifndef know 24733965Sjdp#define know(p) assert(p) /* Verify our assumptions! */ 24833965Sjdp#endif /* not yet defined */ 24933965Sjdp#else 25033965Sjdp#define know(p) /* know() checks are no-op.ed */ 25133965Sjdp#endif 25233965Sjdp 25333965Sjdp/* input_scrub.c */ 25433965Sjdp 25577298Sobrien/* Supplies sanitised buffers to read.c. 25677298Sobrien Also understands printing line-number part of error messages. */ 25733965Sjdp 25833965Sjdp/* subsegs.c Sub-segments. Also, segment(=expression type)s.*/ 25933965Sjdp 26033965Sjdp#ifndef BFD_ASSEMBLER 26133965Sjdp 26233965Sjdp#ifdef MANY_SEGMENTS 26333965Sjdp#include "bfd.h" 26433965Sjdp#define N_SEGMENTS 40 26533965Sjdp#define SEG_NORMAL(x) ((x) >= SEG_E0 && (x) <= SEG_E39) 26633965Sjdp#define SEG_LIST SEG_E0,SEG_E1,SEG_E2,SEG_E3,SEG_E4,SEG_E5,SEG_E6,SEG_E7,SEG_E8,SEG_E9,\ 26733965Sjdp SEG_E10,SEG_E11,SEG_E12,SEG_E13,SEG_E14,SEG_E15,SEG_E16,SEG_E17,SEG_E18,SEG_E19,\ 26833965Sjdp SEG_E20,SEG_E21,SEG_E22,SEG_E23,SEG_E24,SEG_E25,SEG_E26,SEG_E27,SEG_E28,SEG_E29,\ 26933965Sjdp SEG_E30,SEG_E31,SEG_E32,SEG_E33,SEG_E34,SEG_E35,SEG_E36,SEG_E37,SEG_E38,SEG_E39 27033965Sjdp#define SEG_TEXT SEG_E0 27133965Sjdp#define SEG_DATA SEG_E1 27233965Sjdp#define SEG_BSS SEG_E2 27333965Sjdp#define SEG_LAST SEG_E39 27433965Sjdp#else 27533965Sjdp#define N_SEGMENTS 3 27633965Sjdp#define SEG_NORMAL(x) ((x) == SEG_TEXT || (x) == SEG_DATA || (x) == SEG_BSS) 27733965Sjdp#define SEG_LIST SEG_TEXT,SEG_DATA,SEG_BSS 27833965Sjdp#endif 27933965Sjdp 28077298Sobrientypedef enum _segT { 28177298Sobrien SEG_ABSOLUTE = 0, 28277298Sobrien SEG_LIST, 28377298Sobrien SEG_UNKNOWN, 28477298Sobrien SEG_GOOF, /* Only happens if AS has a logic error. */ 28577298Sobrien /* Invented so we don't crash printing */ 28677298Sobrien /* error message involving weird segment. */ 28777298Sobrien SEG_EXPR, /* Intermediate expression values. */ 28877298Sobrien SEG_DEBUG, /* Debug segment */ 28977298Sobrien SEG_NTV, /* Transfert vector preload segment */ 29077298Sobrien SEG_PTV, /* Transfert vector postload segment */ 29177298Sobrien SEG_REGISTER /* Mythical: a register-valued expression */ 29277298Sobrien} segT; 29333965Sjdp 29433965Sjdp#define SEG_MAXIMUM_ORDINAL (SEG_REGISTER) 29533965Sjdp#else 29633965Sjdptypedef asection *segT; 29733965Sjdp#define SEG_NORMAL(SEG) ((SEG) != absolute_section \ 29833965Sjdp && (SEG) != undefined_section \ 29933965Sjdp && (SEG) != reg_section \ 30033965Sjdp && (SEG) != expr_section) 30133965Sjdp#endif 30233965Sjdptypedef int subsegT; 30333965Sjdp 304130561Sobrien/* What subseg we are accessing now? */ 30533965SjdpCOMMON subsegT now_subseg; 30633965Sjdp 30777298Sobrien/* Segment our instructions emit to. */ 30833965SjdpCOMMON segT now_seg; 30933965Sjdp 31033965Sjdp#ifdef BFD_ASSEMBLER 31133965Sjdp#define segment_name(SEG) bfd_get_section_name (stdoutput, SEG) 31233965Sjdp#else 31333965Sjdpextern char const *const seg_name[]; 31433965Sjdp#define segment_name(SEG) seg_name[(int) (SEG)] 31533965Sjdp#endif 31633965Sjdp 31733965Sjdp#ifndef BFD_ASSEMBLER 31833965Sjdpextern int section_alignment[]; 31933965Sjdp#endif 32033965Sjdp 32133965Sjdp#ifdef BFD_ASSEMBLER 32233965Sjdpextern segT reg_section, expr_section; 32333965Sjdp/* Shouldn't these be eliminated someday? */ 32433965Sjdpextern segT text_section, data_section, bss_section; 32533965Sjdp#define absolute_section bfd_abs_section_ptr 32633965Sjdp#define undefined_section bfd_und_section_ptr 32733965Sjdp#else 32833965Sjdp#define reg_section SEG_REGISTER 32933965Sjdp#define expr_section SEG_EXPR 33033965Sjdp#define text_section SEG_TEXT 33133965Sjdp#define data_section SEG_DATA 33233965Sjdp#define bss_section SEG_BSS 33333965Sjdp#define absolute_section SEG_ABSOLUTE 33433965Sjdp#define undefined_section SEG_UNKNOWN 33533965Sjdp#endif 33633965Sjdp 33733965Sjdp/* relax() */ 33833965Sjdp 33977298Sobrienenum _relax_state { 34077298Sobrien /* Variable chars to be repeated fr_offset times. 34177298Sobrien Fr_symbol unused. Used with fr_offset == 0 for a 34277298Sobrien constant length frag. */ 34377298Sobrien rs_fill = 1, 34433965Sjdp 34577298Sobrien /* Align. The fr_offset field holds the power of 2 to which to 34677298Sobrien align. The fr_var field holds the number of characters in the 34777298Sobrien fill pattern. The fr_subtype field holds the maximum number of 34877298Sobrien bytes to skip when aligning, or 0 if there is no maximum. */ 34977298Sobrien rs_align, 35033965Sjdp 35177298Sobrien /* Align code. The fr_offset field holds the power of 2 to which 35277298Sobrien to align. This type is only generated by machine specific 35377298Sobrien code, which is normally responsible for handling the fill 35477298Sobrien pattern. The fr_subtype field holds the maximum number of 35577298Sobrien bytes to skip when aligning, or 0 if there is no maximum. */ 35677298Sobrien rs_align_code, 35733965Sjdp 35877298Sobrien /* Test for alignment. Like rs_align, but used by several targets 35977298Sobrien to warn if data is not properly aligned. */ 36077298Sobrien rs_align_test, 36133965Sjdp 36277298Sobrien /* Org: Fr_offset, fr_symbol: address. 1 variable char: fill 36377298Sobrien character. */ 36477298Sobrien rs_org, 36577298Sobrien 36633965Sjdp#ifndef WORKING_DOT_WORD 36777298Sobrien /* JF: gunpoint */ 36877298Sobrien rs_broken_word, 36933965Sjdp#endif 37033965Sjdp 37177298Sobrien /* machine-specific relaxable (or similarly alterable) instruction */ 37277298Sobrien rs_machine_dependent, 37333965Sjdp 37477298Sobrien /* .space directive with expression operand that needs to be computed 37577298Sobrien later. Similar to rs_org, but different. 37677298Sobrien fr_symbol: operand 37777298Sobrien 1 variable char: fill character */ 37877298Sobrien rs_space, 37938889Sjdp 38077298Sobrien /* A DWARF leb128 value; only ELF uses this. The subtype is 0 for 38177298Sobrien unsigned, 1 for signed. */ 38277298Sobrien rs_leb128, 38338889Sjdp 38477298Sobrien /* Exception frame information which we may be able to optimize. */ 38577298Sobrien rs_cfa, 38633965Sjdp 38777298Sobrien /* Cross-fragment dwarf2 line number optimization. */ 38877298Sobrien rs_dwarf2dbg 38977298Sobrien}; 39077298Sobrien 39133965Sjdptypedef enum _relax_state relax_stateT; 39233965Sjdp 39333965Sjdp/* This type is used in prototypes, so it can't be a type that will be 39433965Sjdp widened for argument passing. */ 39533965Sjdptypedef unsigned int relax_substateT; 39633965Sjdp 39733965Sjdp/* Enough bits for address, but still an integer type. 39833965Sjdp Could be a problem, cross-assembling for 64-bit machines. */ 39933965Sjdptypedef addressT relax_addressT; 40033965Sjdp 40133965Sjdp/* main program "as.c" (command arguments etc) */ 40233965Sjdp 40333965SjdpCOMMON unsigned char flag_no_comments; /* -f */ 40433965SjdpCOMMON unsigned char flag_debug; /* -D */ 40533965SjdpCOMMON unsigned char flag_signed_overflow_ok; /* -J */ 40633965Sjdp#ifndef WORKING_DOT_WORD 40733965SjdpCOMMON unsigned char flag_warn_displacement; /* -K */ 40833965Sjdp#endif 40933965Sjdp 41033965Sjdp/* True if local symbols should be retained. */ 41133965SjdpCOMMON int flag_keep_locals; /* -L */ 41233965Sjdp 41333965Sjdp/* True if we are assembling in MRI mode. */ 41433965SjdpCOMMON int flag_mri; 41533965Sjdp 41633965Sjdp/* Should the data section be made read-only and appended to the text 41733965Sjdp section? */ 41833965SjdpCOMMON unsigned char flag_readonly_data_in_text; /* -R */ 41933965Sjdp 42033965Sjdp/* True if warnings should be inhibited. */ 42133965SjdpCOMMON int flag_no_warnings; /* -W */ 42233965Sjdp 42360484Sobrien/* True if warnings count as errors. */ 42460484SobrienCOMMON int flag_fatal_warnings; /* --fatal-warnings */ 42560484Sobrien 42633965Sjdp/* True if we should attempt to generate output even if non-fatal errors 42733965Sjdp are detected. */ 42833965SjdpCOMMON unsigned char flag_always_generate_output; /* -Z */ 42933965Sjdp 43077298Sobrien/* This is true if the assembler should output time and space usage. */ 43133965SjdpCOMMON unsigned char flag_print_statistics; 43233965Sjdp 43338889Sjdp/* True if local absolute symbols are to be stripped. */ 43438889SjdpCOMMON int flag_strip_local_absolute; 43538889Sjdp 43638889Sjdp/* True if we should generate a traditional format object file. */ 43738889SjdpCOMMON int flag_traditional_format; 43838889Sjdp 439130561Sobrien/* TRUE if .note.GNU-stack section with SEC_CODE should be created */ 440130561SobrienCOMMON int flag_execstack; 441130561Sobrien 442130561Sobrien/* TRUE if .note.GNU-stack section with SEC_CODE should be created */ 443130561SobrienCOMMON int flag_noexecstack; 444130561Sobrien 44533965Sjdp/* name of emitted object file */ 44633965SjdpCOMMON char *out_file_name; 44733965Sjdp 44833965Sjdp/* name of file defining extensions to the basic instruction set */ 44933965SjdpCOMMON char *insttbl_file_name; 45033965Sjdp 45177298Sobrien/* TRUE if we need a second pass. */ 45233965SjdpCOMMON int need_pass_2; 45333965Sjdp 45433965Sjdp/* TRUE if we should do no relaxing, and 45533965Sjdp leave lots of padding. */ 45633965SjdpCOMMON int linkrelax; 45733965Sjdp 45833965Sjdp/* TRUE if we should produce a listing. */ 45933965Sjdpextern int listing; 46033965Sjdp 46177298Sobrien/* Type of debugging information we should generate. We currently support 46277298Sobrien stabs, ECOFF, and DWARF2. 46338889Sjdp 46477298Sobrien NOTE! This means debug information about the assembly source code itself 46577298Sobrien and _not_ about possible debug information from a high-level language. 46677298Sobrien This is especially relevant to DWARF2, since the compiler may emit line 46777298Sobrien number directives that the assembler resolves. */ 46838889Sjdp 46977298Sobrienenum debug_info_type { 47077298Sobrien DEBUG_UNSPECIFIED, 47177298Sobrien DEBUG_NONE, 47277298Sobrien DEBUG_STABS, 47377298Sobrien DEBUG_ECOFF, 47477298Sobrien DEBUG_DWARF, 47577298Sobrien DEBUG_DWARF2 47677298Sobrien}; 47777298Sobrien 47838889Sjdpextern enum debug_info_type debug_type; 479130561Sobrienextern int use_gnu_debug_info_extensions; 48038889Sjdp 48133965Sjdp/* Maximum level of macro nesting. */ 48233965Sjdpextern int max_macro_nest; 48333965Sjdp 484130561Sobrien/* Verbosity level. */ 485130561Sobrienextern int verbose; 486130561Sobrien 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 */ 495130561Sobrien void (*poc_handler) (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 535130561Sobrien#define PRINTF_LIKE(FCN) void FCN (const char *format, ...) 536130561Sobrien#define PRINTF_WHERE_LIKE(FCN) void FCN (char *file, \ 537130561Sobrien unsigned int line, \ 538130561Sobrien 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 556130561Sobrienvoid as_assert (const char *, int, const char *); 557130561Sobrienvoid as_abort (const char *, int, const char *) ATTRIBUTE_NORETURN; 55833965Sjdp 559130561Sobrienvoid fprint_value (FILE *file, addressT value); 560130561Sobrienvoid sprint_value (char *buf, addressT value); 56133965Sjdp 562130561Sobrienint had_errors (void); 563130561Sobrienint had_warnings (void); 56433965Sjdp 565130561Sobrienvoid print_version_id (void); 566130561Sobrienchar *app_push (void); 567130561Sobrienchar *atof_ieee (char *str, int what_kind, LITTLENUM_TYPE * words); 568130561Sobrienchar *input_scrub_include_file (char *filename, char *position); 569130561Sobrienextern void input_scrub_insert_line (const char *line); 570130561Sobrienextern void input_scrub_insert_file (char *path); 571130561Sobrienchar *input_scrub_new_file (char *filename); 572130561Sobrienchar *input_scrub_next_buffer (char **bufp); 573130561Sobrienint do_scrub_chars (int (*get) (char *, int), char *to, int tolen); 574130561Sobrienint gen_to_words (LITTLENUM_TYPE * words, int precision, 575130561Sobrien long exponent_bits); 576130561Sobrienint had_err (void); 577130561Sobrienint ignore_input (void); 578130561Sobrienvoid cond_finish_check (int); 579130561Sobrienvoid cond_exit_macro (int); 580130561Sobrienint seen_at_least_1_file (void); 581130561Sobrienvoid app_pop (char *arg); 582130561Sobrienvoid as_howmuch (FILE * stream); 583130561Sobrienvoid as_perror (const char *gripe, const char *filename); 584130561Sobrienvoid as_where (char **namep, unsigned int *linep); 585130561Sobrienvoid bump_line_counters (void); 586130561Sobrienvoid do_scrub_begin (int); 587130561Sobrienvoid input_scrub_begin (void); 588130561Sobrienvoid input_scrub_close (void); 589130561Sobrienvoid input_scrub_end (void); 590130561Sobrienint new_logical_line (char *fname, int line_number); 591130561Sobrienvoid subsegs_begin (void); 592130561Sobrienvoid subseg_change (segT seg, int subseg); 593130561SobriensegT subseg_new (const char *name, subsegT subseg); 594130561SobriensegT subseg_force_new (const char *name, subsegT subseg); 595130561Sobrienvoid subseg_set (segT seg, subsegT subseg); 59633965Sjdp#ifdef BFD_ASSEMBLER 597130561SobriensegT subseg_get (const char *, int); 59833965Sjdp#endif 599130561Sobrienint subseg_text_p (segT); 60033965Sjdp 601130561Sobrienvoid start_dependencies (char *); 602130561Sobrienvoid register_dependency (char *); 603130561Sobrienvoid print_dependencies (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 */ 613130561SobrienvalueT add_to_literal_pool (symbolS *, valueT, segT, int); 61433965Sjdp#endif 61533965Sjdp 616130561Sobrienint check_eh_frame (struct expressionS *, unsigned int *); 617130561Sobrienint eh_frame_estimate_size_before_relax (fragS *); 618130561Sobrienint eh_frame_relax_frag (fragS *); 619130561Sobrienvoid eh_frame_convert_frag (fragS *); 62038889Sjdp 621130561Sobrienint generic_force_reloc (struct fix *); 622130561Sobrien 62333965Sjdp#include "expr.h" /* Before targ-*.h */ 62433965Sjdp 62533965Sjdp/* this one starts the chain of target dependant headers */ 62633965Sjdp#include "targ-env.h" 62733965Sjdp 628130561Sobrien#ifdef OBJ_MAYBE_ELF 629130561Sobrien#define IS_ELF (OUTPUT_FLAVOR == bfd_target_elf_flavour) 630130561Sobrien#else 631130561Sobrien#ifdef OBJ_ELF 632130561Sobrien#define IS_ELF 1 633130561Sobrien#else 634130561Sobrien#define IS_ELF 0 63577298Sobrien#endif 636130561Sobrien#endif 63777298Sobrien 63833965Sjdp#include "write.h" 63933965Sjdp#include "frags.h" 64033965Sjdp#include "hash.h" 64133965Sjdp#include "read.h" 64233965Sjdp#include "symbols.h" 64333965Sjdp 64433965Sjdp#include "tc.h" 64533965Sjdp#include "obj.h" 64633965Sjdp 64733965Sjdp#ifdef USE_EMULATIONS 64833965Sjdp#include "emul.h" 64933965Sjdp#endif 65033965Sjdp#include "listing.h" 65133965Sjdp 65260484Sobrien#ifdef TC_M68K 65360484Sobrien/* True if we are assembling in m68k MRI mode. */ 65460484SobrienCOMMON int flag_m68k_mri; 65560484Sobrien#else 65660484Sobrien#define flag_m68k_mri 0 65760484Sobrien#endif 65860484Sobrien 65977298Sobrien#ifdef WARN_COMMENTS 66077298SobrienCOMMON int warn_comment; 66177298SobrienCOMMON unsigned int found_comment; 66277298SobrienCOMMON char *found_comment_file; 66377298Sobrien#endif 66477298Sobrien 66560484Sobrien#ifndef NUMBERS_WITH_SUFFIX 66660484Sobrien#define NUMBERS_WITH_SUFFIX 0 66760484Sobrien#endif 66860484Sobrien 66933965Sjdp#ifndef LOCAL_LABELS_DOLLAR 67033965Sjdp#define LOCAL_LABELS_DOLLAR 0 67133965Sjdp#endif 67233965Sjdp 67333965Sjdp#ifndef LOCAL_LABELS_FB 67433965Sjdp#define LOCAL_LABELS_FB 0 67533965Sjdp#endif 67633965Sjdp 67760484Sobrien#ifndef LABELS_WITHOUT_COLONS 67860484Sobrien#define LABELS_WITHOUT_COLONS 0 67960484Sobrien#endif 68060484Sobrien 68160484Sobrien#ifndef NO_PSEUDO_DOT 68260484Sobrien#define NO_PSEUDO_DOT 0 68360484Sobrien#endif 68460484Sobrien 68538889Sjdp#ifndef TEXT_SECTION_NAME 68638889Sjdp#define TEXT_SECTION_NAME ".text" 68738889Sjdp#define DATA_SECTION_NAME ".data" 68838889Sjdp#define BSS_SECTION_NAME ".bss" 68938889Sjdp#endif 69038889Sjdp 69160484Sobrien#ifndef OCTETS_PER_BYTE_POWER 69260484Sobrien#define OCTETS_PER_BYTE_POWER 0 69360484Sobrien#endif 69460484Sobrien#ifndef OCTETS_PER_BYTE 69560484Sobrien#define OCTETS_PER_BYTE (1<<OCTETS_PER_BYTE_POWER) 69660484Sobrien#endif 69760484Sobrien#if OCTETS_PER_BYTE != (1<<OCTETS_PER_BYTE_POWER) 69860484Sobrien #error "Octets per byte conflicts with its power-of-two definition!" 69960484Sobrien#endif 70060484Sobrien 70133965Sjdp#endif /* GAS */ 702