Enable --emulation={i386coff,i386elf} for i386 gas.
[deliverable/binutils-gdb.git] / gas / config / obj-elf.h
1 /* ELF object file format.
2 Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 1999
3 Free Software Foundation, Inc.
4
5 This file is part of GAS, the GNU Assembler.
6
7 GAS is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 1, or (at your option)
10 any later version.
11
12 GAS is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with GAS; see the file COPYING. If not, write to the Free
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
20 02111-1307, USA. */
21
22
23 /* HP PA-RISC support was contributed by the Center for Software Science
24 at the University of Utah. */
25
26 #ifndef _OBJ_ELF_H
27 #define _OBJ_ELF_H
28
29 #define OBJ_ELF 1
30
31 #ifndef OUTPUT_FLAVOR
32 #define OUTPUT_FLAVOR bfd_target_elf_flavour
33 #endif
34
35 #include <bfd.h>
36
37 #define BYTES_IN_WORD 4 /* for now */
38 #include "bfd/elf-bfd.h"
39
40 #include "targ-cpu.h"
41
42 #ifdef TC_ALPHA
43 #define ECOFF_DEBUGGING alpha_flag_mdebug
44 extern int alpha_flag_mdebug;
45 #endif
46
47 /* For now, always set ECOFF_DEBUGGING for a MIPS target. */
48 #ifdef TC_MIPS
49 #ifdef MIPS_STABS_ELF
50 #define ECOFF_DEBUGGING 0
51 #else
52 #define ECOFF_DEBUGGING 1
53 #endif /* MIPS_STABS_ELF */
54 #endif /* TC_MIPS */
55
56 /* Additional information we keep for each symbol. */
57 struct elf_obj_sy
58 {
59 /* Whether the symbol has been marked as local. */
60 int local;
61
62 /* Use this to keep track of .size expressions that involve
63 differences that we can't compute yet. */
64 expressionS *size;
65
66 /* The name specified by the .symver directive. */
67 char *versioned_name;
68
69 #ifdef ECOFF_DEBUGGING
70 /* If we are generating ECOFF debugging information, we need some
71 additional fields for each symbol. */
72 struct efdr *ecoff_file;
73 struct localsym *ecoff_symbol;
74 valueT ecoff_extern_size;
75 #endif
76 };
77
78 #define OBJ_SYMFIELD_TYPE struct elf_obj_sy
79
80 #ifndef FALSE
81 #define FALSE 0
82 #define TRUE !FALSE
83 #endif
84
85 #define obj_begin() elf_begin ()
86 extern void elf_begin PARAMS ((void));
87
88 /* should be conditional on address size! */
89 #define elf_symbol(asymbol) ((elf_symbol_type *)(&(asymbol)->the_bfd))
90
91 #ifndef S_GET_SIZE
92 #define S_GET_SIZE(S) \
93 (elf_symbol (symbol_get_bfdsym (S))->internal_elf_sym.st_size)
94 #endif
95 #ifndef S_SET_SIZE
96 #define S_SET_SIZE(S,V) \
97 (elf_symbol (symbol_get_bfdsym (S))->internal_elf_sym.st_size = (V))
98 #endif
99
100 #ifndef S_GET_ALIGN
101 #define S_GET_ALIGN(S) \
102 (elf_symbol (symbol_get_bfdsym (S))->internal_elf_sym.st_value)
103 #endif
104 #ifndef S_SET_ALIGN
105 #define S_SET_ALIGN(S,V) \
106 (elf_symbol (symbol_get_bfdsym (S))->internal_elf_sym.st_value = (V))
107 #endif
108
109 #define S_GET_OTHER(S) \
110 (elf_symbol (symbol_get_bfdsym (S))->internal_elf_sym.st_other)
111 #define S_SET_OTHER(S,V) \
112 (elf_symbol (symbol_get_bfdsym (S))->internal_elf_sym.st_other = (V))
113
114 extern asection *gdb_section;
115
116 #ifndef obj_frob_file
117 #define obj_frob_file elf_frob_file
118 #endif
119 extern void elf_frob_file PARAMS ((void));
120
121 #ifndef obj_frob_file_after_relocs
122 #define obj_frob_file_after_relocs elf_frob_file_after_relocs
123 #endif
124 extern void elf_frob_file_after_relocs PARAMS ((void));
125
126 #define obj_app_file elf_file_symbol
127 extern void elf_file_symbol PARAMS ((char *));
128
129 extern void obj_elf_section_change_hook PARAMS ((void));
130
131 extern void obj_elf_section PARAMS ((int));
132 extern void obj_elf_previous PARAMS ((int));
133 extern void obj_elf_version PARAMS ((int));
134 extern void obj_elf_common PARAMS ((int));
135 extern void obj_elf_data PARAMS ((int));
136 extern void obj_elf_text PARAMS ((int));
137
138 /* BFD wants to write the udata field, which is a no-no for the
139 globally defined sections. */
140 #ifndef obj_sec_sym_ok_for_reloc
141 #define obj_sec_sym_ok_for_reloc(SEC) ((SEC)->owner != 0)
142 #endif
143
144 /* When setting one symbol equal to another, by default we probably
145 want them to have the same "size", whatever it means in the current
146 context. */
147 #ifndef OBJ_COPY_SYMBOL_ATTRIBUTES
148 #define OBJ_COPY_SYMBOL_ATTRIBUTES(DEST,SRC) \
149 do \
150 { \
151 struct elf_obj_sy *srcelf = symbol_get_obj (SRC); \
152 struct elf_obj_sy *destelf = symbol_get_obj (DEST); \
153 if (srcelf->size) \
154 { \
155 if (destelf->size == NULL) \
156 destelf->size = \
157 (expressionS *) xmalloc (sizeof (expressionS)); \
158 *destelf->size = *srcelf->size; \
159 } \
160 else \
161 { \
162 if (destelf->size != NULL) \
163 free (destelf->size); \
164 destelf->size = NULL; \
165 } \
166 S_SET_SIZE ((DEST), S_GET_SIZE (SRC)); \
167 S_SET_OTHER ((DEST), S_GET_OTHER (SRC)); \
168 } \
169 while (0)
170 #endif
171
172 /* Stabs go in a separate section. */
173 #define SEPARATE_STAB_SECTIONS 1
174
175 /* We need 12 bytes at the start of the section to hold some initial
176 information. */
177 extern void obj_elf_init_stab_section PARAMS ((segT));
178 #define INIT_STAB_SECTION(seg) obj_elf_init_stab_section (seg)
179
180 #ifdef ECOFF_DEBUGGING
181 /* We smuggle stabs in ECOFF rather than using a separate section.
182 The Irix linker can not handle a separate stabs section. */
183
184 #undef SEPARATE_STAB_SECTIONS
185 #define SEPARATE_STAB_SECTIONS (!ECOFF_DEBUGGING)
186
187 #undef INIT_STAB_SECTION
188 #define INIT_STAB_SECTION(seg) \
189 ((void)(ECOFF_DEBUGGING ? 0 : (obj_elf_init_stab_section (seg), 0)))
190
191 #undef OBJ_PROCESS_STAB
192 #define OBJ_PROCESS_STAB(seg, what, string, type, other, desc) \
193 if (ECOFF_DEBUGGING) \
194 ecoff_stab ((seg), (what), (string), (type), (other), (desc))
195 #endif /* ECOFF_DEBUGGING */
196
197 extern void elf_frob_symbol PARAMS ((symbolS *, int *));
198 #ifndef obj_frob_symbol
199 #define obj_frob_symbol(symp, punt) elf_frob_symbol (symp, &punt)
200 #endif
201
202 extern void elf_pop_insert PARAMS ((void));
203 #ifndef obj_pop_insert
204 #define obj_pop_insert() elf_pop_insert()
205 #endif
206
207 #ifndef OBJ_MAYBE_ELF
208 #define obj_ecoff_set_ext elf_ecoff_set_ext
209 #ifdef ANSI_PROTOTYPES
210 struct ecoff_extr;
211 #endif
212 extern void elf_ecoff_set_ext PARAMS ((symbolS *, struct ecoff_extr *));
213 #endif
214
215 #endif /* _OBJ_ELF_H */
This page took 0.032981 seconds and 4 git commands to generate.