1 /* ELF object file format.
2 Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 99, 2000
3 Free Software Foundation, Inc.
5 This file is part of GAS, the GNU Assembler.
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)
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.
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
23 /* HP PA-RISC support was contributed by the Center for Software Science
24 at the University of Utah. */
32 #define OUTPUT_FLAVOR bfd_target_elf_flavour
37 #define BYTES_IN_WORD 4 /* for now */
38 #include "bfd/elf-bfd.h"
43 #define ECOFF_DEBUGGING alpha_flag_mdebug
44 extern int alpha_flag_mdebug
;
47 /* For now, always set ECOFF_DEBUGGING for a MIPS target. */
50 #define ECOFF_DEBUGGING 0
52 #define ECOFF_DEBUGGING 1
53 #endif /* MIPS_STABS_ELF */
56 #ifdef OBJ_MAYBE_ECOFF
57 #ifndef ECOFF_DEBUGGING
58 #define ECOFF_DEBUGGING 1
62 /* Additional information we keep for each symbol. */
65 /* Whether the symbol has been marked as local. */
68 /* Use this to keep track of .size expressions that involve
69 differences that we can't compute yet. */
72 /* The name specified by the .symver directive. */
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
;
84 #define OBJ_SYMFIELD_TYPE struct elf_obj_sy
91 #define obj_begin() elf_begin ()
92 extern void elf_begin
PARAMS ((void));
94 /* should be conditional on address size! */
95 #define elf_symbol(asymbol) ((elf_symbol_type *)(&(asymbol)->the_bfd))
98 #define S_GET_SIZE(S) \
99 (elf_symbol (symbol_get_bfdsym (S))->internal_elf_sym.st_size)
102 #define S_SET_SIZE(S,V) \
103 (elf_symbol (symbol_get_bfdsym (S))->internal_elf_sym.st_size = (V))
107 #define S_GET_ALIGN(S) \
108 (elf_symbol (symbol_get_bfdsym (S))->internal_elf_sym.st_value)
111 #define S_SET_ALIGN(S,V) \
112 (elf_symbol (symbol_get_bfdsym (S))->internal_elf_sym.st_value = (V))
115 int elf_s_get_other
PARAMS ((symbolS
*));
117 #define S_GET_OTHER(S) (elf_s_get_other (S))
120 #define S_SET_OTHER(S,V) \
121 (elf_symbol (symbol_get_bfdsym (S))->internal_elf_sym.st_other = (V))
124 extern asection
*gdb_section
;
126 #ifndef obj_frob_file
127 #define obj_frob_file elf_frob_file
129 extern void elf_frob_file
PARAMS ((void));
131 #ifndef obj_frob_file_after_relocs
132 #define obj_frob_file_after_relocs elf_frob_file_after_relocs
134 extern void elf_frob_file_after_relocs
PARAMS ((void));
136 #define obj_app_file elf_file_symbol
137 extern void elf_file_symbol
PARAMS ((char *));
139 extern void obj_elf_section_change_hook
PARAMS ((void));
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));
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)
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
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
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
167 #ifndef OBJ_COPY_SYMBOL_ATTRIBUTES
168 #define OBJ_COPY_SYMBOL_ATTRIBUTES(DEST,SRC) \
171 struct elf_obj_sy *srcelf = symbol_get_obj (SRC); \
172 struct elf_obj_sy *destelf = symbol_get_obj (DEST); \
175 if (destelf->size == NULL) \
177 (expressionS *) xmalloc (sizeof (expressionS)); \
178 *destelf->size = *srcelf->size; \
182 if (destelf->size != NULL) \
183 free (destelf->size); \
184 destelf->size = NULL; \
186 S_SET_SIZE ((DEST), S_GET_SIZE (SRC)); \
187 S_SET_OTHER ((DEST), S_GET_OTHER (SRC)); \
192 /* Stabs go in a separate section. */
193 #define SEPARATE_STAB_SECTIONS 1
195 /* We need 12 bytes at the start of the section to hold some initial
197 extern void obj_elf_init_stab_section
PARAMS ((segT
));
198 #define INIT_STAB_SECTION(seg) obj_elf_init_stab_section (seg)
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. */
204 #undef SEPARATE_STAB_SECTIONS
205 #define SEPARATE_STAB_SECTIONS (!ECOFF_DEBUGGING)
207 #undef INIT_STAB_SECTION
208 #define INIT_STAB_SECTION(seg) \
209 ((void)(ECOFF_DEBUGGING ? 0 : (obj_elf_init_stab_section (seg), 0)))
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 */
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)
222 extern void elf_pop_insert
PARAMS ((void));
223 #ifndef obj_pop_insert
224 #define obj_pop_insert() elf_pop_insert()
227 #ifndef OBJ_MAYBE_ELF
228 #define obj_ecoff_set_ext elf_ecoff_set_ext
229 #ifdef ANSI_PROTOTYPES
232 extern void elf_ecoff_set_ext
PARAMS ((symbolS
*, struct ecoff_extr
*));
235 #endif /* _OBJ_ELF_H */