1 /* coff object file format
2 Copyright (C) 1989, 1990, 1991 Free Software Foundation, Inc.
4 This file is part of GAS.
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 1, or (at your option)
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.
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. */
28 #ifdef USE_NATIVE_HEADERS
32 #include <storclass.h>
36 #include <sys/types.h>
37 #endif /* USE_NATIVE_HEADERS */
39 /* Define some processor dependent values according to the processor we are
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 */
48 #elif defined(TC_I386)
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 */
55 #elif defined(TC_I960)
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 */
62 #elif defined(TC_A29K)
64 #define BYTE_ORDERING F_AR32W /* big endian. */
65 #ifndef FILE_HEADER_MAGIC
66 #define FILE_HEADER_MAGIC SIPFBOMAGIC
67 #endif /* FILE_HEADER_MAGIC */
73 #ifndef OBJ_COFF_MAX_AUXENTRIES
74 #define OBJ_COFF_MAX_AUXENTRIES 1
75 #endif /* OBJ_COFF_MAX_AUXENTRIES */
77 extern const short seg_N_TYPE
[];
78 extern const segT N_TYPE_seg
[];
80 /* Magic number of paged executable. */
81 #define DEFAULT_MAGIC_NUMBER_FOR_OBJECT_FILE (OMAGIC)
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)
90 /* targets may also set this */
91 #ifndef SYMBOLS_NEED_BACKPOINTERS
92 #define SYMBOLS_NEED_BACKPOINTERS 1
93 #endif /* SYMBOLS_NEED_BACKPOINTERS */
95 /* Symbol table entry data type */
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 */
103 /* If compiler generate leading underscores, remove them. */
105 #ifndef STRIP_UNDERSCORE
106 #define STRIP_UNDERSCORE 0
107 #endif /* STRIP_UNDERSCORE */
108 #define DO_NOT_STRIP 0
111 /* Symbol table macros and constants */
113 /* Possible and usefull section number in symbol table
114 * The values of TEXT, DATA and BSS may not be portable.
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
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.
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)
150 * True if a symbol can be multiply defined (bss symbols have this def
151 * though it is bad practice)
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)
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) ((unsigned) ((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])
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)
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))
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))
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); }
197 /* Auxiliary entry macros. SA_ stands for symbol auxiliary */
198 /* Omit the tv related fields */
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)
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))
226 * Internal use only definitions. SF_ stands for symbol flags.
228 * These values can be assigned to sy_symbol.ost_flags field of a symbolS.
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
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 */
241 #define SF_NORMAL_MASK (0x0000ffff) /* bits 12-15 are general purpose. */
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 */
248 #define SF_DEBUG_MASK (0xffff0000) /* bits 16-31 are debug info */
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. */
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 */
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 */
301 /* File header macro and type definition */
304 * File position calculators. Beware to use them when all the
305 * appropriate fields are set in the header.
308 #ifdef OBJ_COFF_OMIT_OPTIONAL_HEADER
309 #define OBJ_COFF_AOUTHDRSZ (0)
311 #define OBJ_COFF_AOUTHDRSZ (AOUTHDRSZ)
312 #endif /* OBJ_COFF_OMIT_OPTIONAL_HEADER */
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 + \
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))
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)
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)
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))
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))
390 /* Segment flipping */
391 #define segment_name(v) (seg_name[(int) (v)])
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
400 long lineno_size
; /* Size of the line number information
404 /* -------------- Line number handling ------- */
405 extern int text_lineno_number
;
407 /* line numbering stuff. */
409 typedef 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 */
415 extern lineno
*lineno_lastP
;
416 extern lineno
*lineno_rootP
;
417 #define OBJ_EMIT_LINENO(a, b, c) obj_emit_lineno((a),(b),(c))
420 void obj_emit_lineno(char **where
, lineno
*line
, char *file_start
);
422 void obj_emit_lineno();
423 #endif /* __STDC__ */
427 unsigned long chunk_size
;
428 unsigned long element_size
;
431 unsigned long pointer
;
436 char *stack_pop(stack
*st
);
437 char *stack_push(stack
*st
, char *element
);
438 char *stack_top(stack
*st
);
439 stack
*stack_init(unsigned long chunk_size
, unsigned long element_size
);
440 void c_dot_file_symbol(char *filename
);
441 void obj_extra_stuff(object_headers
*headers
);
442 void stack_delete(stack
*st
);
444 #ifndef tc_headers_hook
445 void tc_headers_hook(object_headers
*headers
);
446 #endif /* tc_headers_hook */
448 #ifndef tc_coff_symbol_emit_hook
449 void tc_coff_symbol_emit_hook(); /* really tc_coff_symbol_emit_hook(symbolS *symbolP) */
450 #endif /* tc_coff_symbol_emit_hook */
452 void c_section_header(SCNHDR
*header
,
469 void c_dot_file_symbol();
470 void c_section_header();
471 void obj_extra_stuff();
473 void tc_headers_hook();
474 void tc_coff_symbol_emit_hook();
476 #endif /* __STDC__ */
483 hey
! Where is the C_LEAFSTAT definition
? i960
-coff support is depending on it
.
484 #endif /* no C_LEAFSTAT */
494 /* end of obj-coff.h */