]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gas/config/obj-elf.h
This commit was generated by cvs2svn to track changes on a CVS vendor
[thirdparty/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 #define OUTPUT_FLAVOR bfd_target_elf_flavour
32
33 #include <bfd.h>
34
35 #define BYTES_IN_WORD 4 /* for now */
36 #include "bfd/elf-bfd.h"
37
38 #include "targ-cpu.h"
39
40 #ifdef TC_ALPHA
41 #define ECOFF_DEBUGGING alpha_flag_mdebug
42 extern int alpha_flag_mdebug;
43 #endif
44
45 /* For now, always set ECOFF_DEBUGGING for a MIPS target. */
46 #ifdef TC_MIPS
47 #ifdef MIPS_STABS_ELF
48 #define ECOFF_DEBUGGING 0
49 #else
50 #define ECOFF_DEBUGGING 1
51 #endif /* MIPS_STABS_ELF */
52 #endif /* TC_MIPS */
53
54 /* Additional information we keep for each symbol. */
55
56 /* FIXME: For some reason, this structure is needed both here and in
57 obj-multi.h. */
58 #ifndef OBJ_SYMFIELD_TYPE
59 struct elf_obj_sy
60 {
61 /* Whether the symbol has been marked as local. */
62 int local;
63
64 /* Use this to keep track of .size expressions that involve
65 differences that we can't compute yet. */
66 expressionS *size;
67
68 /* The name specified by the .symver directive. */
69 char *versioned_name;
70
71 #ifdef ECOFF_DEBUGGING
72 /* If we are generating ECOFF debugging information, we need some
73 additional fields for each symbol. */
74 struct efdr *ecoff_file;
75 struct localsym *ecoff_symbol;
76 valueT ecoff_extern_size;
77 #endif
78 };
79 #endif
80
81 #define OBJ_SYMFIELD_TYPE struct elf_obj_sy
82
83 #ifndef FALSE
84 #define FALSE 0
85 #define TRUE !FALSE
86 #endif
87
88 #define obj_begin() elf_begin ()
89 extern void elf_begin PARAMS ((void));
90
91 /* should be conditional on address size! */
92 #define elf_symbol(asymbol) ((elf_symbol_type *)(&(asymbol)->the_bfd))
93
94 #define S_GET_SIZE(S) \
95 (elf_symbol (symbol_get_bfdsym (S))->internal_elf_sym.st_size)
96 #define S_SET_SIZE(S,V) \
97 (elf_symbol (symbol_get_bfdsym (S))->internal_elf_sym.st_size = (V))
98
99 #define S_GET_ALIGN(S) \
100 (elf_symbol (symbol_get_bfdsym (S))->internal_elf_sym.st_value)
101 #define S_SET_ALIGN(S,V) \
102 (elf_symbol (symbol_get_bfdsym (S))->internal_elf_sym.st_value = (V))
103
104 #define S_GET_OTHER(S) \
105 (elf_symbol (symbol_get_bfdsym (S))->internal_elf_sym.st_other)
106 #define S_SET_OTHER(S,V) \
107 (elf_symbol (symbol_get_bfdsym (S))->internal_elf_sym.st_other = (V))
108
109 extern asection *gdb_section;
110
111 #define obj_frob_file elf_frob_file
112 extern void elf_frob_file PARAMS ((void));
113
114 #define obj_frob_file_after_relocs elf_frob_file_after_relocs
115 extern void elf_frob_file_after_relocs PARAMS ((void));
116
117 #define obj_app_file elf_file_symbol
118 extern void elf_file_symbol PARAMS ((char *));
119
120 extern void obj_elf_section_change_hook PARAMS ((void));
121
122 extern void obj_elf_section PARAMS ((int));
123 extern void obj_elf_previous PARAMS ((int));
124 extern void obj_elf_version PARAMS ((int));
125 extern void obj_elf_common PARAMS ((int));
126 extern void obj_elf_data PARAMS ((int));
127 extern void obj_elf_text PARAMS ((int));
128
129 /* BFD wants to write the udata field, which is a no-no for the
130 globally defined sections. */
131 #define obj_sec_sym_ok_for_reloc(SEC) ((SEC)->owner != 0)
132
133 /* When setting one symbol equal to another, by default we probably
134 want them to have the same "size", whatever it means in the current
135 context. */
136 #define OBJ_COPY_SYMBOL_ATTRIBUTES(DEST,SRC) \
137 do \
138 { \
139 struct elf_obj_sy *srcelf = symbol_get_obj (SRC); \
140 struct elf_obj_sy *destelf = symbol_get_obj (DEST); \
141 if (srcelf->size) \
142 { \
143 if (destelf->size == NULL) \
144 destelf->size = \
145 (expressionS *) xmalloc (sizeof (expressionS)); \
146 *destelf->size = *srcelf->size; \
147 } \
148 else \
149 { \
150 if (destelf->size != NULL) \
151 free (destelf->size); \
152 destelf->size = NULL; \
153 } \
154 S_SET_SIZE ((DEST), S_GET_SIZE (SRC)); \
155 S_SET_OTHER ((DEST), S_GET_OTHER (SRC)); \
156 } \
157 while (0)
158
159 /* Stabs go in a separate section. */
160 #define SEPARATE_STAB_SECTIONS 1
161
162 /* We need 12 bytes at the start of the section to hold some initial
163 information. */
164 extern void obj_elf_init_stab_section PARAMS ((segT));
165 #define INIT_STAB_SECTION(seg) obj_elf_init_stab_section (seg)
166
167 #ifdef ECOFF_DEBUGGING
168 /* We smuggle stabs in ECOFF rather than using a separate section.
169 The Irix linker can not handle a separate stabs section. */
170
171 #undef SEPARATE_STAB_SECTIONS
172 #define SEPARATE_STAB_SECTIONS (!ECOFF_DEBUGGING)
173
174 #undef INIT_STAB_SECTION
175 #define INIT_STAB_SECTION(seg) \
176 ((void)(ECOFF_DEBUGGING ? 0 : (obj_elf_init_stab_section (seg), 0)))
177
178 #define OBJ_PROCESS_STAB(seg, what, string, type, other, desc) \
179 if (ECOFF_DEBUGGING) \
180 ecoff_stab ((seg), (what), (string), (type), (other), (desc))
181 #endif /* ECOFF_DEBUGGING */
182
183 extern void elf_frob_symbol PARAMS ((symbolS *, int *));
184 #ifndef obj_frob_symbol
185 #define obj_frob_symbol(symp, punt) elf_frob_symbol (symp, &punt)
186 #endif
187
188 extern void elf_pop_insert PARAMS ((void));
189 #define obj_pop_insert() elf_pop_insert()
190
191 #ifndef OBJ_MAYBE_ELF
192 #define obj_ecoff_set_ext elf_ecoff_set_ext
193 #ifdef ANSI_PROTOTYPES
194 struct ecoff_extr;
195 #endif
196 extern void elf_ecoff_set_ext PARAMS ((symbolS *, struct ecoff_extr *));
197 #endif
198
199 #endif /* _OBJ_ELF_H */