Commit | Line | Data |
---|---|---|
8696b2db | 1 | /* evax-alpha.c -- BFD back-end for ALPHA EVAX (openVMS/Alpha) files. |
b35711c4 | 2 | Copyright 1996, 1997, 1998 Free Software Foundation, Inc. |
8696b2db | 3 | Written by Klaus K"ampf (kkaempf@progis.de) |
c3d8e071 ILT |
4 | of proGIS Softwareentwicklung, Aachen, Germany |
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | |
19 | ||
c3d8e071 ILT |
20 | #include "bfd.h" |
21 | #include "sysdep.h" | |
22 | #include "bfdlink.h" | |
23 | #include "libbfd.h" | |
24 | ||
25 | #include "evax.h" | |
26 | ||
27 | static boolean evax_initialize PARAMS ((bfd *)); | |
28 | static boolean fill_section_ptr PARAMS ((struct bfd_hash_entry *, PTR)); | |
29 | static boolean evax_fixup_sections PARAMS ((bfd *)); | |
30 | static boolean copy_symbols PARAMS ((struct bfd_hash_entry *, PTR)); | |
31 | static bfd_reloc_status_type reloc_nil | |
32 | PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); | |
33 | static const struct bfd_target *evax_object_p PARAMS ((bfd *abfd)); | |
34 | static const struct bfd_target *evax_archive_p PARAMS ((bfd *abfd)); | |
35 | static boolean evax_mkobject PARAMS ((bfd *abfd)); | |
36 | static boolean evax_write_object_contents PARAMS ((bfd *abfd)); | |
37 | static boolean evax_close_and_cleanup PARAMS ((bfd *abfd)); | |
38 | static boolean evax_bfd_free_cached_info PARAMS ((bfd *abfd)); | |
39 | static boolean evax_new_section_hook PARAMS ((bfd *abfd, asection *section)); | |
40 | static boolean evax_get_section_contents | |
41 | PARAMS ((bfd *abfd, asection *section, PTR x1, file_ptr x2, | |
42 | bfd_size_type x3)); | |
43 | static boolean evax_get_section_contents_in_window | |
44 | PARAMS ((bfd *abfd, asection *section, bfd_window *w, file_ptr offset, | |
45 | bfd_size_type count)); | |
46 | static boolean evax_bfd_copy_private_bfd_data PARAMS ((bfd *src, bfd *dest)); | |
47 | static boolean evax_bfd_copy_private_section_data | |
48 | PARAMS ((bfd *srcbfd, asection *srcsec, bfd *dstbfd, asection *dstsec)); | |
49 | static boolean evax_bfd_copy_private_symbol_data | |
50 | PARAMS ((bfd *ibfd, asymbol *isym, bfd *obfd, asymbol *osym)); | |
51 | static boolean evax_bfd_print_private_bfd_data | |
52 | PARAMS ((bfd *abfd, void *file)); | |
53 | static char *evax_core_file_failing_command PARAMS ((bfd *abfd)); | |
54 | static int evax_core_file_failing_signal PARAMS ((bfd *abfd)); | |
55 | static boolean evax_core_file_matches_executable_p | |
56 | PARAMS ((bfd *abfd, bfd *bbfd)); | |
57 | static boolean evax_slurp_armap PARAMS ((bfd *abfd)); | |
58 | static boolean evax_slurp_extended_name_table PARAMS ((bfd *abfd)); | |
59 | static boolean evax_construct_extended_name_table | |
60 | PARAMS ((bfd *abfd, char **tabloc, bfd_size_type *tablen, | |
61 | const char **name)); | |
62 | static void evax_truncate_arname | |
63 | PARAMS ((bfd *abfd, CONST char *pathname, char *arhdr)); | |
64 | static boolean evax_write_armap | |
65 | PARAMS ((bfd *arch, unsigned int elength, struct orl *map, | |
66 | unsigned int orl_count, int stridx)); | |
67 | static PTR evax_read_ar_hdr PARAMS ((bfd *abfd)); | |
68 | static bfd *evax_get_elt_at_index PARAMS ((bfd *abfd, symindex index)); | |
69 | static bfd *evax_openr_next_archived_file PARAMS ((bfd *arch, bfd *prev)); | |
70 | static boolean evax_update_armap_timestamp PARAMS ((bfd *abfd)); | |
71 | static int evax_generic_stat_arch_elt PARAMS ((bfd *abfd, struct stat *stat)); | |
72 | static long evax_get_symtab_upper_bound PARAMS ((bfd *abfd)); | |
73 | static long evax_get_symtab PARAMS ((bfd *abfd, asymbol **symbols)); | |
74 | static void evax_print_symbol | |
75 | PARAMS ((bfd *abfd, PTR file, asymbol *symbol, bfd_print_symbol_type how)); | |
76 | static void evax_get_symbol_info | |
77 | PARAMS ((bfd *abfd, asymbol *symbol, symbol_info *ret)); | |
35a3e78e | 78 | static boolean evax_bfd_is_local_label_name PARAMS ((bfd *abfd, const char *)); |
c3d8e071 ILT |
79 | static alent *evax_get_lineno PARAMS ((bfd *abfd, asymbol *symbol)); |
80 | static boolean evax_find_nearest_line | |
81 | PARAMS ((bfd *abfd, asection *section, asymbol **symbols, bfd_vma offset, | |
82 | const char **file, const char **func, unsigned int *line)); | |
83 | static asymbol *evax_bfd_make_debug_symbol | |
84 | PARAMS ((bfd *abfd, void *ptr, unsigned long size)); | |
85 | static long evax_read_minisymbols | |
86 | PARAMS ((bfd *abfd, boolean dynamic, PTR *minisymsp, unsigned int *sizep)); | |
87 | static asymbol *evax_minisymbol_to_symbol | |
88 | PARAMS ((bfd *abfd, boolean dynamic, const PTR minisym, asymbol *sym)); | |
89 | static long evax_get_reloc_upper_bound PARAMS ((bfd *abfd, asection *sect)); | |
90 | static long evax_canonicalize_reloc | |
91 | PARAMS ((bfd *abfd, asection *srcsec, arelent **location, | |
92 | asymbol **symbols)); | |
93 | static const struct reloc_howto_struct *evax_bfd_reloc_type_lookup | |
94 | PARAMS ((bfd *abfd, bfd_reloc_code_real_type code)); | |
95 | static boolean evax_set_arch_mach | |
96 | PARAMS ((bfd *abfd, enum bfd_architecture arch, unsigned long mach)); | |
97 | static boolean evax_set_section_contents | |
98 | PARAMS ((bfd *abfd, asection *section, PTR location, file_ptr offset, | |
99 | bfd_size_type count)); | |
100 | static int evax_sizeof_headers PARAMS ((bfd *abfd, boolean reloc)); | |
101 | static bfd_byte *evax_bfd_get_relocated_section_contents | |
102 | PARAMS ((bfd *abfd, struct bfd_link_info *link_info, | |
103 | struct bfd_link_order *link_order, bfd_byte *data, | |
104 | boolean relocateable, asymbol **symbols)); | |
105 | static boolean evax_bfd_relax_section | |
106 | PARAMS ((bfd *abfd, asection *section, struct bfd_link_info *link_info, | |
107 | boolean *again)); | |
108 | static struct bfd_link_hash_table *evax_bfd_link_hash_table_create | |
109 | PARAMS ((bfd *abfd)); | |
110 | static boolean evax_bfd_link_add_symbols | |
111 | PARAMS ((bfd *abfd, struct bfd_link_info *link_info)); | |
112 | static boolean evax_bfd_final_link | |
113 | PARAMS ((bfd *abfd, struct bfd_link_info *link_info)); | |
114 | static boolean evax_bfd_link_split_section | |
115 | PARAMS ((bfd *abfd, asection *section)); | |
116 | static long evax_get_dynamic_symtab_upper_bound PARAMS ((bfd *abfd)); | |
117 | static long evax_canonicalize_dynamic_symtab | |
118 | PARAMS ((bfd *abfd, asymbol **symbols)); | |
119 | static long evax_get_dynamic_reloc_upper_bound PARAMS ((bfd *abfd)); | |
120 | static long evax_canonicalize_dynamic_reloc | |
121 | PARAMS ((bfd *abfd, arelent **arel, asymbol **symbols)); | |
122 | static boolean evax_bfd_merge_private_bfd_data PARAMS ((bfd *ibfd, bfd *obfd)); | |
123 | static boolean evax_bfd_set_private_flags PARAMS ((bfd *abfd, flagword flags)); | |
124 | ||
125 | #define evax_make_empty_symbol _bfd_evax_make_empty_symbol | |
126 | \f | |
127 | /*===========================================================================*/ | |
128 | ||
129 | const bfd_target evax_alpha_vec = | |
130 | { | |
131 | ||
132 | "evax-alpha", /* name */ | |
133 | bfd_target_evax_flavour, | |
134 | false, /* data byte order is little */ | |
135 | false, /* header byte order is little */ | |
136 | ||
8612a388 ILT |
137 | (HAS_RELOC | HAS_SYMS |
138 | | WP_TEXT | D_PAGED), /* object flags */ | |
139 | (SEC_ALLOC | SEC_LOAD | SEC_RELOC | |
140 | | SEC_READONLY | SEC_CODE | SEC_DATA | |
141 | | SEC_HAS_CONTENTS | SEC_IN_MEMORY), /* sect flags */ | |
c3d8e071 ILT |
142 | 0, /* symbol_leading_char */ |
143 | ' ', /* ar_pad_char */ | |
144 | 15, /* ar_max_namelen */ | |
8612a388 ILT |
145 | bfd_getl64, bfd_getl_signed_64, bfd_putl64, |
146 | bfd_getl32, bfd_getl_signed_32, bfd_putl32, | |
147 | bfd_getl16, bfd_getl_signed_16, bfd_putl16, | |
148 | bfd_getl64, bfd_getl_signed_64, bfd_putl64, | |
149 | bfd_getl32, bfd_getl_signed_32, bfd_putl32, | |
150 | bfd_getl16, bfd_getl_signed_16, bfd_putl16, | |
c3d8e071 ILT |
151 | |
152 | {_bfd_dummy_target, evax_object_p, /* bfd_check_format */ | |
153 | evax_archive_p, _bfd_dummy_target}, | |
154 | {bfd_false, evax_mkobject, /* bfd_set_format */ | |
155 | _bfd_generic_mkarchive, bfd_false}, | |
156 | {bfd_false, evax_write_object_contents, /* bfd_write_contents */ | |
157 | _bfd_write_archive_contents, bfd_false}, | |
158 | ||
159 | BFD_JUMP_TABLE_GENERIC (evax), | |
160 | BFD_JUMP_TABLE_COPY (evax), | |
161 | BFD_JUMP_TABLE_CORE (evax), | |
162 | BFD_JUMP_TABLE_ARCHIVE (evax), | |
163 | BFD_JUMP_TABLE_SYMBOLS (evax), | |
164 | BFD_JUMP_TABLE_RELOCS (evax), | |
165 | BFD_JUMP_TABLE_WRITE (evax), | |
166 | BFD_JUMP_TABLE_LINK (evax), | |
167 | BFD_JUMP_TABLE_DYNAMIC (evax), | |
168 | ||
169 | (PTR) 0 | |
170 | }; | |
171 | ||
172 | \f | |
173 | /*===========================================================================*/ | |
174 | ||
175 | /* Initialize private data */ | |
176 | ||
177 | static boolean | |
178 | evax_initialize (abfd) | |
179 | bfd *abfd; | |
180 | { | |
181 | int i; | |
182 | ||
183 | if (abfd->tdata.any != 0) | |
184 | return true; | |
185 | ||
186 | bfd_set_start_address (abfd, (bfd_vma)-1); | |
187 | ||
188 | abfd->tdata.any = ((struct evax_private_data_struct*) | |
189 | bfd_malloc (sizeof (struct evax_private_data_struct))); | |
190 | if (abfd->tdata.any == 0) | |
191 | return false; | |
192 | PRIV(evax_buf) = 0; | |
193 | PRIV(buf_size) = 0; | |
194 | PRIV(rec_length) = 0; | |
195 | PRIV(file_format) = FF_UNKNOWN; | |
c3d8e071 ILT |
196 | PRIV(fixup_done) = false; |
197 | PRIV(sections) = NULL; | |
198 | ||
199 | PRIV(stack) = ((struct stack_struct *) | |
200 | bfd_malloc (sizeof (struct stack_struct) * STACKSIZE)); | |
201 | if (PRIV(stack) == 0) | |
202 | { | |
203 | evax_init_no_mem1: | |
204 | free (abfd->tdata.any); | |
205 | abfd->tdata.any = 0; | |
206 | return false; | |
207 | } | |
208 | PRIV(stackptr) = 0; | |
209 | ||
210 | PRIV(evax_symbol_table) = ((struct bfd_hash_table *) | |
211 | bfd_malloc (sizeof (struct bfd_hash_table))); | |
212 | if (PRIV(evax_symbol_table) == 0) | |
213 | { | |
214 | evax_init_no_mem2: | |
215 | free (PRIV(stack)); | |
216 | PRIV(stack) = 0; | |
217 | goto evax_init_no_mem1; | |
218 | } | |
219 | ||
220 | if (!bfd_hash_table_init (PRIV(evax_symbol_table), _bfd_evax_hash_newfunc)) | |
221 | return false; | |
222 | ||
223 | PRIV(location_stack) = ((struct location_struct *) | |
224 | bfd_malloc (sizeof (struct location_struct) | |
225 | * LOCATION_SAVE_SIZE)); | |
226 | if (PRIV(location_stack) == 0) | |
227 | { | |
228 | evax_init_no_mem3: | |
229 | free (PRIV(evax_symbol_table)); | |
230 | PRIV(evax_symbol_table) = 0; | |
231 | goto evax_init_no_mem2; | |
232 | } | |
233 | ||
8612a388 ILT |
234 | for (i = 0; i < EVAX_SECTION_COUNT; i++) |
235 | PRIV(evax_section_table)[i] = NULL; | |
c3d8e071 ILT |
236 | |
237 | PRIV(output_buf) = (unsigned char *) malloc (MAX_OUTREC_SIZE); | |
238 | if (PRIV(output_buf) == 0) | |
239 | { | |
240 | free (PRIV(location_stack)); | |
241 | PRIV(location_stack) = 0; | |
242 | goto evax_init_no_mem3; | |
243 | } | |
244 | PRIV(push_level) = 0; | |
245 | PRIV(pushed_size) = 0; | |
246 | PRIV(length_pos) = 2; | |
247 | PRIV(output_size) = 0; | |
248 | PRIV(output_alignment) = 1; | |
249 | ||
250 | return true; | |
251 | } | |
252 | ||
253 | ||
254 | /* Fill symbol->section with section ptr | |
255 | symbol->section is filled with the section index for defined symbols | |
256 | during reading the EGSD section. But we need the pointer to the | |
257 | bfd section later. | |
258 | ||
259 | It has the correct value for referenced (undefined section) symbols | |
260 | ||
261 | called from bfd_hash_traverse in evax_fixup_sections */ | |
262 | ||
263 | static boolean | |
264 | fill_section_ptr (entry, sections) | |
265 | struct bfd_hash_entry *entry; | |
266 | PTR sections; | |
267 | { | |
268 | asection *sec; | |
269 | asymbol *sym; | |
270 | ||
271 | sym = ((evax_symbol_entry *)entry)->symbol; | |
272 | sec = sym->section; | |
273 | ||
274 | if (!bfd_is_und_section (sec)) | |
275 | { | |
276 | sec = ((evax_symbol_entry *)entry)->symbol->section = | |
277 | ((asection **)sections)[(int)sec]; | |
278 | } | |
279 | ||
280 | if (strcmp (sym->name, sec->name) == 0) | |
281 | sym->flags |= BSF_SECTION_SYM; | |
282 | ||
283 | return true; | |
284 | } | |
285 | ||
286 | ||
287 | /* Fixup sections | |
288 | set up all pointers and arrays, counters and sizes are fixed now | |
289 | ||
290 | we build a private sections vector for easy access since sections | |
291 | are always referenced by an index number. | |
292 | ||
293 | alloc PRIV(sections) according to abfd->section_count | |
294 | copy abfd->sections to PRIV(sections) */ | |
295 | ||
296 | static boolean | |
297 | evax_fixup_sections (abfd) | |
298 | bfd *abfd; | |
299 | { | |
300 | asection *s; | |
301 | ||
302 | if (PRIV(fixup_done)) | |
303 | return true; | |
304 | ||
305 | PRIV(sections) = ((asection **) | |
306 | bfd_malloc (abfd->section_count * sizeof (asection *))); | |
307 | if (PRIV(sections) == 0) | |
308 | return false; | |
309 | PRIV(egsd_sec_count) = abfd->section_count; | |
310 | s = abfd->sections; | |
311 | while (s) | |
312 | { | |
313 | PRIV(sections)[s->index] = s; | |
314 | s = s->next; | |
315 | } | |
316 | ||
317 | /* | |
318 | * traverse symbol table and fill in all section pointers | |
319 | */ | |
320 | ||
321 | bfd_hash_traverse (PRIV(evax_symbol_table), fill_section_ptr, | |
322 | (PTR)(PRIV(sections))); | |
323 | ||
324 | PRIV(fixup_done) = true; | |
325 | ||
326 | return true; | |
327 | } | |
328 | ||
329 | /*===========================================================================*/ | |
330 | ||
331 | /* Check the format for a file being read. | |
332 | Return a (bfd_target *) if it's an object file or zero if not. */ | |
333 | ||
334 | static const struct bfd_target * | |
335 | evax_object_p (abfd) | |
336 | bfd *abfd; | |
337 | { | |
338 | int err = 0; | |
339 | int prev_type; | |
340 | #if EVAX_DEBUG | |
341 | evax_debug (1, "evax_object_p(%p)\n", abfd); | |
342 | #endif | |
343 | if (bfd_seek (abfd, 0L, SEEK_SET)) | |
344 | { | |
345 | bfd_set_error (bfd_error_file_truncated); | |
346 | return 0; | |
347 | } | |
348 | ||
349 | prev_type = -1; | |
350 | ||
351 | do | |
352 | { | |
353 | #if EVAX_DEBUG | |
354 | evax_debug (3, "reading at %08lx\n", bfd_tell(abfd)); | |
355 | #endif | |
356 | if (_bfd_evax_next_record (abfd) < 0) | |
357 | { | |
358 | #if EVAX_DEBUG | |
359 | evax_debug (2, "next_record failed\n"); | |
360 | #endif | |
361 | bfd_set_error (bfd_error_wrong_format); | |
362 | return 0; | |
363 | } | |
364 | ||
365 | if ((prev_type == EOBJ_S_C_EGSD) && (PRIV(rec_type) != EOBJ_S_C_EGSD)) | |
366 | { | |
367 | if (evax_fixup_sections (abfd) == false) | |
368 | { | |
369 | #if EVAX_DEBUG | |
370 | evax_debug (2, "evax_fixup_sections failed\n"); | |
371 | #endif | |
372 | bfd_set_error (bfd_error_wrong_format); | |
373 | return 0; | |
374 | } | |
375 | } | |
376 | ||
377 | prev_type = PRIV(rec_type); | |
378 | ||
379 | switch (PRIV(rec_type)) | |
380 | { | |
381 | case EOBJ_S_C_EMH: | |
382 | err = _bfd_evax_slurp_emh (abfd); | |
383 | break; | |
384 | case EOBJ_S_C_EEOM: | |
385 | err = _bfd_evax_slurp_eeom (abfd); | |
386 | break; | |
387 | case EOBJ_S_C_EGSD: | |
388 | err = _bfd_evax_slurp_egsd (abfd); | |
389 | break; | |
390 | case EOBJ_S_C_ETIR: | |
391 | err = _bfd_evax_slurp_etir (abfd); | |
392 | break; | |
393 | case EOBJ_S_C_EDBG: | |
394 | err = _bfd_evax_slurp_edbg (abfd); | |
395 | break; | |
396 | case EOBJ_S_C_ETBT: | |
397 | err = _bfd_evax_slurp_etbt (abfd); | |
398 | break; | |
399 | default: | |
400 | err = -1; | |
401 | } | |
402 | if (err != 0) | |
403 | { | |
404 | #if EVAX_DEBUG | |
405 | evax_debug (2, "slurp type %d failed with %d\n", PRIV(rec_type), err); | |
406 | #endif | |
407 | bfd_set_error (bfd_error_wrong_format); | |
408 | return 0; | |
409 | } | |
410 | } | |
411 | while (prev_type != EOBJ_S_C_EEOM); | |
412 | ||
413 | /* set arch_info to alpha */ | |
414 | ||
415 | { | |
416 | const bfd_arch_info_type *arch = bfd_scan_arch ("alpha"); | |
417 | if (arch == 0) | |
418 | { | |
419 | #if EVAX_DEBUG | |
420 | evax_debug (2, "arch not found\n"); | |
421 | #endif | |
422 | bfd_set_error (bfd_error_wrong_format); | |
423 | return 0; | |
424 | } | |
425 | abfd->arch_info = arch; | |
426 | } | |
427 | ||
428 | return &evax_alpha_vec; | |
429 | } | |
430 | ||
431 | ||
432 | /* Check the format for a file being read. | |
433 | Return a (bfd_target *) if it's an archive file or zero. */ | |
434 | ||
435 | static const struct bfd_target * | |
436 | evax_archive_p (abfd) | |
437 | bfd *abfd; | |
438 | { | |
439 | #if EVAX_DEBUG | |
440 | evax_debug (1, "evax_archive_p(%p)\n", abfd); | |
441 | #endif | |
442 | ||
443 | if (!evax_initialize (abfd)) | |
444 | return 0; | |
445 | ||
446 | return 0; | |
447 | } | |
448 | ||
449 | ||
450 | /* Set the format of a file being written. */ | |
451 | ||
452 | static boolean | |
453 | evax_mkobject (abfd) | |
454 | bfd *abfd; | |
455 | { | |
456 | #if EVAX_DEBUG | |
457 | evax_debug (1, "evax_mkobject(%p)\n", abfd); | |
458 | #endif | |
459 | ||
460 | if (!evax_initialize (abfd)) | |
461 | return 0; | |
462 | ||
463 | { | |
464 | const bfd_arch_info_type *arch = bfd_scan_arch ("alpha"); | |
465 | if (arch == 0) | |
466 | { | |
467 | bfd_set_error(bfd_error_wrong_format); | |
468 | return 0; | |
469 | } | |
470 | abfd->arch_info = arch; | |
471 | } | |
472 | ||
473 | return true; | |
474 | } | |
475 | ||
476 | ||
477 | /* Write cached information into a file being written, at bfd_close. */ | |
478 | ||
479 | static boolean | |
480 | evax_write_object_contents (abfd) | |
481 | bfd *abfd; | |
482 | { | |
483 | #if EVAX_DEBUG | |
484 | evax_debug (1, "evax_write_object_contents(%p)\n", abfd); | |
485 | #endif | |
486 | ||
487 | if (abfd->section_count > 0) /* we have sections */ | |
488 | { | |
489 | if (_bfd_evax_write_emh (abfd) != 0) | |
490 | return false; | |
491 | if (_bfd_evax_write_egsd (abfd) != 0) | |
492 | return false; | |
493 | if (_bfd_evax_write_etir (abfd) != 0) | |
494 | return false; | |
495 | if (_bfd_evax_write_etbt (abfd) != 0) | |
496 | return false; | |
497 | if (_bfd_evax_write_eeom (abfd) != 0) | |
498 | return false; | |
499 | } | |
500 | return true; | |
501 | } | |
502 | ||
503 | /*-- 4.1, generic -----------------------------------------------------------*/ | |
504 | ||
505 | /* Called when the BFD is being closed to do any necessary cleanup. */ | |
506 | ||
507 | static boolean | |
508 | evax_close_and_cleanup (abfd) | |
509 | bfd *abfd; | |
510 | { | |
511 | asection *sec; | |
512 | evax_section *es, *es1; | |
c3d8e071 ILT |
513 | int i; |
514 | ||
515 | #if EVAX_DEBUG | |
516 | evax_debug (1, "evax_close_and_cleanup(%p)\n", abfd); | |
517 | #endif | |
518 | if (abfd == 0) | |
519 | return true; | |
520 | ||
521 | if (PRIV(evax_buf) != NULL) | |
522 | { | |
523 | free (PRIV(evax_buf)); | |
524 | PRIV(evax_buf) = NULL; | |
525 | } | |
526 | PRIV(buf_size) = 0; | |
527 | ||
c3d8e071 ILT |
528 | if (PRIV(output_buf) != 0) |
529 | { | |
530 | free (PRIV(output_buf)); | |
531 | PRIV(output_buf) = 0; | |
532 | } | |
533 | ||
534 | sec = abfd->sections; | |
535 | while (sec != NULL) | |
536 | { | |
537 | if (sec->contents) | |
538 | free (sec->contents); | |
539 | sec = sec->next; | |
540 | } | |
541 | ||
542 | if (PRIV(sections) != NULL) | |
543 | { | |
544 | free (PRIV(sections)); | |
545 | PRIV(sections) = NULL; | |
546 | } | |
547 | ||
548 | if (PRIV(evax_symbol_table)) | |
549 | { | |
550 | bfd_hash_table_free (PRIV(evax_symbol_table)); | |
551 | PRIV(evax_symbol_table) = 0; | |
552 | } | |
553 | ||
554 | if (PRIV(stack)) | |
555 | { | |
556 | free (PRIV(stack)); | |
557 | PRIV(stack) = 0; | |
558 | } | |
559 | ||
560 | if (PRIV(location_stack)) | |
561 | { | |
562 | free (PRIV(location_stack)); | |
563 | PRIV(location_stack) = 0; | |
564 | } | |
565 | ||
566 | for (i = 0; i < EVAX_SECTION_COUNT; i++) | |
567 | { | |
568 | es = PRIV(evax_section_table)[i]; | |
569 | while (es != NULL) | |
570 | { | |
571 | es1 = es->next; | |
572 | free (es); | |
573 | es = es1; | |
574 | } | |
575 | PRIV(evax_section_table)[i] = NULL; | |
c3d8e071 ILT |
576 | } |
577 | ||
578 | free (abfd->tdata.any); | |
579 | abfd->tdata.any = NULL; | |
580 | ||
581 | return true; | |
582 | } | |
583 | ||
584 | ||
585 | /* Ask the BFD to free all cached information. */ | |
586 | static boolean | |
587 | evax_bfd_free_cached_info (abfd) | |
588 | bfd *abfd; | |
589 | { | |
590 | #if EVAX_DEBUG | |
591 | evax_debug (1, "evax_bfd_free_cached_info(%p)\n", abfd); | |
592 | #endif | |
593 | return true; | |
594 | } | |
595 | ||
596 | ||
597 | /* Called when a new section is created. */ | |
598 | ||
599 | static boolean | |
600 | evax_new_section_hook (abfd, section) | |
601 | bfd *abfd; | |
602 | asection *section; | |
603 | { | |
604 | #if EVAX_DEBUG | |
605 | evax_debug (1, "evax_new_section_hook(%p, %s)\n", abfd, section->name); | |
606 | #endif | |
607 | bfd_set_section_alignment(abfd, section, 4); | |
608 | return true; | |
609 | } | |
610 | ||
611 | ||
612 | /* Read the contents of a section. | |
613 | buf points to a buffer of buf_size bytes to be filled with | |
614 | section data (starting at offset into section) */ | |
615 | ||
616 | static boolean | |
617 | evax_get_section_contents (abfd, section, buf, offset, buf_size) | |
618 | bfd *abfd; | |
619 | asection *section; | |
620 | PTR buf; | |
621 | file_ptr offset; | |
622 | bfd_size_type buf_size; | |
623 | { | |
624 | #if EVAX_DEBUG | |
625 | evax_debug (1, "evax_get_section_contents(%p, %s, %p, off %ld, size %d)\n", | |
626 | abfd, section->name, buf, offset, (int)buf_size); | |
627 | #endif | |
628 | ||
629 | /* shouldn't be called, since all sections are IN_MEMORY */ | |
630 | ||
631 | return false; | |
632 | } | |
633 | ||
634 | /* Read the contents of a section. | |
635 | buf points to a buffer of buf_size bytes to be filled with | |
636 | section data (starting at offset into section) */ | |
637 | ||
638 | static boolean | |
639 | evax_get_section_contents_in_window (abfd, section, w, offset, count) | |
640 | bfd *abfd; | |
641 | asection *section; | |
642 | bfd_window *w; | |
643 | file_ptr offset; | |
644 | bfd_size_type count; | |
645 | { | |
646 | #if EVAX_DEBUG | |
647 | evax_debug (1, "evax_get_section_contents_in_window(%p, %s, %p, off %ld, count %d)\n", | |
648 | abfd, section->name, w, offset, (int)count); | |
649 | #endif | |
650 | ||
651 | /* shouldn't be called, since all sections are IN_MEMORY */ | |
652 | ||
653 | return false; | |
654 | } | |
655 | ||
656 | /*-- Part 4.2, copy private data --------------------------------------------*/ | |
657 | ||
658 | /* Called to copy BFD general private data from one object file | |
659 | to another. */ | |
660 | ||
661 | static boolean | |
662 | evax_bfd_copy_private_bfd_data (src, dest) | |
663 | bfd *src; | |
664 | bfd *dest; | |
665 | { | |
666 | #if EVAX_DEBUG | |
667 | evax_debug (1, "evax_bfd_copy_private_bfd_data(%p, %p)\n", src, dest); | |
668 | #endif | |
669 | return true; | |
670 | } | |
671 | ||
672 | ||
673 | /* Merge private BFD information from the BFD @var{ibfd} to the | |
674 | the output file BFD @var{obfd} when linking. Return <<true>> | |
675 | on success, <<false>> on error. Possible error returns are: | |
676 | ||
677 | o <<bfd_error_no_memory>> - | |
678 | Not enough memory exists to create private data for @var{obfd}. */ | |
679 | ||
680 | static boolean | |
681 | evax_bfd_merge_private_bfd_data (ibfd, obfd) | |
682 | bfd *ibfd; | |
683 | bfd *obfd; | |
684 | { | |
685 | #if EVAX_DEBUG | |
686 | evax_debug (1,"evax_bfd_merge_private_bfd_data(%p, %p)\n", ibfd, obfd); | |
687 | #endif | |
688 | return true; | |
689 | } | |
690 | ||
691 | ||
692 | /* Set private BFD flag information in the BFD @var{abfd}. | |
693 | Return <<true>> on success, <<false>> on error. Possible error | |
694 | returns are: | |
695 | ||
696 | o <<bfd_error_no_memory>> - | |
697 | Not enough memory exists to create private data for @var{obfd}. */ | |
698 | ||
699 | static boolean | |
700 | evax_bfd_set_private_flags (abfd, flags) | |
701 | bfd *abfd; | |
702 | flagword flags; | |
703 | { | |
704 | #if EVAX_DEBUG | |
705 | evax_debug (1,"evax_bfd_set_private_flags(%p, %lx)\n", abfd, (long)flags); | |
706 | #endif | |
707 | return true; | |
708 | } | |
709 | ||
710 | ||
711 | /* Called to copy BFD private section data from one object file | |
712 | to another. */ | |
713 | ||
714 | static boolean | |
715 | evax_bfd_copy_private_section_data (srcbfd, srcsec, dstbfd, dstsec) | |
716 | bfd *srcbfd; | |
717 | asection *srcsec; | |
718 | bfd *dstbfd; | |
719 | asection *dstsec; | |
720 | { | |
721 | #if EVAX_DEBUG | |
722 | evax_debug (1, "evax_bfd_copy_private_section_data(%p, %s, %p, %s)\n", | |
723 | srcbfd, srcsec->name, dstbfd, dstsec->name); | |
724 | #endif | |
725 | return true; | |
726 | } | |
727 | ||
728 | /* Called to copy BFD private symbol data from one object file | |
729 | to another. */ | |
730 | ||
731 | static boolean | |
732 | evax_bfd_copy_private_symbol_data (ibfd, isym, obfd, osym) | |
733 | bfd *ibfd; | |
734 | asymbol *isym; | |
735 | bfd *obfd; | |
736 | asymbol *osym; | |
737 | { | |
738 | #if EVAX_DEBUG | |
739 | evax_debug (1, "evax_bfd_copy_private_symbol_data(%p, %s, %p, %s)\n", | |
740 | ibfd, isym->name, obfd, osym->name); | |
741 | #endif | |
742 | return true; | |
743 | } | |
744 | ||
745 | /*-- Part 4.3, core file ----------------------------------------------------*/ | |
746 | ||
747 | /* Return a read-only string explaining which program was running | |
748 | when it failed and produced the core file abfd. */ | |
749 | ||
750 | static char * | |
751 | evax_core_file_failing_command (abfd) | |
752 | bfd *abfd; | |
753 | { | |
754 | #if EVAX_DEBUG | |
755 | evax_debug (1, "evax_core_file_failing_command(%p)\n", abfd); | |
756 | #endif | |
757 | return 0; | |
758 | } | |
759 | ||
760 | ||
761 | /* Returns the signal number which caused the core dump which | |
762 | generated the file the BFD abfd is attached to. */ | |
763 | ||
764 | static int | |
765 | evax_core_file_failing_signal (abfd) | |
766 | bfd *abfd; | |
767 | { | |
768 | #if EVAX_DEBUG | |
769 | evax_debug (1, "evax_core_file_failing_signal(%p)\n", abfd); | |
770 | #endif | |
771 | return 0; | |
772 | } | |
773 | ||
774 | ||
775 | /* Return true if the core file attached to core_bfd was generated | |
776 | by a run of the executable file attached to exec_bfd, false otherwise. */ | |
777 | ||
778 | static boolean | |
779 | evax_core_file_matches_executable_p (abfd, bbfd) | |
780 | bfd *abfd; | |
781 | bfd *bbfd; | |
782 | { | |
783 | #if EVAX_DEBUG | |
784 | evax_debug (1, "evax_core_file_matches_executable_p(%p, %p)\n", abfd, bbfd); | |
785 | #endif | |
786 | return false; | |
787 | } | |
788 | ||
789 | /*-- Part 4.4, archive ------------------------------------------------------*/ | |
790 | ||
791 | /* ??? do something with an archive map. | |
792 | Return false on error, true otherwise. */ | |
793 | ||
794 | static boolean | |
795 | evax_slurp_armap (abfd) | |
796 | bfd *abfd; | |
797 | { | |
798 | #if EVAX_DEBUG | |
799 | evax_debug (1, "evax_slurp_armap(%p)\n", abfd); | |
800 | #endif | |
801 | return false; | |
802 | } | |
803 | ||
804 | ||
805 | /* ??? do something with an extended name table. | |
806 | Return false on error, true otherwise. */ | |
807 | ||
808 | static boolean | |
809 | evax_slurp_extended_name_table (abfd) | |
810 | bfd *abfd; | |
811 | { | |
812 | #if EVAX_DEBUG | |
813 | evax_debug (1, "evax_slurp_extended_name_table(%p)\n", abfd); | |
814 | #endif | |
815 | return false; | |
816 | } | |
817 | ||
818 | ||
819 | /* ??? do something with an extended name table. | |
820 | Return false on error, true otherwise. */ | |
821 | ||
822 | static boolean | |
823 | evax_construct_extended_name_table (abfd, tabloc, tablen, name) | |
824 | bfd *abfd; | |
825 | char **tabloc; | |
826 | bfd_size_type *tablen; | |
827 | const char **name; | |
828 | { | |
829 | #if EVAX_DEBUG | |
830 | evax_debug (1, "evax_construct_extended_name_table(%p)\n", abfd); | |
831 | #endif | |
832 | return false; | |
833 | } | |
834 | ||
835 | ||
836 | /* Truncate the name of an archive to match system-dependent restrictions */ | |
837 | ||
838 | static void | |
839 | evax_truncate_arname (abfd, pathname, arhdr) | |
840 | bfd *abfd; | |
841 | CONST char *pathname; | |
842 | char *arhdr; | |
843 | { | |
844 | #if EVAX_DEBUG | |
845 | evax_debug (1, "evax_truncate_arname(%p, %s, %s)\n", abfd, pathname, arhdr); | |
846 | #endif | |
847 | return; | |
848 | } | |
849 | ||
850 | ||
851 | /* ??? write archive map */ | |
852 | ||
853 | static boolean | |
854 | evax_write_armap (arch, elength, map, orl_count, stridx) | |
855 | bfd *arch; | |
856 | unsigned int elength; | |
857 | struct orl *map; | |
858 | unsigned int orl_count; | |
859 | int stridx; | |
860 | { | |
861 | #if EVAX_DEBUG | |
862 | evax_debug (1, "evax_write_armap(%p, %d, %p, %d %d)\n", | |
863 | arch, elength, map, orl_count, stridx); | |
864 | #endif | |
865 | return true; | |
866 | } | |
867 | ||
868 | /* Read archive header ??? */ | |
869 | ||
870 | static PTR | |
871 | evax_read_ar_hdr (abfd) | |
872 | bfd * abfd; | |
873 | { | |
874 | #if EVAX_DEBUG | |
875 | evax_debug (1, "evax_read_ar_hdr(%p)\n", abfd); | |
876 | #endif | |
877 | return (PTR)0; | |
878 | } | |
879 | ||
880 | ||
881 | /* Provided a BFD, @var{archive}, containing an archive and NULL, open | |
882 | an input BFD on the first contained element and returns that. | |
883 | Subsequent calls should pass the archive and the previous return value | |
884 | to return a created BFD to the next contained element. | |
885 | NULL is returned when there are no more. */ | |
886 | ||
887 | static bfd * | |
888 | evax_openr_next_archived_file (arch, prev) | |
889 | bfd *arch; | |
890 | bfd *prev; | |
891 | { | |
892 | #if EVAX_DEBUG | |
893 | evax_debug (1, "evax_openr_next_archived_file(%p, %p)\n", arch, prev); | |
894 | #endif | |
895 | return false; | |
896 | } | |
897 | ||
898 | ||
899 | /* Return the BFD which is referenced by the symbol in ABFD indexed by | |
900 | INDEX. INDEX should have been returned by bfd_get_next_mapent. */ | |
901 | ||
902 | static bfd * | |
903 | evax_get_elt_at_index (abfd, index) | |
904 | bfd *abfd; | |
905 | symindex index; | |
906 | { | |
907 | #if EVAX_DEBUG | |
908 | evax_debug (1, "evax_get_elt_at_index(%p, %p)\n", abfd, index); | |
909 | #endif | |
910 | return _bfd_generic_get_elt_at_index(abfd, index); | |
911 | } | |
912 | ||
913 | ||
914 | /* ??? | |
915 | -> bfd_generic_stat_arch_elt */ | |
916 | ||
917 | static int | |
918 | evax_generic_stat_arch_elt (abfd, stat) | |
919 | bfd *abfd; | |
920 | struct stat *stat; | |
921 | { | |
922 | #if EVAX_DEBUG | |
923 | evax_debug (1, "evax_generic_stat_arch_elt(%p, %p)\n", abfd, stat); | |
924 | #endif | |
925 | return bfd_generic_stat_arch_elt(abfd, stat); | |
926 | } | |
927 | ||
928 | ||
929 | /* This is a new function in bfd 2.5 */ | |
930 | ||
931 | static boolean | |
932 | evax_update_armap_timestamp (abfd) | |
933 | bfd *abfd; | |
934 | { | |
935 | #if EVAX_DEBUG | |
936 | evax_debug (1, "evax_update_armap_timestamp(%p)\n", abfd); | |
937 | #endif | |
938 | return true; | |
939 | } | |
940 | ||
941 | /*-- Part 4.5, symbols --------------------------------------------------------*/ | |
942 | ||
943 | /* Return the number of bytes required to store a vector of pointers | |
944 | to asymbols for all the symbols in the BFD abfd, including a | |
945 | terminal NULL pointer. If there are no symbols in the BFD, | |
946 | then return 0. If an error occurs, return -1. */ | |
947 | ||
948 | static long | |
949 | evax_get_symtab_upper_bound (abfd) | |
950 | bfd *abfd; | |
951 | { | |
952 | #if EVAX_DEBUG | |
953 | evax_debug (1, "evax_get_symtab_upper_bound(%p), %d symbols\n", abfd, PRIV(egsd_sym_count)); | |
954 | #endif | |
955 | return (PRIV(egsd_sym_count)+1) * sizeof(asymbol *); | |
956 | } | |
957 | ||
958 | ||
959 | /* Copy symbols from hash table to symbol vector | |
960 | ||
961 | called from bfd_hash_traverse in evax_get_symtab | |
962 | init counter to 0 if entry == 0 */ | |
963 | ||
964 | static boolean | |
965 | copy_symbols (entry, arg) | |
966 | struct bfd_hash_entry *entry; | |
967 | PTR arg; | |
968 | { | |
969 | bfd *abfd = (bfd *) arg; | |
970 | ||
971 | if (entry == NULL) /* init counter */ | |
972 | PRIV(symnum) = 0; | |
973 | else /* fill vector, inc counter */ | |
974 | PRIV(symcache)[PRIV(symnum)++] = ((evax_symbol_entry *)entry)->symbol; | |
975 | ||
976 | return true; | |
977 | } | |
978 | ||
979 | ||
980 | /* Read the symbols from the BFD abfd, and fills in the vector | |
981 | location with pointers to the symbols and a trailing NULL. | |
982 | ||
983 | return # of symbols read */ | |
984 | ||
985 | static long | |
986 | evax_get_symtab (abfd, symbols) | |
987 | bfd *abfd; | |
988 | asymbol **symbols; | |
989 | { | |
990 | #if EVAX_DEBUG | |
991 | evax_debug (1, "evax_get_symtab(%p, <ret>)\n", abfd); | |
992 | #endif | |
993 | ||
994 | /* init counter */ | |
995 | (void)copy_symbols((struct bfd_hash_entry *)0, abfd); | |
996 | ||
997 | /* traverse table and fill symbols vector */ | |
998 | ||
999 | PRIV(symcache) = symbols; | |
1000 | bfd_hash_traverse(PRIV(evax_symbol_table), copy_symbols, (PTR)abfd); | |
1001 | ||
bf53bd9f | 1002 | symbols[PRIV(egsd_sym_count)] = NULL; |
c3d8e071 | 1003 | |
bf53bd9f | 1004 | return PRIV(egsd_sym_count); |
c3d8e071 ILT |
1005 | } |
1006 | ||
1007 | ||
1008 | /* Create a new asymbol structure for the BFD abfd and return a pointer | |
1009 | to it. | |
1010 | This routine is necessary because each back end has private information | |
1011 | surrounding the asymbol. Building your own asymbol and pointing to it | |
1012 | will not create the private information, and will cause problems later on. */ | |
1013 | ||
1014 | asymbol * | |
1015 | _bfd_evax_make_empty_symbol (abfd) | |
1016 | bfd *abfd; | |
1017 | { | |
1018 | asymbol *symbol = (asymbol *)bfd_zalloc(abfd, sizeof(asymbol)); | |
1019 | ||
1020 | #if EVAX_DEBUG | |
1021 | evax_debug (1, "_bfd_evax_make_empty_symbol(%p)\n", abfd); | |
1022 | #endif | |
1023 | ||
1024 | if (symbol == 0) | |
1025 | { | |
1026 | bfd_set_error (bfd_error_no_memory); | |
1027 | return 0; | |
1028 | } | |
1029 | symbol->the_bfd = abfd; | |
1030 | ||
1031 | return symbol; | |
1032 | } | |
1033 | ||
1034 | ||
1035 | /* Print symbol to file according to how. how is one of | |
1036 | bfd_print_symbol_name just print the name | |
1037 | bfd_print_symbol_more print more (???) | |
1038 | bfd_print_symbol_all print all we know, which is not much right now :-) */ | |
1039 | ||
1040 | static void | |
1041 | evax_print_symbol (abfd, file, symbol, how) | |
1042 | bfd *abfd; | |
1043 | PTR file; | |
1044 | asymbol *symbol; | |
1045 | bfd_print_symbol_type how; | |
1046 | { | |
1047 | #if EVAX_DEBUG | |
1048 | evax_debug (1, "evax_print_symbol(%p, %p, %p, %d)\n", abfd, file, symbol, how); | |
1049 | #endif | |
1050 | ||
1051 | switch (how) | |
1052 | { | |
1053 | case bfd_print_symbol_name: | |
1054 | case bfd_print_symbol_more: | |
1055 | fprintf((FILE *)file," %s", symbol->name); | |
1056 | break; | |
1057 | ||
1058 | break; | |
1059 | ||
1060 | case bfd_print_symbol_all: | |
1061 | { | |
1062 | CONST char *section_name = symbol->section->name; | |
1063 | ||
1064 | bfd_print_symbol_vandf((PTR)file,symbol); | |
1065 | ||
1066 | fprintf((FILE *)file," %-8s %s", section_name, symbol->name); | |
1067 | } | |
1068 | break; | |
1069 | } | |
1070 | return; | |
1071 | } | |
1072 | ||
1073 | ||
1074 | /* Return information about symbol in ret. | |
1075 | ||
1076 | fill type, value and name | |
1077 | type: | |
1078 | A absolute | |
1079 | B bss segment symbol | |
1080 | C common symbol | |
1081 | D data segment symbol | |
1082 | f filename | |
1083 | t a static function symbol | |
1084 | T text segment symbol | |
1085 | U undefined | |
1086 | - debug */ | |
1087 | ||
1088 | static void | |
1089 | evax_get_symbol_info (abfd, symbol, ret) | |
1090 | bfd *abfd; | |
1091 | asymbol *symbol; | |
1092 | symbol_info *ret; | |
1093 | { | |
1094 | asection *sec; | |
1095 | ||
1096 | #if EVAX_DEBUG | |
1097 | evax_debug (1, "evax_get_symbol_info(%p, %p, <ret>)\n", abfd, symbol); | |
1098 | #endif | |
1099 | ||
1100 | sec = symbol->section; | |
1101 | ||
1102 | if (bfd_is_com_section (sec)) | |
1103 | ret->type = 'C'; | |
1104 | else if (bfd_is_abs_section (sec)) | |
1105 | ret->type = 'A'; | |
1106 | else if (bfd_is_und_section (sec)) | |
1107 | ret->type = 'U'; | |
c3d8e071 ILT |
1108 | else if (bfd_is_ind_section (sec)) |
1109 | ret->type = 'I'; | |
1110 | else if (bfd_get_section_flags (abfd, sec) & SEC_CODE) | |
1111 | ret->type = 'T'; | |
1112 | else if (bfd_get_section_flags (abfd, sec) & SEC_DATA) | |
1113 | ret->type = 'D'; | |
1114 | else if (bfd_get_section_flags (abfd, sec) & SEC_ALLOC) | |
1115 | ret->type = 'B'; | |
1116 | else | |
1117 | ret->type = '-'; | |
1118 | ||
1119 | if (ret->type != 'U') | |
1120 | ret->value = symbol->value + symbol->section->vma; | |
1121 | else | |
1122 | ret->value = 0; | |
1123 | ret->name = symbol->name; | |
1124 | ||
1125 | return; | |
1126 | } | |
1127 | ||
1128 | ||
1129 | /* Return true if the given symbol sym in the BFD abfd is | |
1130 | a compiler generated local label, else return false. */ | |
1131 | ||
1132 | static boolean | |
35a3e78e | 1133 | evax_bfd_is_local_label_name (abfd, name) |
c3d8e071 | 1134 | bfd *abfd; |
35a3e78e | 1135 | const char *name; |
c3d8e071 ILT |
1136 | { |
1137 | #if EVAX_DEBUG | |
35a3e78e | 1138 | evax_debug (1, "evax_bfd_is_local_label_name(%p, %s)\n", abfd, name); |
c3d8e071 | 1139 | #endif |
af4dffff | 1140 | return name[0] == '$'; |
c3d8e071 ILT |
1141 | } |
1142 | ||
1143 | ||
1144 | /* Get source line number for symbol */ | |
1145 | ||
1146 | static alent * | |
1147 | evax_get_lineno (abfd, symbol) | |
1148 | bfd *abfd; | |
1149 | asymbol *symbol; | |
1150 | { | |
1151 | #if EVAX_DEBUG | |
1152 | evax_debug (1, "evax_get_lineno(%p, %p)\n", abfd, symbol); | |
1153 | #endif | |
1154 | return 0; | |
1155 | } | |
1156 | ||
1157 | ||
1158 | /* Provided a BFD, a section and an offset into the section, calculate and | |
1159 | return the name of the source file and the line nearest to the wanted | |
1160 | location. */ | |
1161 | ||
1162 | static boolean | |
1163 | evax_find_nearest_line (abfd, section, symbols, offset, file, func, line) | |
1164 | bfd *abfd; | |
1165 | asection *section; | |
1166 | asymbol **symbols; | |
1167 | bfd_vma offset; | |
1168 | CONST char **file; | |
1169 | CONST char **func; | |
1170 | unsigned int *line; | |
1171 | { | |
1172 | #if EVAX_DEBUG | |
1173 | evax_debug (1, "evax_find_nearest_line(%p, %s, %p, %ld, <ret>, <ret>, <ret>)\n", | |
1174 | abfd, section->name, symbols, (long int)offset); | |
1175 | #endif | |
1176 | return false; | |
1177 | } | |
1178 | ||
1179 | ||
1180 | /* Back-door to allow format-aware applications to create debug symbols | |
1181 | while using BFD for everything else. Currently used by the assembler | |
1182 | when creating COFF files. */ | |
1183 | ||
1184 | static asymbol * | |
1185 | evax_bfd_make_debug_symbol (abfd, ptr, size) | |
1186 | bfd *abfd; | |
1187 | void *ptr; | |
1188 | unsigned long size; | |
1189 | { | |
1190 | #if EVAX_DEBUG | |
1191 | evax_debug (1, "evax_bfd_make_debug_symbol(%p, %p, %ld)\n", abfd, ptr, size); | |
1192 | #endif | |
1193 | return 0; | |
1194 | } | |
1195 | ||
1196 | ||
1197 | /* Read minisymbols. For minisymbols, we use the unmodified a.out | |
1198 | symbols. The minisymbol_to_symbol function translates these into | |
1199 | BFD asymbol structures. */ | |
1200 | ||
1201 | static long | |
1202 | evax_read_minisymbols (abfd, dynamic, minisymsp, sizep) | |
1203 | bfd *abfd; | |
1204 | boolean dynamic; | |
1205 | PTR *minisymsp; | |
1206 | unsigned int *sizep; | |
1207 | { | |
1208 | #if EVAX_DEBUG | |
1209 | evax_debug (1, "evax_read_minisymbols(%p, %d, %p, %d)\n", abfd, dynamic, minisymsp, *sizep); | |
1210 | #endif | |
1211 | return _bfd_generic_read_minisymbols (abfd, dynamic, minisymsp, sizep); | |
1212 | } | |
1213 | ||
1214 | /* Convert a minisymbol to a BFD asymbol. A minisymbol is just an | |
1215 | unmodified a.out symbol. The SYM argument is a structure returned | |
1216 | by bfd_make_empty_symbol, which we fill in here. */ | |
1217 | ||
1218 | static asymbol * | |
1219 | evax_minisymbol_to_symbol (abfd, dynamic, minisym, sym) | |
1220 | bfd *abfd; | |
1221 | boolean dynamic; | |
1222 | const PTR minisym; | |
1223 | asymbol *sym; | |
1224 | { | |
1225 | #if EVAX_DEBUG | |
1226 | evax_debug (1, "evax_minisymbol_to_symbol(%p, %d, %p, %p)\n", abfd, dynamic, minisym, sym); | |
1227 | #endif | |
1228 | return _bfd_generic_minisymbol_to_symbol (abfd, dynamic, minisym, sym); | |
1229 | } | |
1230 | ||
1231 | /*-- Part 4.6, relocations --------------------------------------------------*/ | |
1232 | ||
1233 | /* Return the number of bytes required to store the relocation information | |
1234 | associated with section sect attached to bfd abfd. | |
1235 | If an error occurs, return -1. */ | |
1236 | ||
1237 | static long | |
1238 | evax_get_reloc_upper_bound (abfd, section) | |
1239 | bfd *abfd; | |
1240 | asection *section; | |
1241 | { | |
1242 | #if EVAX_DEBUG | |
1243 | evax_debug (1, "evax_get_reloc_upper_bound(%p, %s)\n", abfd, section->name); | |
1244 | #endif | |
1245 | return -1L; | |
1246 | } | |
1247 | ||
1248 | ||
1249 | /* Call the back end associated with the open BFD abfd and translate the | |
1250 | external form of the relocation information attached to sec into the | |
1251 | internal canonical form. Place the table into memory at loc, which has | |
1252 | been preallocated, usually by a call to bfd_get_reloc_upper_bound. | |
1253 | Returns the number of relocs, or -1 on error. */ | |
1254 | ||
1255 | static long | |
1256 | evax_canonicalize_reloc (abfd, section, location, symbols) | |
1257 | bfd *abfd; | |
1258 | asection *section; | |
1259 | arelent **location; | |
1260 | asymbol **symbols; | |
1261 | { | |
1262 | #if EVAX_DEBUG | |
1263 | evax_debug (1, "evax_canonicalize_reloc(%p, %s, <ret>, <ret>)\n", abfd, section->name); | |
1264 | #endif | |
1265 | return false; | |
1266 | } | |
1267 | ||
1268 | /*---------------------------------------------------------------------------*/ | |
1269 | /* this is just copied from ecoff-alpha, needs to be fixed probably */ | |
1270 | ||
1271 | /* How to process the various reloc types. */ | |
1272 | ||
1273 | static bfd_reloc_status_type | |
1274 | reloc_nil (abfd, reloc, sym, data, sec, output_bfd, error_message) | |
1275 | bfd *abfd; | |
1276 | arelent *reloc; | |
1277 | asymbol *sym; | |
1278 | PTR data; | |
1279 | asection *sec; | |
1280 | bfd *output_bfd; | |
1281 | char **error_message; | |
1282 | { | |
c3d8e071 ILT |
1283 | #if EVAX_DEBUG |
1284 | evax_debug (1, "reloc_nil(abfd %p, output_bfd %p)\n", abfd, output_bfd); | |
1285 | evax_debug (2, "In section %s, symbol %s\n", | |
1286 | sec->name, sym->name); | |
1287 | evax_debug (2, "reloc sym %s, addr %08lx, addend %08lx, reloc is a %s\n", | |
1288 | reloc->sym_ptr_ptr[0]->name, | |
1289 | (unsigned long)reloc->address, | |
1290 | (unsigned long)reloc->addend, reloc->howto->name); | |
1291 | evax_debug (2, "data at %p\n", data); | |
1292 | /* _bfd_hexdump (2, data, bfd_get_reloc_size(reloc->howto),0); */ | |
1293 | #endif | |
1294 | ||
c3d8e071 ILT |
1295 | return bfd_reloc_ok; |
1296 | } | |
1297 | ||
1298 | /* In case we're on a 32-bit machine, construct a 64-bit "-1" value | |
1299 | from smaller values. Start with zero, widen, *then* decrement. */ | |
1300 | #define MINUS_ONE (((bfd_vma)0) - 1) | |
1301 | ||
1302 | static reloc_howto_type alpha_howto_table[] = | |
1303 | { | |
1304 | HOWTO (ALPHA_R_IGNORE, /* type */ | |
1305 | 0, /* rightshift */ | |
1306 | 0, /* size (0 = byte, 1 = short, 2 = long) */ | |
1307 | 8, /* bitsize */ | |
1308 | true, /* pc_relative */ | |
1309 | 0, /* bitpos */ | |
1310 | complain_overflow_dont, /* complain_on_overflow */ | |
1311 | reloc_nil, /* special_function */ | |
1312 | "IGNORE", /* name */ | |
1313 | true, /* partial_inplace */ | |
1314 | 0, /* src_mask */ | |
1315 | 0, /* dst_mask */ | |
1316 | true), /* pcrel_offset */ | |
1317 | ||
1318 | /* A 64 bit reference to a symbol. */ | |
1319 | HOWTO (ALPHA_R_REFQUAD, /* type */ | |
1320 | 0, /* rightshift */ | |
1321 | 4, /* size (0 = byte, 1 = short, 2 = long) */ | |
1322 | 64, /* bitsize */ | |
1323 | false, /* pc_relative */ | |
1324 | 0, /* bitpos */ | |
1325 | complain_overflow_bitfield, /* complain_on_overflow */ | |
1326 | reloc_nil, /* special_function */ | |
1327 | "REFQUAD", /* name */ | |
1328 | true, /* partial_inplace */ | |
1329 | MINUS_ONE, /* src_mask */ | |
1330 | MINUS_ONE, /* dst_mask */ | |
1331 | false), /* pcrel_offset */ | |
1332 | ||
1333 | /* A 21 bit branch. The native assembler generates these for | |
1334 | branches within the text segment, and also fills in the PC | |
1335 | relative offset in the instruction. */ | |
1336 | HOWTO (ALPHA_R_BRADDR, /* type */ | |
1337 | 2, /* rightshift */ | |
1338 | 2, /* size (0 = byte, 1 = short, 2 = long) */ | |
1339 | 21, /* bitsize */ | |
1340 | true, /* pc_relative */ | |
1341 | 0, /* bitpos */ | |
1342 | complain_overflow_signed, /* complain_on_overflow */ | |
1343 | reloc_nil, /* special_function */ | |
1344 | "BRADDR", /* name */ | |
1345 | true, /* partial_inplace */ | |
1346 | 0x1fffff, /* src_mask */ | |
1347 | 0x1fffff, /* dst_mask */ | |
1348 | false), /* pcrel_offset */ | |
1349 | ||
1350 | /* A hint for a jump to a register. */ | |
1351 | HOWTO (ALPHA_R_HINT, /* type */ | |
1352 | 2, /* rightshift */ | |
1353 | 1, /* size (0 = byte, 1 = short, 2 = long) */ | |
1354 | 14, /* bitsize */ | |
1355 | true, /* pc_relative */ | |
1356 | 0, /* bitpos */ | |
1357 | complain_overflow_dont, /* complain_on_overflow */ | |
1358 | reloc_nil, /* special_function */ | |
1359 | "HINT", /* name */ | |
1360 | true, /* partial_inplace */ | |
1361 | 0x3fff, /* src_mask */ | |
1362 | 0x3fff, /* dst_mask */ | |
1363 | false), /* pcrel_offset */ | |
1364 | ||
1365 | /* 16 bit PC relative offset. */ | |
1366 | HOWTO (ALPHA_R_SREL16, /* type */ | |
1367 | 0, /* rightshift */ | |
1368 | 1, /* size (0 = byte, 1 = short, 2 = long) */ | |
1369 | 16, /* bitsize */ | |
1370 | true, /* pc_relative */ | |
1371 | 0, /* bitpos */ | |
1372 | complain_overflow_signed, /* complain_on_overflow */ | |
1373 | reloc_nil, /* special_function */ | |
1374 | "SREL16", /* name */ | |
1375 | true, /* partial_inplace */ | |
1376 | 0xffff, /* src_mask */ | |
1377 | 0xffff, /* dst_mask */ | |
1378 | false), /* pcrel_offset */ | |
1379 | ||
1380 | /* 32 bit PC relative offset. */ | |
1381 | HOWTO (ALPHA_R_SREL32, /* type */ | |
1382 | 0, /* rightshift */ | |
1383 | 2, /* size (0 = byte, 1 = short, 2 = long) */ | |
1384 | 32, /* bitsize */ | |
1385 | true, /* pc_relative */ | |
1386 | 0, /* bitpos */ | |
1387 | complain_overflow_signed, /* complain_on_overflow */ | |
1388 | reloc_nil, /* special_function */ | |
1389 | "SREL32", /* name */ | |
1390 | true, /* partial_inplace */ | |
1391 | 0xffffffff, /* src_mask */ | |
1392 | 0xffffffff, /* dst_mask */ | |
1393 | false), /* pcrel_offset */ | |
1394 | ||
1395 | /* A 64 bit PC relative offset. */ | |
1396 | HOWTO (ALPHA_R_SREL64, /* type */ | |
1397 | 0, /* rightshift */ | |
1398 | 4, /* size (0 = byte, 1 = short, 2 = long) */ | |
1399 | 64, /* bitsize */ | |
1400 | true, /* pc_relative */ | |
1401 | 0, /* bitpos */ | |
1402 | complain_overflow_signed, /* complain_on_overflow */ | |
1403 | reloc_nil, /* special_function */ | |
1404 | "SREL64", /* name */ | |
1405 | true, /* partial_inplace */ | |
1406 | MINUS_ONE, /* src_mask */ | |
1407 | MINUS_ONE, /* dst_mask */ | |
1408 | false), /* pcrel_offset */ | |
1409 | ||
1410 | /* Push a value on the reloc evaluation stack. */ | |
1411 | HOWTO (ALPHA_R_OP_PUSH, /* type */ | |
1412 | 0, /* rightshift */ | |
1413 | 0, /* size (0 = byte, 1 = short, 2 = long) */ | |
1414 | 0, /* bitsize */ | |
1415 | false, /* pc_relative */ | |
1416 | 0, /* bitpos */ | |
1417 | complain_overflow_dont, /* complain_on_overflow */ | |
1418 | reloc_nil, /* special_function */ | |
1419 | "OP_PUSH", /* name */ | |
1420 | false, /* partial_inplace */ | |
1421 | 0, /* src_mask */ | |
1422 | 0, /* dst_mask */ | |
1423 | false), /* pcrel_offset */ | |
1424 | ||
1425 | /* Store the value from the stack at the given address. Store it in | |
1426 | a bitfield of size r_size starting at bit position r_offset. */ | |
1427 | HOWTO (ALPHA_R_OP_STORE, /* type */ | |
1428 | 0, /* rightshift */ | |
1429 | 4, /* size (0 = byte, 1 = short, 2 = long) */ | |
1430 | 64, /* bitsize */ | |
1431 | false, /* pc_relative */ | |
1432 | 0, /* bitpos */ | |
1433 | complain_overflow_dont, /* complain_on_overflow */ | |
1434 | reloc_nil, /* special_function */ | |
1435 | "OP_STORE", /* name */ | |
1436 | false, /* partial_inplace */ | |
1437 | 0, /* src_mask */ | |
1438 | MINUS_ONE, /* dst_mask */ | |
1439 | false), /* pcrel_offset */ | |
1440 | ||
1441 | /* Subtract the reloc address from the value on the top of the | |
1442 | relocation stack. */ | |
1443 | HOWTO (ALPHA_R_OP_PSUB, /* type */ | |
1444 | 0, /* rightshift */ | |
1445 | 0, /* size (0 = byte, 1 = short, 2 = long) */ | |
1446 | 0, /* bitsize */ | |
1447 | false, /* pc_relative */ | |
1448 | 0, /* bitpos */ | |
1449 | complain_overflow_dont, /* complain_on_overflow */ | |
1450 | reloc_nil, /* special_function */ | |
1451 | "OP_PSUB", /* name */ | |
1452 | false, /* partial_inplace */ | |
1453 | 0, /* src_mask */ | |
1454 | 0, /* dst_mask */ | |
1455 | false), /* pcrel_offset */ | |
1456 | ||
1457 | /* Shift the value on the top of the relocation stack right by the | |
1458 | given value. */ | |
1459 | HOWTO (ALPHA_R_OP_PRSHIFT, /* type */ | |
1460 | 0, /* rightshift */ | |
1461 | 0, /* size (0 = byte, 1 = short, 2 = long) */ | |
1462 | 0, /* bitsize */ | |
1463 | false, /* pc_relative */ | |
1464 | 0, /* bitpos */ | |
1465 | complain_overflow_dont, /* complain_on_overflow */ | |
1466 | reloc_nil, /* special_function */ | |
1467 | "OP_PRSHIFT", /* name */ | |
1468 | false, /* partial_inplace */ | |
1469 | 0, /* src_mask */ | |
1470 | 0, /* dst_mask */ | |
1471 | false), /* pcrel_offset */ | |
1472 | ||
1473 | /* Hack. Linkage is done by linker. */ | |
1474 | HOWTO (ALPHA_R_LINKAGE, /* type */ | |
1475 | 0, /* rightshift */ | |
1476 | 8, /* size (0 = byte, 1 = short, 2 = long) */ | |
1477 | 256, /* bitsize */ | |
1478 | false, /* pc_relative */ | |
1479 | 0, /* bitpos */ | |
1480 | complain_overflow_dont, /* complain_on_overflow */ | |
1481 | reloc_nil, /* special_function */ | |
1482 | "LINKAGE", /* name */ | |
1483 | false, /* partial_inplace */ | |
1484 | 0, /* src_mask */ | |
1485 | 0, /* dst_mask */ | |
1486 | false), /* pcrel_offset */ | |
1487 | ||
c3d8e071 ILT |
1488 | /* A 32 bit reference to a symbol. */ |
1489 | HOWTO (ALPHA_R_REFLONG, /* type */ | |
1490 | 0, /* rightshift */ | |
1491 | 2, /* size (0 = byte, 1 = short, 2 = long) */ | |
1492 | 32, /* bitsize */ | |
1493 | false, /* pc_relative */ | |
1494 | 0, /* bitpos */ | |
1495 | complain_overflow_bitfield, /* complain_on_overflow */ | |
1496 | reloc_nil, /* special_function */ | |
1497 | "REFLONG", /* name */ | |
1498 | true, /* partial_inplace */ | |
1499 | 0xffffffff, /* src_mask */ | |
1500 | 0xffffffff, /* dst_mask */ | |
1501 | false), /* pcrel_offset */ | |
1502 | ||
8696b2db ILT |
1503 | /* A 64 bit reference to a procedure, written as 32 bit value. */ |
1504 | HOWTO (ALPHA_R_CODEADDR, /* type */ | |
1505 | 0, /* rightshift */ | |
1506 | 4, /* size (0 = byte, 1 = short, 2 = long) */ | |
1507 | 64, /* bitsize */ | |
1508 | false, /* pc_relative */ | |
1509 | 0, /* bitpos */ | |
1510 | complain_overflow_signed,/* complain_on_overflow */ | |
1511 | reloc_nil, /* special_function */ | |
1512 | "CODEADDR", /* name */ | |
1513 | false, /* partial_inplace */ | |
1514 | 0xffffffff, /* src_mask */ | |
1515 | 0xffffffff, /* dst_mask */ | |
1516 | false), /* pcrel_offset */ | |
1517 | ||
c3d8e071 ILT |
1518 | }; |
1519 | ||
1520 | /* Return a pointer to a howto structure which, when invoked, will perform | |
1521 | the relocation code on data from the architecture noted. */ | |
1522 | ||
1523 | static const struct reloc_howto_struct * | |
1524 | evax_bfd_reloc_type_lookup (abfd, code) | |
1525 | bfd *abfd; | |
1526 | bfd_reloc_code_real_type code; | |
1527 | { | |
1528 | int alpha_type; | |
1529 | ||
1530 | #if EVAX_DEBUG | |
1531 | evax_debug (1, "evax_bfd_reloc_type_lookup(%p, %d)\t", abfd, code); | |
1532 | #endif | |
1533 | ||
1534 | switch (code) | |
1535 | { | |
1536 | case BFD_RELOC_16: alpha_type = ALPHA_R_SREL16; break; | |
1537 | case BFD_RELOC_32: alpha_type = ALPHA_R_REFLONG; break; | |
1538 | case BFD_RELOC_64: alpha_type = ALPHA_R_REFQUAD; break; | |
1539 | case BFD_RELOC_CTOR: alpha_type = ALPHA_R_REFQUAD; break; | |
1540 | case BFD_RELOC_23_PCREL_S2: alpha_type = ALPHA_R_BRADDR; break; | |
1541 | case BFD_RELOC_ALPHA_HINT: alpha_type = ALPHA_R_HINT; break; | |
1542 | case BFD_RELOC_16_PCREL: alpha_type = ALPHA_R_SREL16; break; | |
1543 | case BFD_RELOC_32_PCREL: alpha_type = ALPHA_R_SREL32; break; | |
1544 | case BFD_RELOC_64_PCREL: alpha_type = ALPHA_R_SREL64; break; | |
1545 | case BFD_RELOC_ALPHA_LINKAGE: alpha_type = ALPHA_R_LINKAGE; break; | |
8696b2db | 1546 | case BFD_RELOC_ALPHA_CODEADDR: alpha_type = ALPHA_R_CODEADDR; break; |
c3d8e071 ILT |
1547 | default: |
1548 | (*_bfd_error_handler) ("reloc (%d) is *UNKNOWN*", code); | |
1549 | return (const struct reloc_howto_struct *) NULL; | |
1550 | } | |
1551 | #if EVAX_DEBUG | |
1552 | evax_debug (2, "reloc is %s\n", alpha_howto_table[alpha_type].name); | |
1553 | #endif | |
1554 | return &alpha_howto_table[alpha_type]; | |
1555 | } | |
1556 | ||
1557 | ||
1558 | /*-- Part 4.7, writing an object file ---------------------------------------*/ | |
1559 | ||
1560 | /* Set the architecture and machine type in BFD abfd to arch and mach. | |
1561 | Find the correct pointer to a structure and insert it into the arch_info | |
1562 | pointer. */ | |
1563 | ||
1564 | static boolean | |
1565 | evax_set_arch_mach (abfd, arch, mach) | |
1566 | bfd *abfd; | |
1567 | enum bfd_architecture arch; | |
1568 | unsigned long mach; | |
1569 | { | |
1570 | #if EVAX_DEBUG | |
1571 | evax_debug (1, "evax_set_arch_mach(%p, %d, %ld)\n", abfd, arch, mach); | |
1572 | #endif | |
b35711c4 ILT |
1573 | if (arch != bfd_arch_alpha |
1574 | && arch != bfd_arch_unknown) | |
1575 | return false; | |
c3d8e071 | 1576 | |
b35711c4 | 1577 | return bfd_default_set_arch_mach (abfd, arch, mach); |
c3d8e071 ILT |
1578 | } |
1579 | ||
1580 | ||
1581 | /* Sets the contents of the section section in BFD abfd to the data starting | |
1582 | in memory at data. The data is written to the output section starting at | |
1583 | offset offset for count bytes. | |
1584 | ||
1585 | Normally true is returned, else false. Possible error returns are: | |
1586 | o bfd_error_no_contents - The output section does not have the | |
1587 | SEC_HAS_CONTENTS attribute, so nothing can be written to it. | |
1588 | o and some more too */ | |
1589 | ||
1590 | static boolean | |
1591 | evax_set_section_contents (abfd, section, location, offset, count) | |
1592 | bfd *abfd; | |
1593 | asection *section; | |
1594 | PTR location; | |
1595 | file_ptr offset; | |
1596 | bfd_size_type count; | |
1597 | { | |
1598 | #if EVAX_DEBUG | |
1599 | evax_debug (1, "evax_set_section_contents(%p, sec %s, loc %p, off %ld, count %d)\n", | |
1600 | abfd, section->name, location, (long int)offset, (int)count); | |
8612a388 | 1601 | evax_debug (2, "secraw %d, seccooked %d\n", (int)section->_raw_size, (int)section->_cooked_size); |
c3d8e071 ILT |
1602 | #endif |
1603 | return _bfd_save_evax_section(abfd, section, location, offset, count); | |
1604 | } | |
1605 | ||
1606 | ||
1607 | /*-- Part 4.8, linker -------------------------------------------------------*/ | |
1608 | ||
1609 | /* Get the size of the section headers. */ | |
1610 | ||
1611 | static int | |
1612 | evax_sizeof_headers (abfd, reloc) | |
1613 | bfd *abfd; | |
1614 | boolean reloc; | |
1615 | { | |
1616 | #if EVAX_DEBUG | |
1617 | evax_debug (1, "evax_sizeof_headers(%p, %s)\n", abfd, (reloc)?"True":"False"); | |
1618 | #endif | |
1619 | return 0; | |
1620 | } | |
1621 | ||
1622 | ||
1623 | /* Provides default handling of relocation effort for back ends | |
1624 | which can't be bothered to do it efficiently. */ | |
1625 | ||
1626 | static bfd_byte * | |
1627 | evax_bfd_get_relocated_section_contents (abfd, link_info, link_order, data, | |
1628 | relocateable, symbols) | |
1629 | bfd *abfd; | |
1630 | struct bfd_link_info *link_info; | |
1631 | struct bfd_link_order *link_order; | |
1632 | bfd_byte *data; | |
1633 | boolean relocateable; | |
1634 | asymbol **symbols; | |
1635 | { | |
1636 | #if EVAX_DEBUG | |
1637 | evax_debug (1, "evax_bfd_get_relocated_section_contents(%p, %p, %p, %p, %s, %p)\n", | |
1638 | abfd, link_info, link_order, data, (relocateable)?"True":"False", symbols); | |
1639 | #endif | |
1640 | return 0; | |
1641 | } | |
1642 | ||
1643 | ||
1644 | /* ??? */ | |
1645 | ||
1646 | static boolean | |
1647 | evax_bfd_relax_section (abfd, section, link_info, again) | |
1648 | bfd *abfd; | |
1649 | asection *section; | |
1650 | struct bfd_link_info *link_info; | |
1651 | boolean *again; | |
1652 | { | |
1653 | #if EVAX_DEBUG | |
1654 | evax_debug (1, "evax_bfd_relax_section(%p, %s, %p, <ret>)\n", | |
1655 | abfd, section->name, link_info); | |
1656 | #endif | |
1657 | return true; | |
1658 | } | |
1659 | ||
1660 | ||
1661 | /* Create a hash table for the linker. Different backends store | |
1662 | different information in this table. */ | |
1663 | ||
1664 | static struct bfd_link_hash_table * | |
1665 | evax_bfd_link_hash_table_create (abfd) | |
1666 | bfd *abfd; | |
1667 | { | |
1668 | #if EVAX_DEBUG | |
1669 | evax_debug (1, "evax_bfd_link_hash_table_create(%p)\n", abfd); | |
1670 | #endif | |
1671 | return 0; | |
1672 | } | |
1673 | ||
1674 | ||
1675 | /* Add symbols from this object file into the hash table. */ | |
1676 | ||
1677 | static boolean | |
1678 | evax_bfd_link_add_symbols (abfd, link_info) | |
1679 | bfd *abfd; | |
1680 | struct bfd_link_info *link_info; | |
1681 | { | |
1682 | #if EVAX_DEBUG | |
1683 | evax_debug (1, "evax_bfd_link_add_symbols(%p, %p)\n", abfd, link_info); | |
1684 | #endif | |
1685 | return false; | |
1686 | } | |
1687 | ||
1688 | ||
1689 | /* Do a link based on the link_order structures attached to each | |
1690 | section of the BFD. */ | |
1691 | ||
1692 | static boolean | |
1693 | evax_bfd_final_link (abfd, link_info) | |
1694 | bfd *abfd; | |
1695 | struct bfd_link_info *link_info; | |
1696 | { | |
1697 | #if EVAX_DEBUG | |
1698 | evax_debug (1, "evax_bfd_final_link(%p, %p)\n", abfd, link_info); | |
1699 | #endif | |
1700 | return true; | |
1701 | } | |
1702 | ||
1703 | /* Should this section be split up into smaller pieces during linking. */ | |
1704 | ||
1705 | static boolean | |
1706 | evax_bfd_link_split_section (abfd, section) | |
1707 | bfd *abfd; | |
1708 | asection *section; | |
1709 | { | |
1710 | #if EVAX_DEBUG | |
1711 | evax_debug (1, "evax_bfd_link_split_section(%p, %s)\n", abfd, section->name); | |
1712 | #endif | |
1713 | return false; | |
1714 | } | |
1715 | ||
1716 | /*-- Part 4.9, dynamic symbols and relocations ------------------------------*/ | |
1717 | ||
1718 | /* Get the amount of memory required to hold the dynamic symbols. */ | |
1719 | ||
1720 | static long | |
1721 | evax_get_dynamic_symtab_upper_bound (abfd) | |
1722 | bfd *abfd; | |
1723 | { | |
1724 | #if EVAX_DEBUG | |
1725 | evax_debug (1, "evax_get_dynamic_symtab_upper_bound(%p)\n", abfd); | |
1726 | #endif | |
1727 | return 0; | |
1728 | } | |
1729 | ||
1730 | static boolean | |
1731 | evax_bfd_print_private_bfd_data (abfd, file) | |
1732 | bfd *abfd; | |
1733 | void *file; | |
1734 | { | |
1735 | #if EVAX_DEBUG | |
1736 | evax_debug (1, "evax_bfd_print_private_bfd_data(%p)\n", abfd); | |
1737 | #endif | |
1738 | return 0; | |
1739 | } | |
1740 | ||
1741 | ||
1742 | /* Read in the dynamic symbols. */ | |
1743 | ||
1744 | static long | |
1745 | evax_canonicalize_dynamic_symtab (abfd, symbols) | |
1746 | bfd *abfd; | |
1747 | asymbol **symbols; | |
1748 | { | |
1749 | #if EVAX_DEBUG | |
1750 | evax_debug (1, "evax_canonicalize_dynamic_symtab(%p, <ret>)\n", abfd); | |
1751 | #endif | |
1752 | return 0L; | |
1753 | } | |
1754 | ||
1755 | ||
1756 | /* Get the amount of memory required to hold the dynamic relocs. */ | |
1757 | ||
1758 | static long | |
1759 | evax_get_dynamic_reloc_upper_bound (abfd) | |
1760 | bfd *abfd; | |
1761 | { | |
1762 | #if EVAX_DEBUG | |
1763 | evax_debug (1, "evax_get_dynamic_reloc_upper_bound(%p)\n", abfd); | |
1764 | #endif | |
1765 | return 0L; | |
1766 | } | |
1767 | ||
1768 | ||
1769 | /* Read in the dynamic relocs. */ | |
1770 | ||
1771 | static long | |
1772 | evax_canonicalize_dynamic_reloc (abfd, arel, symbols) | |
1773 | bfd *abfd; | |
1774 | arelent **arel; | |
1775 | asymbol **symbols; | |
1776 | { | |
1777 | #if EVAX_DEBUG | |
1778 | evax_debug (1, "evax_canonicalize_dynamic_reloc(%p)\n", abfd); | |
1779 | #endif | |
1780 | return 0L; | |
1781 | } |