White space and comments only. The devo tree prior to this delta is
[deliverable/binutils-gdb.git] / gas / config / obj-aout.h
CommitLineData
fecd2382
RP
1/* a.out object file format
2 Copyright (C) 1989, 1990, 1991 Free Software Foundation, Inc.
a39116f1
RP
3
4 This file is part of GAS, the GNU Assembler.
5
6 GAS is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as
8 published by the Free Software Foundation; either version 2,
9 or (at your option) any later version.
10
11 GAS is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
14 the GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public
17 License along with GAS; see the file COPYING. If not, write
18 to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
fecd2382
RP
19
20/* $Id$ */
21
22/* Tag to validate a.out object file format processing */
23#define OBJ_AOUT 1
24
25#include "targ-cpu.h"
26
27#ifndef VMS
28#include "a.out.gnu.h" /* Needed to define struct nlist. Sigh. */
29#else
30#include "a_out.h"
31#endif
32
a39116f1
RP
33#ifndef AOUT_MACHTYPE
34#define AOUT_MACHTYPE 0
35#endif /* AOUT_MACHTYPE */
d1a9e594 36
fecd2382
RP
37extern const short seg_N_TYPE[];
38extern const segT N_TYPE_seg[];
39
40#ifndef DEFAULT_MAGIC_NUMBER_FOR_OBJECT_FILE
41#define DEFAULT_MAGIC_NUMBER_FOR_OBJECT_FILE (OMAGIC)
42#endif /* DEFAULT_MAGIC_NUMBER_FOR_OBJECT_FILE */
43
44/* SYMBOL TABLE */
45/* Symbol table entry data type */
46
47typedef struct nlist obj_symbol_type; /* Symbol table entry */
48
fecd2382
RP
49/* Symbol table macros and constants */
50
51/*
52 * Macros to extract information from a symbol table entry.
53 * This syntaxic indirection allows independence regarding a.out or coff.
54 * The argument (s) of all these macros is a pointer to a symbol table entry.
55 */
56
57/* True if the symbol is external */
58#define S_IS_EXTERNAL(s) ((s)->sy_symbol.n_type & N_EXT)
59
60/* True if symbol has been defined, ie is in N_{TEXT,DATA,BSS,ABS} or N_EXT */
61#define S_IS_DEFINED(s) ((S_GET_TYPE(s) != N_UNDF) || (S_GET_OTHER(s) != 0) || (S_GET_DESC(s) != 0))
62
63#define S_IS_REGISTER(s) ((s)->sy_symbol.n_type == N_REGISTER)
64
65/* True if a debug special symbol entry */
66#define S_IS_DEBUG(s) ((s)->sy_symbol.n_type & N_STAB)
67/* True if a symbol is local symbol name */
68/* A symbol name whose name begin with ^A is a gas internal pseudo symbol
69 nameless symbols come from .stab directives. */
70#define S_IS_LOCAL(s) (S_GET_NAME(s) && \
71 !S_IS_DEBUG(s) && \
72 (S_GET_NAME(s)[0] == '\001' || \
73 (S_LOCAL_NAME(s) && !flagseen['L'])))
74/* True if a symbol is not defined in this file */
75#define S_IS_EXTERN(s) ((s)->sy_symbol.n_type & N_EXT)
76/* True if the symbol has been generated because of a .stabd directive */
77#define S_IS_STABD(s) (S_GET_NAME(s) == (char *)0)
78
79/* Accessors */
80/* The value of the symbol */
81#define S_GET_VALUE(s) (((s)->sy_symbol.n_value))
82/* The name of the symbol */
83#define S_GET_NAME(s) ((s)->sy_symbol.n_un.n_name)
84/* The pointer to the string table */
85#define S_GET_OFFSET(s) ((s)->sy_symbol.n_un.n_strx)
86/* The type of the symbol */
87#define S_GET_TYPE(s) ((s)->sy_symbol.n_type & N_TYPE)
88/* The numeric value of the segment */
89#define S_GET_SEGMENT(s) (N_TYPE_seg[S_GET_TYPE(s)])
90/* The n_other expression value */
91#define S_GET_OTHER(s) ((s)->sy_symbol.n_other)
92/* The n_desc expression value */
93#define S_GET_DESC(s) ((s)->sy_symbol.n_desc)
94
95/* Modifiers */
96/* Set the value of the symbol */
97#define S_SET_VALUE(s,v) ((s)->sy_symbol.n_value = (unsigned long) (v))
98/* Assume that a symbol cannot be simultaneously in more than on segment */
a39116f1 99/* set segment */
fecd2382
RP
100#define S_SET_SEGMENT(s,seg) ((s)->sy_symbol.n_type &= ~N_TYPE,(s)->sy_symbol.n_type|=SEGMENT_TO_SYMBOL_TYPE(seg))
101/* The symbol is external */
102#define S_SET_EXTERNAL(s) ((s)->sy_symbol.n_type |= N_EXT)
103/* The symbol is not external */
104#define S_CLEAR_EXTERNAL(s) ((s)->sy_symbol.n_type &= ~N_EXT)
105/* Set the name of the symbol */
106#define S_SET_NAME(s,v) ((s)->sy_symbol.n_un.n_name = (v))
107/* Set the offset in the string table */
108#define S_SET_OFFSET(s,v) ((s)->sy_symbol.n_un.n_strx = (v))
109/* Set the n_other expression value */
110#define S_SET_OTHER(s,v) ((s)->sy_symbol.n_other = (v))
111/* Set the n_desc expression value */
112#define S_SET_DESC(s,v) ((s)->sy_symbol.n_desc = (v))
113
114/* File header macro and type definition */
115
f6e504fe
RP
116#define H_GET_FILE_SIZE(h) (H_GET_HEADER_SIZE(h) \
117 + H_GET_TEXT_SIZE(h) \
118 + H_GET_DATA_SIZE(h) \
119 + H_GET_SYMBOL_TABLE_SIZE(h) \
120 + H_GET_TEXT_RELOCATION_SIZE(h) \
121 + H_GET_DATA_RELOCATION_SIZE(h) \
122 + H_GET_STRING_SIZE(h))
fecd2382 123
f6e504fe 124#define H_GET_HEADER_SIZE(h) (sizeof(struct exec))
fecd2382
RP
125#define H_GET_TEXT_SIZE(h) ((h)->header.a_text)
126#define H_GET_DATA_SIZE(h) ((h)->header.a_data)
127#define H_GET_BSS_SIZE(h) ((h)->header.a_bss)
128#define H_GET_TEXT_RELOCATION_SIZE(h) ((h)->header.a_trsize)
129#define H_GET_DATA_RELOCATION_SIZE(h) ((h)->header.a_drsize)
130#define H_GET_SYMBOL_TABLE_SIZE(h) ((h)->header.a_syms)
fecd2382
RP
131#define H_GET_ENTRY_POINT(h) ((h)->header.a_entry)
132#define H_GET_STRING_SIZE(h) ((h)->string_table_size)
f6e504fe
RP
133#define H_GET_LINENO_SIZE(h) (0)
134
a39116f1
RP
135#define H_GET_DYNAMIC(h) ((h)->header.a_info >> 31)
136#define H_GET_VERSION(h) (((h)->header.a_info >> 24) & 0x7f)
137#define H_GET_MACHTYPE(h) (((h)->header.a_info >> 16) & 0xff)
138#define H_GET_MAGIC_NUMBER(h) ((h)->header.a_info & 0xffff)
f6e504fe 139
a39116f1
RP
140#define H_SET_DYNAMIC(h,v) ((h)->header.a_info = (((v) << 31) \
141 | (H_GET_VERSION(h) << 24) \
142 | (H_GET_MACHTYPE(h) << 16) \
143 | (H_GET_MAGIC_NUMBER(h))))
144
145#define H_SET_VERSION(h,v) ((h)->header.a_info = ((H_GET_DYNAMIC(h) << 31) \
146 | ((v) << 24) \
147 | (H_GET_MACHTYPE(h) << 16) \
148 | (H_GET_MAGIC_NUMBER(h))))
149
150#define H_SET_MACHTYPE(h,v) ((h)->header.a_info = ((H_GET_DYNAMIC(h) << 31) \
151 | (H_GET_VERSION(h) << 24) \
152 | ((v) << 16) \
153 | (H_GET_MAGIC_NUMBER(h))))
154
155#define H_SET_MAGIC_NUMBER(h,v) ((h)->header.a_info = ((H_GET_DYNAMIC(h) << 31) \
156 | (H_GET_VERSION(h) << 24) \
157 | (H_GET_MACHTYPE(h) << 16) \
158 | ((v))))
fecd2382
RP
159
160#define H_SET_TEXT_SIZE(h,v) ((h)->header.a_text = md_section_align(SEG_TEXT, (v)))
161#define H_SET_DATA_SIZE(h,v) ((h)->header.a_data = md_section_align(SEG_DATA, (v)))
162#define H_SET_BSS_SIZE(h,v) ((h)->header.a_bss = md_section_align(SEG_BSS, (v)))
163
164#define H_SET_RELOCATION_SIZE(h,t,d) (H_SET_TEXT_RELOCATION_SIZE((h),(t)),\
165 H_SET_DATA_RELOCATION_SIZE((h),(d)))
166
167#define H_SET_TEXT_RELOCATION_SIZE(h,v) ((h)->header.a_trsize = (v))
168#define H_SET_DATA_RELOCATION_SIZE(h,v) ((h)->header.a_drsize = (v))
169#define H_SET_SYMBOL_TABLE_SIZE(h,v) ((h)->header.a_syms = (v) * \
170 sizeof(struct nlist))
171
fecd2382
RP
172#define H_SET_ENTRY_POINT(h,v) ((h)->header.a_entry = (v))
173#define H_SET_STRING_SIZE(h,v) ((h)->string_table_size = (v))
fecd2382
RP
174
175/*
176 * Current means for getting the name of a segment.
177 * This will change for infinite-segments support (e.g. COFF).
178 */
179#define segment_name(seg) ( seg_name[(int)(seg)] )
180extern char *const seg_name[];
181
182typedef struct {
a39116f1
RP
183 struct exec header; /* a.out header */
184 long string_table_size; /* names + '\0' + sizeof(int) */
fecd2382
RP
185} object_headers;
186
187/* line numbering stuff. */
a39116f1
RP
188#define OBJ_EMIT_LINENO(a, b, c) {;}
189
190#define obj_symbol_new_hook(s) {;}
191
192#ifdef __STDC__
193struct fix;
194void tc_aout_fix_to_chars(char *where, struct fix *fixP, relax_addressT segment_address);
195#else
196void tc_aout_fix_to_chars();
197#endif /* __STDC__ */
fecd2382
RP
198
199/*
200 * Local Variables:
201 * comment-column: 0
202 * fill-column: 131
203 * End:
204 */
205
206/* end of obj-aout.h */
This page took 0.047989 seconds and 4 git commands to generate.