]> Git Repo - binutils.git/blame - gas/config/obj-coff.h
* main.c: Move entire file except for #ifndef MAIN_OVERRIDE code
[binutils.git] / gas / config / obj-coff.h
CommitLineData
fecd2382 1/* coff object file format
71b4de6f 2 Copyright (C) 1989, 1990, 1991, 1992, 1994 Free Software Foundation, Inc.
ba75c1ed 3
a39116f1 4 This file is part of GAS.
ba75c1ed 5
a39116f1
RP
6 GAS is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
ba75c1ed 10
a39116f1
RP
11 GAS is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
ba75c1ed 15
a39116f1
RP
16 You should have received a copy of the GNU General Public License
17 along with GAS; see the file COPYING. If not, write to
18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
fecd2382 19
8fb85d50
KR
20#ifndef OBJ_FORMAT_H
21#define OBJ_FORMAT_H
22
fecd2382
RP
23#define OBJ_COFF 1
24
25#include "targ-cpu.h"
26
8fb85d50
KR
27#include "bfd.h"
28
85051959
ILT
29/* This internal_lineno crap is to stop namespace pollution from the
30 bfd internal coff headerfile. */
7c328fb0 31
7c328fb0 32#define internal_lineno bfd_internal_lineno
a39116f1 33#include "coff/internal.h"
7c328fb0 34#undef internal_lineno
85051959 35
85051959 36#include "../bfd/libcoff.h"
85051959 37
257df791
ILT
38#ifdef TC_PPC
39#include "coff/rs6000.h"
40#endif
41
42#ifdef TC_SPARC
43#include "coff/sparc.h"
44#ifdef TE_LYNX
45#define TARGET_FORMAT "coff-sparc-lynx"
46#else
47#define TARGET_FORMAT "coff-sparc"
48#endif
49#endif
50
8fb85d50
KR
51#ifdef TC_I386
52#include "coff/i386.h"
53#ifndef TARGET_FORMAT
54#define TARGET_FORMAT "coff-i386"
55#endif
56#endif
57
58#ifdef TC_M68K
59#include "coff/m68k.h"
60#ifndef TARGET_FORMAT
61#define TARGET_FORMAT "coff-m68k"
62#endif
63#endif
64
65#ifdef TC_A29K
66#include "coff/a29k.h"
67#define TARGET_FORMAT "coff-a29k-big"
68#endif
69
70#ifdef TC_I960
71#include "coff/i960.h"
72#define TARGET_FORMAT "coff-Intel-little"
73#endif
74
fecd2382
RP
75/* SYMBOL TABLE */
76
a39116f1 77/* targets may also set this */
8fb85d50 78#undef SYMBOLS_NEED_BACKPOINTERS
fecd2382 79#define SYMBOLS_NEED_BACKPOINTERS 1
fecd2382 80
257df791
ILT
81/* Alter the field names, for now, until we've fixed up the other
82 references to use the new name. */
85051959 83#ifdef TC_I960
257df791
ILT
84#define TC_SYMFIELD_TYPE struct symbol *
85#define sy_tc bal
85051959
ILT
86#endif
87
257df791
ILT
88#define OBJ_SYMFIELD_TYPE unsigned long
89#define sy_obj sy_flags
85051959
ILT
90
91#ifndef OBJ_COFF_MAX_AUXENTRIES
92#define OBJ_COFF_MAX_AUXENTRIES 1
93#endif
94
85051959 95
85051959 96#define SYM_AUXENT(S) (&coffsymbol ((S)->bsym)->native[1].u.auxent)
fecd2382 97
fecd2382
RP
98#define DO_NOT_STRIP 0
99#define DO_STRIP 1
100
75d20ac8
KR
101extern void obj_coff_section PARAMS ((int));
102
85051959
ILT
103/* The number of auxiliary entries */
104#define S_GET_NUMBER_AUXILIARY(s) (coffsymbol((s)->bsym)->native->u.syment.n_numaux)
85051959
ILT
105/* The number of auxiliary entries */
106#define S_SET_NUMBER_AUXILIARY(s,v) (S_GET_NUMBER_AUXILIARY (s) = (v))
107
108/* True if a symbol name is in the string table, i.e. its length is > 8. */
109#define S_IS_STRING(s) (strlen(S_GET_NAME(s)) > 8 ? 1 : 0)
110
75d20ac8 111extern int S_SET_DATA_TYPE PARAMS ((struct symbol *, int));
257df791
ILT
112extern int S_SET_STORAGE_CLASS PARAMS ((struct symbol *, int));
113extern int S_GET_STORAGE_CLASS PARAMS ((struct symbol *));
75d20ac8 114extern void SA_SET_SYM_ENDNDX PARAMS ((struct symbol *, struct symbol *));
85051959 115
fecd2382
RP
116/* Auxiliary entry macros. SA_ stands for symbol auxiliary */
117/* Omit the tv related fields */
118/* Accessors */
85051959 119
85051959 120#define SA_GET_SYM_TAGNDX(s) (SYM_AUXENT (s)->x_sym.x_tagndx.l)
85051959
ILT
121#define SA_GET_SYM_LNNO(s) (SYM_AUXENT (s)->x_sym.x_misc.x_lnsz.x_lnno)
122#define SA_GET_SYM_SIZE(s) (SYM_AUXENT (s)->x_sym.x_misc.x_lnsz.x_size)
123#define SA_GET_SYM_FSIZE(s) (SYM_AUXENT (s)->x_sym.x_misc.x_fsize)
124#define SA_GET_SYM_LNNOPTR(s) (SYM_AUXENT (s)->x_sym.x_fcnary.x_fcn.x_lnnoptr)
85051959 125#define SA_GET_SYM_ENDNDX(s) (SYM_AUXENT (s)->x_sym.x_fcnary.x_fcn.x_endndx)
85051959
ILT
126#define SA_GET_SYM_DIMEN(s,i) (SYM_AUXENT (s)->x_sym.x_fcnary.x_ary.x_dimen[(i)])
127#define SA_GET_FILE_FNAME(s) (SYM_AUXENT (s)->x_file.x_fname)
128#define SA_GET_SCN_SCNLEN(s) (SYM_AUXENT (s)->x_scn.x_scnlen)
129#define SA_GET_SCN_NRELOC(s) (SYM_AUXENT (s)->x_scn.x_nreloc)
130#define SA_GET_SCN_NLINNO(s) (SYM_AUXENT (s)->x_scn.x_nlinno)
fecd2382 131
85051959
ILT
132#define SA_SET_SYM_LNNO(s,v) (SYM_AUXENT (s)->x_sym.x_misc.x_lnsz.x_lnno=(v))
133#define SA_SET_SYM_SIZE(s,v) (SYM_AUXENT (s)->x_sym.x_misc.x_lnsz.x_size=(v))
134#define SA_SET_SYM_FSIZE(s,v) (SYM_AUXENT (s)->x_sym.x_misc.x_fsize=(v))
135#define SA_SET_SYM_LNNOPTR(s,v) (SYM_AUXENT (s)->x_sym.x_fcnary.x_fcn.x_lnnoptr=(v))
136#define SA_SET_SYM_DIMEN(s,i,v) (SYM_AUXENT (s)->x_sym.x_fcnary.x_ary.x_dimen[(i)]=(v))
137#define SA_SET_FILE_FNAME(s,v) strncpy(SYM_AUXENT (s)->x_file.x_fname,(v),FILNMLEN)
138#define SA_SET_SCN_SCNLEN(s,v) (SYM_AUXENT (s)->x_scn.x_scnlen=(v))
139#define SA_SET_SCN_NRELOC(s,v) (SYM_AUXENT (s)->x_scn.x_nreloc=(v))
140#define SA_SET_SCN_NLINNO(s,v) (SYM_AUXENT (s)->x_scn.x_nlinno=(v))
fecd2382
RP
141
142/*
143 * Internal use only definitions. SF_ stands for symbol flags.
144 *
145 * These values can be assigned to sy_symbol.ost_flags field of a symbolS.
146 *
147 * You'll break i960 if you shift the SYSPROC bits anywhere else. for
148 * more on the balname/callname hack, see tc-i960.h. b.out is done
149 * differently.
150 */
151
ba75c1ed
KR
152#define SF_I960_MASK (0x000001ff) /* Bits 0-8 are used by the i960 port. */
153#define SF_SYSPROC (0x0000003f) /* bits 0-5 are used to store the sysproc number */
154#define SF_IS_SYSPROC (0x00000040) /* bit 6 marks symbols that are sysprocs */
155#define SF_BALNAME (0x00000080) /* bit 7 marks BALNAME symbols */
156#define SF_CALLNAME (0x00000100) /* bit 8 marks CALLNAME symbols */
fecd2382 157
ba75c1ed 158#define SF_NORMAL_MASK (0x0000ffff) /* bits 12-15 are general purpose. */
fecd2382 159
ba75c1ed
KR
160#define SF_STATICS (0x00001000) /* Mark the .text & all symbols */
161#define SF_DEFINED (0x00002000) /* Symbol is defined in this file */
162#define SF_STRING (0x00004000) /* Symbol name length > 8 */
163#define SF_LOCAL (0x00008000) /* Symbol must not be emitted */
fecd2382 164
ba75c1ed 165#define SF_DEBUG_MASK (0xffff0000) /* bits 16-31 are debug info */
fecd2382 166
ba75c1ed
KR
167#define SF_FUNCTION (0x00010000) /* The symbol is a function */
168#define SF_PROCESS (0x00020000) /* Process symbol before write */
169#define SF_TAGGED (0x00040000) /* Is associated with a tag */
170#define SF_TAG (0x00080000) /* Is a tag */
171#define SF_DEBUG (0x00100000) /* Is in debug or abs section */
172#define SF_GET_SEGMENT (0x00200000) /* Get the section of the forward symbol. */
a39116f1 173/* All other bits are unused. */
fecd2382
RP
174
175/* Accessors */
85051959
ILT
176#define SF_GET(s) ((s)->sy_flags)
177#define SF_GET_DEBUG(s) ((s)->bsym->flags & BSF_DEBUGGING)
178#define SF_SET_DEBUG(s) ((s)->bsym->flags |= BSF_DEBUGGING)
85051959
ILT
179#define SF_GET_NORMAL_FIELD(s) (SF_GET (s) & SF_NORMAL_MASK)
180#define SF_GET_DEBUG_FIELD(s) (SF_GET (s) & SF_DEBUG_MASK)
181#define SF_GET_FILE(s) (SF_GET (s) & SF_FILE)
182#define SF_GET_STATICS(s) (SF_GET (s) & SF_STATICS)
183#define SF_GET_DEFINED(s) (SF_GET (s) & SF_DEFINED)
184#define SF_GET_STRING(s) (SF_GET (s) & SF_STRING)
185#define SF_GET_LOCAL(s) (SF_GET (s) & SF_LOCAL)
186#define SF_GET_FUNCTION(s) (SF_GET (s) & SF_FUNCTION)
187#define SF_GET_PROCESS(s) (SF_GET (s) & SF_PROCESS)
188#define SF_GET_TAGGED(s) (SF_GET (s) & SF_TAGGED)
189#define SF_GET_TAG(s) (SF_GET (s) & SF_TAG)
190#define SF_GET_GET_SEGMENT(s) (SF_GET (s) & SF_GET_SEGMENT)
191#define SF_GET_I960(s) (SF_GET (s) & SF_I960_MASK) /* used by i960 */
192#define SF_GET_BALNAME(s) (SF_GET (s) & SF_BALNAME) /* used by i960 */
193#define SF_GET_CALLNAME(s) (SF_GET (s) & SF_CALLNAME) /* used by i960 */
194#define SF_GET_IS_SYSPROC(s) (SF_GET (s) & SF_IS_SYSPROC) /* used by i960 */
195#define SF_GET_SYSPROC(s) (SF_GET (s) & SF_SYSPROC) /* used by i960 */
fecd2382
RP
196
197/* Modifiers */
85051959
ILT
198#define SF_SET(s,v) (SF_GET (s) = (v))
199#define SF_SET_NORMAL_FIELD(s,v)(SF_GET (s) |= ((v) & SF_NORMAL_MASK))
200#define SF_SET_DEBUG_FIELD(s,v) (SF_GET (s) |= ((v) & SF_DEBUG_MASK))
201#define SF_SET_FILE(s) (SF_GET (s) |= SF_FILE)
202#define SF_SET_STATICS(s) (SF_GET (s) |= SF_STATICS)
203#define SF_SET_DEFINED(s) (SF_GET (s) |= SF_DEFINED)
204#define SF_SET_STRING(s) (SF_GET (s) |= SF_STRING)
205#define SF_SET_LOCAL(s) (SF_GET (s) |= SF_LOCAL)
206#define SF_CLEAR_LOCAL(s) (SF_GET (s) &= ~SF_LOCAL)
207#define SF_SET_FUNCTION(s) (SF_GET (s) |= SF_FUNCTION)
208#define SF_SET_PROCESS(s) (SF_GET (s) |= SF_PROCESS)
209#define SF_SET_TAGGED(s) (SF_GET (s) |= SF_TAGGED)
210#define SF_SET_TAG(s) (SF_GET (s) |= SF_TAG)
211#define SF_SET_GET_SEGMENT(s) (SF_GET (s) |= SF_GET_SEGMENT)
212#define SF_SET_I960(s,v) (SF_GET (s) |= ((v) & SF_I960_MASK)) /* used by i960 */
213#define SF_SET_BALNAME(s) (SF_GET (s) |= SF_BALNAME) /* used by i960 */
214#define SF_SET_CALLNAME(s) (SF_GET (s) |= SF_CALLNAME) /* used by i960 */
215#define SF_SET_IS_SYSPROC(s) (SF_GET (s) |= SF_IS_SYSPROC) /* used by i960 */
216#define SF_SET_SYSPROC(s,v) (SF_GET (s) |= ((v) & SF_SYSPROC)) /* used by i960 */
fecd2382 217
fecd2382 218/* -------------- Line number handling ------- */
ba75c1ed 219extern int text_lineno_number;
257df791 220extern int coff_line_base;
fecd2382 221
257df791
ILT
222#define obj_emit_lineno(WHERE,LINE,FILE_START) abort ()
223extern void coff_add_linesym PARAMS ((struct symbol *));
fecd2382 224
8fb85d50 225
85051959 226void c_dot_file_symbol PARAMS ((char *filename));
fecd2382 227
fecd2382 228#ifndef tc_coff_symbol_emit_hook
85051959
ILT
229void tc_coff_symbol_emit_hook PARAMS ((/* symbolS * */));
230#endif
231
257df791
ILT
232extern void coff_frob_symbol PARAMS ((struct symbol *, int *));
233extern void coff_frob_file PARAMS ((void));
71b4de6f 234extern void coff_frob_section PARAMS ((segT));
257df791
ILT
235#define obj_frob_symbol(S,P) coff_frob_symbol(S,&P)
236#define obj_frob_file() coff_frob_file ()
71b4de6f 237#define obj_frob_section(S) coff_frob_section (S)
257df791 238
75d20ac8
KR
239extern struct symbol *coff_last_function;
240
257df791
ILT
241/* Forward the segment of a forwarded symbol. */
242#ifndef TE_I386AIX
243#define obj_frob_forward_symbol(symp) \
244 (SF_GET_GET_SEGMENT (symp) \
245 ? (S_SET_SEGMENT (symp, S_GET_SEGMENT (symp->sy_value.X_add_symbol)), 0) \
246 : 0)
247#else
248#define obj_frob_forward_symbol(symp) \
249 (SF_GET_GET_SEGMENT (symp) && S_GET_SEGMENT (symp) == SEG_UNKNOWN \
250 ? (S_SET_SEGMENT (symp, S_GET_SEGMENT (symp->sy_value.X_add_symbol)), 0) \
251 : 0)
252#endif
fecd2382 253
a39116f1 254/* sanity check */
fecd2382
RP
255
256#ifdef TC_I960
257#ifndef C_LEAFSTAT
ba75c1ed 258hey ! Where is the C_LEAFSTAT definition ? i960 - coff support is depending on it.
fecd2382
RP
259#endif /* no C_LEAFSTAT */
260#endif /* TC_I960 */
fecd2382 261
8fb85d50 262/* Stabs in a coff file go into their own section. */
257df791 263#define SEPARATE_STAB_SECTIONS
8fb85d50 264
71b4de6f
KR
265/* We need 12 bytes at the start of the section to hold some initial
266 information. */
267extern void obj_coff_init_stab_section PARAMS ((segT));
268#define INIT_STAB_SECTION(seg) obj_coff_init_stab_section (seg)
269
8fb85d50 270#endif /* OBJ_FORMAT_H */
This page took 0.287179 seconds and 4 git commands to generate.