Assorted code cleanup and fixes for hppa. Re-enable elf32-hppa as
[deliverable/binutils-gdb.git] / gas / config / obj-elf.h
1 /* ELF object file format.
2 Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 99, 2000
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 #ifdef OBJ_MAYBE_ECOFF
57 #ifndef ECOFF_DEBUGGING
58 #define ECOFF_DEBUGGING 1
59 #endif
60 #endif
61
62 /* Additional information we keep for each symbol. */
63 struct elf_obj_sy
64 {
65 /* Whether the symbol has been marked as local. */
66 int local;
67
68 /* Use this to keep track of .size expressions that involve
69 differences that we can't compute yet. */
70 expressionS *size;
71
72 /* The name specified by the .symver directive. */
73 char *versioned_name;
74
75 #ifdef ECOFF_DEBUGGING
76 /* If we are generating ECOFF debugging information, we need some
77 additional fields for each symbol. */
78 struct efdr *ecoff_file;
79 struct localsym *ecoff_symbol;
80 valueT ecoff_extern_size;
81 #endif
82 };
83
84 #define OBJ_SYMFIELD_TYPE struct elf_obj_sy
85
86 #ifndef FALSE
87 #define FALSE 0
88 #define TRUE !FALSE
89 #endif
90
91 #define obj_begin() elf_begin ()
92 extern void elf_begin PARAMS ((void));
93
94 /* should be conditional on address size! */
95 #define elf_symbol(asymbol) ((elf_symbol_type *)(&(asymbol)->the_bfd))
96
97 #ifndef S_GET_SIZE
98 #define S_GET_SIZE(S) \
99 (elf_symbol (symbol_get_bfdsym (S))->internal_elf_sym.st_size)
100 #endif
101 #ifndef S_SET_SIZE
102 #define S_SET_SIZE(S,V) \
103 (elf_symbol (symbol_get_bfdsym (S))->internal_elf_sym.st_size = (V))
104 #endif
105
106 #ifndef S_GET_ALIGN
107 #define S_GET_ALIGN(S) \
108 (elf_symbol (symbol_get_bfdsym (S))->internal_elf_sym.st_value)
109 #endif
110 #ifndef S_SET_ALIGN
111 #define S_SET_ALIGN(S,V) \
112 (elf_symbol (symbol_get_bfdsym (S))->internal_elf_sym.st_value = (V))
113 #endif
114
115 int elf_s_get_other PARAMS ((symbolS *));
116 #ifndef S_GET_OTHER
117 #define S_GET_OTHER(S) (elf_s_get_other (S))
118 #endif
119 #ifndef S_SET_OTHER
120 #define S_SET_OTHER(S,V) \
121 (elf_symbol (symbol_get_bfdsym (S))->internal_elf_sym.st_other = (V))
122 #endif
123
124 extern asection *gdb_section;
125
126 #ifndef obj_frob_file
127 #define obj_frob_file elf_frob_file
128 #endif
129 extern void elf_frob_file PARAMS ((void));
130
131 #ifndef obj_frob_file_after_relocs
132 #define obj_frob_file_after_relocs elf_frob_file_after_relocs
133 #endif
134 extern void elf_frob_file_after_relocs PARAMS ((void));
135
136 #define obj_app_file elf_file_symbol
137 extern void elf_file_symbol PARAMS ((char *));
138
139 extern void obj_elf_section_change_hook PARAMS ((void));
140
141 extern void obj_elf_section PARAMS ((int));
142 extern void obj_elf_previous PARAMS ((int));
143 extern void obj_elf_version PARAMS ((int));
144 extern void obj_elf_common PARAMS ((int));
145 extern void obj_elf_data PARAMS ((int));
146 extern void obj_elf_text PARAMS ((int));
147
148 /* BFD wants to write the udata field, which is a no-no for the
149 globally defined sections. */
150 #ifndef obj_sec_sym_ok_for_reloc
151 #define obj_sec_sym_ok_for_reloc(SEC) ((SEC)->owner != 0)
152 #endif
153
154 void elf_obj_read_begin_hook PARAMS ((void));
155 #ifndef obj_read_begin_hook
156 #define obj_read_begin_hook elf_obj_read_begin_hook
157 #endif
158
159 void elf_obj_symbol_new_hook PARAMS ((symbolS *));
160 #ifndef obj_symbol_new_hook
161 #define obj_symbol_new_hook elf_obj_symbol_new_hook
162 #endif
163
164 /* When setting one symbol equal to another, by default we probably
165 want them to have the same "size", whatever it means in the current
166 context. */
167 #ifndef OBJ_COPY_SYMBOL_ATTRIBUTES
168 #define OBJ_COPY_SYMBOL_ATTRIBUTES(DEST,SRC) \
169 do \
170 { \
171 struct elf_obj_sy *srcelf = symbol_get_obj (SRC); \
172 struct elf_obj_sy *destelf = symbol_get_obj (DEST); \
173 if (srcelf->size) \
174 { \
175 if (destelf->size == NULL) \
176 destelf->size = \
177 (expressionS *) xmalloc (sizeof (expressionS)); \
178 *destelf->size = *srcelf->size; \
179 } \
180 else \
181 { \
182 if (destelf->size != NULL) \
183 free (destelf->size); \
184 destelf->size = NULL; \
185 } \
186 S_SET_SIZE ((DEST), S_GET_SIZE (SRC)); \
187 S_SET_OTHER ((DEST), S_GET_OTHER (SRC)); \
188 } \
189 while (0)
190 #endif
191
192 /* Stabs go in a separate section. */
193 #define SEPARATE_STAB_SECTIONS 1
194
195 /* We need 12 bytes at the start of the section to hold some initial
196 information. */
197 extern void obj_elf_init_stab_section PARAMS ((segT));
198 #define INIT_STAB_SECTION(seg) obj_elf_init_stab_section (seg)
199
200 #ifdef ECOFF_DEBUGGING
201 /* We smuggle stabs in ECOFF rather than using a separate section.
202 The Irix linker can not handle a separate stabs section. */
203
204 #undef SEPARATE_STAB_SECTIONS
205 #define SEPARATE_STAB_SECTIONS (!ECOFF_DEBUGGING)
206
207 #undef INIT_STAB_SECTION
208 #define INIT_STAB_SECTION(seg) \
209 ((void)(ECOFF_DEBUGGING ? 0 : (obj_elf_init_stab_section (seg), 0)))
210
211 #undef OBJ_PROCESS_STAB
212 #define OBJ_PROCESS_STAB(seg, what, string, type, other, desc) \
213 if (ECOFF_DEBUGGING) \
214 ecoff_stab ((seg), (what), (string), (type), (other), (desc))
215 #endif /* ECOFF_DEBUGGING */
216
217 extern void elf_frob_symbol PARAMS ((symbolS *, int *));
218 #ifndef obj_frob_symbol
219 #define obj_frob_symbol(symp, punt) elf_frob_symbol (symp, &punt)
220 #endif
221
222 extern void elf_pop_insert PARAMS ((void));
223 #ifndef obj_pop_insert
224 #define obj_pop_insert() elf_pop_insert()
225 #endif
226
227 #ifndef OBJ_MAYBE_ELF
228 #define obj_ecoff_set_ext elf_ecoff_set_ext
229 #ifdef ANSI_PROTOTYPES
230 struct ecoff_extr;
231 #endif
232 extern void elf_ecoff_set_ext PARAMS ((symbolS *, struct ecoff_extr *));
233 #endif
234
235 #endif /* _OBJ_ELF_H */
This page took 0.04983 seconds and 4 git commands to generate.