Imported intl subdir from GNU gettext 0.10.32
[deliverable/binutils-gdb.git] / gas / config / obj-coff.h
CommitLineData
3a69b3ac 1/* coff object file format
2 Copyright (C) 1989, 1990, 1991 Free Software Foundation, Inc.
3
4This file is part of GAS.
5
6GAS is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 1, or (at your option)
9any later version.
10
11GAS is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with GAS; see the file COPYING. If not, write to
18the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
19
20/* $Id$ */
21
22#define OBJ_COFF 1
23
24#include "targ-cpu.h"
25
26#include "coff.gnu.h"
27
28#ifdef USE_NATIVE_HEADERS
29#include <filehdr.h>
30#include <aouthdr.h>
31#include <scnhdr.h>
32#include <storclass.h>
33#include <linenum.h>
34#include <syms.h>
35#include <reloc.h>
36#include <sys/types.h>
37#endif /* USE_NATIVE_HEADERS */
38
39/* Define some processor dependent values according to the processor we are
40 on. */
41#ifdef TC_M68K
42
43#define BYTE_ORDERING F_AR32W /* See filehdr.h for more info. */
44#ifndef FILE_HEADER_MAGIC
45#define FILE_HEADER_MAGIC MC68MAGIC /* ... */
46#endif /* FILE_HEADER_MAGIC */
47
48#elif defined(TC_I386)
49
50#define BYTE_ORDERING F_AR32WR /* See filehdr.h for more info. */
51#ifndef FILE_HEADER_MAGIC
52#define FILE_HEADER_MAGIC I386MAGIC /* ... */
53#endif /* FILE_HEADER_MAGIC */
54
55#elif defined(TC_I960)
56
57#define BYTE_ORDERING F_AR32WR /* See filehdr.h for more info. */
58#ifndef FILE_HEADER_MAGIC
59#define FILE_HEADER_MAGIC I960ROMAGIC /* ... */
60#endif /* FILE_HEADER_MAGIC */
61
62#elif defined(TC_A29K)
63
64#define BYTE_ORDERING F_AR32W /* big endian. */
65#ifndef FILE_HEADER_MAGIC
66#define FILE_HEADER_MAGIC SIPFBOMAGIC
67#endif /* FILE_HEADER_MAGIC */
68
69#else
70you lose
71#endif
72
73#ifndef OBJ_COFF_MAX_AUXENTRIES
74#define OBJ_COFF_MAX_AUXENTRIES 1
75#endif /* OBJ_COFF_MAX_AUXENTRIES */
76
77extern const short seg_N_TYPE[];
78extern const segT N_TYPE_seg[];
79
80/* Magic number of paged executable. */
81#define DEFAULT_MAGIC_NUMBER_FOR_OBJECT_FILE (OMAGIC)
82
83/* Add these definitions to have a consistent convention for all the
84 types used in COFF format. */
85#define AOUTHDR struct aouthdr
86#define AOUTHDRSZ sizeof(AOUTHDR)
87
88/* SYMBOL TABLE */
89
90 /* targets may also set this */
91#ifndef SYMBOLS_NEED_BACKPOINTERS
92#define SYMBOLS_NEED_BACKPOINTERS 1
93#endif /* SYMBOLS_NEED_BACKPOINTERS */
94
95/* Symbol table entry data type */
96
97typedef struct {
98 SYMENT ost_entry; /* Basic symbol */
99 AUXENT ost_auxent[OBJ_COFF_MAX_AUXENTRIES]; /* Auxiliary entry. */
100 unsigned int ost_flags; /* obj_coff internal use only flags */
101} obj_symbol_type;
102
103/* If compiler generate leading underscores, remove them. */
104
105#ifndef STRIP_UNDERSCORE
106#define STRIP_UNDERSCORE 0
107#endif /* STRIP_UNDERSCORE */
108#define DO_NOT_STRIP 0
109#define DO_STRIP 1
110
111/* Symbol table macros and constants */
112
113/* Possible and usefull section number in symbol table
114 * The values of TEXT, DATA and BSS may not be portable.
115 */
116
117#define C_TEXT_SECTION ((short)1)
118#define C_DATA_SECTION ((short)2)
119#define C_BSS_SECTION ((short)3)
120#define C_ABS_SECTION N_ABS
121#define C_UNDEF_SECTION N_UNDEF
122#define C_DEBUG_SECTION N_DEBUG
123#define C_NTV_SECTION N_TV
124#define C_PTV_SECTION P_TV
125
126/*
127 * Macros to extract information from a symbol table entry.
128 * This syntaxic indirection allows independence regarding a.out or coff.
129 * The argument (s) of all these macros is a pointer to a symbol table entry.
130 */
131
132/* Predicates */
133/* True if the symbol is external */
134#define S_IS_EXTERNAL(s) ((s)->sy_symbol.ost_entry.n_scnum == C_UNDEF_SECTION)
135/* True if symbol has been defined, ie :
136 section > 0 (DATA, TEXT or BSS)
137 section == 0 and value > 0 (external bss symbol) */
138#define S_IS_DEFINED(s) ((s)->sy_symbol.ost_entry.n_scnum > C_UNDEF_SECTION || \
139 ((s)->sy_symbol.ost_entry.n_scnum == C_UNDEF_SECTION && \
140 (s)->sy_symbol.ost_entry.n_value > 0))
141/* True if a debug special symbol entry */
142#define S_IS_DEBUG(s) ((s)->sy_symbol.ost_entry.n_scnum == C_DEBUG_SECTION)
143/* True if a symbol is local symbol name */
144/* A symbol name whose name begin with ^A is a gas internal pseudo symbol */
145#define S_IS_LOCAL(s) (S_GET_NAME(s)[0] == '\001' || \
146 (S_LOCAL_NAME(s) && !flagseen['L']))
147/* True if a symbol is not defined in this file */
148#define S_IS_EXTERN(s) ((s)->sy_symbol.ost_entry.n_scnum == 0 && (s)->sy_symbol.ost_entry.n_value == 0)
149/*
150 * True if a symbol can be multiply defined (bss symbols have this def
151 * though it is bad practice)
152 */
153#define S_IS_COMMON(s) ((s)->sy_symbol.ost_entry.n_scnum == 0 && (s)->sy_symbol.ost_entry.n_value != 0)
154/* True if a symbol name is in the string table, i.e. its length is > 8. */
155#define S_IS_STRING(s) (strlen(S_GET_NAME(s)) > 8 ? 1 : 0)
156
157/* Accessors */
158/* The name of the symbol */
159#define S_GET_NAME(s) ((char*)(s)->sy_symbol.ost_entry.n_offset)
160/* The pointer to the string table */
161#define S_GET_OFFSET(s) ((s)->sy_symbol.ost_entry.n_offset)
162/* The zeroes if symbol name is longer than 8 chars */
163#define S_GET_ZEROES(s) ((s)->sy_symbol.ost_entry.n_zeroes)
164/* The value of the symbol */
165#define S_GET_VALUE(s) ((s)->sy_symbol.ost_entry.n_value)
166/* The numeric value of the segment */
167#define S_GET_SEGMENT(s) (N_TYPE_seg[(s)->sy_symbol.ost_entry.n_scnum+4])
168/* The data type */
169#define S_GET_DATA_TYPE(s) ((s)->sy_symbol.ost_entry.n_type)
170/* The storage class */
171#define S_GET_STORAGE_CLASS(s) ((s)->sy_symbol.ost_entry.n_sclass)
172/* The number of auxiliary entries */
173#define S_GET_NUMBER_AUXILIARY(s) ((s)->sy_symbol.ost_entry.n_numaux)
174
175/* Modifiers */
176/* Set the name of the symbol */
177#define S_SET_NAME(s,v) ((s)->sy_symbol.ost_entry.n_offset = (unsigned long)(v))
178/* Set the offset of the symbol */
179#define S_SET_OFFSET(s,v) ((s)->sy_symbol.ost_entry.n_offset = (v))
180/* The zeroes if symbol name is longer than 8 chars */
181#define S_SET_ZEROES(s,v) ((s)->sy_symbol.ost_entry.n_zeroes = (v))
182/* Set the value of the symbol */
183#define S_SET_VALUE(s,v) ((s)->sy_symbol.ost_entry.n_value = (v))
184/* The numeric value of the segment */
185#define S_SET_SEGMENT(s,v) ((s)->sy_symbol.ost_entry.n_scnum = SEGMENT_TO_SYMBOL_TYPE(v))
186/* The data type */
187#define S_SET_DATA_TYPE(s,v) ((s)->sy_symbol.ost_entry.n_type = (v))
188/* The storage class */
189#define S_SET_STORAGE_CLASS(s,v) ((s)->sy_symbol.ost_entry.n_sclass = (v))
190/* The number of auxiliary entries */
191#define S_SET_NUMBER_AUXILIARY(s,v) ((s)->sy_symbol.ost_entry.n_numaux = (v))
192
193/* Additional modifiers */
194/* The symbol is external (does not mean undefined) */
195#define S_SET_EXTERNAL(s) { S_SET_STORAGE_CLASS(s, C_EXT) ; SF_CLEAR_LOCAL(s); }
196
197/* Auxiliary entry macros. SA_ stands for symbol auxiliary */
198/* Omit the tv related fields */
199/* Accessors */
200#define SA_GET_SYM_TAGNDX(s) ((s)->sy_symbol.ost_auxent[0].x_sym.x_tagndx)
201#define SA_GET_SYM_LNNO(s) ((s)->sy_symbol.ost_auxent[0].x_sym.x_misc.x_lnsz.x_lnno)
202#define SA_GET_SYM_SIZE(s) ((s)->sy_symbol.ost_auxent[0].x_sym.x_misc.x_lnsz.x_size)
203#define SA_GET_SYM_FSIZE(s) ((s)->sy_symbol.ost_auxent[0].x_sym.x_misc.x_fsize)
204#define SA_GET_SYM_LNNOPTR(s) ((s)->sy_symbol.ost_auxent[0].x_sym.x_fcnary.x_fcn.x_lnnoptr)
205#define SA_GET_SYM_ENDNDX(s) ((s)->sy_symbol.ost_auxent[0].x_sym.x_fcnary.x_fcn.x_endndx)
206#define SA_GET_SYM_DIMEN(s,i) ((s)->sy_symbol.ost_auxent[0].x_sym.x_fcnary.x_ary.x_dimen[(i)])
207#define SA_GET_FILE_FNAME(s) ((s)->sy_symbol.ost_auxent[0].x_file.x_fname)
208#define SA_GET_SCN_SCNLEN(s) ((s)->sy_symbol.ost_auxent[0].x_scn.x_scnlen)
209#define SA_GET_SCN_NRELOC(s) ((s)->sy_symbol.ost_auxent[0].x_scn.x_nreloc)
210#define SA_GET_SCN_NLINNO(s) ((s)->sy_symbol.ost_auxent[0].x_scn.x_nlinno)
211
212/* Modifiers */
213#define SA_SET_SYM_TAGNDX(s,v) ((s)->sy_symbol.ost_auxent[0].x_sym.x_tagndx=(v))
214#define SA_SET_SYM_LNNO(s,v) ((s)->sy_symbol.ost_auxent[0].x_sym.x_misc.x_lnsz.x_lnno=(v))
215#define SA_SET_SYM_SIZE(s,v) ((s)->sy_symbol.ost_auxent[0].x_sym.x_misc.x_lnsz.x_size=(v))
216#define SA_SET_SYM_FSIZE(s,v) ((s)->sy_symbol.ost_auxent[0].x_sym.x_misc.x_fsize=(v))
217#define SA_SET_SYM_LNNOPTR(s,v) ((s)->sy_symbol.ost_auxent[0].x_sym.x_fcnary.x_fcn.x_lnnoptr=(v))
218#define SA_SET_SYM_ENDNDX(s,v) ((s)->sy_symbol.ost_auxent[0].x_sym.x_fcnary.x_fcn.x_endndx=(v))
219#define SA_SET_SYM_DIMEN(s,i,v) ((s)->sy_symbol.ost_auxent[0].x_sym.x_fcnary.x_ary.x_dimen[(i)]=(v))
220#define SA_SET_FILE_FNAME(s,v) strncpy((s)->sy_symbol.ost_auxent[0].x_file.x_fname,(v),FILNMLEN)
221#define SA_SET_SCN_SCNLEN(s,v) ((s)->sy_symbol.ost_auxent[0].x_scn.x_scnlen=(v))
222#define SA_SET_SCN_NRELOC(s,v) ((s)->sy_symbol.ost_auxent[0].x_scn.x_nreloc=(v))
223#define SA_SET_SCN_NLINNO(s,v) ((s)->sy_symbol.ost_auxent[0].x_scn.x_nlinno=(v))
224
225/*
226 * Internal use only definitions. SF_ stands for symbol flags.
227 *
228 * These values can be assigned to sy_symbol.ost_flags field of a symbolS.
229 *
230 * You'll break i960 if you shift the SYSPROC bits anywhere else. for
231 * more on the balname/callname hack, see tc-i960.h. b.out is done
232 * differently.
233 */
234
235#define SF_I960_MASK (0x000001ff) /* Bits 0-8 are used by the i960 port. */
236#define SF_SYSPROC (0x0000003f) /* bits 0-5 are used to store the sysproc number */
237#define SF_IS_SYSPROC (0x00000040) /* bit 6 marks symbols that are sysprocs */
238#define SF_BALNAME (0x00000080) /* bit 7 marks BALNAME symbols */
239#define SF_CALLNAME (0x00000100) /* bit 8 marks CALLNAME symbols */
240
241#define SF_NORMAL_MASK (0x0000ffff) /* bits 12-15 are general purpose. */
242
243#define SF_STATICS (0x00001000) /* Mark the .text & all symbols */
244#define SF_DEFINED (0x00002000) /* Symbol is defined in this file */
245#define SF_STRING (0x00004000) /* Symbol name length > 8 */
246#define SF_LOCAL (0x00008000) /* Symbol must not be emitted */
247
248#define SF_DEBUG_MASK (0xffff0000) /* bits 16-31 are debug info */
249
250#define SF_FUNCTION (0x00010000) /* The symbol is a function */
251#define SF_PROCESS (0x00020000) /* Process symbol before write */
252#define SF_TAGGED (0x00040000) /* Is associated with a tag */
253#define SF_TAG (0x00080000) /* Is a tag */
254#define SF_DEBUG (0x00100000) /* Is in debug or abs section */
255#define SF_GET_SEGMENT (0x00200000) /* Get the section of the forward symbol. */
256 /* All other bits are unused. */
257
258/* Accessors */
259#define SF_GET(s) ((s)->sy_symbol.ost_flags)
260#define SF_GET_NORMAL_FIELD(s) ((s)->sy_symbol.ost_flags & SF_NORMAL_MASK)
261#define SF_GET_DEBUG_FIELD(s) ((s)->sy_symbol.ost_flags & SF_DEBUG_MASK)
262#define SF_GET_FILE(s) ((s)->sy_symbol.ost_flags & SF_FILE)
263#define SF_GET_STATICS(s) ((s)->sy_symbol.ost_flags & SF_STATICS)
264#define SF_GET_DEFINED(s) ((s)->sy_symbol.ost_flags & SF_DEFINED)
265#define SF_GET_STRING(s) ((s)->sy_symbol.ost_flags & SF_STRING)
266#define SF_GET_LOCAL(s) ((s)->sy_symbol.ost_flags & SF_LOCAL)
267#define SF_GET_FUNCTION(s) ((s)->sy_symbol.ost_flags & SF_FUNCTION)
268#define SF_GET_PROCESS(s) ((s)->sy_symbol.ost_flags & SF_PROCESS)
269#define SF_GET_DEBUG(s) ((s)->sy_symbol.ost_flags & SF_DEBUG)
270#define SF_GET_TAGGED(s) ((s)->sy_symbol.ost_flags & SF_TAGGED)
271#define SF_GET_TAG(s) ((s)->sy_symbol.ost_flags & SF_TAG)
272#define SF_GET_GET_SEGMENT(s) ((s)->sy_symbol.ost_flags & SF_GET_SEGMENT)
273#define SF_GET_I960(s) ((s)->sy_symbol.ost_flags & SF_I960_MASK) /* used by i960 */
274#define SF_GET_BALNAME(s) ((s)->sy_symbol.ost_flags & SF_BALNAME) /* used by i960 */
275#define SF_GET_CALLNAME(s) ((s)->sy_symbol.ost_flags & SF_CALLNAME) /* used by i960 */
276#define SF_GET_IS_SYSPROC(s) ((s)->sy_symbol.ost_flags & SF_IS_SYSPROC) /* used by i960 */
277#define SF_GET_SYSPROC(s) ((s)->sy_symbol.ost_flags & SF_SYSPROC) /* used by i960 */
278
279/* Modifiers */
280#define SF_SET(s,v) ((s)->sy_symbol.ost_flags = (v))
281#define SF_SET_NORMAL_FIELD(s,v)((s)->sy_symbol.ost_flags |= ((v) & SF_NORMAL_MASK))
282#define SF_SET_DEBUG_FIELD(s,v) ((s)->sy_symbol.ost_flags |= ((v) & SF_DEBUG_MASK))
283#define SF_SET_FILE(s) ((s)->sy_symbol.ost_flags |= SF_FILE)
284#define SF_SET_STATICS(s) ((s)->sy_symbol.ost_flags |= SF_STATICS)
285#define SF_SET_DEFINED(s) ((s)->sy_symbol.ost_flags |= SF_DEFINED)
286#define SF_SET_STRING(s) ((s)->sy_symbol.ost_flags |= SF_STRING)
287#define SF_SET_LOCAL(s) ((s)->sy_symbol.ost_flags |= SF_LOCAL)
288#define SF_CLEAR_LOCAL(s) ((s)->sy_symbol.ost_flags &= ~SF_LOCAL)
289#define SF_SET_FUNCTION(s) ((s)->sy_symbol.ost_flags |= SF_FUNCTION)
290#define SF_SET_PROCESS(s) ((s)->sy_symbol.ost_flags |= SF_PROCESS)
291#define SF_SET_DEBUG(s) ((s)->sy_symbol.ost_flags |= SF_DEBUG)
292#define SF_SET_TAGGED(s) ((s)->sy_symbol.ost_flags |= SF_TAGGED)
293#define SF_SET_TAG(s) ((s)->sy_symbol.ost_flags |= SF_TAG)
294#define SF_SET_GET_SEGMENT(s) ((s)->sy_symbol.ost_flags |= SF_GET_SEGMENT)
295#define SF_SET_I960(s,v) ((s)->sy_symbol.ost_flags |= ((v) & SF_I960_MASK)) /* used by i960 */
296#define SF_SET_BALNAME(s) ((s)->sy_symbol.ost_flags |= SF_BALNAME) /* used by i960 */
297#define SF_SET_CALLNAME(s) ((s)->sy_symbol.ost_flags |= SF_CALLNAME) /* used by i960 */
298#define SF_SET_IS_SYSPROC(s) ((s)->sy_symbol.ost_flags |= SF_IS_SYSPROC) /* used by i960 */
299#define SF_SET_SYSPROC(s,v) ((s)->sy_symbol.ost_flags |= ((v) & SF_SYSPROC)) /* used by i960 */
300
301/* File header macro and type definition */
302
303/*
304 * File position calculators. Beware to use them when all the
305 * appropriate fields are set in the header.
306 */
307
308#ifdef OBJ_COFF_OMIT_OPTIONAL_HEADER
309#define OBJ_COFF_AOUTHDRSZ (0)
310#else
311#define OBJ_COFF_AOUTHDRSZ (AOUTHDRSZ)
312#endif /* OBJ_COFF_OMIT_OPTIONAL_HEADER */
313
314#define H_GET_FILE_SIZE(h) \
315 (long)(FILHSZ + OBJ_COFF_AOUTHDRSZ + \
316 H_GET_NUMBER_OF_SECTIONS(h) * SCNHSZ + \
317 H_GET_TEXT_SIZE(h) + H_GET_DATA_SIZE(h) + \
318 H_GET_RELOCATION_SIZE(h) + H_GET_LINENO_SIZE(h) + \
319 H_GET_SYMBOL_TABLE_SIZE(h) * SYMESZ + \
320 (h)->string_table_size)
321#define H_GET_TEXT_FILE_OFFSET(h) \
322 (long)(FILHSZ + OBJ_COFF_AOUTHDRSZ + \
323 H_GET_NUMBER_OF_SECTIONS(h) * SCNHSZ)
324#define H_GET_DATA_FILE_OFFSET(h) \
325 (long)(FILHSZ + OBJ_COFF_AOUTHDRSZ + \
326 H_GET_NUMBER_OF_SECTIONS(h) * SCNHSZ + \
327 H_GET_TEXT_SIZE(h))
328#define H_GET_BSS_FILE_OFFSET(h) 0
329#define H_GET_RELOCATION_FILE_OFFSET(h) \
330 (long)(FILHSZ + OBJ_COFF_AOUTHDRSZ + \
331 H_GET_NUMBER_OF_SECTIONS(h) * SCNHSZ + \
332 H_GET_TEXT_SIZE(h) + H_GET_DATA_SIZE(h))
333#define H_GET_LINENO_FILE_OFFSET(h) \
334 (long)(FILHSZ + OBJ_COFF_AOUTHDRSZ + \
335 H_GET_NUMBER_OF_SECTIONS(h) * SCNHSZ + \
336 H_GET_TEXT_SIZE(h) + H_GET_DATA_SIZE(h) + \
337 H_GET_RELOCATION_SIZE(h))
338#define H_GET_SYMBOL_TABLE_FILE_OFFSET(h) \
339 (long)(FILHSZ + OBJ_COFF_AOUTHDRSZ + \
340 H_GET_NUMBER_OF_SECTIONS(h) * SCNHSZ + \
341 H_GET_TEXT_SIZE(h) + H_GET_DATA_SIZE(h) + \
342 H_GET_RELOCATION_SIZE(h) + H_GET_LINENO_SIZE(h))
343
344/* Accessors */
345/* aouthdr */
346#define H_GET_MAGIC_NUMBER(h) ((h)->aouthdr.magic)
347#define H_GET_VERSION_STAMP(h) ((h)->aouthdr.vstamp)
348#define H_GET_TEXT_SIZE(h) ((h)->aouthdr.tsize)
349#define H_GET_DATA_SIZE(h) ((h)->aouthdr.dsize)
350#define H_GET_BSS_SIZE(h) ((h)->aouthdr.bsize)
351#define H_GET_ENTRY_POINT(h) ((h)->aouthdr.entry)
352#define H_GET_TEXT_START(h) ((h)->aouthdr.text_start)
353#define H_GET_DATA_START(h) ((h)->aouthdr.data_start)
354/* filehdr */
355#define H_GET_FILE_MAGIC_NUMBER(h) ((h)->filehdr.f_magic)
356#define H_GET_NUMBER_OF_SECTIONS(h) ((h)->filehdr.f_nscns)
357#define H_GET_TIME_STAMP(h) ((h)->filehdr.f_timdat)
358#define H_GET_SYMBOL_TABLE_POINTER(h) ((h)->filehdr.f_symptr)
359#define H_GET_SYMBOL_TABLE_SIZE(h) ((h)->filehdr.f_nsyms)
360#define H_GET_SIZEOF_OPTIONAL_HEADER(h) ((h)->filehdr.f_opthdr)
361#define H_GET_FLAGS(h) ((h)->filehdr.f_flags)
362/* Extra fields to achieve bsd a.out compatibility and for convenience */
363#define H_GET_RELOCATION_SIZE(h) ((h)->relocation_size)
364#define H_GET_STRING_SIZE(h) ((h)->string_table_size)
365#define H_GET_LINENO_SIZE(h) ((h)->lineno_size)
366
367/* Modifiers */
368/* aouthdr */
369#define H_SET_MAGIC_NUMBER(h,v) ((h)->aouthdr.magic = (v))
370#define H_SET_VERSION_STAMP(h,v) ((h)->aouthdr.vstamp = (v))
371#define H_SET_TEXT_SIZE(h,v) ((h)->aouthdr.tsize = (v))
372#define H_SET_DATA_SIZE(h,v) ((h)->aouthdr.dsize = (v))
373#define H_SET_BSS_SIZE(h,v) ((h)->aouthdr.bsize = (v))
374#define H_SET_ENTRY_POINT(h,v) ((h)->aouthdr.entry = (v))
375#define H_SET_TEXT_START(h,v) ((h)->aouthdr.text_start = (v))
376#define H_SET_DATA_START(h,v) ((h)->aouthdr.data_start = (v))
377/* filehdr */
378#define H_SET_FILE_MAGIC_NUMBER(h,v) ((h)->filehdr.f_magic = (v))
379#define H_SET_NUMBER_OF_SECTIONS(h,v) ((h)->filehdr.f_nscns = (v))
380#define H_SET_TIME_STAMP(h,v) ((h)->filehdr.f_timdat = (v))
381#define H_SET_SYMBOL_TABLE_POINTER(h,v) ((h)->filehdr.f_symptr = (v))
382#define H_SET_SYMBOL_TABLE_SIZE(h,v) ((h)->filehdr.f_nsyms = (v))
383#define H_SET_SIZEOF_OPTIONAL_HEADER(h,v) ((h)->filehdr.f_opthdr = (v))
384#define H_SET_FLAGS(h,v) ((h)->filehdr.f_flags = (v))
385/* Extra fields to achieve bsd a.out compatibility and for convinience */
386#define H_SET_RELOCATION_SIZE(h,t,d) ((h)->relocation_size = (t)+(d))
387#define H_SET_STRING_SIZE(h,v) ((h)->string_table_size = (v))
388#define H_SET_LINENO_SIZE(h,v) ((h)->lineno_size = (v))
389
390 /* Segment flipping */
391#define segment_name(v) (seg_name[(int) (v)])
392
393typedef struct {
394 AOUTHDR aouthdr; /* a.out header */
395 FILHDR filehdr; /* File header, not machine dep. */
396 long string_table_size; /* names + '\0' + sizeof(int) */
397 long relocation_size; /* Cumulated size of relocation
398 information for all sections in
399 bytes. */
400 long lineno_size; /* Size of the line number information
401 table in bytes */
402} object_headers;
403
404/* -------------- Line number handling ------- */
405extern int text_lineno_number;
406
407/* line numbering stuff. */
408
409typedef struct internal_lineno {
410 LINENO line; /* The lineno structure itself */
411 char* frag; /* Frag to which the line number is related */
412 struct internal_lineno* next; /* Forward chain pointer */
413} lineno;
414
415extern lineno *lineno_lastP;
416extern lineno *lineno_rootP;
417#define OBJ_EMIT_LINENO(a, b, c) obj_emit_lineno((a),(b),(c))
418
419#ifdef __STDC__
420void obj_emit_lineno(char **where, lineno *line, char *file_start);
421#else /* __STDC__ */
422void obj_emit_lineno();
423#endif /* __STDC__ */
424
425 /* stack stuff */
426typedef struct {
427 unsigned long chunk_size;
428 unsigned long element_size;
429 unsigned long size;
430 char* data;
431 unsigned long pointer;
432} stack;
433
434#ifdef __STDC__
435
436char *stack_pop(stack *st);
437char *stack_push(stack *st, char *element);
438char *stack_top(stack *st);
439stack *stack_init(unsigned long chunk_size, unsigned long element_size);
440void c_dot_file_symbol(char *filename);
441void obj_extra_stuff(object_headers *headers);
442void stack_delete(stack *st);
443
444#ifndef tc_headers_hook
445void tc_headers_hook(object_headers *headers);
446#endif /* tc_headers_hook */
447
448#ifndef tc_coff_symbol_emit_hook
449void tc_coff_symbol_emit_hook(); /* really tc_coff_symbol_emit_hook(symbolS *symbolP) */
450#endif /* tc_coff_symbol_emit_hook */
451
452void c_section_header(SCNHDR *header,
453 char *name,
454 long core_address,
455 long size,
456 long data_ptr,
457 long reloc_ptr,
458 long lineno_ptr,
459 long reloc_number,
460 long lineno_number,
461 long alignment);
462
463#else /* __STDC__ */
464
465char *stack_pop();
466char *stack_push();
467char *stack_top();
468stack *stack_init();
469void c_dot_file_symbol();
470void c_section_header();
471void obj_extra_stuff();
472void stack_delete();
473void tc_headers_hook();
474void tc_coff_symbol_emit_hook();
475
476#endif /* __STDC__ */
477
478
479 /* sanity check */
480
481#ifdef TC_I960
482#ifndef C_LEAFSTAT
483hey! Where is the C_LEAFSTAT definition? i960-coff support is depending on it.
484#endif /* no C_LEAFSTAT */
485#endif /* TC_I960 */
486
487/*
488 * Local Variables:
489 * comment-column: 0
490 * fill-column: 131
491 * End:
492 */
493
494/* end of obj-coff.h */
This page took 0.042368 seconds and 4 git commands to generate.