revised elf support
[binutils-gdb.git] / bfd / elf32-target.h
1 /* Target definitions for 32-bit ELF
2 Copyright 1993 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 /* Archives are generic or unimplemented. */
29 #define elf_slurp_armap bfd_slurp_coff_armap
30 #define elf_slurp_extended_name_table _bfd_slurp_extended_name_table
31 #define elf_truncate_arname bfd_dont_truncate_arname
32 #define elf_openr_next_archived_file bfd_generic_openr_next_archived_file
33 #define elf_generic_stat_arch_elt bfd_generic_stat_arch_elt
34 #define elf_write_armap coff_write_armap
35
36 /* Ordinary section reading and writing */
37 #define elf_new_section_hook _bfd_dummy_new_section_hook
38 #define elf_get_section_contents bfd_generic_get_section_contents
39 /* #define elf_set_section_contents bfd_generic_set_section_contents */
40 #define elf_close_and_cleanup bfd_generic_close_and_cleanup
41
42 #define elf_bfd_debug_info_start bfd_void
43 #define elf_bfd_debug_info_end bfd_void
44 #define elf_bfd_debug_info_accumulate (PROTO(void,(*),(bfd*, struct sec *))) bfd_void
45 #define elf_bfd_get_relocated_section_contents \
46 bfd_generic_get_relocated_section_contents
47 #define elf_bfd_relax_section bfd_generic_relax_section
48 #define elf_bfd_seclet_link bfd_generic_seclet_link
49 #define elf_bfd_make_debug_symbol \
50 ((asymbol *(*) PARAMS ((bfd *, void *, unsigned long))) bfd_nullvoidptr)
51
52 static CONST struct elf_backend_data elf_bed =
53 {
54 elf_info_to_howto,
55 ELF_ARCH,
56 };
57
58 #ifdef TARGET_BIG_SYM
59 bfd_target TARGET_BIG_SYM =
60 {
61 /* name: identify kind of target */
62 TARGET_BIG_NAME,
63
64 /* flavour: general indication about file */
65 bfd_target_elf_flavour,
66
67 /* byteorder_big_p: data is big endian */
68 true,
69
70 /* header_byteorder_big_p: header is also big endian */
71 true,
72
73 /* object_flags: mask of all file flags */
74 (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS |
75 DYNAMIC | WP_TEXT),
76
77 /* section_flags: mask of all section flags */
78 (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY |
79 SEC_CODE | SEC_DATA),
80
81 /* leading_symbol_char: is the first char of a user symbol
82 predictable, and if so what is it */
83 0,
84
85 /* ar_pad_char: pad character for filenames within an archive header
86 FIXME: this really has nothing to do with ELF, this is a characteristic
87 of the archiver and/or os and should be independently tunable */
88 '/',
89
90 /* ar_max_namelen: maximum number of characters in an archive header
91 FIXME: this really has nothing to do with ELF, this is a characteristic
92 of the archiver and should be independently tunable. This value is
93 a WAG (wild a** guess) */
94 15,
95
96 /* align_power_min: minimum alignment restriction for any section
97 FIXME: this value may be target machine dependent */
98 3,
99
100 /* Routines to byte-swap various sized integers from the data sections */
101 _do_getb64, _do_putb64, _do_getb32, _do_putb32, _do_getb16, _do_putb16,
102
103 /* Routines to byte-swap various sized integers from the file headers */
104 _do_getb64, _do_putb64, _do_getb32, _do_putb32, _do_getb16, _do_putb16,
105
106 /* bfd_check_format: check the format of a file being read */
107 { _bfd_dummy_target, /* unknown format */
108 elf_object_p, /* assembler/linker output (object file) */
109 bfd_generic_archive_p, /* an archive */
110 elf_core_file_p /* a core file */
111 },
112
113 /* bfd_set_format: set the format of a file being written */
114 { bfd_false,
115 elf_mkobject,
116 _bfd_generic_mkarchive,
117 bfd_false
118 },
119
120 /* bfd_write_contents: write cached information into a file being written */
121 { bfd_false,
122 elf_write_object_contents,
123 _bfd_write_archive_contents,
124 bfd_false
125 },
126
127 /* Initialize a jump table with the standard macro. All names start with
128 "elf" */
129 JUMP_TABLE(elf),
130
131 /* backend_data: */
132 (PTR) &elf_bed,
133 };
134 #endif
135
136 #ifdef TARGET_LITTLE_SYM
137 bfd_target TARGET_LITTLE_SYM =
138 {
139 /* name: identify kind of target */
140 TARGET_LITTLE_NAME,
141
142 /* flavour: general indication about file */
143 bfd_target_elf_flavour,
144
145 /* byteorder_big_p: data is big endian */
146 false, /* Nope -- this one's little endian */
147
148 /* header_byteorder_big_p: header is also big endian */
149 false, /* Nope -- this one's little endian */
150
151 /* object_flags: mask of all file flags */
152 (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS |
153 DYNAMIC | WP_TEXT),
154
155 /* section_flags: mask of all section flags */
156 (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY |
157 SEC_DATA),
158
159 /* leading_symbol_char: is the first char of a user symbol
160 predictable, and if so what is it */
161 0,
162
163 /* ar_pad_char: pad character for filenames within an archive header
164 FIXME: this really has nothing to do with ELF, this is a characteristic
165 of the archiver and/or os and should be independently tunable */
166 '/',
167
168 /* ar_max_namelen: maximum number of characters in an archive header
169 FIXME: this really has nothing to do with ELF, this is a characteristic
170 of the archiver and should be independently tunable. This value is
171 a WAG (wild a** guess) */
172 15,
173
174 /* align_power_min: minimum alignment restriction for any section
175 FIXME: this value may be target machine dependent */
176 3,
177
178 /* Routines to byte-swap various sized integers from the data sections */
179 _do_getl64, _do_putl64, _do_getl32, _do_putl32, _do_getl16, _do_putl16,
180
181 /* Routines to byte-swap various sized integers from the file headers */
182 _do_getl64, _do_putl64, _do_getl32, _do_putl32, _do_getl16, _do_putl16,
183
184 /* bfd_check_format: check the format of a file being read */
185 { _bfd_dummy_target, /* unknown format */
186 elf_object_p, /* assembler/linker output (object file) */
187 bfd_generic_archive_p, /* an archive */
188 elf_core_file_p /* a core file */
189 },
190
191 /* bfd_set_format: set the format of a file being written */
192 { bfd_false,
193 elf_mkobject,
194 _bfd_generic_mkarchive,
195 bfd_false
196 },
197
198 /* bfd_write_contents: write cached information into a file being written */
199 { bfd_false,
200 elf_write_object_contents,
201 _bfd_write_archive_contents,
202 bfd_false
203 },
204
205 /* Initialize a jump table with the standard macro. All names start with
206 "elf" */
207 JUMP_TABLE(elf),
208
209 /* backend_data: */
210 (PTR) &elf_bed,
211 };
212 #endif