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