Rev 5197 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5197 | Rev 6324 | ||
---|---|---|---|
1 | /* BFD back-end for binary objects. |
1 | /* BFD back-end for binary objects. |
2 | Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, |
- | |
3 | 2004, 2005, 2006, 2007, 2009, 2011 Free Software Foundation, Inc. |
2 | Copyright (C) 1994-2015 Free Software Foundation, Inc. |
4 | Written by Ian Lance Taylor, Cygnus Support, |
3 | Written by Ian Lance Taylor, Cygnus Support, |
5 | 4 | ||
6 | This file is part of BFD, the Binary File Descriptor library. |
5 | This file is part of BFD, the Binary File Descriptor library. |
7 | 6 | ||
8 | This program is free software; you can redistribute it and/or modify |
7 | This program is free software; you can redistribute it and/or modify |
9 | it under the terms of the GNU General Public License as published by |
8 | it under the terms of the GNU General Public License as published by |
10 | the Free Software Foundation; either version 3 of the License, or |
9 | the Free Software Foundation; either version 3 of the License, or |
11 | (at your option) any later version. |
10 | (at your option) any later version. |
12 | 11 | ||
13 | This program is distributed in the hope that it will be useful, |
12 | This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU General Public License for more details. |
15 | GNU General Public License for more details. |
17 | 16 | ||
18 | You should have received a copy of the GNU General Public License |
17 | You should have received a copy of the GNU General Public License |
19 | along with this program; if not, write to the Free Software |
18 | along with this program; if not, write to the Free Software |
20 | Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, |
19 | Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, |
21 | MA 02110-1301, USA. */ |
20 | MA 02110-1301, USA. */ |
22 | 21 | ||
23 | /* This is a BFD backend which may be used to write binary objects. |
22 | /* This is a BFD backend which may be used to write binary objects. |
24 | It may only be used for output, not input. The intention is that |
23 | It may only be used for output, not input. The intention is that |
25 | this may be used as an output format for objcopy in order to |
24 | this may be used as an output format for objcopy in order to |
26 | generate raw binary data. |
25 | generate raw binary data. |
27 | 26 | ||
28 | This is very simple. The only complication is that the real data |
27 | This is very simple. The only complication is that the real data |
29 | will start at some address X, and in some cases we will not want to |
28 | will start at some address X, and in some cases we will not want to |
30 | include X zeroes just to get to that point. Since the start |
29 | include X zeroes just to get to that point. Since the start |
31 | address is not meaningful for this object file format, we use it |
30 | address is not meaningful for this object file format, we use it |
32 | instead to indicate the number of zeroes to skip at the start of |
31 | instead to indicate the number of zeroes to skip at the start of |
33 | the file. objcopy cooperates by specially setting the start |
32 | the file. objcopy cooperates by specially setting the start |
34 | address to zero by default. */ |
33 | address to zero by default. */ |
35 | 34 | ||
36 | #include "sysdep.h" |
35 | #include "sysdep.h" |
37 | #include "bfd.h" |
36 | #include "bfd.h" |
38 | #include "safe-ctype.h" |
37 | #include "safe-ctype.h" |
39 | #include "libbfd.h" |
38 | #include "libbfd.h" |
40 | 39 | ||
41 | /* Any bfd we create by reading a binary file has three symbols: |
40 | /* Any bfd we create by reading a binary file has three symbols: |
42 | a start symbol, an end symbol, and an absolute length symbol. */ |
41 | a start symbol, an end symbol, and an absolute length symbol. */ |
43 | #define BIN_SYMS 3 |
42 | #define BIN_SYMS 3 |
44 | 43 | ||
45 | /* Create a binary object. Invoked via bfd_set_format. */ |
44 | /* Create a binary object. Invoked via bfd_set_format. */ |
46 | 45 | ||
47 | static bfd_boolean |
46 | static bfd_boolean |
48 | binary_mkobject (bfd *abfd ATTRIBUTE_UNUSED) |
47 | binary_mkobject (bfd *abfd ATTRIBUTE_UNUSED) |
49 | { |
48 | { |
50 | return TRUE; |
49 | return TRUE; |
51 | } |
50 | } |
52 | 51 | ||
53 | /* Any file may be considered to be a binary file, provided the target |
52 | /* Any file may be considered to be a binary file, provided the target |
54 | was not defaulted. That is, it must be explicitly specified as |
53 | was not defaulted. That is, it must be explicitly specified as |
55 | being binary. */ |
54 | being binary. */ |
56 | 55 | ||
57 | static const bfd_target * |
56 | static const bfd_target * |
58 | binary_object_p (bfd *abfd) |
57 | binary_object_p (bfd *abfd) |
59 | { |
58 | { |
60 | struct stat statbuf; |
59 | struct stat statbuf; |
61 | asection *sec; |
60 | asection *sec; |
62 | flagword flags; |
61 | flagword flags; |
63 | 62 | ||
64 | if (abfd->target_defaulted) |
63 | if (abfd->target_defaulted) |
65 | { |
64 | { |
66 | bfd_set_error (bfd_error_wrong_format); |
65 | bfd_set_error (bfd_error_wrong_format); |
67 | return NULL; |
66 | return NULL; |
68 | } |
67 | } |
69 | 68 | ||
70 | abfd->symcount = BIN_SYMS; |
69 | abfd->symcount = BIN_SYMS; |
71 | 70 | ||
72 | /* Find the file size. */ |
71 | /* Find the file size. */ |
73 | if (bfd_stat (abfd, &statbuf) < 0) |
72 | if (bfd_stat (abfd, &statbuf) < 0) |
74 | { |
73 | { |
75 | bfd_set_error (bfd_error_system_call); |
74 | bfd_set_error (bfd_error_system_call); |
76 | return NULL; |
75 | return NULL; |
77 | } |
76 | } |
78 | 77 | ||
79 | /* One data section. */ |
78 | /* One data section. */ |
80 | flags = SEC_ALLOC | SEC_LOAD | SEC_DATA | SEC_HAS_CONTENTS; |
79 | flags = SEC_ALLOC | SEC_LOAD | SEC_DATA | SEC_HAS_CONTENTS; |
81 | sec = bfd_make_section_with_flags (abfd, ".data", flags); |
80 | sec = bfd_make_section_with_flags (abfd, ".data", flags); |
82 | if (sec == NULL) |
81 | if (sec == NULL) |
83 | return NULL; |
82 | return NULL; |
84 | sec->vma = 0; |
83 | sec->vma = 0; |
85 | sec->size = statbuf.st_size; |
84 | sec->size = statbuf.st_size; |
86 | sec->filepos = 0; |
85 | sec->filepos = 0; |
87 | 86 | ||
88 | abfd->tdata.any = (void *) sec; |
87 | abfd->tdata.any = (void *) sec; |
89 | 88 | ||
90 | return abfd->xvec; |
89 | return abfd->xvec; |
91 | } |
90 | } |
92 | 91 | ||
93 | #define binary_close_and_cleanup _bfd_generic_close_and_cleanup |
92 | #define binary_close_and_cleanup _bfd_generic_close_and_cleanup |
94 | #define binary_bfd_free_cached_info _bfd_generic_bfd_free_cached_info |
93 | #define binary_bfd_free_cached_info _bfd_generic_bfd_free_cached_info |
95 | #define binary_new_section_hook _bfd_generic_new_section_hook |
94 | #define binary_new_section_hook _bfd_generic_new_section_hook |
96 | 95 | ||
97 | /* Get contents of the only section. */ |
96 | /* Get contents of the only section. */ |
98 | 97 | ||
99 | static bfd_boolean |
98 | static bfd_boolean |
100 | binary_get_section_contents (bfd *abfd, |
99 | binary_get_section_contents (bfd *abfd, |
101 | asection *section ATTRIBUTE_UNUSED, |
100 | asection *section ATTRIBUTE_UNUSED, |
102 | void * location, |
101 | void * location, |
103 | file_ptr offset, |
102 | file_ptr offset, |
104 | bfd_size_type count) |
103 | bfd_size_type count) |
105 | { |
104 | { |
106 | if (bfd_seek (abfd, offset, SEEK_SET) != 0 |
105 | if (bfd_seek (abfd, offset, SEEK_SET) != 0 |
107 | || bfd_bread (location, count, abfd) != count) |
106 | || bfd_bread (location, count, abfd) != count) |
108 | return FALSE; |
107 | return FALSE; |
109 | return TRUE; |
108 | return TRUE; |
110 | } |
109 | } |
111 | 110 | ||
112 | /* Return the amount of memory needed to read the symbol table. */ |
111 | /* Return the amount of memory needed to read the symbol table. */ |
113 | 112 | ||
114 | static long |
113 | static long |
115 | binary_get_symtab_upper_bound (bfd *abfd ATTRIBUTE_UNUSED) |
114 | binary_get_symtab_upper_bound (bfd *abfd ATTRIBUTE_UNUSED) |
116 | { |
115 | { |
117 | return (BIN_SYMS + 1) * sizeof (asymbol *); |
116 | return (BIN_SYMS + 1) * sizeof (asymbol *); |
118 | } |
117 | } |
119 | 118 | ||
120 | /* Create a symbol name based on the bfd's filename. */ |
119 | /* Create a symbol name based on the bfd's filename. */ |
121 | 120 | ||
122 | static char * |
121 | static char * |
123 | mangle_name (bfd *abfd, char *suffix) |
122 | mangle_name (bfd *abfd, char *suffix) |
124 | { |
123 | { |
125 | bfd_size_type size; |
124 | bfd_size_type size; |
126 | char *buf; |
125 | char *buf; |
127 | char *p; |
126 | char *p; |
128 | 127 | ||
129 | size = (strlen (bfd_get_filename (abfd)) |
128 | size = (strlen (bfd_get_filename (abfd)) |
130 | + strlen (suffix) |
129 | + strlen (suffix) |
131 | + sizeof "_binary__"); |
130 | + sizeof "_binary__"); |
132 | 131 | ||
133 | buf = (char *) bfd_alloc (abfd, size); |
132 | buf = (char *) bfd_alloc (abfd, size); |
134 | if (buf == NULL) |
133 | if (buf == NULL) |
135 | return ""; |
134 | return ""; |
136 | 135 | ||
137 | sprintf (buf, "_binary_%s_%s", bfd_get_filename (abfd), suffix); |
136 | sprintf (buf, "_binary_%s_%s", bfd_get_filename (abfd), suffix); |
138 | 137 | ||
139 | /* Change any non-alphanumeric characters to underscores. */ |
138 | /* Change any non-alphanumeric characters to underscores. */ |
140 | for (p = buf; *p; p++) |
139 | for (p = buf; *p; p++) |
141 | if (! ISALNUM (*p)) |
140 | if (! ISALNUM (*p)) |
142 | *p = '_'; |
141 | *p = '_'; |
143 | 142 | ||
144 | return buf; |
143 | return buf; |
145 | } |
144 | } |
146 | 145 | ||
147 | /* Return the symbol table. */ |
146 | /* Return the symbol table. */ |
148 | 147 | ||
149 | static long |
148 | static long |
150 | binary_canonicalize_symtab (bfd *abfd, asymbol **alocation) |
149 | binary_canonicalize_symtab (bfd *abfd, asymbol **alocation) |
151 | { |
150 | { |
152 | asection *sec = (asection *) abfd->tdata.any; |
151 | asection *sec = (asection *) abfd->tdata.any; |
153 | asymbol *syms; |
152 | asymbol *syms; |
154 | unsigned int i; |
153 | unsigned int i; |
155 | bfd_size_type amt = BIN_SYMS * sizeof (asymbol); |
154 | bfd_size_type amt = BIN_SYMS * sizeof (asymbol); |
156 | 155 | ||
157 | syms = (asymbol *) bfd_alloc (abfd, amt); |
156 | syms = (asymbol *) bfd_alloc (abfd, amt); |
158 | if (syms == NULL) |
157 | if (syms == NULL) |
159 | return -1; |
158 | return -1; |
160 | 159 | ||
161 | /* Start symbol. */ |
160 | /* Start symbol. */ |
162 | syms[0].the_bfd = abfd; |
161 | syms[0].the_bfd = abfd; |
163 | syms[0].name = mangle_name (abfd, "start"); |
162 | syms[0].name = mangle_name (abfd, "start"); |
164 | syms[0].value = 0; |
163 | syms[0].value = 0; |
165 | syms[0].flags = BSF_GLOBAL; |
164 | syms[0].flags = BSF_GLOBAL; |
166 | syms[0].section = sec; |
165 | syms[0].section = sec; |
167 | syms[0].udata.p = NULL; |
166 | syms[0].udata.p = NULL; |
168 | 167 | ||
169 | /* End symbol. */ |
168 | /* End symbol. */ |
170 | syms[1].the_bfd = abfd; |
169 | syms[1].the_bfd = abfd; |
171 | syms[1].name = mangle_name (abfd, "end"); |
170 | syms[1].name = mangle_name (abfd, "end"); |
172 | syms[1].value = sec->size; |
171 | syms[1].value = sec->size; |
173 | syms[1].flags = BSF_GLOBAL; |
172 | syms[1].flags = BSF_GLOBAL; |
174 | syms[1].section = sec; |
173 | syms[1].section = sec; |
175 | syms[1].udata.p = NULL; |
174 | syms[1].udata.p = NULL; |
176 | 175 | ||
177 | /* Size symbol. */ |
176 | /* Size symbol. */ |
178 | syms[2].the_bfd = abfd; |
177 | syms[2].the_bfd = abfd; |
179 | syms[2].name = mangle_name (abfd, "size"); |
178 | syms[2].name = mangle_name (abfd, "size"); |
180 | syms[2].value = sec->size; |
179 | syms[2].value = sec->size; |
181 | syms[2].flags = BSF_GLOBAL; |
180 | syms[2].flags = BSF_GLOBAL; |
182 | syms[2].section = bfd_abs_section_ptr; |
181 | syms[2].section = bfd_abs_section_ptr; |
183 | syms[2].udata.p = NULL; |
182 | syms[2].udata.p = NULL; |
184 | 183 | ||
185 | for (i = 0; i < BIN_SYMS; i++) |
184 | for (i = 0; i < BIN_SYMS; i++) |
186 | *alocation++ = syms++; |
185 | *alocation++ = syms++; |
187 | *alocation = NULL; |
186 | *alocation = NULL; |
188 | 187 | ||
189 | return BIN_SYMS; |
188 | return BIN_SYMS; |
190 | } |
189 | } |
191 | 190 | ||
192 | #define binary_make_empty_symbol _bfd_generic_make_empty_symbol |
191 | #define binary_make_empty_symbol _bfd_generic_make_empty_symbol |
193 | #define binary_print_symbol _bfd_nosymbols_print_symbol |
192 | #define binary_print_symbol _bfd_nosymbols_print_symbol |
- | 193 | #define binary_get_symbol_version_string \ |
|
- | 194 | _bfd_nosymbols_get_symbol_version_string |
|
194 | 195 | ||
195 | /* Get information about a symbol. */ |
196 | /* Get information about a symbol. */ |
196 | 197 | ||
197 | static void |
198 | static void |
198 | binary_get_symbol_info (bfd *ignore_abfd ATTRIBUTE_UNUSED, |
199 | binary_get_symbol_info (bfd *ignore_abfd ATTRIBUTE_UNUSED, |
199 | asymbol *symbol, |
200 | asymbol *symbol, |
200 | symbol_info *ret) |
201 | symbol_info *ret) |
201 | { |
202 | { |
202 | bfd_symbol_info (symbol, ret); |
203 | bfd_symbol_info (symbol, ret); |
203 | } |
204 | } |
204 | 205 | ||
205 | #define binary_bfd_is_local_label_name bfd_generic_is_local_label_name |
206 | #define binary_bfd_is_local_label_name bfd_generic_is_local_label_name |
206 | #define binary_get_lineno _bfd_nosymbols_get_lineno |
207 | #define binary_get_lineno _bfd_nosymbols_get_lineno |
207 | #define binary_find_nearest_line _bfd_nosymbols_find_nearest_line |
208 | #define binary_find_nearest_line _bfd_nosymbols_find_nearest_line |
- | 209 | #define binary_find_line _bfd_nosymbols_find_line |
|
208 | #define binary_find_inliner_info _bfd_nosymbols_find_inliner_info |
210 | #define binary_find_inliner_info _bfd_nosymbols_find_inliner_info |
209 | #define binary_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol |
211 | #define binary_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol |
210 | #define binary_read_minisymbols _bfd_generic_read_minisymbols |
212 | #define binary_read_minisymbols _bfd_generic_read_minisymbols |
211 | #define binary_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol |
213 | #define binary_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol |
212 | #define binary_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false) |
214 | #define binary_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false) |
213 | 215 | ||
214 | /* Set the architecture of a binary file. */ |
216 | /* Set the architecture of a binary file. */ |
215 | #define binary_set_arch_mach _bfd_generic_set_arch_mach |
217 | #define binary_set_arch_mach _bfd_generic_set_arch_mach |
216 | 218 | ||
217 | /* Write section contents of a binary file. */ |
219 | /* Write section contents of a binary file. */ |
218 | 220 | ||
219 | static bfd_boolean |
221 | static bfd_boolean |
220 | binary_set_section_contents (bfd *abfd, |
222 | binary_set_section_contents (bfd *abfd, |
221 | asection *sec, |
223 | asection *sec, |
222 | const void * data, |
224 | const void * data, |
223 | file_ptr offset, |
225 | file_ptr offset, |
224 | bfd_size_type size) |
226 | bfd_size_type size) |
225 | { |
227 | { |
226 | if (size == 0) |
228 | if (size == 0) |
227 | return TRUE; |
229 | return TRUE; |
228 | 230 | ||
229 | if (! abfd->output_has_begun) |
231 | if (! abfd->output_has_begun) |
230 | { |
232 | { |
231 | bfd_boolean found_low; |
233 | bfd_boolean found_low; |
232 | bfd_vma low; |
234 | bfd_vma low; |
233 | asection *s; |
235 | asection *s; |
234 | 236 | ||
235 | /* The lowest section LMA sets the virtual address of the start |
237 | /* The lowest section LMA sets the virtual address of the start |
236 | of the file. We use this to set the file position of all the |
238 | of the file. We use this to set the file position of all the |
237 | sections. */ |
239 | sections. */ |
238 | found_low = FALSE; |
240 | found_low = FALSE; |
239 | low = 0; |
241 | low = 0; |
240 | for (s = abfd->sections; s != NULL; s = s->next) |
242 | for (s = abfd->sections; s != NULL; s = s->next) |
241 | if (((s->flags |
243 | if (((s->flags |
242 | & (SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC | SEC_NEVER_LOAD)) |
244 | & (SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC | SEC_NEVER_LOAD)) |
243 | == (SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC)) |
245 | == (SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC)) |
244 | && (s->size > 0) |
246 | && (s->size > 0) |
245 | && (! found_low || s->lma < low)) |
247 | && (! found_low || s->lma < low)) |
246 | { |
248 | { |
247 | low = s->lma; |
249 | low = s->lma; |
248 | found_low = TRUE; |
250 | found_low = TRUE; |
249 | } |
251 | } |
250 | 252 | ||
251 | for (s = abfd->sections; s != NULL; s = s->next) |
253 | for (s = abfd->sections; s != NULL; s = s->next) |
252 | { |
254 | { |
253 | s->filepos = s->lma - low; |
255 | s->filepos = s->lma - low; |
254 | 256 | ||
255 | /* Skip following warning check for sections that will not |
257 | /* Skip following warning check for sections that will not |
256 | occupy file space. */ |
258 | occupy file space. */ |
257 | if ((s->flags |
259 | if ((s->flags |
258 | & (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_NEVER_LOAD)) |
260 | & (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_NEVER_LOAD)) |
259 | != (SEC_HAS_CONTENTS | SEC_ALLOC) |
261 | != (SEC_HAS_CONTENTS | SEC_ALLOC) |
260 | || (s->size == 0)) |
262 | || (s->size == 0)) |
261 | continue; |
263 | continue; |
262 | 264 | ||
263 | /* If attempting to generate a binary file from a bfd with |
265 | /* If attempting to generate a binary file from a bfd with |
264 | LMA's all over the place, huge (sparse?) binary files may |
266 | LMA's all over the place, huge (sparse?) binary files may |
265 | result. This condition attempts to detect this situation |
267 | result. This condition attempts to detect this situation |
266 | and print a warning. Better heuristics would be nice to |
268 | and print a warning. Better heuristics would be nice to |
267 | have. */ |
269 | have. */ |
268 | 270 | ||
269 | if (s->filepos < 0) |
271 | if (s->filepos < 0) |
270 | (*_bfd_error_handler) |
272 | (*_bfd_error_handler) |
271 | (_("Warning: Writing section `%s' to huge (ie negative) file offset 0x%lx."), |
273 | (_("Warning: Writing section `%s' to huge (ie negative) file offset 0x%lx."), |
272 | bfd_get_section_name (abfd, s), |
274 | bfd_get_section_name (abfd, s), |
273 | (unsigned long) s->filepos); |
275 | (unsigned long) s->filepos); |
274 | } |
276 | } |
275 | 277 | ||
276 | abfd->output_has_begun = TRUE; |
278 | abfd->output_has_begun = TRUE; |
277 | } |
279 | } |
278 | 280 | ||
279 | /* We don't want to output anything for a section that is neither |
281 | /* We don't want to output anything for a section that is neither |
280 | loaded nor allocated. The contents of such a section are not |
282 | loaded nor allocated. The contents of such a section are not |
281 | meaningful in the binary format. */ |
283 | meaningful in the binary format. */ |
282 | if ((sec->flags & (SEC_LOAD | SEC_ALLOC)) == 0) |
284 | if ((sec->flags & (SEC_LOAD | SEC_ALLOC)) == 0) |
283 | return TRUE; |
285 | return TRUE; |
284 | if ((sec->flags & SEC_NEVER_LOAD) != 0) |
286 | if ((sec->flags & SEC_NEVER_LOAD) != 0) |
285 | return TRUE; |
287 | return TRUE; |
286 | 288 | ||
287 | return _bfd_generic_set_section_contents (abfd, sec, data, offset, size); |
289 | return _bfd_generic_set_section_contents (abfd, sec, data, offset, size); |
288 | } |
290 | } |
289 | 291 | ||
290 | /* No space is required for header information. */ |
292 | /* No space is required for header information. */ |
291 | 293 | ||
292 | static int |
294 | static int |
293 | binary_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED, |
295 | binary_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED, |
294 | struct bfd_link_info *info ATTRIBUTE_UNUSED) |
296 | struct bfd_link_info *info ATTRIBUTE_UNUSED) |
295 | { |
297 | { |
296 | return 0; |
298 | return 0; |
297 | } |
299 | } |
298 | 300 | ||
299 | #define binary_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents |
301 | #define binary_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents |
300 | #define binary_bfd_relax_section bfd_generic_relax_section |
302 | #define binary_bfd_relax_section bfd_generic_relax_section |
301 | #define binary_bfd_gc_sections bfd_generic_gc_sections |
303 | #define binary_bfd_gc_sections bfd_generic_gc_sections |
302 | #define binary_bfd_lookup_section_flags bfd_generic_lookup_section_flags |
304 | #define binary_bfd_lookup_section_flags bfd_generic_lookup_section_flags |
303 | #define binary_bfd_merge_sections bfd_generic_merge_sections |
305 | #define binary_bfd_merge_sections bfd_generic_merge_sections |
304 | #define binary_bfd_is_group_section bfd_generic_is_group_section |
306 | #define binary_bfd_is_group_section bfd_generic_is_group_section |
305 | #define binary_bfd_discard_group bfd_generic_discard_group |
307 | #define binary_bfd_discard_group bfd_generic_discard_group |
306 | #define binary_section_already_linked _bfd_generic_section_already_linked |
308 | #define binary_section_already_linked _bfd_generic_section_already_linked |
307 | #define binary_bfd_define_common_symbol bfd_generic_define_common_symbol |
309 | #define binary_bfd_define_common_symbol bfd_generic_define_common_symbol |
308 | #define binary_bfd_link_hash_table_create _bfd_generic_link_hash_table_create |
310 | #define binary_bfd_link_hash_table_create _bfd_generic_link_hash_table_create |
309 | #define binary_bfd_link_hash_table_free _bfd_generic_link_hash_table_free |
- | |
310 | #define binary_bfd_link_just_syms _bfd_generic_link_just_syms |
311 | #define binary_bfd_link_just_syms _bfd_generic_link_just_syms |
311 | #define binary_bfd_copy_link_hash_symbol_type \ |
312 | #define binary_bfd_copy_link_hash_symbol_type \ |
312 | _bfd_generic_copy_link_hash_symbol_type |
313 | _bfd_generic_copy_link_hash_symbol_type |
313 | #define binary_bfd_link_add_symbols _bfd_generic_link_add_symbols |
314 | #define binary_bfd_link_add_symbols _bfd_generic_link_add_symbols |
314 | #define binary_bfd_final_link _bfd_generic_final_link |
315 | #define binary_bfd_final_link _bfd_generic_final_link |
315 | #define binary_bfd_link_split_section _bfd_generic_link_split_section |
316 | #define binary_bfd_link_split_section _bfd_generic_link_split_section |
316 | #define binary_get_section_contents_in_window _bfd_generic_get_section_contents_in_window |
317 | #define binary_get_section_contents_in_window _bfd_generic_get_section_contents_in_window |
317 | 318 | ||
318 | const bfd_target binary_vec = |
319 | const bfd_target binary_vec = |
319 | { |
320 | { |
320 | "binary", /* name */ |
321 | "binary", /* name */ |
321 | bfd_target_unknown_flavour, /* flavour */ |
322 | bfd_target_unknown_flavour, /* flavour */ |
322 | BFD_ENDIAN_UNKNOWN, /* byteorder */ |
323 | BFD_ENDIAN_UNKNOWN, /* byteorder */ |
323 | BFD_ENDIAN_UNKNOWN, /* header_byteorder */ |
324 | BFD_ENDIAN_UNKNOWN, /* header_byteorder */ |
324 | EXEC_P, /* object_flags */ |
325 | EXEC_P, /* object_flags */ |
325 | (SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_CODE | SEC_DATA |
326 | (SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_CODE | SEC_DATA |
326 | | SEC_ROM | SEC_HAS_CONTENTS), /* section_flags */ |
327 | | SEC_ROM | SEC_HAS_CONTENTS), /* section_flags */ |
327 | 0, /* symbol_leading_char */ |
328 | 0, /* symbol_leading_char */ |
328 | ' ', /* ar_pad_char */ |
329 | ' ', /* ar_pad_char */ |
329 | 16, /* ar_max_namelen */ |
330 | 16, /* ar_max_namelen */ |
330 | 255, /* match priority. */ |
331 | 255, /* match priority. */ |
331 | bfd_getb64, bfd_getb_signed_64, bfd_putb64, |
332 | bfd_getb64, bfd_getb_signed_64, bfd_putb64, |
332 | bfd_getb32, bfd_getb_signed_32, bfd_putb32, |
333 | bfd_getb32, bfd_getb_signed_32, bfd_putb32, |
333 | bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */ |
334 | bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */ |
334 | bfd_getb64, bfd_getb_signed_64, bfd_putb64, |
335 | bfd_getb64, bfd_getb_signed_64, bfd_putb64, |
335 | bfd_getb32, bfd_getb_signed_32, bfd_putb32, |
336 | bfd_getb32, bfd_getb_signed_32, bfd_putb32, |
336 | bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */ |
337 | bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */ |
337 | { /* bfd_check_format */ |
338 | { /* bfd_check_format */ |
338 | _bfd_dummy_target, |
339 | _bfd_dummy_target, |
339 | binary_object_p, |
340 | binary_object_p, |
340 | _bfd_dummy_target, |
341 | _bfd_dummy_target, |
341 | _bfd_dummy_target, |
342 | _bfd_dummy_target, |
342 | }, |
343 | }, |
343 | { /* bfd_set_format */ |
344 | { /* bfd_set_format */ |
344 | bfd_false, |
345 | bfd_false, |
345 | binary_mkobject, |
346 | binary_mkobject, |
346 | bfd_false, |
347 | bfd_false, |
347 | bfd_false, |
348 | bfd_false, |
348 | }, |
349 | }, |
349 | { /* bfd_write_contents */ |
350 | { /* bfd_write_contents */ |
350 | bfd_false, |
351 | bfd_false, |
351 | bfd_true, |
352 | bfd_true, |
352 | bfd_false, |
353 | bfd_false, |
353 | bfd_false, |
354 | bfd_false, |
354 | }, |
355 | }, |
355 | 356 | ||
356 | BFD_JUMP_TABLE_GENERIC (binary), |
357 | BFD_JUMP_TABLE_GENERIC (binary), |
357 | BFD_JUMP_TABLE_COPY (_bfd_generic), |
358 | BFD_JUMP_TABLE_COPY (_bfd_generic), |
358 | BFD_JUMP_TABLE_CORE (_bfd_nocore), |
359 | BFD_JUMP_TABLE_CORE (_bfd_nocore), |
359 | BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive), |
360 | BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive), |
360 | BFD_JUMP_TABLE_SYMBOLS (binary), |
361 | BFD_JUMP_TABLE_SYMBOLS (binary), |
361 | BFD_JUMP_TABLE_RELOCS (_bfd_norelocs), |
362 | BFD_JUMP_TABLE_RELOCS (_bfd_norelocs), |
362 | BFD_JUMP_TABLE_WRITE (binary), |
363 | BFD_JUMP_TABLE_WRITE (binary), |
363 | BFD_JUMP_TABLE_LINK (binary), |
364 | BFD_JUMP_TABLE_LINK (binary), |
364 | BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), |
365 | BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic), |
365 | 366 | ||
366 | NULL, |
367 | NULL, |
367 | 368 | ||
368 | NULL |
369 | NULL |
369 | };>>>> |
370 | };>>>> |