Passdown -S to linker.
[deliverable/binutils-gdb.git] / bfd / elf32-target.h
1 /* Target definitions for 32-bit ELF
2 Copyright 1993, 1994 Free Software Foundation, Inc.
3
4 This file is part of BFD, the Binary File Descriptor library.
5
6 This program 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 2 of the License, or
9 (at your option) any later version.
10
11 This program 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
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
19
20 /* This structure contains everything that BFD knows about a target.
21 It includes things like its byte order, name, what routines to call
22 to do various operations, etc. Every BFD points to a target structure
23 with its "xvec" member.
24
25 There are two such structures here: one for big-endian machines and
26 one for little-endian machines. */
27
28 #define bfd_elf32_close_and_cleanup _bfd_generic_close_and_cleanup
29 #define bfd_elf32_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
30 #ifndef bfd_elf32_get_section_contents
31 #define bfd_elf32_get_section_contents _bfd_generic_get_section_contents
32 #endif
33
34 #define bfd_elf32_bfd_get_relocated_section_contents \
35 bfd_generic_get_relocated_section_contents
36 #define bfd_elf32_bfd_relax_section bfd_generic_relax_section
37 #define bfd_elf32_bfd_make_debug_symbol \
38 ((asymbol *(*) PARAMS ((bfd *, void *, unsigned long))) bfd_nullvoidptr)
39
40 #ifndef bfd_elf32_bfd_copy_private_section_data
41 #define bfd_elf32_bfd_copy_private_section_data \
42 ((boolean (*) PARAMS ((bfd *, asection *, bfd *, asection *))) bfd_true)
43 #endif
44 #ifndef bfd_elf32_bfd_copy_private_bfd_data
45 #define bfd_elf32_bfd_copy_private_bfd_data \
46 ((boolean (*) PARAMS ((bfd *, bfd *))) bfd_true)
47 #endif
48 #ifndef bfd_elf32_bfd_is_local_label
49 #define bfd_elf32_bfd_is_local_label bfd_generic_is_local_label
50 #endif
51
52 #ifndef bfd_elf32_get_dynamic_reloc_upper_bound
53 #define bfd_elf32_get_dynamic_reloc_upper_bound \
54 _bfd_nodynamic_get_dynamic_reloc_upper_bound
55 #endif
56 #ifndef bfd_elf32_canonicalize_dynamic_reloc
57 #define bfd_elf32_canonicalize_dynamic_reloc \
58 _bfd_nodynamic_canonicalize_dynamic_reloc
59 #endif
60
61 #ifdef elf_backend_relocate_section
62 #ifndef bfd_elf32_bfd_link_hash_table_create
63 #define bfd_elf32_bfd_link_hash_table_create _bfd_elf_link_hash_table_create
64 #endif
65 #else /* ! defined (elf_backend_relocate_section) */
66 /* If no backend relocate_section routine, use the generic linker. */
67 #ifndef bfd_elf32_bfd_link_hash_table_create
68 #define bfd_elf32_bfd_link_hash_table_create \
69 _bfd_generic_link_hash_table_create
70 #endif
71 #ifndef bfd_elf32_bfd_link_add_symbols
72 #define bfd_elf32_bfd_link_add_symbols _bfd_generic_link_add_symbols
73 #endif
74 #ifndef bfd_elf32_bfd_final_link
75 #define bfd_elf32_bfd_final_link _bfd_generic_final_link
76 #endif
77 #endif /* ! defined (elf_backend_relocate_section) */
78
79 #ifndef elf_info_to_howto_rel
80 #define elf_info_to_howto_rel 0
81 #endif
82
83 #ifndef ELF_MAXPAGESIZE
84 #define ELF_MAXPAGESIZE 1
85 #endif
86
87 #ifndef elf_backend_collect
88 #define elf_backend_collect false
89 #endif
90
91 #ifndef elf_backend_sym_is_global
92 #define elf_backend_sym_is_global 0
93 #endif
94 #ifndef elf_backend_object_p
95 #define elf_backend_object_p 0
96 #endif
97 #ifndef elf_backend_symbol_processing
98 #define elf_backend_symbol_processing 0
99 #endif
100 #ifndef elf_backend_symbol_table_processing
101 #define elf_backend_symbol_table_processing 0
102 #endif
103 #ifndef elf_backend_section_processing
104 #define elf_backend_section_processing 0
105 #endif
106 #ifndef elf_backend_section_from_shdr
107 #define elf_backend_section_from_shdr 0
108 #endif
109 #ifndef elf_backend_fake_sections
110 #define elf_backend_fake_sections 0
111 #endif
112 #ifndef elf_backend_section_from_bfd_section
113 #define elf_backend_section_from_bfd_section 0
114 #endif
115 #ifndef elf_backend_add_symbol_hook
116 #define elf_backend_add_symbol_hook 0
117 #endif
118 #ifndef elf_backend_relocate_section
119 #define elf_backend_relocate_section 0
120 #endif
121 #ifndef elf_backend_begin_write_processing
122 #define elf_backend_begin_write_processing 0
123 #endif
124 #ifndef elf_backend_final_write_processing
125 #define elf_backend_final_write_processing 0
126 #endif
127 #ifndef elf_backend_ecoff_debug_swap
128 #define elf_backend_ecoff_debug_swap 0
129 #endif
130
131 static CONST struct elf_backend_data elf32_bed =
132 {
133 #ifdef USE_REL
134 0, /* use_rela_p */
135 #else
136 1, /* use_rela_p */
137 #endif
138 0, /* elf_64_p */
139 ELF_ARCH, /* arch */
140 ELF_MACHINE_CODE, /* elf_machine_code */
141 ELF_MAXPAGESIZE, /* maxpagesize */
142 elf_backend_collect,
143 elf_info_to_howto,
144 elf_info_to_howto_rel,
145 elf_backend_sym_is_global,
146 elf_backend_object_p,
147 elf_backend_symbol_processing,
148 elf_backend_symbol_table_processing,
149 elf_backend_section_processing,
150 elf_backend_section_from_shdr,
151 elf_backend_fake_sections,
152 elf_backend_section_from_bfd_section,
153 elf_backend_add_symbol_hook,
154 elf_backend_relocate_section,
155 elf_backend_begin_write_processing,
156 elf_backend_final_write_processing,
157 elf_backend_ecoff_debug_swap
158 };
159
160 #ifdef TARGET_BIG_SYM
161 bfd_target TARGET_BIG_SYM =
162 {
163 /* name: identify kind of target */
164 TARGET_BIG_NAME,
165
166 /* flavour: general indication about file */
167 bfd_target_elf_flavour,
168
169 /* byteorder_big_p: data is big endian */
170 true,
171
172 /* header_byteorder_big_p: header is also big endian */
173 true,
174
175 /* object_flags: mask of all file flags */
176 (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS |
177 DYNAMIC | WP_TEXT),
178
179 /* section_flags: mask of all section flags */
180 (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY |
181 SEC_CODE | SEC_DATA | SEC_DEBUGGING),
182
183 /* leading_symbol_char: is the first char of a user symbol
184 predictable, and if so what is it */
185 0,
186
187 /* ar_pad_char: pad character for filenames within an archive header
188 FIXME: this really has nothing to do with ELF, this is a characteristic
189 of the archiver and/or os and should be independently tunable */
190 '/',
191
192 /* ar_max_namelen: maximum number of characters in an archive header
193 FIXME: this really has nothing to do with ELF, this is a characteristic
194 of the archiver and should be independently tunable. This value is
195 a WAG (wild a** guess) */
196 15,
197
198 /* align_power_min: minimum alignment restriction for any section
199 FIXME: this value may be target machine dependent */
200 3,
201
202 /* Routines to byte-swap various sized integers from the data sections */
203 bfd_getb64, bfd_getb_signed_64, bfd_putb64,
204 bfd_getb32, bfd_getb_signed_32, bfd_putb32,
205 bfd_getb16, bfd_getb_signed_16, bfd_putb16,
206
207 /* Routines to byte-swap various sized integers from the file headers */
208 bfd_getb64, bfd_getb_signed_64, bfd_putb64,
209 bfd_getb32, bfd_getb_signed_32, bfd_putb32,
210 bfd_getb16, bfd_getb_signed_16, bfd_putb16,
211
212 /* bfd_check_format: check the format of a file being read */
213 { _bfd_dummy_target, /* unknown format */
214 bfd_elf32_object_p, /* assembler/linker output (object file) */
215 bfd_generic_archive_p, /* an archive */
216 bfd_elf32_core_file_p /* a core file */
217 },
218
219 /* bfd_set_format: set the format of a file being written */
220 { bfd_false,
221 bfd_elf_mkobject,
222 _bfd_generic_mkarchive,
223 bfd_false
224 },
225
226 /* bfd_write_contents: write cached information into a file being written */
227 { bfd_false,
228 bfd_elf32_write_object_contents,
229 _bfd_write_archive_contents,
230 bfd_false
231 },
232
233 BFD_JUMP_TABLE_GENERIC (bfd_elf32),
234 BFD_JUMP_TABLE_COPY (bfd_elf32),
235 BFD_JUMP_TABLE_CORE (bfd_elf32),
236 BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
237 BFD_JUMP_TABLE_SYMBOLS (bfd_elf32),
238 BFD_JUMP_TABLE_RELOCS (bfd_elf32),
239 BFD_JUMP_TABLE_WRITE (bfd_elf32),
240 BFD_JUMP_TABLE_LINK (bfd_elf32),
241 BFD_JUMP_TABLE_DYNAMIC (bfd_elf32),
242
243 /* backend_data: */
244 (PTR) &elf32_bed,
245 };
246 #endif
247
248 #ifdef TARGET_LITTLE_SYM
249 bfd_target TARGET_LITTLE_SYM =
250 {
251 /* name: identify kind of target */
252 TARGET_LITTLE_NAME,
253
254 /* flavour: general indication about file */
255 bfd_target_elf_flavour,
256
257 /* byteorder_big_p: data is big endian */
258 false, /* Nope -- this one's little endian */
259
260 /* header_byteorder_big_p: header is also big endian */
261 false, /* Nope -- this one's little endian */
262
263 /* object_flags: mask of all file flags */
264 (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS |
265 DYNAMIC | WP_TEXT),
266
267 /* section_flags: mask of all section flags */
268 (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY |
269 SEC_CODE | SEC_DATA | SEC_DEBUGGING),
270
271 /* leading_symbol_char: is the first char of a user symbol
272 predictable, and if so what is it */
273 0,
274
275 /* ar_pad_char: pad character for filenames within an archive header
276 FIXME: this really has nothing to do with ELF, this is a characteristic
277 of the archiver and/or os and should be independently tunable */
278 '/',
279
280 /* ar_max_namelen: maximum number of characters in an archive header
281 FIXME: this really has nothing to do with ELF, this is a characteristic
282 of the archiver and should be independently tunable. This value is
283 a WAG (wild a** guess) */
284 15,
285
286 /* align_power_min: minimum alignment restriction for any section
287 FIXME: this value may be target machine dependent */
288 3,
289
290 /* Routines to byte-swap various sized integers from the data sections */
291 bfd_getl64, bfd_getl_signed_64, bfd_putl64,
292 bfd_getl32, bfd_getl_signed_32, bfd_putl32,
293 bfd_getl16, bfd_getl_signed_16, bfd_putl16,
294
295 /* Routines to byte-swap various sized integers from the file headers */
296 bfd_getl64, bfd_getl_signed_64, bfd_putl64,
297 bfd_getl32, bfd_getl_signed_32, bfd_putl32,
298 bfd_getl16, bfd_getl_signed_16, bfd_putl16,
299
300 /* bfd_check_format: check the format of a file being read */
301 { _bfd_dummy_target, /* unknown format */
302 bfd_elf32_object_p, /* assembler/linker output (object file) */
303 bfd_generic_archive_p, /* an archive */
304 bfd_elf32_core_file_p /* a core file */
305 },
306
307 /* bfd_set_format: set the format of a file being written */
308 { bfd_false,
309 bfd_elf_mkobject,
310 _bfd_generic_mkarchive,
311 bfd_false
312 },
313
314 /* bfd_write_contents: write cached information into a file being written */
315 { bfd_false,
316 bfd_elf32_write_object_contents,
317 _bfd_write_archive_contents,
318 bfd_false
319 },
320
321 BFD_JUMP_TABLE_GENERIC (bfd_elf32),
322 BFD_JUMP_TABLE_COPY (bfd_elf32),
323 BFD_JUMP_TABLE_CORE (bfd_elf32),
324 BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
325 BFD_JUMP_TABLE_SYMBOLS (bfd_elf32),
326 BFD_JUMP_TABLE_RELOCS (bfd_elf32),
327 BFD_JUMP_TABLE_WRITE (bfd_elf32),
328 BFD_JUMP_TABLE_LINK (bfd_elf32),
329 BFD_JUMP_TABLE_DYNAMIC (bfd_elf32),
330
331 /* backend_data: */
332 (PTR) &elf32_bed,
333 };
334 #endif
This page took 0.035475 seconds and 4 git commands to generate.